static main() { auto i,fp; fp = fopen("d:\\1.txt","wb"); auto start = 0x6020c0; auto size = 0x60213B - 0x6020c0; for(i=start;i<start+size;i++) { fputc(Byte(i),fp); } fp.close(); }
解密脚本
1 2 3 4 5 6 7 8 9 10 11
s = r'''L3t_ME_T3ll_Y0u_S0m3th1ng_1mp0rtant_A_{FL4G}_W0nt_b3_3X4ctly_th4t_345y_t0_c4ptur3_H0wev3r_1T_w1ll_b3_C00l_1F_Y0u_g0t_1t''' n = [] with open('1.txt', 'rb')as f: data = f.read() for i,b in enumerate(data): if i % 4 == 0: n.append(b) flag = '' for i in n: flag += s[i] print(flag)
ALEXCTF{W3_L0v3_C_W1th_CL45535}
是不是逻辑很简单?
0x04 crackme
见到了一个新壳,nsPack,网上找了个脱壳工具。
傻瓜式脱壳
不过好像脱的不是很干净,ida打开时弹出几个报错窗口
不过还是能正常加载出函数来的。
很简单的异或。
1 2 3 4
a = [0x74] + [ord(i) for i in'his_is_not_flag'] b = [0x12,4,8,0x14,0x24,0x5c,0x4a,0x3d,0x56,0x0a,0x10,0x67,0,0x41,0,1,0x46,0x5a,0x44,0x42,0x6e,0x0c,0x44,0x72,0x0c,0x0d,0x40,0x3e,0x4b,0x5f,2,1,0x4c,0x5e,0x5b,0x17,0x6e,0x0c,0x16,0x68,0x5b,0x12] for i in range(42): print(chr(a[i % 16] ^ b[i]),end='')
v3 = "Dufhbmf"; v4 = "pG`imos"; v5 = "ewUglpt"; for ( i = 0; i <= 11; ++i ){ a1[i] = (&v3)[i % 3][2 * (i / 3)]; } for ( i = 0; i <= 11; ++i ){ cout<<char(a1[i]-1); } return0; }
IgniteMe
主函数:
看着花里胡巧的,其实关键代码不多。
sub_4011C0:
没啥可说的,直接放解密脚本:
1 2 3 4 5 6 7 8 9 10 11 12
byte_4420B0 = [0x0d,0x13,0x17,0x11,0x2,0x1,0x20,0x1d,0x0c,0x2,0x19,0x2f,0x17,0x2b,0x24,0x1f,0x1e,0x16,0x9,0x0f,0x15,0x27,0x13,0x26,0x0a,0x2f,0x1e,0x1a,0x2d,0x0c,0x22,0x4] string = list(map(ord, 'GONDPHyGjPEKruv{{pj]X@rF')) flag = [] for i in range(24): flag.append((((string[i] ^ byte_4420B0[i]) - 72) ^ 0x55) & 0x7f) print(flag) for i in range(len(flag)): if65 <= flag[i] <= 90: flag[i] += 32 elif97 <= flag[i] <= 122: flag[i] -= 32 print(''.join(map(chr, flag)))
注意一点,异或的运算优先级低于减号。我被这一点坑了十分钟。
srm-50
简直就是明文存储的flag.
把上图中的字符读出来,就是flag.
Windows_Reverse1
加密后的字符串已知,加密如下:
很简单的替换,只是byte_402ff8无法看到数据。
动态轻松获取:
1 2 3 4 5 6
s = ' '*32 + '~}|{zyxwvutsrqponmlkjihgfedcba`_^]\[ZYXWVUTSRQPONMLKJIHGFEDCBA@?>=<;:9876543210/.-,+*)(\'&%$#"!' ss = 'DDCTF{reverseME}' flag = '' for i in range(len(ss)): flag += chr(s.index(ss[i])) print(flag)
import struct with open(r'rev100', 'r')as f: b = f.read() data = b'' for line in b.split('\n'): temp = line[len('00400080 '):].split(' ') for i in temp: if i: data += struct.pack('B', int(i, 16))
for i in range(len(data)): if data[i] == ord('h'): print('{}{}'.format(chr(data[i+1]), chr(data[i+2])), end='')
a = 'KanXueCTF2019JustForhappy' b = 'abcdefghiABCDEFGHIJKLMNjklmn0123456789opqrstuvwxyzOPQRSTUVWXYZ' c = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' flag = '' for i in a: temp = b.index(i) flag += c[temp] print(flag)
666
水题
1 2 3 4 5 6 7 8 9
cipher = list(map(ord, 'izwhroz""w"v.K".Ni')) key = 0x12 flag = [] for i in range(0, len(cipher), 3): print(i) flag.append((key ^ cipher[i]) - 6) flag.append((key ^ cipher[i+1]) + 6) flag.append(key ^ cipher[i+2] ^ 6) print(''.join(map(chr, flag)))
SignIn
逆向里考察rsa
用到了GMP(The GNU Multiple Precision Arithmetic Library)又叫GNU多精度算术库。
n才256bit,直接yafu.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
c = 0xad939ff59f6e70bcbfad406f2494993757eee98b91bc244184a377520d06fc35 n = 103461035900816914121390101299049044413950405173712170434161686539878160984549 e = 65537