Advertisement
Guest User

leviathan

a guest
Oct 14th, 2017
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.43 KB | None | 0 0
  1. Dump of assembler code for function main:
  2. 0x0804852d <+0>: push ebp ; save the frame pointer for ebp
  3. 0x0804852e <+1>: mov ebp,esp ; move the new base pointer to where the old top of the stack was
  4. 0x08048530 <+3>: and esp,0xfffffff0 ; align esp
  5. 0x08048533 <+6>: sub esp,0x230 ; move esp 0x230 lower in memory
  6. 0x08048539 <+12>: mov eax,DWORD PTR [ebp+0xc]
  7. 0x0804853c <+15>: mov DWORD PTR [esp+0x1c],eax ; move [ebp+0xc] to [ebp+0x1c]
  8. 0x08048540 <+19>: mov eax,gs:0x14
  9. 0x08048546 <+25>: mov DWORD PTR [esp+0x22c],eax ; move gs:0x14 to [esp+0x22c]
  10. 0x0804854d <+32>: xor eax,eax
  11. 0x0804854f <+34>: cmp DWORD PTR [ebp+0x8],0x1 ; compare argc to 1. weirdness: if there's actually 2 extra args, it'll think its 0, and 1 is 2
  12. 0x08048553 <+38>: jg 0x804857e <main+81> ; if argc >= 2, jump to CONT
  13. 0x08048555 <+40>: mov DWORD PTR [esp],0x8048690 ; else if argc == 1, (no filename argument), put "*** File Printer ***" on the stack for puts
  14. 0x0804855c <+47>: call 0x80483d0 <puts@plt> ; call puts to print "*** File Printer ***"
  15. 0x08048561 <+52>: mov eax,DWORD PTR [esp+0x1c]
  16. 0x08048565 <+56>: mov eax,DWORD PTR [eax]
  17. 0x08048567 <+58>: mov DWORD PTR [esp+0x4],eax ; put parameter "/home/leviathan2/printfile" on the stack for printf
  18. 0x0804856b <+62>: mov DWORD PTR [esp],0x80486a5 ; put parameter "Usage: %s filename\n" on the stack for printf
  19. 0x08048572 <+69>: call 0x80483b0 <printf@plt> ; print "Usage: /home/leviathan2/printfile filename"
  20. 0x08048577 <+74>: mov eax,0xffffffff
  21. 0x0804857c <+79>: jmp 0x80485e8 <main+187> ; jump to EXIT
  22. ; there was a filename argument
  23. CONT 0x0804857e <+81>: mov eax,DWORD PTR [esp+0x1c] ; [esp+1c] is argv
  24. 0x08048582 <+85>: add eax,0x4 ; add 4 to argv to access the 2nd string
  25. 0x08048585 <+88>: mov eax,DWORD PTR [eax] ; eax now contains the 2nd string (a pointer to it)
  26. 0x08048587 <+90>: mov DWORD PTR [esp+0x4],0x4 ; stack argument 2: 0x4
  27. 0x0804858f <+98>: mov DWORD PTR [esp],eax ; stack argument 1: the filename string
  28. 0x08048592 <+101>: call 0x8048420 <access@plt> ; function that checks if the user has access to the file
  29. 0x08048597 <+106>: test eax,eax ; test if eax is zero
  30. 0x08048599 <+108>: je 0x80485ae <main+129> ; if eax is zero, jump to LABEL
  31. 0x0804859b <+110>: mov DWORD PTR [esp],0x80486b9 ; if eax isn't zero, push "You cant have that file..."
  32. 0x080485a2 <+117>: call 0x80483d0 <puts@plt>
  33. 0x080485a7 <+122>: mov eax,0x1
  34. 0x080485ac <+127>: jmp 0x80485e8 <main+187> ; jump to EXIT
  35. LABEL 0x080485ae <+129>: mov eax,DWORD PTR [esp+0x1c]
  36. 0x080485b2 <+133>: add eax,0x4
  37. 0x080485b5 <+136>: mov eax,DWORD PTR [eax]
  38. 0x080485b7 <+138>: mov DWORD PTR [esp+0xc],eax
  39. 0x080485bb <+142>: mov DWORD PTR [esp+0x8],0x80486d4
  40. 0x080485c3 <+150>: mov DWORD PTR [esp+0x4],0x1ff
  41. 0x080485cb <+158>: lea eax,[esp+0x2c]
  42. 0x080485cf <+162>: mov DWORD PTR [esp],eax
  43. 0x080485d2 <+165>: call 0x8048410 <snprintf@plt>
  44. 0x080485d7 <+170>: lea eax,[esp+0x2c]
  45. 0x080485db <+174>: mov DWORD PTR [esp],eax
  46. 0x080485de <+177>: call 0x80483e0 <system@plt>
  47. 0x080485e3 <+182>: mov eax,0x0
  48. EXIT 0x080485e8 <+187>: mov edx,DWORD PTR [esp+0x22c]
  49. 0x080485ef <+194>: xor edx,DWORD PTR gs:0x14
  50. 0x080485f6 <+201>: je 0x80485fd <main+208>
  51. 0x080485f8 <+203>: call 0x80483c0 <__stack_chk_fail@plt>
  52. 0x080485fd <+208>: leave
  53. 0x080485fe <+209>: ret
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement