2009-03-29 07:30:54 +00:00
|
|
|
#!/usr/bin/env ruby
|
|
|
|
|
|
|
|
# This file is part of Metasm, the Ruby assembly manipulation suite
|
2010-09-09 18:19:35 +00:00
|
|
|
# Copyright (C) 2006-2009 Yoann GUILLOT
|
2009-03-29 07:30:54 +00:00
|
|
|
#
|
|
|
|
# Licence is LGPL, see LICENCE in the top-level directory
|
|
|
|
|
|
|
|
require 'metasm'
|
2010-09-09 18:19:35 +00:00
|
|
|
$opts = { :execlass => Metasm::MachO }
|
2009-03-29 07:30:54 +00:00
|
|
|
load File.join(File.dirname(__FILE__), 'exeencode.rb')
|
|
|
|
|
|
|
|
__END__
|
|
|
|
.text
|
|
|
|
|
|
|
|
str db "Hello, World !\n", 0
|
|
|
|
strlen equ $-str
|
|
|
|
.align 8
|
|
|
|
|
|
|
|
.entrypoint
|
|
|
|
push strlen
|
|
|
|
push str
|
|
|
|
push 1 // stdout
|
|
|
|
mov eax, 4 // sys_write
|
2010-09-09 18:19:35 +00:00
|
|
|
push eax
|
2009-03-29 07:30:54 +00:00
|
|
|
int 80h
|
|
|
|
add esp, 12
|
|
|
|
|
|
|
|
push 0
|
|
|
|
mov eax, 1 // sys_exit
|
2010-09-09 18:19:35 +00:00
|
|
|
push eax
|
2009-03-29 07:30:54 +00:00
|
|
|
int 80h
|