s = [0x40,0x35,0x20,0x56,0x5D,0x18,0x22,0x45,0x17,0x2F,0x24,0x6E,0x62, 0x3C,0x27,0x54,0x48,0x6C,0x24,0x6E,0x72,0x3C,0x32,0x45,0x5B] s1 = 'flag' key = '' flag = '' for k inrange(4): key += chr(s[k] ^ ord(s1[k])) for i inrange(len(s)): flag += chr(s[i] ^ ord(key[i%4])) print(flag)
[ACTF新生赛2020]rome
拖进IDA,查看main函数
先判断了前面几位,再判断是不是大小写,然后运算
1 2 3 4 5 6 7 8 9 10 11 12 13
x = [81,115,119,51,115,106,95,108,122,52,95,85,106,119,64,108] flag = '' for k inrange(0,16): for i inrange(0,127): z = i if i > 64and i <= 90: i = (i-51)%26 + 65 if i > 96and i <= 122: i = (i-79)%26 + 97 if(i == x[k]): flag += chr(z)
print(flag)
[FlareOn4]login
这是个前端验证flag的题目
题目给了一个提示
直接查看源码
1
String.fromCharCode((c <= "Z" ? 90 : 122) >= (c = c.charCodeAt(0) + 13) ? c : c - 26);
关键的函数就是这一句,先判断大小写,与对应的Z或者z比较,大于减26,小于就原来的加上13的
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
enc = 'PyvragFvqrYbtvafNerRnfl@syner-ba.pbz' flag = '' for i in enc: iford(i) >= 65andord(i) <= 90: iford(i) - 13 < 65 : flag += chr(ord(i) + 13) else: flag += chr(ord(i) - 13) eliford(i) >= 97andord(i) <= 122: iford(i) - 13 < 97 : flag += chr(ord(i) + 13) else: flag += chr(ord(i) - 13) else: flag += i