@echo off :next reverse.exe if %ERRORLEVEL% EQU 2 echo !!!!!get_len!!!!! & goto next if %ERRORLEVEL% EQU 1 echo again & goto next if %ERRORLEVEL% EQU 0 echo############ & goto next
voidlen() { int i; unsignedlonglong result; for (i = 0; i < 50; i++) { result = func((longlong)&i, 4); if (result == 0xD31580A28DD8E6C4) { printf("Len is %d\n", i - 9); return; } } printf("Not found the lenn"); return; }
voidhash() { unsignedlonglong i; unsignedlonglong result; char buff[20]; for (i = 10000000000; i > 0; i--) { sprintf_s(buff, "%0.10llu", i); /*if (i % 100000 == 0) { printf("%0.10llu\n", i); }*/ result = func((longlong)buff, 10); if (result == 0xC886BDF39CB4ED72) { printf("flag is %lld\n", i); return; } } }
intmain() { HINSTANCE hdll;
hdll = LoadLibrary(TEXT("D:\\C++\\reverse.dll")); if (hdll == NULL) { printf("Load dll Error: %dn", GetLastError()); return0; } printf("Dll base is %llx\n", hdll); func = ((f)((char*)hdll + 0x17A0)); len(); hash(); } /* Dll base is 7ffb57d20000 Len is 10 flag is 9352641078 */
from hashlib import md5 from pwn import p64 ans = [0x0F59BB02BDBB4647,0x5CFCE8EC2128ACBE,0xEF0375CA659274AD,0x27422CC18FB38643,0xA72DECA745CC3EB0,0xE8341712FE5F3CBE] ans = [p64(i) for i in ans] print(ans) for i inrange(97,123): for j inrange(97,123): for k inrange(97,123): for l inrange(97,123): enc = bytes([i,j,k,l]) val = md5(enc).digest()[:8] if val in ans: print(enc, val, ans.index(val)) #[b'GF\xbb\xbd\x02\xbbY\x0f', b'\xbe\xac(!\xec\xe8\xfc\\', b'\xadt\x92e\xcau\x03\xef', b"C\x86\xb3\x8f\xc1,B'", b'\xb0>\xccE\xa7\xec-\xa7', b'\xbe<_\xfe\x12\x174\xe8'] # b'dunu' b'\xbe<_\xfe\x12\x174\xe8' 5 # b'hfen' b'\xbe\xac(!\xec\xe8\xfc\\' 1 # b'hjif' b'\xb0>\xccE\xa7\xec-\xa7' 4 # b'iuer' b"C\x86\xb3\x8f\xc1,B'" 3 # b'juhu' b'GF\xbb\xbd\x02\xbbY\x0f' 0 # b'laps' b'\xadt\x92e\xcau\x03\xef' 2 #juhuhfenlapsiuerhjifdunu
from hashlib import md5 from pwn import p64 ans = [0x0F59BB02BDBB4647,0x5CFCE8EC2128ACBE,0xEF0375CA659274AD,0x27422CC18FB38643,0xA72DECA745CC3EB0,0xE8341712FE5F3CBE] ans = [p64(i) for i in ans] print(ans) for i inrange(97,123): for j inrange(97,123): for k inrange(97,123): for l inrange(97,123): enc = bytes([i,j,k,l]) val = md5(enc).digest()[:8] if val in ans: print(enc, val, ans.index(val)) #[b'GF\xbb\xbd\x02\xbbY\x0f', b'\xbe\xac(!\xec\xe8\xfc\\', b'\xadt\x92e\xcau\x03\xef', b"C\x86\xb3\x8f\xc1,B'", b'\xb0>\xccE\xa7\xec-\xa7', b'\xbe<_\xfe\x12\x174\xe8'] # b'dunu' b'\xbe<_\xfe\x12\x174\xe8' 5 # b'hfen' b'\xbe\xac(!\xec\xe8\xfc\\' 1 # b'hjif' b'\xb0>\xccE\xa7\xec-\xa7' 4 # b'iuer' b"C\x86\xb3\x8f\xc1,B'" 3 # b'juhu' b'GF\xbb\xbd\x02\xbbY\x0f' 0 # b'laps' b'\xadt\x92e\xcau\x03\xef' 2 #juhuhfenlapsiuerhjifdunu input1 = 'juhuhfenlapsiuerhjifdunu' check = [0xfe,0xe9,0xf4,0xe2,0xf1,0xfa,0xf4,0xe4,0xf0,0xe7,0xe4,0xe5,0xe3,0xf2,0xf5,0xef,0xe8,0xff,0xf6,0xf4,0xfd,0xb4,0xa5,0xb2] len = 24 i = 0 v10 = 0 while(i != len): v11 = ord(input1[i]) + i v10 = v10 ^ v11 i = i + 1
input2 = 'juhuhfenlapsiuerhjifdunu' flag = '' for i inrange(24): temp = ord(input2[i]) ^ v10 ^ check[i] flag += chr(temp) print(flag) #goodjobyougetthisflag233
from ida_bytes import get_bytes, patch_bytes import re addr = 0x402400 end = 0x403000 buf = get_bytes(addr, end-addr) defhandler1(s): s = s.group(0) print("".join(["%02x"%i for i in s])) s = b"\x90"*len(s) return s p = b"\xe8\x00\x00\x00\x00.*?\xc3.*?\xc3" buf = re.sub(p, handler1, buf, flags=re.I) patch_bytes(addr, buf) print("Done")
enc = b''.join([bytes([i]) for i in a]) rc4 = ARC4.new(key) decrypted_data = rc4.decrypt(enc)[::-1] print(decrypted_data.decode('utf-8')) #973387a11fa3f724d74802857d3e052f