CorePy: Assembly Programming in Python
We've got something similar in Ruby (we're not the first, and ours is nowhere nearly as mature as CorePy). We use it for building ad-hoc debuggers for reversing targets that don't support native debugging and tracing interfaces.
Ruby is an excellent language for this, because it gets out of the way. Here's a Rasm snippet:
Obviously, that's all pure Ruby.@epilog ||= @prog.add { push ebx mov ebx, retv mov [ebx], eax pop ebx xor eax, eax ret }Once you have a class mapping for each of the instructions in your target ISA --- way easier than it sounds --- getting your code to jump into a runtime generated buffer is pretty easy.
We're starting to throw code onto Github; I've been thinking about publishing this, but didn't think it would be very interesting, except as a hack.
> "CorePy makes assembly fun again!" (Alex Breuer)
This is great because it allows you to create algorithms at runtime for your data.
So rather than doing...
def doit(option1, data): for x in data: if option1: x += 7
You can create a function that doesn't include the "if option1" part. This is great if you have many different options... and instead of bloating your code for many different optimized function, or one slower generic function, you can create the optimized functions at run time.
Looks very nice. I just wish it had support for 3dnow, and windows :)
i would have liked to see llvm bindings to python... i am sure they are out there...
any body benchmarked the performance of CorePy?
Wow. So cool.
Thanks for this news.