> For the complete documentation index, see [llms.txt](https://refabr1k.gitbook.io/oscp/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://refabr1k.gitbook.io/oscp/exploitation-1/compiling-code.md).

# Compiling

## For Linux

```bash
# Compiling for linux
gcc 643.c -o 643
```

## For Windows

```bash
# Compiling for windows 
i686-w64-mingw32-gcc 646-fixed.c -lws2_32 -o 646.exe

# Compiling fail with error "error while loading shared libraries: requires glibc 2.5 or later dynamic linker"
gcc -m32 -Wl,--hash-style=both exploit.c -o exploit
```

## Convert EXE to PY

```bash
# Install pyinstaller of windows with wine on Kali 
wine ~/.wine/drive_c/Python27/Scripts/pyinstaller.exe --onefile 18176.py

# run installer located under the same directory as Python scripts and convert exe to py
pyinstaller 
wine ~/.wine/drive_c/Python27/Scripts/pyinstaller.exe --onefile HelloWorld.py
```
