> For the complete documentation index, see [llms.txt](https://davidtancredi.gitbook.io/pentesting-notes/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://davidtancredi.gitbook.io/pentesting-notes/r3dcl1ff/privesc/file-transfers/windows-file-transfers/exe2hex.md).

# exe2hex

Compress the binary to transfer, convert it to a hex string, and embed it into a Windows script.

**Copy nc.exe to the current directory**

```
locate nc.exe | grep binaries
cp /usr/share/windows-resources/binaries/nc.exe .
```

**Use the executable packer upx to compress nc.exe**

```
upx -9 nc.exe
```

Convert the compressed file into a windows script that will convert the file to hex and reassemble it in binary form using powershell

```
exe2hex -x nc.exe -p nc.cmd
```

**Paste the output directly into Windows remote shell to reassemble nc.exe**
