Is there any tool or python library for converting python code to shellcode for specific architecture (ex. x86) and system (ex. Windows Vista)?

For instance I would like to convert:

print "This is sample text"

to something like:


In brief, I need the tool or library that would have similar functionality to msfvenom written in ruby. I tried converting .py to .pyc, then extracting shellcode from it by using py_compile and binascii with hexlify libraries but it was not i wanted. Is it possible to convert python code to shellcode in any way? Maybe is there any compilator to binary of python code?

  • 1
    As you only mention the target OS as example, are you interested in other OSes than Windows – or would "Windows only" be acceptable? If so, py2exe would be an example. The latest downloads on Sourceforge are years old; but the source has at least been updated a year ago. Supports Python 2 and 3. – Izzy Sep 25 '18 at 15:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.