__int64 __fastcall main(int a1, char **a2, char **a3) { puts("======================================="); puts("= Welcome to the flag access machine! ="); puts("= Input the password to login ... ="); puts("======================================="); __isoc99_scanf("%s", s); if ( (unsigned int)sub_400766("%s", s) ) { puts("Congratulations! You should get the flag..."); sub_400B16("Congratulations! You should get the flag..."); } else { puts("Wrong password!"); } return 0LL; }
.bss:00000000006020A0 s db 4 dup(?) ; DATA XREF: sub_400766+8↑o .bss:00000000006020A0 ; sub_400766:loc_400788↑o ... .bss:00000000006020A4 ; int dword_6020A4 .bss:00000000006020A4 dword_6020A4 dd ? ; DATA XREF: sub_400766+2F↑o .bss:00000000006020A8 ; int dword_6020A8 .bss:00000000006020A8 dword_6020A8 dd ? ; DATA XREF: sub_400766+3C↑o .bss:00000000006020AC ; int dword_6020AC .bss:00000000006020AC dword_6020AC dd ? ; DATA XREF: sub_400766+49↑o .bss:00000000006020B0 unk_6020B0 db ? ; ; DATA XREF: sub_400766+56↑o .bss:00000000006020B1 db ? ; .bss:00000000006020B2 db ? ; .bss:00000000006020B3 db ? ; .bss:00000000006020B4 unk_6020B4 db ? ; ; DATA XREF: sub_400766+63↑o .bss:00000000006020B5 db ? ; .bss:00000000006020B6 db ? ; .bss:00000000006020B7 db ? ; .bss:00000000006020B8 unk_6020B8 db ? ; ; DATA XREF: sub_400766+70↑o .bss:00000000006020B9 db ? ; .bss:00000000006020BA db ? ; .bss:00000000006020BB db ? ; .bss:00000000006020BC unk_6020BC db ? ; ; DATA XREF: sub_400766+7D↑o .bss:00000000006020BD db ? ; .bss:00000000006020BE db ? ; .bss:00000000006020BF db ? ; .bss:00000000006020C0 db ? ;
flag = [1869639009,1801073242,829124174,862734414,811816014,828593230,1867395930,1195788129] tmp = "" final = "" for i in flag: i = hex(i) tmp = "" for j inrange(2,len(i),2): tmp += chr(int(i[j:j+2],16)).strip("\n") tmp = tmp[::-1] final += tmp print(final) print("\n")
或者用下面的这个库(为什么这个不用反转呢?) [::-1]
1 2 3 4 5 6 7 8 9 10 11 12
#/usr/bin/env python # coding=utf-8 import libnum
flag = "" x = [1869639009,1801073242,829124174,862734414,811816014,828593230,1867395930,1195788129] for y in x: flag += libnum.n2s(y)[::-1] print flag 运算结果: ampoZ2ZkNnk1NHl3NTc0NTc1Z3NoaGFG opmakZ2Z1knN3lHN0cTN1cTNoN3ZGFGa
1 2 3 4 5 6 7 8
root@VM-24-10-ubuntu:/home/ubuntu/re# ./My\ math\ is\ bad ======================================= = Welcome to the flag access machine! = = Input the password to login ... = ======================================= ampoZ2ZkNnk1NHl3NTc0NTc1Z3NoaGFG Congratulations! You should get the flag... flag{th3_Line@r_4lgebra_1s_d1fficult!}