Skip to content

Commit 4f4277e

Browse files
committed
exe2hex v1.1
1 parent 2b83aae commit 4f4277e

File tree

4 files changed

+490
-326
lines changed

4 files changed

+490
-326
lines changed

LICENSE

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2015 g0tmi1k
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.
22+

README.md

+73-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,75 @@
1-
exe2bam
2-
=======
1+
# exe2hex
32

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.
54

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

Comments
 (0)