cat3.hex2 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. ## ELF Header
  2. 7F 45 4C 46 ## e_ident[EI_MAG0-3] ELF's magic number
  3. 02 ## e_ident[EI_CLASS] Indicating 64 bit
  4. 01 ## e_ident[EI_DATA] Indicating little endianness
  5. 01 ## e_ident[EI_VERSION] Indicating original elf
  6. 00 ## e_ident[EI_OSABI] Set at 0 because none cares
  7. 00 ## e_ident[EI_ABIVERSION] See above
  8. 00 00 00 00 00 00 00 ## e_ident[EI_PAD]
  9. 02 00 ## e_type Indicating Executable
  10. 3E 00 ## e_machine Indicating AMD64
  11. 01 00 00 00 ## e_version Indicating original elf
  12. 78 00 60 00 00 00 00 00 ## e_entry Address of the entry point
  13. 40 00 00 00 00 00 00 00 ## e_phoff Address of program header table
  14. 00 00 00 00 00 00 00 00 ## e_shoff Address of section header table
  15. 00 00 00 00 ## e_flags
  16. 40 00 ## e_ehsize Indicating our 64 Byte header
  17. 38 00 ## e_phentsize size of a program header table
  18. 01 00 ## e_phnum number of entries in program table
  19. 00 00 ## e_shentsize size of a section header table
  20. 00 00 ## e_shnum number of entries in section table
  21. 00 00 ## e_shstrndx index of the section names
  22. ## Program Header table
  23. 01 00 00 00 ## p_type
  24. 06 00 00 00 ## Flags
  25. 00 00 00 00 00 00 00 00 ## p_offset
  26. 00 00 60 00 00 00 00 00 ## p_vaddr
  27. 00 00 60 00 00 00 00 00 ## Undefined
  28. 08 10 00 00 00 00 00 00 ## p_filesz
  29. 08 10 00 00 00 00 00 00 ## p_memsz
  30. 00 00 20 00 00 00 00 00 ## Required alignment
  31. :_start
  32. e8 *getchar # call 600096 <getchar>
  33. 48 83 f8 ff # cmp rax,0xffffffffffffffff
  34. 74 ._start.done # je 60008a <_start.done>
  35. e8 *putchar # call 6000d0 <putchar>
  36. eb ._start # jmp 600078 <_start>
  37. :_start.done
  38. 48 89 c7 # mov rdi,rax
  39. 48 c7 c0 3c 00 00 00 # mov rax,0x3c
  40. 0f 05 # syscall
  41. :getchar
  42. 48 c7 c0 00 00 00 00 # mov rax,0x0
  43. 48 c7 c7 00 00 00 00 # mov rdi,0x0
  44. 48 8d 35 *buf # lea rsi,[rip+0x4a] # 6000f5 <buf>
  45. 48 c7 c2 01 00 00 00 # mov rdx,0x1
  46. 0f 05 # syscall
  47. 48 83 f8 01 # cmp rax,0x1
  48. 75 .getchar.getchar_fail # jne 6000c8 <getchar.getchar_fail>
  49. 48 c7 c0 00 00 00 00 # mov rax,0x0
  50. 8a 05 *buf # mov al,BYTE PTR [rip+0x2e] # 6000f5 <buf>
  51. c3 # ret
  52. :getchar.getchar_fail
  53. 48 c7 c0 ff ff ff ff # mov rax,0xffffffffffffffff
  54. c3 # ret
  55. :putchar
  56. 88 05 *buf # mov BYTE PTR [rip+0x1f],al # 6000f5 <buf>
  57. 48 c7 c0 01 00 00 00 # mov rax,0x1
  58. 48 c7 c7 01 00 00 00 # mov rdi,0x1
  59. 48 8d 35 *buf # lea rsi,[rip+0xa] # 6000f5 <buf>
  60. 48 c7 c2 01 00 00 00 # mov rdx,0x1
  61. 0f 05 # syscall
  62. c3 # ret
  63. :buf
  64. 00 00 00 00 00 00 00 00