edb-debugger icon indicating copy to clipboard operation
edb-debugger copied to clipboard

Python scripting

Open eteran opened this issue 7 years ago • 8 comments

I'd like to have a plugin which can run a user supplied python script. The scripts don't need to have access to the entire edb plugin API. We can probably get away with (for starters):

get/set register state, read/write memory, list of memory regions, maybe a PyQt reference to the MainWindow

which would allow some basic analysis from any scripts, and do some possible integration with the GUI. From there, we can make the python code gain features that the normal plugin API has on a piecemeal basis.


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

eteran avatar Dec 14 '16 02:12 eteran

I like this idea! I think we should embrace the future and support Python3 only.

Another option is to have some sort of IPC server which can do request/responses to edb, then users can script it however they want, and we can provide 'official' libs. Although that sounds suspiciously like gdbserver.

AaronOpfer avatar Dec 14 '16 02:12 AaronOpfer

Yea, I'm fine with going Python3 only. If someone REALLY wants Python2 support, they are free to hack that into the plugin. I honestly think the difference will be almost entirely in what version of libpyton we compile against.

Adding general remote control to edb is also interesting, I think that if we wanted to this, Qt's implementation of DBUS may be the way to do it, I'm not 100% sure though. For now, I think a simply scripting plugin will do, and we'll see about a more generalized approach sometime in the future.

eteran avatar Dec 14 '16 02:12 eteran

It looks like we would need to use Python Stable ABI. If we do that then we should be able to make our binaries happy with a system libpython or a conda environment python.

AaronOpfer avatar Dec 15 '16 02:12 AaronOpfer

I'm working on this feature: https://github.com/owerosu/edb-debugger/tree/python-plugin For now, there is a skeleton that allows to execute python commands and exports two APIs from edb. screenshot_2019-02-03_23-09-32

owerosu avatar Feb 03 '19 22:02 owerosu

This is fantastic progress! Thanks for the effort!

eteran avatar Feb 03 '19 22:02 eteran

Looking forward to this. I was interested in writing an angr target for edb but the scripting interface is a must. It would allow using edb to debug/step through the code concretely but then use angr for some analysis.

sraboy avatar Apr 02 '19 10:04 sraboy

Sorry for stalling progress, I don't have much time these days Any help would be appreciated btw :)

owerosu avatar Apr 10 '19 18:04 owerosu

No worries! I completely understand how much of a time commitment open source can be. Take your time, I'll help as much as I can. Also, don't feel like it has to cover the entire API 100% completely to be worth a PR. Maybe get just the basic functionality (read registers, read memory) and once that's in, I can expand on it too.

But really, no rush beyond people just thinking it'll be awesome when it comes :-)

eteran avatar Apr 10 '19 23:04 eteran