Skip to content

Instantly share code, notes, and snippets.

@enderphan94
Created August 26, 2020 03:57
Show Gist options
  • Save enderphan94/cbd5d08207564fb987ce31a5c027967e to your computer and use it in GitHub Desktop.
Save enderphan94/cbd5d08207564fb987ce31a5c027967e to your computer and use it in GitHub Desktop.
Endode dll file to base64 #dll #dllinjection #base64dll
#!/usr/bin/python
# DLL Encoder - Insecurety Research
import sys
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:\\windows\win32.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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment