# Tools for working with x86 assembly in Ruby?

**URL:** <https://www.ruby-forum.com/t/tools-for-working-with-x86-assembly-in-ruby/129262>\
**Category:** Ruby\
**Created:** [February 15, 2008, 9:15pm UTC](https://www.ruby-forum.com/t/tools-for-working-with-x86-assembly-in-ruby/129262 "2008-02-15T21:15:31Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ljp](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/cab0a1/32.png) [@ljp](https://www.ruby-forum.com/u/ljp)\
**Post date:** [February 15, 2008, 9:15pm UTC](https://www.ruby-forum.com/t/tools-for-working-with-x86-assembly-in-ruby/129262/1 "2008-02-15T21:15:31Z")

</div>

Hi all,

I’m starting a project that will involve injecting instructions into  
x86 assembly code. I’d like to write this tool in Ruby. In the  
interest of not reinventing wheels, I’m appealing to the Ruby  
community: does anyone know of some serviceable source code for  
parsing x86 assembly, and ideally for editing (e.g., ability to update  
offsets when an instruction is moved around)? Or perhaps someone  
knows of an assembler written in Ruby that I could pilfer? My Google-  
fu hasn’t turned up anything.

(I know of Racc - it will be my starting point if I can’t find an  
existing parser)

Many thanks =)

---

<div class="post-metadata">

**Author:** ![ljp](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/cab0a1/32.png) [@ljp](https://www.ruby-forum.com/u/ljp)\
**Post date:** [February 15, 2008, 9:29pm UTC](https://www.ruby-forum.com/t/tools-for-working-with-x86-assembly-in-ruby/129262/2 "2008-02-15T21:29:43Z")

</div>

On Sat, 16 Feb 2008, ljp wrote:

> I’m starting a project that will involve injecting instructions into  
> x86 assembly code. I’d like to write this tool in Ruby. In the  
> interest of not reinventing wheels, I’m appealing to the Ruby  
> community: does anyone know of some serviceable source code for  
> parsing x86 assembly, and ideally for editing (e.g., ability to update  
> offsets when an instruction is moved around)? Or perhaps someone  
> knows of an assembler written in Ruby that I could pilfer? My Google-  
> fu hasn’t turned up anything.

You may want to take a look at Metasploit, I think it does some of that.

– Matt  
It’s not what I know that counts.  
It’s what I can remember in time to use.

---

<div class="post-metadata">

**Author:** ![ljp](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/cab0a1/32.png) [@ljp](https://www.ruby-forum.com/u/ljp)\
**Post date:** [February 16, 2008, 5:16am UTC](https://www.ruby-forum.com/t/tools-for-working-with-x86-assembly-in-ruby/129262/3 "2008-02-16T05:16:42Z")

</div>

ljp wrote:

> (I know of Racc - it will be my starting point if I can’t find an  
> existing parser)
> 
> Many thanks =)

Have a look at RubyInline. It lets you put C code in line in Ruby code.  
I would imagine that “C code” on a Gnu/Linux system could include Gnu  
Assembler code as well. I can’t help you on Windows, however. 😉
