glo.hex2 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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
  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. b0 00 40 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. 02 00 ## e_phnum number of entries in program table
  19. 40 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. 05 00 00 00 ## Flags
  25. 00 00 00 00 00 00 00 00 ## p_offset
  26. 00 00 40 00 00 00 00 00 ## p_vaddr
  27. 00 00 40 00 00 00 00 00 ## Undefined
  28. 11 01 00 00 00 00 00 00 ## p_filesz
  29. 11 01 00 00 00 00 00 00 ## p_memsz
  30. 00 00 20 00 00 00 00 00 ## Required alignment
  31. ## BSS section header
  32. 01 00 00 00 ## p_type
  33. 06 00 00 00 ## Flags
  34. 14 01 00 00 00 00 00 00 ## p_offset
  35. 14 01 60 00 00 00 00 00 ## p_vaddr
  36. 14 01 60 00 00 00 00 00 ## Undefined
  37. 00 00 00 00 00 00 00 00 ## p_filesz
  38. 00 00 40 00 00 00 00 00 ## p_memsz (4MB)
  39. 00 00 20 00 00 00 00 00 ## Required alignment
  40. ## Text section
  41. b0 2a # mov al,0x2a
  42. 88 04 25 14 01 60 00 # mov [0x600114],al
  43. 88 04 25 15 01 60 00 # mov [0x600115],al
  44. 88 04 25 16 01 60 00 # mov [0x600116],al
  45. 88 04 25 17 01 60 00 # mov [0x600117],al
  46. 88 04 25 18 01 60 00 # mov [0x600118],al
  47. 88 04 25 19 01 60 00 # mov [0x600119],al
  48. 88 04 25 1a 01 60 00 # mov [0x60011a],al
  49. 48 c7 c0 01 00 00 00 # mov rax,0x1
  50. 48 c7 c7 00 00 00 00 # mov rdi,0x0
  51. 48 c7 c6 14 01 60 00 # mov rsi,0x600114
  52. 48 c7 c2 03 00 00 00 # mov rdx,0x3
  53. 0f 05 # syscall
  54. 48 c7 c0 3c 00 00 00 # mov rax,0x3c
  55. 48 c7 c7 00 00 00 00 # mov rdi,0x0
  56. 0f 05 # syscall