Code Monkey home page Code Monkey logo

deprecated-binaryninja-python's Introduction

Binary Ninja (OBSOLETE PYTHON PROTOTYPE)

This is the Binary Ninja prototype, written in Python. See binary.ninja for information about the current version.

This source code is released under the GPLv2 license. The individual disassembler libraries (which include X86.py, PPC.py, and ARM.py) are released under the MIT license.

Binary Ninja and the Binary Ninja logo are trademarks of Vector 35 LLC.

Running Binary Ninja

Binary Ninja is cross-platform and can run on Linux, Mac OS X, Windows, and FreeBSD. In order to run Binary Ninja, you will need to install a few prerequisites:

You can start Binary Ninja by running binja.py in the Python interpreter.

Windows Step-by-step Instructions

  • Install the latest Python 2.7.
  • In a command-prompt, run:
    cd \Python27\Scripts
    pip install PySide
    easy_install http://www.voidspace.org.uk/downloads/pycrypto26/pycrypto-2.6.win32-py2.7.exe
  • Install SourceTree or GitHub for Windows
  • Clone https://github.com/Vector35/binaryninja-python to a local folder using whichever tool you installed.
  • Run binja.py from the directory you cloned the source code into

deprecated-binaryninja-python's People

Contributors

coldheat avatar d0ntpanic avatar psifertex 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  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

deprecated-binaryninja-python's Issues

Capstone?

Just curious why BinaryNinja has its own disassembler rather than re-using Capstone -- or contributing enhancements when it's insufficient.

Drag & Drop files to open

Dragging files onto different windows/tabs to open them would be a very welcome addition to Binja.

Import ERROR "from PySide.QtCore import *"

Not sure exactly whats the problem here, latest OSX:

$python binja.py
Traceback (most recent call last):
File "binja.py", line 25, in
import Threads
File "/binaryninja-python/Threads.py", line 16, in
from PySide.QtCore import *
ImportError: dlopen(/Library/Python/2.7/site-packages/PySide/QtCore.so, 2): Library not loaded: libpyside-python2.7.1.2.dylib
Referenced from: /Library/Python/2.7/site-packages/PySide/QtCore.so
Reason: image not found

Not sure whether it's Expected Behaviour or not.

Hi sirs,

i've got several questions.
Hope the questions are not too n00bish.

Binary Ninja Version : ??
My setup:

  • Python 2.7
  • Windows 7 64bit

The following are my questions:
1.) Must i open a file before i can use "Python Console" under "Tools" -> "Python Console"?
If the answer is no, it didn't work as expected. The "Python Console" didn't show up if no files are opened. If yes, just ignore this question.

2.) So when i opened a executable and fire up "Python Console" under "Tools" -> "Python Console".
The "Python Console" showed. Then i type "quit()" in the console. Naturally the "Python Console" became "disabled". But i cannot go to "Tools" -> "Python Console" to re-enable it.
I have close the application in order to use "Python Console" again. Not sure this is the expected behaviour.

3.) If i click "Help" -> "About", i can see these keep repeating in the command line.
QPicture: invalid format version 0
libpng warning: Unknown iTXt compression type or method
libpng warning: Unknown iTXt compression type or method
It will only stop printing these once i close the "About" messagebox.

Thanks & Regards
Jacob Soo

Elf Viewer can't display ELF file with only section headers and no program headers

I have an ELF file that was converted from RPL (the Wii U's modified ELF format); when trying to view its information in Elf Viewer, I get a blank screen with the following error in the console:

Traceback (most recent call last):
  File "binja.py", line 803, in setView
    self.focus_tab.widget(self.focus_tab.currentIndex()).setViewType(type)
  File "/home/zhuowei/binaryninja-python/View.py", line 100, in setViewType
    view = self.createView(type)
  File "/home/zhuowei/binaryninja-python/View.py", line 84, in createView
    view = type(self.data, self.filename, self, self.main_area)
  File "/home/zhuowei/binaryninja-python/ElfFile.py", line 507, in __init__
    super(ElfViewer, self).__init__(view.exe, filename, view, parent)
  File "/home/zhuowei/binaryninja-python/HexEditor.py", line 61, in __init__
    self.status = "Cursor: 0x%.8x" % self.data.start()
TypeError: %x format: a number is required, not NoneType

I'm on Ubuntu 14.04 (32-bit) and using the latest version from the master branch.

The readelf output for the ELF file if that helps: https://gist.github.com/zhuowei/45d1eb080bc36dc34237

As one can see, there are no program headers in the file at all (RPLs are loaded through the section headers), so ElfFile.start() can't find a start address from the program headers and will return None.

Crash when opening CFF Explorer.exe

The app crashes when opening "CFF Explorer.exe" or any other executable from NTCore's Explorer Suite.

The error:


Exception in thread Thread-1:
Traceback (most recent call last):
File "D:\Python27\lib\threading.py", line 810, in *bootstrap_inner
self.run()
File "D:\Python27\lib\threading.py", line 763, in run
self.__target(_self.__args, _self.__kwargs)
File "D:\Temp\binaryninja-python-master\DisassemblerView.py", line 175, in ana
lysis_thread_proc
self.analysis.analyze()
File "D:\Temp\binaryninja-python-master\Analysis.py", line 962, in analyze
self.start.findBasicBlocks()
File "D:\Temp\binaryninja-python-master\Analysis.py", line 865, in findBasicBl
ocks
block.populate(known_instrs)
File "D:\Temp\binaryninja-python-master\Analysis.py", line 807, in populate
instr.format_text(self, self.analysis.options)
File "D:\Temp\binaryninja-python-master\Analysis.py", line 142, in format_text
elif (instr.operands[j].size == self.addr_size) and (value >= block.exe.star
t()) and (value < block.exe.end()) and (not self.isLocalJump()):
File "D:\Temp\binaryninja-python-master\BinaryData.py", line 148, in end
return self.start() + len(self)
TypeError: __len
() should return an int


I attach an image of the crash
binjaerror
:

Displayed Instructions Different between Container Formats

f1 = bv.functions[0]
f1b1 = f1.basic_blocks[0]
start = f1b1.start
end = f1b1.end
while start != end:
     x, size = bv.arch.get_instruction_text(bv.read(start, 4), start)
     ins.append(x)
     start += size

print ins results in a nice clean output for Mach-O:

[['push ', 'rbp'],
 ['push ', 'rbp'],
 ['mov  ', 'rbp', ', ', 'rsp'],
 ['push ', 'r15'],
 ['push ', 'r14'],
 ['push ', 'r13'],
 ['push ', 'r12'],
 ['push ', 'rbx'],
 ['sub  ', 'rsp', ', ', '0x38'],
 ['mov  ', 'r13', ', ', 'rsi'],
 ['mov  ', 'r15d', ', ', 'edi'],
 ['mov  ', 'qword ', '[', 'rbp', '-0x38', ']', ', ', '0x0'],
 ['lea  ', 'r12', ', ', '', '[', '0x100001d5a', ']'],
 ['lea  ', 'r14', ', ', '', '[', '0x100001610', ']'],
 ['xor  ', 'ebx', ', ', 'ebx'],
 ['xor  ', 'eax', ', ', 'eax'],
 ['xor  ', 'ecx', ', ', 'ecx'],
 ['mov  ', 'qword ', '[', 'rbp', '-0x58', ']', ', ', 'rcx'],
 ['jmp  ', '0x100001280']]

and for ELF looks like a giant mess:

[['stp', '    ', 'x29', ', ', 'x30', ', ', '[', 'sp', ', #', '-0x10', ']!'], ['adrp', '   ', 'x0', ', ', '0x473000'], ['mov', '    ', 'x29', ', ', 'sp'], ['add', '    ', 'x0', ', ', 'x0', ', ', '#', '0xf50'], ['bl', '     ', '0x448214'], ['bl', '     ', '0x439c28'], ['eor', '    ', 'x7', ', ', 'x0', ', ', 'x1'], ['mov', '    ', 'x10', ', ', '#', '0x101010101010101'], ['tst', '    ', 'x7', ', ', '#', '0x7'], ['b.ne', '   ', '0x428960'], ['eor', '    ', 'x7', ', ', 'x0', ', ', 'x1'], ['mov', '    ', 'x10', ', ', '#', '0x101010101010101'], ['tst', '    ', 'x7', ', ', '#', '0x7'], ['b.ne', '   ', '0x428960']]

Wondering why the difference? Tried a few different basic blocks, same output. note: these are two different binaries, i don't really want to go compile the same binary on both archs right now

Crash when opening....notepad.exe

So...I was installing this on a test linux box and decided to open notepad.exe from Windows 7 64 bit. Here's what I get when opening:

Exception in thread Thread-1:
Traceback (most recent call last):
  File "/usr/lib/python2.7/threading.py", line 810, in __bootstrap_inner
    self.run()
  File "/usr/lib/python2.7/threading.py", line 763, in run
    self.__target(*self.__args, **self.__kwargs)
  File "/home/jlay/Apps/binaryninja-python/DisassemblerView.py", line 175, in analysis_thread_proc
    self.analysis.analyze()
  File "/home/jlay/Apps/binaryninja-python/Analysis.py", line 962, in analyze
    self.start.findBasicBlocks()
  File "/home/jlay/Apps/binaryninja-python/Analysis.py", line 865, in findBasicBlocks
    block.populate(known_instrs)
  File "/home/jlay/Apps/binaryninja-python/Analysis.py", line 807, in populate
    instr.format_text(self, self.analysis.options)
  File "/home/jlay/Apps/binaryninja-python/Analysis.py", line 142, in format_text
    elif (instr.operands[j].size == self.addr_size) and (value >= block.exe.start()) and (value < block.exe.end()) and (not self.isLocalJump()):
  File "/home/jlay/Apps/binaryninja-python/BinaryData.py", line 148, in end
    return self.start() + len(self)
TypeError: __len__() should return an int

Every other file I throw at BinaryNinja works awesome...just...apparently not this one :) I get the same results with Linux or Windows. Thank you.

add menus for missing hotkeys

There are a couple of hotkeys that aren't documented anywhere/visible in the menus (g, for go, p for procedure, potentially others) that should either be added to some docs, menus, or both.

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.