Guest User

Untitled

a guest
Sep 17th, 2019
274
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. f000:fff0  ljmp 0xf000:0xe05b
  2. f000:e05b  jmp 0xf46c
  3. f000:f46c  cli
  4. f000:f46d  cld
  5. f000:f470  smsw ax       ; read CR0
  6. f000:f473  test al, 1    ; test Protected Mode Enable
  7. f000:f475  je 0xf480
  8. [assuming PE is zero – jump:]
  9. f000:f480  jmp 0xe043
  10. f000:e043  mov al, 0x8f
  11. f000:e045  out 0x70, al  ; CMOS controller: disable NMI, set index 0xf
  12. f000:e047  out 0xeb, al  ; this port is presumably unoccupied: just a delay mechanism
  13. f000:e049  in al, 0x71   ; read 0xf (CMOS Shutdown Status)
  14. f000:e04b  out 0xeb, al  ; more delay
  15. f000:e04d  or al, al
  16. f000:e04f  jmp 0xf483
  17. f000:f483  jne 0xf488
  18. [assuming status ≥ 0x0D (cold boot) – jump:]
  19. f000:f488  mov ax, 0x40
  20. f000:f48b  mov es, ax
  21. f000:f48d  cmp word es:[0x72], 0x1234
  22. f000:f494  je 0xf49b
  23.  
  24. [Scenario 1: we find word 0x1234 at 0040:0072:]
  25. f000:f49b  test byte es:[0xba], 1
  26. f000:f4a1  je 0xf4c8
  27. [Scenario 1.1: byte at 0040:00BA is 1 → f000:f4c8]
  28. [Scenario 1.2: byte at 0040:00BA is other than 1:]
  29. f000:f4a3  mov esi, dword es:[0xa3]
  30. f000:f4a9  mov eax, esi
  31. f000:f4ac  shr eax, 0x10
  32. f000:f4b0  mov ds, ax
  33. f000:f4b2  mov ax, word [0]
  34. f000:f4b5  cmp ax, 0xaa55
  35. f000:f4b8  jne 0xf4c8
  36. [Scenario 1.2.1: word at [0040:00A5]:0000 is other than 0xAA55 → f000:f4c8]
  37. [Scenario 1.2.1: word at [0040:00A5]:0000 is 0xAA55:]
  38. f000:f4ba  xor ax, ax
  39. f000:f4bc  mov ds, ax
  40. f000:f4be  mov dword [0x40], esi
  41. f000:f4c3  mov ax, 3
  42. f000:f4c6  int 0x10
  43. [CS:IP now f000:f4c8]
  44.  
  45. [Scenario 2: 0040:0072 does not return 0x1234:]
  46. f000:f496  jmp 0x3253
  47. f000:3253  jmp 0xf499
  48. f000:f499  jmp 0xf4c8
  49.  
  50. [All cases now converge HERE]    <<<   This is the interesting bit
  51. f000:f4c8  mov ax, 0x30
  52. f000:f4cb  mov ss, ax
  53. f000:f4cd  mov sp, 0x100
  54. f000:f4d0  mov al, 0x8f
  55. f000:f4d2  call 0xe415
Advertisement
Add Comment
Please, Sign In to add comment