Git Product home page Git Product logo

disasm's Introduction

Interactive Disassembler GUI

About

Disasm is a browser-based application, built on Flask, that allows you to disassemble ELF files into Intel x86 assembly. The assembly and analysis is displayed in a browser so that you can click around and interact with it.

Before running

  1. Install Capstone
  2. Install the dependencies
    • $ pip install -r requirements.txt --ignore-installed
  3. Replace the upload path and source code directory path in config.py with the appropriate relative paths on your machine.

IACA

There is optional IACA integration. To use it, you must first download IACA from Intel's website and update variables in your config.py accordingly.

PyPy

PyPy is an alternative implementation of python that provides a considerable speedup. To use it, there is a little more setup involved.

  1. Set up the requirements for pypy using either of the following methods:
    • pip_pypy install -r requirements.pypy.txt (regular pip doesn't install to a directory that pypy can find)
    • OR create a pypy virtualenv and pip install -r requirements.pypy.txt within that virtualenv
  2. Ensure that you have either c++filt or gc++filt on your machine and in your $PATH. The demangler library we use does not work with pypy so we use command line tools instead. If you know of a python demangler library that can run on pypy, please let us know!

Running

You can run the application with

python run.py

This will run the server on top of Gunicorn, a faster, more reliable, and more robust server than Werkzeug, the default Flask server. If Gunicorn isn't working for you, or if you'd like to use Werkzeug for any other reason, you can do so by running:

python app/app.py

If Pypy is installed, then you can run the application by running pypy instead of python:

pypy run.py

Options

  • -f <file(s)>, --files <file(s)>
    • File(s) that you want to disassemble.

Features

Features marked with an asterisk (*) require that the .dwarf_info section be defined in order to use it.

Disassembly

The main feature of the application, an ELF executable can be disassembled into x86 assembly and displayed in the browser.

Source code stack trace *

After selecting a line of assembly, the source code that corresponds to it can be displayed, as well as the full stack trace of function calls that refer to it.

Note: This feature requires that the source directory of the code that compiled into this executable be defined in config.py.

source code stack trace

IACA integration

A sequence of instructions can be analyzed by Intel IACA.

Note: In order to use this feature, you must first download IACA from Intel's website and update variables in your config.py accordingly.

intel iaca integration

Register contents *

Whenever possible, the contents of a register will be displayed, including the object's member that is being pointed to if a valid offset is given.

register tracking

Register tracking *

Observe which instructions read and/or write to a particular register by right clicking on the desired register and selecting the appropriate option from the dropdown menu.

registers written to and read from

Flags read/written

Instructions that write to a flag(s) will display a white flag next to the mnemonic. Instructions that read from a flag(s) will display a black flag next to the mnemonic. Hovering over the flag will display which flags are read to/written from in this operation.

flags written to and read from

Jump table resolution

Jump tables are parsed. Clicking on the jump table instruction displays the mapping between each condition value and the address to jump to. Clicking on each of these addresses jumps to the respective instruction.

jump table parsing

Rip-relative address resolution and interpretation

A rip-relative adddress (e.g, rip + 0x129d866) can be resolved into a single address by right clicking on that part of the instruction. The value at this address can also be read from the file as an 8/16/32/64-bit signed decimal/unsigned decimal/hexadecimal/binary number, single/double precision floating point number, or null-terminated C String (up to 128 bytes).

rip relative resolution and interpretation

Type analysis *

You can search for a type that is defined in this file in order to obtain obtain in-depth information about this type, including its size, subtype, and member variables. When displaying member variables, you can also see their types, their offsets, and their name.

type analysis

Jumping

Clicking on the address of a jump or call instruction will allow you to jump to the address.

jumping

Number conversion

By right clicking on an immediate value, you can convert it to/from decimal (signed and unsigned), hexadecimal, and binary. If the number is less than 128 in unsigned decimal, then it can also be converted to ASCII.

number conversion

Instruction documentation

Hovering over an instruction mnemonic will display a short explaination of what it does. Clicking on an instruction mnemonic will display an in-depth explaination.

short description

full description

File upload

When a file is uploaded, it will be stored on the server for quicker lookup later. These files can also be deleted.

file upload

NOP byte size

NOP operations (which are essentially meaningless) are replaced with the size of the NOP.

NOP byte size

Keyboard shortcuts

Function search

  • Up/down: Navigate through the list of functions
  • Enter: Disassemble the currently selected function
  • ?: Display the help menu

Disassembly

  • Up/down: Navigate through the instructions
  • Right Arrow
    • On jmp/call: Go to target address
    • On ret: Return to the calling function (only available if this function was reached by entering going through a call instruction)
  • Left Arrow
    • Undo previous jump/call (if applicable)
  • Enter: Open the analysis window relevant to this instruction
Analysis window open
  • Shift + up/down: Go up/down the function stack
  • Tab: Cycle through the analysis tabs
  • Escape: Close the analysis window

Bugs

If you find any bugs, please contact [email protected] or [email protected] with as much of the following information as possible:

  • Version of python being run
  • Source code language and version
  • A link to download the executable, along with the name of the function that prodeced the bug.
  • If an error/exception was raised, then the full stack trace of the error/exception.
  • The browser and version of the browser being used.
  • Anything else you think might be relevant.

Contributors

  • Dorothy Chen
  • Dan Harel

License

Copyright 2016 MongoDB Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

disasm's People

Contributors

danharel avatar dorothychen avatar redbeard0531 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

disasm's Issues

AttributeError: 'NoneType' object has no attribute 'iter_symbols'

I installed the current version, but when uploading a 64 bit ELF file (/bin/bash), or any other file, i get the following error:

(disasm) dobin@minime:~/Development/disasm$ python app/app.py
/home/dobin/.virtualenvs/disasm/local/lib/python2.7/site-packages/flask/exthook.py:71: ExtDeprecationWarning: Importing flask.ext.script is deprecated, use flask_script instead.
  .format(x=modname), ExtDeprecationWarning
 * Running on http://127.0.0.1:8000/ (Press CTRL+C to quit)
 * Restarting with stat
...

127.0.0.1 - - [31/Aug/2016 19:42:15] "GET /functions?filename=41999504-6fa2-11e6-9282-a434d9937ce5 HTTP/1.1" 500 -
Traceback (most recent call last):
  File "/home/dobin/.virtualenvs/disasm/lib/python2.7/site-packages/flask/app.py", line 2000, in __call__
    return self.wsgi_app(environ, start_response)
  File "/home/dobin/.virtualenvs/disasm/lib/python2.7/site-packages/flask/app.py", line 1991, in wsgi_app
    response = self.make_response(self.handle_exception(e))
  File "/home/dobin/.virtualenvs/disasm/lib/python2.7/site-packages/flask/app.py", line 1567, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "/home/dobin/.virtualenvs/disasm/lib/python2.7/site-packages/flask/app.py", line 1988, in wsgi_app
    response = self.full_dispatch_request()
  File "/home/dobin/.virtualenvs/disasm/lib/python2.7/site-packages/flask/app.py", line 1641, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/home/dobin/.virtualenvs/disasm/lib/python2.7/site-packages/flask/app.py", line 1544, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/home/dobin/.virtualenvs/disasm/lib/python2.7/site-packages/flask/app.py", line 1639, in full_dispatch_request
    rv = self.dispatch_request()
  File "/home/dobin/.virtualenvs/disasm/lib/python2.7/site-packages/flask/app.py", line 1625, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/home/dobin/Development/disasm/app/app.py", line 237, in functions
    load_functions(filename)
  File "/home/dobin/Development/disasm/app/app.py", line 216, in load_functions
    functions = executables.get(filename).get_all_functions()
  File "/home/dobin/Development/disasm/app/executable.py", line 109, in get_all_functions
    function_syms = self.get_function_syms()
  File "/home/dobin/Development/disasm/app/executable.py", line 131, in get_function_syms
    function_syms = list(filter(lambda sym: sym["st_info"]["type"] == "STT_FUNC", symtab.iter_symbols()))
AttributeError: 'NoneType' object has no attribute 'iter_symbols'
dobin@minime:~$ uname -a
Linux minime 4.4.0-34-generic #53-Ubuntu SMP Wed Jul 27 16:06:39 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
dobin@minime:~$ cat /etc/lsb-release 
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=16.04
DISTRIB_CODENAME=xenial
DISTRIB_DESCRIPTION="Ubuntu 16.04.1 LTS"
dobin@minime:~$ 

Wrong source file path

I build a small program with -g, and set the config.py to look for the source at ../test (I also tried the full path). However, disasm insists my source file is under /usr/include (e.g. it looks for the file /usr/include/test.c, and reports "Sorry, cannot get source code from this path", unless I really put the source file there).

Any fixes or workarounds?

P.S. The executable is built on Ubuntu 14.04 LTS with included GCC 4.8.4. The command line is simply gcc -g .... I also tried CentOS 7, with the same result. disasm itself is run on Ubuntu 14.04 LTS and macOS Sierra.

interesting!

this looks like a fun tool, but currently the description is " No description or website provided. "?

is there any screenshots?

thanks.

".dwarf_info section"

This project looks interesting, and I have managed to make it start working. However, there is no explanation as to how to make ".dwarf_info section be defined" to enable some of the features, nor can I find much information about it via Google (in fact, this project is the top hit when I search).

Would you please clarify? Many thanks.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.