It looks like you're new here. If you want to get involved, click one of these buttons!
# Hello_world.s
# Semtex-Primed
.section .data
helloworld:
.ascii \"Hello iExploit\n\"
helloworld_end:
.equ helloworld_len, helloworld_end - helloworld
.equ STDOUT, 1
.equ EXIT, 1
.equ WRITE, 4
.equ SYSCALL, 0x80
.section .text
.globl _start
_start:
movl $STDOUT, %ebx
movl $helloworld, %ecx
movl $helloworld_len, %edx
movl $WRITE, %eax
int $SYSCALL
movl $0, %ebx
movl $EXIT, %eax
int $SYSCALL
# hello_world-lib.s
# Semtex-Primed
.section .data
helloworld:
.ascii \"Hello iExploit\n\"
.section .text
.globl _start
_start:
pushl $helloworld
call printf
pushl $0
call exit
# Hello_world.s
# Semtex-Primed
.section .data #start of data section
helloworld: #variable to hold hello world
.ascii \"Hello iExploit\n\" #variable contents - ascii data-type
helloworld_end:
# CONSTANT's #
.equ helloworld_len, helloworld_end - helloworld #calculates the length of the value in helloworld
#System Calls - I could write an entire book on this,
# http://asm.sourceforge.net/syscall.html
# Basically were putting the system calls into constants avoiding using the number calls.
.equ STDOUT, 1
.equ EXIT, 1
.equ WRITE, 4
.equ SYSCALL, 0x80
.section .text #text section
.globl _start #declares the start of \"_start\"
#start of the main block of code
_start:
### Print hello iexploit
movl $STDOUT, %ebx #tells *nix we want to output (loaded into ebx register)
movl $helloworld, %ecx #gives the value/variable we want to output (loaded into ecx register)
movl $helloworld_len, %edx #give the length of hello world variable being output (loaded into edx reg)
movl $WRITE, %eax
int $SYSCALL #initiates the previous block of code.
### Exit
movl $0, %ebx #return code to the OS: similar to \"return 0;\" in C
movl $EXIT, %eax #$EXIT contains 1 which is the syscall for exit. (sys_exit).
int $SYSCALL