Create a gist now

Instantly share code, notes, and snippets.

@rmolina /tang0-main.txt Secret
Created Jul 29, 2016

What would you like to do?
.text:00000000004007CE ; =============== S U B R O U T I N E =======================================
.text:00000000004007CE
.text:00000000004007CE ; Attributes: bp-based frame
.text:00000000004007CE
.text:00000000004007CE ; int __cdecl main(int argc, const char **argv, const char **envp)
.text:00000000004007CE public main
.text:00000000004007CE main proc near ; DATA XREF: _start+1D↑o
.text:00000000004007CE
.text:00000000004007CE var_60 = qword ptr -60h
.text:00000000004007CE var_54 = dword ptr -54h
.text:00000000004007CE s2 = byte ptr -50h
.text:00000000004007CE var_48 = byte ptr -48h
.text:00000000004007CE var_40 = byte ptr -40h
.text:00000000004007CE var_38 = dword ptr -38h
.text:00000000004007CE var_34 = word ptr -34h
.text:00000000004007CE var_32 = byte ptr -32h
.text:00000000004007CE s = byte ptr -30h
.text:00000000004007CE var_14 = dword ptr -14h
.text:00000000004007CE stream = qword ptr -10h
.text:00000000004007CE s1 = qword ptr -8
.text:00000000004007CE
.text:00000000004007CE push rbp
.text:00000000004007CF mov rbp, rsp
.text:00000000004007D2 sub rsp, 60h
.text:00000000004007D6 mov [rbp+var_54], edi
.text:00000000004007D9 mov [rbp+var_60], rsi
.text:00000000004007DD cmp [rbp+var_54], 2
.text:00000000004007E1 jz short loc_4007F2
.text:00000000004007E3 mov edi, offset aAccessDenied ; "Access denied"
.text:00000000004007E8 call _puts
.text:00000000004007ED jmp locret_400902
.text:00000000004007F2 ; ---------------------------------------------------------------------------
.text:00000000004007F2
.text:00000000004007F2 loc_4007F2: ; CODE XREF: main+13↑j
.text:00000000004007F2 mov rax, 2E6B2E722E612E4Dh
.text:00000000004007FC mov qword ptr [rbp+var_40], rax
.text:0000000000400800 mov [rbp+var_38], 2E332E38h
.text:0000000000400807 mov [rbp+var_34], 61h
.text:000000000040080D mov [rbp+var_32], 0
.text:0000000000400811 mov rax, 78742E6E336B3074h
.text:000000000040081B mov qword ptr [rbp+s2], rax
.text:000000000040081F mov [rbp+var_48], 74h
.text:0000000000400823 jmp loc_4008E7
.text:0000000000400828 ; ---------------------------------------------------------------------------
.text:0000000000400828
.text:0000000000400828 loc_400828: ; CODE XREF: main+12E↓j
.text:0000000000400828 lea rdx, [rbp+s2]
.text:000000000040082C mov rax, [rbp+s1]
.text:0000000000400830 mov rsi, rdx ; s2
.text:0000000000400833 mov rdi, rax ; s1
.text:0000000000400836 call _strcmp
.text:000000000040083B test eax, eax
.text:000000000040083D jnz loc_4008DD
.text:0000000000400843 mov rax, [rbp+s1]
.text:0000000000400847 mov esi, offset modes ; "r"
.text:000000000040084C mov rdi, rax ; filename
.text:000000000040084F call _fopen
.text:0000000000400854 mov [rbp+stream], rax
.text:0000000000400858 cmp [rbp+stream], 0
.text:000000000040085D jz loc_4008E7
.text:0000000000400863 lea rdx, [rbp+s]
.text:0000000000400867 mov rax, [rbp+stream]
.text:000000000040086B mov esi, offset aS ; "%s"
.text:0000000000400870 mov rdi, rax
.text:0000000000400873 mov eax, 0
.text:0000000000400878 call ___isoc99_fscanf
.text:000000000040087D lea rdx, [rbp+var_40]
.text:0000000000400881 lea rax, [rbp+s]
.text:0000000000400885 mov rsi, rdx ; s2
.text:0000000000400888 mov rdi, rax ; s1
.text:000000000040088B call _strcmp
.text:0000000000400890 test eax, eax
.text:0000000000400892 jnz short loc_4008C5
.text:0000000000400894 lea rax, [rbp+s]
.text:0000000000400898 mov rdi, rax ; s
.text:000000000040089B call _strlen
.text:00000000004008A0 mov [rbp+var_14], eax
.text:00000000004008A3 mov edi, offset aCongratulation ; "Congratulations, you've found the GGoCy"...
.text:00000000004008A8 call _puts
.text:00000000004008AD mov eax, [rbp+var_14]
.text:00000000004008B0 mov edi, eax
.text:00000000004008B2 call t0k3n_g3n
.text:00000000004008B7 mov rax, [rbp+stream]
.text:00000000004008BB mov rdi, rax ; stream
.text:00000000004008BE call _fclose
.text:00000000004008C3 jmp short loc_4008E7
.text:00000000004008C5 ; ---------------------------------------------------------------------------
.text:00000000004008C5
.text:00000000004008C5 loc_4008C5: ; CODE XREF: main+C4↑j
.text:00000000004008C5 mov edi, offset aAccessDenied_T ; "Access denied.\nThis file does not cont"...
.text:00000000004008CA call _puts
.text:00000000004008CF mov rax, [rbp+stream]
.text:00000000004008D3 mov rdi, rax ; stream
.text:00000000004008D6 call _fclose
.text:00000000004008DB jmp short loc_4008E7
.text:00000000004008DD ; ---------------------------------------------------------------------------
.text:00000000004008DD
.text:00000000004008DD loc_4008DD: ; CODE XREF: main+6F↑j
.text:00000000004008DD mov edi, offset aUnableToLocate ; "Unable to locate the t0k3n file."
.text:00000000004008E2 call _puts
.text:00000000004008E7
.text:00000000004008E7 loc_4008E7: ; CODE XREF: main+55↑j
.text:00000000004008E7 ; main+8F↑j ...
.text:00000000004008E7 add [rbp+var_60], 8
.text:00000000004008EC mov rax, [rbp+var_60]
.text:00000000004008F0 mov rax, [rax]
.text:00000000004008F3 mov [rbp+s1], rax
.text:00000000004008F7 cmp [rbp+s1], 0
.text:00000000004008FC jnz loc_400828
.text:0000000000400902
.text:0000000000400902 locret_400902: ; CODE XREF: main+1F↑j
.text:0000000000400902 leave
.text:0000000000400903 retn
.text:0000000000400903 main endp
.text:0000000000400903
.text:0000000000400903 ; ---------------------------------------------------------------------------
.text:0000000000400904 align 10h
.text:0000000000400910
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment