pfalcon / ScratchABit

Easily retargetable and hackable interactive disassembler with IDAPython-compatible plugin API
GNU General Public License v3.0
393 stars 47 forks source link

Recommended way to add plugins? #5

Closed projectgus closed 9 years ago

projectgus commented 9 years ago

Hi Paul,

I just wanted to check if this is the recommended way to add a new plugin: http://www.esp8266.com/viewtopic.php?f=13&t=3756&p=22201#p22200

If you let me know the recommended way, I'll submit a PR with an addition to the README about adding plugins.

Cheers,

Angus

pfalcon commented 9 years ago

No, using plugins doesn't require any patching. Plugins should be installed anywhere on Python path, or indeed copied/symlinked to plugins/cpu/ . default_plugins.py is there to map default shipped loaders to default shipped cpu plugins. I don't plan to ship many plugins in distro - besides already existing, capstone is about the only one worth dragging around in the main dsitro. For all other plugins, I hope that community members will manage them (and then if they're posted on PyPI, they can be installed as easily as "pip install idapython-").

So, ability to load ELF directly is essentially a demo feature to let users have a sneak peek with their own executables. It's hardly suitable for real work. For that, there're .def files. README mentions that sample one is provided. It's commented. I don't believe you'd need more than 5 mins to set up one for esp8266 work. But if not, I need feedback what's unclear ;-). (And, well, ok, I just pushed couple of things which were missed).

pfalcon commented 9 years ago

So, to let other people to start easily, you need to provide them a .def file. I don't provide one because, again, I need to make sure they can make it easily themselves ;-). I suggest starting with just .def for bootrom, adding an SDK-linked ELF is of course obvious.

Then, how I envision a community RE project is that there's repo with .def file and (textual) ScratchABit database. People edit stuff, commit, and send PR to coordinator. I plan to implement automatic git commit on save.

Again, why I don't do all that myself is: 1) someone else should get an idea that it's good way to do it, or it's all vain; 2) I already do enough, e.g. with writing ScratchABit itself ;-). I'm ready to process feedback/bugreports for it.

pfalcon commented 9 years ago

P.S. Make sure you use my branch https://github.com/pfalcon/ida-xtensa , or you miss bunch of goodies.

projectgus commented 9 years ago

Thanks for clarifying all that. The commit linked above adds some of what you've just mentioned here to the documentation.

FWIW, for my work (whether or not you consider it "real work"), I'm mostly interested in disassembling ELF files.

I appreciate all your work on scratchabit so far.

pfalcon commented 9 years ago

FWIW, for my work (whether or not you consider it "real work"), I'm mostly interested in disassembling ELF files.

Sure, just ELF will call into bootrom, so you need a .def to load both, and I guess similar situation will be for any "interesting" embedded RE. Compare a .def with how IDA deals with it: you need to go thru series of GUI dialogs, full of confusing options, to define segments and load files.

https://gist.github.com/projectgus/f898d5798e3e44240796

Yes, that's pretty much what I have. If you care, I also have

0x3fffc000-0x3fffffff rw # "system ram"

(And yep, I need to add ability to actually name such section in a .def).

pfalcon commented 9 years ago

Thanks too for trying SAB. When time permits, feel free to browser existing tickets too, in particular https://github.com/pfalcon/ScratchABit/issues/3 needs feedback.

Will merge patch a bit later.