-
Notifications
You must be signed in to change notification settings - Fork 93
Expand file tree
/
Copy pathdll_encoder.py
More file actions
35 lines (31 loc) · 922 Bytes
/
dll_encoder.py
File metadata and controls
35 lines (31 loc) · 922 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/usr/bin/python
# DLL Encoder - Insecurety Research
# Encodes a DLL as a text file for text_inject.py
# Just does a base64, nothing super exciting...
import sys
print "DLL to Text Encoder - Insecurety Research (2013)"
print "Encodes a DLL as a base64 encoded textfile"
if (len(sys.argv) != 3):
print "Usage: %s <Path To DLL> <Outfile>" %(sys.argv[0])
print "Eg: %s C:\\test\messagebox.dll encoded.txt" %(sys.argv[0])
sys.exit(0)
dll = sys.argv[1]
out = sys.argv[2]
try:
print "[+] Reading DLL..."
f = open(dll, "r")
raw = f.read()
f.close()
except Exception:
print "[-] Something failed... Quitting!"
sys.exit(0)
try:
print "[+] Creating encoded outfile..."
encoded = raw.encode('base64')
g = open(out, "w")
g.write(encoded)
g.close()
except Exception:
print "[-] Something failed... Quitting!"
sys.exit(0)
print "[+] Encoded File Saved As: %s" %(out)