-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
490 additions
and
326 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) 2015 g0tmi1k | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,75 @@ | ||
exe2bam | ||
======= | ||
# exe2hex | ||
|
||
Python update of exe2bat that adds PoSh functionality in addition to the legacy bat/debug technique | ||
Inline file transfer method using debug and/or PowerShell. | ||
|
||
More details coming soon; use -h/--help for the time being | ||
- - - | ||
|
||
### Overview | ||
|
||
|
||
Encodes a executable binary file into ASCII text format. | ||
|
||
Restores using `DEBUG.exe` (BATch - x86) and/or PowerShell (PoSh - x86/x64). | ||
|
||
```Binary EXE -> ASCII text -> Binary EXE``` | ||
|
||
- - - | ||
|
||
### Quick usage | ||
|
||
+ Input with `-s` or `-x /path/to/binary.exe` | ||
+ Output with `-b /path/to/debug.bat` and/or `-p powershell.cmd` | ||
|
||
#### Examples | ||
|
||
```bash | ||
$ python exe2hex.py -x /usr/share/windows-binaries/nc.exe -b /var/www/html/nc.txt | ||
[*] exe2hex v1.1 | ||
|
||
[+] Successfully wrote: /var/www/html/nc.txt | ||
$ | ||
``` | ||
|
||
```bash | ||
$ cat /usr/share/windows-binaries/whoami.exe | ./exe2hex.py -s -b who_debug.bat -p who_ps.cmd | ||
[*] exe2hex v1.1 | ||
|
||
[i] Reading from STDIN | ||
[+] Successfully wrote: who_debug.bat | ||
[+] Successfully wrote: who_ps.cmd | ||
$ | ||
``` | ||
|
||
```bash | ||
$ python exe2hex.py -h | ||
[*] exe2hex v1.1 | ||
|
||
Usage: exe2hex.py [options] | ||
|
||
Options: | ||
-h, --help show this help message and exit | ||
-x EXE The EXE binary file to convert | ||
-s Read from STDIN | ||
-b BAT BAT output file (DEBUG.exe method) | ||
-p POSH PoSh output file (PowerShell method) | ||
-e HTML encode the output? | ||
-r TEXT pRefix - text to add before the command | ||
-f TEXT suFfix - text to add after the command | ||
-l INT Maximum hex values per line | ||
-v Enable verbose output | ||
$ | ||
``` | ||
|
||
- - - | ||
|
||
### Methods/OS Support | ||
|
||
+ **`DEBUG.exe` (BATch mode - `-b`)** | ||
+ Useful for legacy versions of Windows. | ||
+ Every version of Windows x86 (No x64 support). | ||
+ Has a limitation of 64k input file size. | ||
+ **PowerShell (PoSh mode - `-p`)** | ||
+ Useful for recent versions of Windows. | ||
+ Supports both Windows x64 & x86. | ||
+ First integrated into core OS with Windows 7/Windows Server 2008 R2. | ||
+ Windows XP SP2, Windows Server 2003 & Windows Vista requires PowerShell to be pre-installed. |
Oops, something went wrong.