Title xor
Link
https://buuoj.cn/challenges#xor
WP
用file看一下,这是一个 Mach-O,用ida64打开,然后F5看一下
printf("Input your flag:\n", 0LL);
get_line(v6, 0x100u);
if ( strlen(v6) != 33 ) goto FAIL;
for ( i = 1; i < 33; ++i) v6[i] ^= v6[i - 1];
v3 = global;
if ( !strncmp(v6, global, 0x21uLL) )
printf("Success", v3);
这个flag有33位,程序将输入flag与前一位异或后与一个数组比较
利用array得到这个数组
# [102, 10, 107, 12, 119, 38, 79, 46, 64, 17, 120, 13, 90, 59, 85, 17, 112, 25, 70, 31, 118, 34, 77, 35, 68, 14, 103, 6, 104, 15, 71, 50, 79]
逆着来就好了
a = [102, 10, 107, 12, 119, 38, 79, 46, 64, 17, 120, 13, 90, 59, 85, 17, 112, 25, 70, 31, 118, 34, 77, 35, 68, 14, 103, 6, 104, 15, 71, 50, 79]
i = 32
while(i > 0) :
a[i] ^= a[i - 1]
i -= 1
''.join(list(map(chr, a)))
# flag{QianQiuWanDai_YiTongJiangHu}