https://github.com/sha0coder/pynasm
Python to nasm compilation
https://github.com/sha0coder/pynasm
Last synced: 6 months ago
JSON representation
Python to nasm compilation
- Host: GitHub
- URL: https://github.com/sha0coder/pynasm
- Owner: sha0coder
- Created: 2024-03-06T09:10:11.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2025-01-22T18:57:27.000Z (11 months ago)
- Last Synced: 2025-03-27T22:51:08.638Z (9 months ago)
- Language: Python
- Size: 4.93 MB
- Stars: 0
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 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
```bash
python3 pynasm.py shellcode.py
nasm -f bin shellcode.nasm
ls shellcode
```
or generating an 64bits exe
```hash
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
```bash
./scemu -f shellcode -vv -6
```
## Demo
https://www.youtube.com/watch?v=o072bXNtxmg
## Examples
check the examples folder.
### WinapiAcces importing winapi lib


### Control blocks

### Comparing strings


### API Call




### Arrays and memory blobs

## 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