|
1 |
| -exe2bam |
2 |
| -======= |
| 1 | +# exe2hex |
3 | 2 |
|
4 |
| -Python update of exe2bat that adds PoSh functionality in addition to the legacy bat/debug technique |
| 3 | +Inline file transfer method using debug and/or PowerShell. |
5 | 4 |
|
6 |
| -More details coming soon; use -h/--help for the time being |
| 5 | +- - - |
| 6 | + |
| 7 | +### Overview |
| 8 | + |
| 9 | + |
| 10 | +Encodes a executable binary file into ASCII text format. |
| 11 | + |
| 12 | +Restores using `DEBUG.exe` (BATch - x86) and/or PowerShell (PoSh - x86/x64). |
| 13 | + |
| 14 | +```Binary EXE -> ASCII text -> Binary EXE``` |
| 15 | + |
| 16 | +- - - |
| 17 | + |
| 18 | +### Quick usage |
| 19 | + |
| 20 | + + Input with `-s` or `-x /path/to/binary.exe` |
| 21 | + + Output with `-b /path/to/debug.bat` and/or `-p powershell.cmd` |
| 22 | + |
| 23 | +#### Examples |
| 24 | + |
| 25 | +```bash |
| 26 | +$ python exe2hex.py -x /usr/share/windows-binaries/nc.exe -b /var/www/html/nc.txt |
| 27 | +[*] exe2hex v1.1 |
| 28 | + |
| 29 | +[+] Successfully wrote: /var/www/html/nc.txt |
| 30 | +$ |
| 31 | +``` |
| 32 | + |
| 33 | +```bash |
| 34 | +$ cat /usr/share/windows-binaries/whoami.exe | ./exe2hex.py -s -b who_debug.bat -p who_ps.cmd |
| 35 | +[*] exe2hex v1.1 |
| 36 | + |
| 37 | +[i] Reading from STDIN |
| 38 | +[+] Successfully wrote: who_debug.bat |
| 39 | +[+] Successfully wrote: who_ps.cmd |
| 40 | +$ |
| 41 | +``` |
| 42 | + |
| 43 | +```bash |
| 44 | +$ python exe2hex.py -h |
| 45 | +[*] exe2hex v1.1 |
| 46 | + |
| 47 | +Usage: exe2hex.py [options] |
| 48 | + |
| 49 | +Options: |
| 50 | + -h, --help show this help message and exit |
| 51 | + -x EXE The EXE binary file to convert |
| 52 | + -s Read from STDIN |
| 53 | + -b BAT BAT output file (DEBUG.exe method) |
| 54 | + -p POSH PoSh output file (PowerShell method) |
| 55 | + -e HTML encode the output? |
| 56 | + -r TEXT pRefix - text to add before the command |
| 57 | + -f TEXT suFfix - text to add after the command |
| 58 | + -l INT Maximum hex values per line |
| 59 | + -v Enable verbose output |
| 60 | +$ |
| 61 | +``` |
| 62 | + |
| 63 | +- - - |
| 64 | + |
| 65 | +### Methods/OS Support |
| 66 | + |
| 67 | ++ **`DEBUG.exe` (BATch mode - `-b`)** |
| 68 | + + Useful for legacy versions of Windows. |
| 69 | + + Every version of Windows x86 (No x64 support). |
| 70 | + + Has a limitation of 64k input file size. |
| 71 | ++ **PowerShell (PoSh mode - `-p`)** |
| 72 | + + Useful for recent versions of Windows. |
| 73 | + + Supports both Windows x64 & x86. |
| 74 | + + First integrated into core OS with Windows 7/Windows Server 2008 R2. |
| 75 | + + Windows XP SP2, Windows Server 2003 & Windows Vista requires PowerShell to be pre-installed. |
0 commit comments