hex0b2s.hex2 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  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. CALL 61 00 00 00
  33. 48 83 f8 ff # cmp rax,0xffffffffffffffff
  34. JE 4b
  35. 48 83 f8 20 # cmp rax,0x20
  36. JE ef
  37. 48 83 f8 09 # cmp rax,0x9
  38. JE e9
  39. 48 83 f8 0a # cmp rax,0xa
  40. JE e3
  41. 48 83 f8 23 # cmp rax,0x23
  42. 0f 84 d1 00 00 00 # je 600170 <skip_comment>
  43. CALL 99 00 00 00
  44. 48 c1 e0 04 # shl rax,0x4
  45. 48 89 05 f0 00 00 00 # mov QWORD PTR [rip+0xf0],rax # 60019f <oct>
  46. CALL 2a 00 00 00 # call 6000de <getchar>
  47. CALL 84 00 00 00 # call 60013d <hex_digit>
  48. 48 09 05 df 00 00 00 # or QWORD PTR [rip+0xdf],rax # 60019f <oct>
  49. 48 8b 05 d8 00 00 00 # mov rax,QWORD PTR [rip+0xd8] # 60019f <oct>
  50. CALL 4c 00 00 00 # call 600118 <putchar>
  51. JMP aa # jmp 600078 <_start>
  52. :_start.done
  53. 48 c7 c0 3c 00 00 00 # mov rax,0x3c
  54. 48 c7 c7 00 00 00 00 # mov rdi,0x0
  55. SYSCALL # syscall
  56. :getchar
  57. 48 c7 c0 00 00 00 00 # mov rax,0x0
  58. 48 c7 c7 00 00 00 00 # mov rdi,0x0
  59. 48 8d 35 a4 00 00 00 # lea rsi,[rip+0xa4] # 600197 <buf>
  60. 48 c7 c2 01 00 00 00 # mov rdx,0x1
  61. SYSCALL # syscall
  62. 48 83 f8 01 # cmp rax,0x1
  63. JNE 0e # jne 600110 <getchar.getchar_fail>
  64. 48 c7 c0 00 00 00 00 # mov rax,0x0
  65. 8a 05 88 00 00 00 # mov al,BYTE PTR [rip+0x88] # 600197 <buf>
  66. RET # ret
  67. :getchar.getchar_fail
  68. 48 c7 c0 ff ff ff ff # mov rax,0xffffffffffffffff
  69. RET # ret
  70. :putchar
  71. 88 05 79 00 00 00 # mov BYTE PTR [rip+0x79],al # 600197 <buf>
  72. 48 c7 c0 01 00 00 00 # mov rax,0x1
  73. 48 c7 c7 01 00 00 00 # mov rdi,0x1
  74. 48 8d 35 64 00 00 00 # lea rsi,[rip+0x64] # 600197 <buf>
  75. 48 c7 c2 01 00 00 00 # mov rdx,0x1
  76. SYSCALL # syscall
  77. RET # ret
  78. :hex_digit
  79. 48 83 f8 30 # cmp rax,0x30
  80. JL 0b # jl 60014e <hex_digit.next1>
  81. 48 83 f8 39 # cmp rax,0x39
  82. JG 05 # jg 60014e <hex_digit.next1>
  83. 48 83 e8 30 # sub rax,0x30
  84. RET # ret
  85. :hex_digit.next1
  86. 48 83 f8 61 # cmp rax,0x61
  87. JL 0b # jl 60015f <hex_digit.next2>
  88. 48 83 f8 66 # cmp rax,0x66
  89. JG 05 # jg 60015f <hex_digit.next2>
  90. 48 83 e8 57 # sub rax,0x57
  91. RET # ret
  92. :hex_digit.next2
  93. 48 83 f8 41 # cmp rax,0x41
  94. JL 22 # jl 600187 <die>
  95. 48 83 f8 46 # cmp rax,0x46
  96. JG 1c # jg 600187 <die>
  97. 48 83 e8 37 # sub rax,0x37
  98. RET # ret
  99. :skip_comment
  100. CALL 69 ff ff ff # call 6000de <getchar>
  101. 48 83 f8 ff # cmp rax,0xffffffffffffffff
  102. JE 0c # je 600187 <die>
  103. 48 83 f8 0a # cmp rax,0xa
  104. 0f 84 f3 fe ff ff # je 600078 <_start>
  105. JMP e9 # jmp 600170 <skip_comment>
  106. :die
  107. 48 c7 c0 3c 00 00 00 # mov rax,0x3c
  108. 48 c7 c7 01 00 00 00 # mov rdi,0x1
  109. SYSCALL # syscall
  110. :buf 00 00 00 00 00 00 00 00
  111. :oct 00 00 00 00 00 00 00 00