Converts Machine Code to x86 (32-bit) Linux executable (auto-wrapping with ELF headers)
Perl M Objective-C Brainfuck
Latest commit f25bbc5 Jul 26, 2016 @XlogicX committed on GitHub Intel format for interactive mode
Instead of the ugly AT&T stuff
Permalink
Failed to load latest commit information.
LICENSE Initial commit Aug 25, 2014
README.md Update README.md Dec 31, 2015
hello_world.b Update hello_world.b May 7, 2015
hello_world.m Update hello_world.m Aug 25, 2014
m2elf.pl Intel format for interactive mode Jul 26, 2016
spawnshell.m Create spawnshell.m Aug 27, 2014

README.md

m2elf

Converts Machine Code to x86 (32-bit) Linux executable (auto-wrapping with ELF headers). This script comes included in Remnux v6

Command Usage

Options:
--in (input file)
--out (output file)
--binary (if the input is already binary form)
--mem (bytes)
--entry (This changes the entry point, it adds to the offset whichever decimal number is provided)
--writeover - changes the r-x of the .text to rwx; now you can have self modifying codes

m2elf --in source_file.m --out executable_file --mem 100

Example Source Files

  • hello.m - written in machine code, prints hello world. Use --mem 16
  • hello.b - same as above, but written in pure 1's and 0's :)
  • Spawnshell.m - shellcode from: http://phrack.org/issues/49/14.html#article, the difference with this .m file is that each instruction is commented. To get this to actually run, the --writeover argument must be used.

Source File Syntax

The source file can include ascii hex and binary byte by byte. Spacing between hex bytes not a requirment, but could reduce bugs (4 hex bytes could look like binary to m2elf if the hex is only 1's and 0's). In order for a binary byte to be interpreted as such, it needs to be a series of 8 1's and 0's preceded by an underscore, i.e. _01011000

Valid comments include #, //, ', and --