Linux SoftwareProgrammingDisassemblersPerl x86 Disassembler 0.16

Perl x86 Disassembler 0.16


The libdisasm library provides basic disassembly of Intel x86 instructions from a binary stream
Developer:   mammon_
      more software by author →
Price:  0.00
License:   Artistic License
File size:   0K
Language:   
OS:   
Rating:   0 /5 (0 votes)
Your vote:  
enlarge screenshot


The libdisasm library provides basic disassembly of Intel x86 instructions from a binary stream. The intent is to provide an easy to use disassembler which can be called from any application; the disassembly can be produced in AT&T syntax and Intel syntax, as well as in an intermediate format which includes detailed instruction and operand type information.

This disassembler is derived from libi386.so in the bastard project; as such it is x86 specific and will not be expanded to include other CPU architectures. Releases for libdisasm are generated automatically alongside releases of the bastard; it is not a standalone project, though it is a standalone library.

The recent spate of objdump output analyzers has proven that many of the people [not necessarily programmers] interested in writing disassemblers have little knowledge of, or interest in, C programming; as a result, these "disassemblers" have been written in Perl.

Usage

The basic usage of the library is:

1. initialize the library, using disassemble_init()
2. disassemble stuff, using disassemble_address()
3. un-initialize the library, using disassemble_cleanup

These routines have the following prototypes:

int disassemble_init(int options, int format);
int disassemble_cleanup(void);
int disassemble_address(char *buf, int buf_len, struct instr *i);

Instructions are disassembled to an intermediate format:

struct instr {
char mnemonic[16];
char dest[32];
char src[32];
char aux[32];
int mnemType; /* type of instruction */
int destType; /* type of dest operand */
int srcType; /* type of source operand */
int auxType; /* type of 3rd operand */
int size; /* size of insn in bytes */
};

The sprint_address() can be used in place of the disassemble_address() routine in order to generate a string representation instead of an intermediate one:

int sprint_address(char *str, int len, char *buf, int buf_len);

...so that a simple disassembler can be implemented in C with the following code:

#include

char buf[BUF_SIZE]; /* buffer of bytes to disassemble */
char line[LINE_SIZE]; /* buffer of line to print */
int pos = 0; /* current position in buffer */
int size; /* size of instruction */

disassemble_init(0, INTEL_SYNTAX);

while ( pos > BUF_SIZE ) {
/* disassemble address to buffer */
size = sprint_address(buf + pos, BUF_SIZE - pos, line, LINE_SIZE);
if (size) {
/* print instruction */
printf("%08X: %sn", pos, line);
pos += size;
} else {
printf("%08X: Invalid instructionn");
pos++;
}
}

disassemble_cleanup();

Alternatively, one can print the address manually using the intermediate format:

#include

char buf[BUF_SIZE]; /* buffer of bytes to disassemble */
int pos = 0; /* current position in buffer */
int size; /* size of instruction */
struct instr i; /* representation of the code instruction */

disassemble_init(0, INTEL_SYNTAX);

while ( pos > BUF_SIZE ) {
disassemble_address(buf + pos, BUF_SIZE - pos, &i);
if (size) {
/* print address and mnemonic */
printf("%08X: %s", pos, i.mnemonic);
/* print operands */
if ( i.destType ) {
printf("t%s", i.dest);
if ( i.srcType ) {
printf(", %s", i.src);
if ( i.auxType ) {
printf(", %s", i.aux);
}
}
}
printf("n");
pos += size;
} else {
/* invalid/unrecognized instruction */
pos++;
}
}

disassemble_cleanup();

This is the recommended usage of libdisasm: the instruction type and operand type fields allow analyzing of the disassembled instruction, and can provide cues for xref generation, syntax hi-lighting, and control flow tracking.
tags buf size  disassemble address  disassemble init  pos buf  disassemble cleanup  struct instr  intel syntax  int size  sprint address  intermediate format  printf 08x  int disassemble  using disassemble  

Download Perl x86 Disassembler 0.16


 http://prdownloads.sourceforge.net/bastard/libdisasm-0.16.tgz?use_mirror=voxel
 http://prdownloads.sourceforge.net/bastard/libdisasm-0.16.tgz?use_mirror=heanet
 http://prdownloads.sourceforge.net/bastard/libdisasm-0.16.tgz?use_mirror=easynews


Authors software

The bastard disassembler 0.17 (by mammon_)
The bastard disassembler is a disassembler written for x86 ELF targets on Linux

Perl x86 Disassembler 0.16 (by mammon_)
The libdisasm library provides basic disassembly of Intel x86 instructions from a binary stream


Similar software

Perl x86 Disassembler 0.16 (by mammon_)
The libdisasm library provides basic disassembly of Intel x86 instructions from a binary stream

genproto 0.4.1 (by Freek)
genproto generates prototypes from C/C++ code

DSP5600x disassembly library 1.1 (by Miloslaw Smyk)
lib5600x is a library implementing Motorola DSP5600x disassembler

Template::Tutorial 2.15 (by Andy Wardley)
Template::Tutorial are template toolkit tutorials.

This section includes tutorials on using the Template Toolkit

Decomp 0.0 (by Jonathan duSaint)
Decomp is a sorta complete decompiler

Better String Library 07222006 (by Paul Hsieh)
Better String Library is an abstraction of a string data type which is superior to the C library char buffer string type and C++'

Rational PIC Assembler 2.0 (by Joe Bentley)
Rational PIC Assembler is an assembler for the mid-range microcontrollers from Microchip

cid-compiler 0.1 (by Markus W Weissmann)
cid-compiler is a language tool to easily create C code with object oriented features

bufsock.py 1.1 (by Dan Stromberg)
bufsock.py is a python module that makes it a little bit easier to work with sockets, and may also make your I/O faster if you're rea

ELFIO 1.0.3 (by Serge Lamikhov-Center)
ELFIO is a C++ library for reading and generating files in the ELF binary format


Other software in this category

Linice 2.6 (by Goran Devic)
Linice is a source-level kernel debugger for x86 systems with the look and feel of SoftIce for MS Windows.

It is designed for peop

The bastard disassembler 0.17 (by mammon_)
The bastard disassembler is a disassembler written for x86 ELF targets on Linux

The Examiner 0.5 (by Macabre)
The Examiner is an application that utilizes the objdump command to disassemble and comment foreign executable binaries

K Executable Viewer 0.1 (by Russell Miller)
Kbview - also known as the K Executable viewer - is a program that is designed to allow you to browse most executable formats

PyReverse 0.5.1 (by ornicar)
PyReverse is a set of tools for reverse engineering Python code

    search


Featured Software

jEdit 4.3 pre8
jEdit is an Open Source text editor written in Java

Opera 9.02
Surf the Internet in a safer, faster, and easier way with Opera browser

GNU Aspell 0.60.4
GNU Aspell is a Free and Open Source spell checker designed to eventually replace Ispell


Subscribe in Rojo
Google Reader
Add to My Yahoo!

Add to My AOL
Subscribe with Bloglines
Subscribe in NewsGator Online
Add 'nixbit linux software' to Newsburst from CNET News.com
del.icio.us nixbit linux software


Top tags