Reversing - Intro to Reversing 3

rev 3


# the password found while reversing
pw = "lp`7a<qLw\x1ekHopt(f-f*,o}V\x0f\x15J"

# the actual password (defining a list of appropriate length)
rw = "aaaaaaaaaaaaaaaaaaaaaaaaaaa"
pa = []
for i in rw:
	pa.append(i)

# for every char in the password
for i in range(0, len(pw)):
  
  	# try out every possible char
	for a in range(32, 126):
		b = a ^ i + 10
		b = b - 2
        
        # if the result is bigger or equal to zero
		if b >= 0:
          
          	# if the result matches the password
			if chr(b) == pw[i]:
              
              	# store the result
				pa[i] = chr(a)
				break

# print the result
print("".join(pa))

# dyn4m1c_k3y_gen3r4t10n_y34h
$ nc hax1.allesctf.net 9602
Give me your password:
dyn4m1c_k3y_gen3r4t10n_y34h
Thats the right password!
Flag: CSCG{pass_1_g3ts_a_x0r_p4ss_2_g3ts_a_x0r_EVERYBODY_GETS_A_X0R}