Files
metasploit-gs/lib/metasm/samples/a.out.rb
T
HD Moore 1894dc4f1a New metasm
git-svn-id: file:///home/svn/framework3/trunk@6429 4d416f70-5f16-0410-b530-b9f4589650da
2009-03-29 07:30:54 +00:00

32 lines
510 B
Ruby

# This file is part of Metasm, the Ruby assembly manipulation suite
# Copyright (C) 2007 Yoann GUILLOT
#
# Licence is LGPL, see LICENCE in the top-level directory
#
# here we build a simple a.out executable
#
require 'metasm'
Metasm::AOut.assemble(Metasm::Ia32.new, <<EOS).encode_file('m-a.out')
.text
.entrypoint
mov eax, 4
mov ebx, 1
.data
str db "kikoo\\n"
strend:
.text
mov ecx, str
mov edx, strend - str
int 80h // linux sys_write
mov eax, 1
mov ebx, 42
int 80h // linux sys_exit
ret
EOS