Giter VIP home page Giter VIP logo

pynasm's Introduction

pynasm

python to nasm assembly conversion, with cpu control.

  • x86 64bits only for now.

This allows to create:

  • shellcodes
  • PIC relocatable low-level code
  • infections (for red-teaming)
  • obfuscation

Disclaimer

Don't use this for creating malicious payloads!

Usage

generating a relocatable 64bits code blob

python3 pynasm.py shellcode.py
nasm -f bin shellcode.nasm
ls shellcode

or generating an 64bits exe

python3 pynasm.py program.py exe
nasm -f win64 program.nasm
x86_64-w64-mingw32-ld program.obj
ls a.exe

Emulate with SCEMU for testing

./scemu -f shellcode -vv -6

Demo

https://www.youtube.com/watch?v=o072bXNtxmg

Examples

check the examples folder.

WinapiAcces importing winapi lib

winapi

msgbox

Control blocks

blocks

Comparing strings

python code

emulated binary

API Call

api call

emulation

virtual allocs

emulation

Arrays and memory blobs

arrays

Documentation

https://github.com/sha0coder/pynasm/blob/main/DOCUMENTAITON.md

TODO:

  • modulus with aug assign %=
  • len(s) from a parameter
  • complex ifs and/or
  • elif
  • break
  • continue
  • structures
  • alloc 100 with: padding times 100 db 0x00

pynasm's People

Contributors

sha0coder avatar

Watchers

 avatar

Forkers

gavz

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.