vector35 / deprecated_python_debugger Goto Github PK
View Code? Open in Web Editor NEWBinary Ninja Debugger Plugin
License: MIT License
Binary Ninja Debugger Plugin
License: MIT License
This means that if your adapter cannot connect, the debugger state will be left with a nonworking adapter and no way to exit it. We need to set adapter to None on exception.
Setting rsp to 0x10 will throw a ValueError as the stack view tries to read negative addresses.
In dockwidgets/StackWidget.py:116
you have
old_val = info['value']
new_val = int(value, 16) # <------
address = info['address']
# Tell the debugger to update
adapter = binjaplug.get_state(self.bv).adapter
adapter.mem_write(address, new_val) # <------
but adapter.mem_write
expects bytes
and not an int
resulting in the crash.
Also you could check if old_val == new_val
to avoid doing the write if the value didn't actually change. In my use case, I was just copying the value for example.
Each of the widgets need to be dynamically populated with current state from the debugger
Currently there are some cases where two threads send messages to the adapter at the same time. This causes race conditions when the adapter returns data. There are a few solutions to this:
Currently these are printed to sys.stderr and any errors they send are lost.
Should be able to examine memory at arbitrary addresses. It would probably make sense for this to be a LinearView. Potential feature: follow register (i.e. each time the debugger stops navigate to rax
)
See title
I noticed here that you are initializing a COM interface inside of DllMain
, which is likely to cause issues and is not good practice.
https://docs.microsoft.com/en-us/windows/win32/dlls/dllmain says:
There are significant limits on what you can safely do in a DLL entry point. See General Best Practices for specific Windows APIs that are unsafe to call in DllMain. If you need anything but the simplest initialization then do that in an initialization function for the DLL. You can require applications to call the initialization function after DllMain has run and before they call any other functions in the DLL.
See https://docs.microsoft.com/en-us/windows/win32/dlls/dynamic-link-library-best-practices for more information about the potential issues.
add setting that will automatically add register states (maybe stack for function entry/exit?) as ephemeral comments. Blocking on Vector35/binaryninja-api#1532
Can only switch in STOPPED state right now, seems to be a UI limitation.
If the analyzed file does not exist on disk, dump the saved binary in our analysis so we can still debug it
re: Vector35/binaryninja-api#1527 we need to re-arrange the import order to fix an annoying py3.8.1 issue.
Related to #21, currently the debug view does not respond when the user tries to navigate to functions. Need some way to determine if they are navigating to code (show in the left view) or local data (linear view in the left view?) or memory (show in the right view).
Also need to figure out how history works
Not sure if linux specific or not, but with current dev and latest debugger master:
Traceback (most recent call last):
File "/home/williamg/binaryninja/plugins/../python/binaryninja/plugin.py", line 144, in _default_action
action(view_obj)
TypeError: cb_bp_set() missing 1 required positional argument: 'local_address'
File "/Applications/Binary Ninja-dev.app/Contents/MacOS/plugins/../../Resources/python/binaryninja/plugin.py", line 227, in _default_is_valid
return is_valid(view_obj)
File "/Users/jwiens/Library/Application Support/Binary Ninja/plugins/debugger/ui.py", line 248, in require_adapter
debug_state = binjaplug.get_state(bv)
File "/Users/jwiens/Library/Application Support/Binary Ninja/plugins/debugger/binjaplug.py", line 31, in get_state
state = DebuggerState(bv)
File "/Users/jwiens/Library/Application Support/Binary Ninja/plugins/debugger/binjaplug.py", line 115, in __init__
self.memory_view = ProcessView.DebugProcessView(bv)
File "/Users/jwiens/Library/Application Support/Binary Ninja/plugins/debugger/ProcessView.py", line 26, in __init__
length = self.memory.perform_get_length()
File "/Users/jwiens/Library/Application Support/Binary Ninja/plugins/debugger/ProcessView.py", line 134, in perform_get_length
return (2 ** (self.perform_get_address_size() * 8)) - 1
File "/Users/jwiens/Library/Application Support/Binary Ninja/plugins/debugger/ProcessView.py", line 126, in perform_get_address_size
return self.parent_view.arch.address_size
AttributeError: 'NoneType' object has no attribute 'address_size'
Currently, if a user does not have lldb installed, the debugger will throw lots of exceptions. To better handle this, we should:
We need a way to view mapped regions of memory. Essentially /proc/<pid>/maps
At least on x86_64, I cannot set r10-r15, cs, fs, or any of the eax, ebx, etc registers.
Sometimes rip/rflags/gs are writable and sometimes not.
I would at least expect r10-r15 to be writable. rip/rflags/fs/gs potentially could be. cs is fine being immutable.
Environment: macOS + lldb
Need a mechanism to send data to the stdin of the running process
Simple buttons to
When stepping, if the user is in LLIL or MLIL view, add a setting so that the debugger can step over optimized-away disassembly and just step between each LLIL/MLIL instruction, similar to "source mode" in WinDbg
Two important features we plan:
set_user_indirect_branches
When code is being executed outside the current BinaryView (or inside but not at a code aligned address) the raw disassembly view will be shown.
Currently all debugger configuration is cleared on reload. Here is a tentative list of data we need to save:
If Xcode is installed, but the command-line utilities have not been, then the expected path for debugserver is not valid. We need to prompt the user to install the command-line utilities with xcode-select --install
Needs testing
List active threads. Double click to navigate to the location the clicked thread is at. Right-click to follow that thread.
Already have the svgs, just need to integrate them
And tag a release
Bug where the debugger doesn't let you run it form the Tools>Debugger>Process>Run, you must go to the View>Debugger first.
This is on Windows 10. Tried it with both Python 3.7 and 3.8 with the same results.
It also freezes randomly with some binaries and gets an "Exception: Cannot resolve relative address:" with others.
Needs the following features:
The function binaryninja.binaryview.BinaryView.get_functions_containing in version 1.2 (tested on 1.2.1921) returns None in some cases and thus breaks the debugger's UI.update_highlights function:
Traceback (most recent call last):
File "/Applications/Binary Ninja.app/Contents/MacOS/plugins/../../Resources/python/binaryninja/plugin.py", line 227, in _default_is_valid
return is_valid(view_obj)
File "/Users/someuser/Library/Application Support/Binary Ninja/repositories/official/plugins/Vector35_debugger/ui.py", line 601, in valid_control_pause
debug_state = binjaplug.get_state(bv)
File "/Users/someuser/Library/Application Support/Binary Ninja/repositories/official/plugins/Vector35_debugger/binjaplug.py", line 35, in get_state
state = DebuggerState(bv)
File "/Users/someuser/Library/Application Support/Binary Ninja/repositories/official/plugins/Vector35_debugger/binjaplug.py", line 409, in init
self.ui = ui.DebuggerUI(self)
File "/Users/someuser/Library/Application Support/Binary Ninja/repositories/official/plugins/Vector35_debugger/ui.py", line 37, in init
self.update_highlights()
File "/Users/someuser/Library/Application Support/Binary Ninja/repositories/official/plugins/Vector35_debugger/ui.py", line 315, in update_highlights
for func in self.state.bv.get_functions_containing(self.last_ip):
TypeError: 'NoneType' object is not iterable
Potential fix for older versions is verify that the returned value is not None.
I intentionally tried to crash the running program, and instead of telling me anything, it just keeps trying to resume when I step or resume, rather than alerting me that the program has crashed
The current method uses a read of /proc//maps which won't work on remote targets.
This also prevents finding the location of the module being debugged and resolving ASLR'd addresses.
Currently the breakpoint tags are piggybacking off the default "Crashes" tag type. We should instead create our own tag type and create tags for it. Also may want to investigate alternate tags when we have additional line-data (eg as in #36)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.