Advertisement
Guest User

ASM_SecurityTube

a guest
Jul 18th, 2011
345
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. .text
  2. .globl _start
  3.  
  4. _start:
  5. # We jump to the bottom of the page, so we can call thecode
  6. # from below, we need to do this in order to avoid null bytes.
  7. jmp intro
  8.  
  9. thecode:
  10. # Flush the registers to remove potential random data
  11. xorl %eax, %eax
  12. xorl %ebx, %ebx
  13. xorl %edx, %edx
  14.  
  15. # Write to the 1 byte counterpart of eax and ebx (to remove nulls)
  16. movb $4, %al
  17. movb $1, %bl
  18.  
  19. # Get the string from the stack and put it into ecx
  20. popl %ecx
  21.  
  22. # Write the string length into dl (edx)
  23. movb $12, %dl
  24. int $0x80
  25.  
  26. # Flush the registers once more and call exit(1)
  27. xorl %eax,%eax
  28. xorl %ebx, %ebx
  29. movb $1, %al
  30. movb $1, %bl
  31. int $0x80
  32.  
  33. intro:
  34. call thecode
  35.  
  36. # We define this after the so we can pop it off the stack
  37. .ascii "Hello World\n"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement