Git Product home page Git Product logo

andreafioraldi / idangr Goto Github PK

View Code? Open in Web Editor NEW
265.0 18.0 32.0 30.87 MB

Use angr in the IDA Pro debugger generating a state from the current debug session

Home Page: https://andreafioraldi.github.io/IDAngr/

License: BSD 2-Clause "Simplified" License

Python 99.29% Makefile 0.64% Shell 0.07%
angr ida-pro ida-plugin symbolic-execution debugger idapython ida plugin symbolic execution

idangr's Introduction

IDAngr

Use angr in the IDA Pro debugger generating a state from the current debug session.

it works only with x86/x86_64 ELF binaries on linux at the moment

IDAngr needs angrdbg installed in the same machine of IDA or in a remote machine.

python2 -m pip install angrdbg

IDAngr can run only with angr 7 at the moment because IDAPython is only Python 2.

GUI

The idangr_gui.py script must be loaded during the debug.

IDAngr adds a panel with a self explanatory interface.

You can set find/avoid addresses and symbolic memory directly from the context menu in the IDA View.

Explore other useful context menus in the panel with the rigth-click on items.

youtube_img

Plugin

You can install indagr as a plugin (see INSTALL.md), to activate it press Ctrl+Alt+I.

Api

IDAngr implements the angrdbg api in the IDA debugger.

Use idangr.init(is_remote=False, host=None, port=None, use_pin=False) to setup the library environment and access to the angrdbg api at the beginning of everything. When is_remote is True the plugin will connect to a remote angrdbg server (start it on the remote machine using python -m angrdbg). You must set use_pin to True if you are connected to Intel Pin with a PinTool compatible with IDAngr (this problably does not work when using remote angrdbg).

idangr.is_initialized() can be used in a script to check if init must be called or not.

StateShot

Return an angr state from the current debug session state.

StateManager

A wrapper around angr to simplify the symbolic values creation and to write the results back in the debugger when angr founds a valid path.

Methods
  • instance.sim(key, size) create a symbolic value on a register or on a memory address (size is optional)
  • instance[key] get a register or a memory value
  • instance.simulation_manager() create an angr simulation manager based on the state
  • instance.to_dbg(found_state) transfer to the debugger state the evaluated value of the symbolic value created before with sim

note: memory values are the same that are returned by state.mem[addr]

A more detailed description of the Api can be found in the angrdbg repo and in my Bachelor thesis.

hook_lib_funcs

Try to hook functions that are recognized by IDA as inserted by the compiler to the corrispondent simprocedure if present.

Example

Python>sm = StateManager()
Python>sm.sim("edi")
Python>sm.sim("esi")
Python>m = sm.simulation_manager()
Python>m.explore(avoid=0x04005D5, find=0x00004005BC)
<SimulationManager with 1 found, 3 avoid>
Python>idc.GetRegValue("edi")
0
Python>idc.GetRegValue("esi")
5
Python>sm.to_dbg(m.found[0])
Python>idc.GetRegValue("edi")
2
Python>idc.GetRegValue("esi")
0

See examples folder.

Other Debuggers

If you want to use angr in other debuggers looks at angrdbg

I'va also made an almost equal plugin for GDB: angrgdb

TODO

  • add support to angr data dependence graph integration in the ida view
  • add an iphyton shell to manually change the value in the gui
  • add a taint engine based on intel pin

Cite

Thesis PDF.

Bibtex:

@misc{fioraldi2020symbolic,
    title={Symbolic Execution and Debugging Synchronization},
    author={Andrea Fioraldi},
    year={2020},
    eprint={2006.16601},
    archivePrefix={arXiv},
    primaryClass={cs.CR}
}

idangr's People

Contributors

andreafioraldi 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

idangr's Issues

object of type 'NoneType' has no len()

HI! I used version of Ida angr, and a set of required packages (https://github.com/andreafioraldi/angr-win64-wheels) of 22 may, and have never experienced any problems. Today, 07.20 I updated both a set of packages and ida angr then I had such problem:.
screenshot 137

If I try to use an old version (may 22) of IDA angr with new pre-compiled packages I get this error:

Traceback (most recent call last):
File "C:/Program Files/IDA 7.0/MyScripts/IDAngr\idangr\gui.py", line 405, in runClicked
sm.explore(find=conds[0], avoid=conds[1])
File "C:\Python27\lib\site-packages\angr\misc\immutability.py", line 24, in _wrapper
if method(self, *args, **kwargs) is not self:
File "C:\Python27\lib\site-packages\angr\sim_manager.py", line 238, in explore
self.run(stash=stash, n=n, **kwargs)
File "C:\Python27\lib\site-packages\angr\misc\immutability.py", line 24, in _wrapper
if method(self, *args, **kwargs) is not self:
File "C:\Python27\lib\site-packages\angr\sim_manager.py", line 260, in run
self.step(stash=stash, **kwargs)
File "C:\Python27\lib\site-packages\angr\misc\hookset.py", line 57, in call
result = next_hook(self.func.im_self, *args, **kwargs)
File "C:\Python27\lib\site-packages\angr\exploration_techniques\explorer.py", line 101, in step
return simgr.step(stash=stash, extra_stop_points=base_extra_stop_points | self._extra_stop_points, **kwargs)
File "C:\Python27\lib\site-packages\angr\misc\hookset.py", line 60, in call
result = self.func(*args, **kwargs)
File "C:\Python27\lib\site-packages\angr\misc\immutability.py", line 24, in _wrapper
if method(self, *args, **kwargs) is not self:
File "C:\Python27\lib\site-packages\angr\sim_manager.py", line 341, in step
successors = self.step_state(state, successor_func, **run_args)
File "C:\Python27\lib\site-packages\angr\sim_manager.py", line 362, in step_state
successors = self.successors(state, successor_func, **run_args)
File "C:\Python27\lib\site-packages\angr\sim_manager.py", line 401, in successors
return self._project.factory.successors(state, **run_args)
File "C:\Python27\lib\site-packages\angr\factory.py", line 61, in successors
return self.project.engines.successors(*args, **kwargs)
File "C:\Python27\lib\site-packages\angr\engines\hub.py", line 128, in successors
r = engine.process(state, **kwargs)
File "C:\Python27\lib\site-packages\angr\engines\vex\engine.py", line 135, in process
opt_level=opt_level)
File "C:\Python27\lib\site-packages\angr\engines\engine.py", line 35, in process
new_state = state.copy()
File "C:\Python27\lib\site-packages\angr\sim_state.py", line 440, in copy
c_plugins = self._copy_plugins()
File "C:\Python27\lib\site-packages\angr\sim_state.py", line 427, in _copy_plugins
out[n] = p.copy(memo)
TypeError: copy() takes exactly 1 argument (2 given)

Is there anything you can do about it? Or how I can roll back the version. The only problem is that I could not find the old versions of the compiled packages (https://github.com/andreafioraldi/angr-win64-wheels) under windows...
P.S. Im using IDA Version 7.0.170914 under Windows 10 x64

Error : IDA 7.0 cannot save

When i trying to save all my constrains in AngrIDA, got this problem

Traceback (most recent call last):
File "C:/Program Files/IDA 7.0/plugins\idangr\main_gui.py", line 649, in save_clicked
save_ctx(filename)
File "C:/Program Files/IDA 7.0/plugins\idangr\main_gui.py", line 47, in save_ctx
pickle.dump(_idangr_ctx, fh)
File "C:\python27-x64\Lib\pickle.py", line 1376, in dump
Pickler(file, protocol).dump(obj)
File "C:\python27-x64\Lib\pickle.py", line 224, in dump
self.save(obj)
File "C:\python27-x64\Lib\pickle.py", line 331, in save
self.save_reduce(obj=obj, *rv)
File "C:\python27-x64\Lib\pickle.py", line 425, in save_reduce
save(state)
File "C:\python27-x64\Lib\pickle.py", line 286, in save
f(self, obj) # Call unbound method with explicit self
File "C:\python27-x64\Lib\pickle.py", line 655, in save_dict
self._batch_setitems(obj.iteritems())
File "C:\python27-x64\Lib\pickle.py", line 669, in _batch_setitems
save(v)
File "C:\python27-x64\Lib\pickle.py", line 331, in save
self.save_reduce(obj=obj, *rv)
File "C:\python27-x64\Lib\pickle.py", line 401, in save_reduce
save(args)
File "C:\python27-x64\Lib\pickle.py", line 286, in save
f(self, obj) # Call unbound method with explicit self
File "C:\python27-x64\Lib\pickle.py", line 568, in save_tuple
save(element)
File "C:\python27-x64\Lib\pickle.py", line 286, in save
f(self, obj) # Call unbound method with explicit self
File "C:\python27-x64\Lib\pickle.py", line 655, in save_dict
self._batch_setitems(obj.iteritems())
File "C:\python27-x64\Lib\pickle.py", line 669, in _batch_setitems
save(v)
File "C:\python27-x64\Lib\pickle.py", line 331, in save
self.save_reduce(obj=obj, *rv)
File "C:\python27-x64\Lib\pickle.py", line 422, in save_reduce
self._batch_setitems(dictitems)
File "C:\python27-x64\Lib\pickle.py", line 669, in _batch_setitems
save(v)
File "C:\python27-x64\Lib\pickle.py", line 286, in save
f(self, obj) # Call unbound method with explicit self
File "C:\python27-x64\Lib\pickle.py", line 606, in save_list
self._batch_appends(iter(obj))
File "C:\python27-x64\Lib\pickle.py", line 621, in _batch_appends
save(x)
File "C:\python27-x64\Lib\pickle.py", line 331, in save
self.save_reduce(obj=obj, *rv)
File "C:\python27-x64\Lib\pickle.py", line 401, in save_reduce
save(args)
File "C:\python27-x64\Lib\pickle.py", line 286, in save
f(self, obj) # Call unbound method with explicit self
File "C:\python27-x64\Lib\pickle.py", line 568, in save_tuple
save(element)
File "C:\python27-x64\Lib\pickle.py", line 286, in save
f(self, obj) # Call unbound method with explicit self
File "C:\python27-x64\Lib\pickle.py", line 655, in save_dict
self._batch_setitems(obj.iteritems())
File "C:\python27-x64\Lib\pickle.py", line 669, in _batch_setitems
save(v)
File "C:\python27-x64\Lib\pickle.py", line 331, in save
self.save_reduce(obj=obj, *rv)
File "C:\python27-x64\Lib\pickle.py", line 425, in save_reduce
save(state)
File "C:\python27-x64\Lib\pickle.py", line 286, in save
f(self, obj) # Call unbound method with explicit self
File "C:\python27-x64\Lib\pickle.py", line 655, in save_dict
self._batch_setitems(obj.iteritems())
File "C:\python27-x64\Lib\pickle.py", line 669, in _batch_setitems
save(v)
File "C:\python27-x64\Lib\pickle.py", line 331, in save
self.save_reduce(obj=obj, *rv)
File "C:\python27-x64\Lib\pickle.py", line 425, in save_reduce
save(state)
File "C:\python27-x64\Lib\pickle.py", line 286, in save
f(self, obj) # Call unbound method with explicit self
File "C:\python27-x64\Lib\pickle.py", line 655, in save_dict
self._batch_setitems(obj.iteritems())
File "C:\python27-x64\Lib\pickle.py", line 669, in _batch_setitems
save(v)
File "C:\python27-x64\Lib\pickle.py", line 331, in save
self.save_reduce(obj=obj, *rv)
File "C:\python27-x64\Lib\pickle.py", line 425, in save_reduce
save(state)
File "C:\python27-x64\Lib\pickle.py", line 286, in save
f(self, obj) # Call unbound method with explicit self
File "C:\python27-x64\Lib\pickle.py", line 655, in save_dict
self._batch_setitems(obj.iteritems())
File "C:\python27-x64\Lib\pickle.py", line 669, in _batch_setitems
save(v)
File "C:\python27-x64\Lib\pickle.py", line 331, in save
self.save_reduce(obj=obj, *rv)
File "C:\python27-x64\Lib\pickle.py", line 425, in save_reduce
save(state)
File "C:\python27-x64\Lib\pickle.py", line 286, in save
f(self, obj) # Call unbound method with explicit self
File "C:\python27-x64\Lib\pickle.py", line 655, in save_dict
self._batch_setitems(obj.iteritems())
File "C:\python27-x64\Lib\pickle.py", line 669, in _batch_setitems
save(v)
File "C:\python27-x64\Lib\pickle.py", line 286, in save
f(self, obj) # Call unbound method with explicit self
File "C:\python27-x64\Lib\pickle.py", line 606, in save_list
self._batch_appends(iter(obj))
File "C:\python27-x64\Lib\pickle.py", line 621, in _batch_appends
save(x)
File "C:\python27-x64\Lib\pickle.py", line 306, in save
rv = reduce(self.proto)
File "C:\python27-x64\Lib\copy_reg.py", line 84, in _reduce_ex
dict = getstate()
File "C:\python27-x64\lib\site-packages\cle\backends\elf\elf.py", line 386, in getstate
raise ValueError("Can't pickle an object loaded from a stream")
ValueError: Can't pickle an object loaded from a stream

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.