Skip to content

Instantly share code, notes, and snippets.

@gquere
Created Feb 12, 2021
Embed
What would you like to do?
#!/usr/bin/env python3
import sys
import re
import random
import base64
with open(sys.argv[1], "rb") as f:
lines = f.readlines()
obfuscated_lines = b""
for line in lines:
matches = re.findall(b'"[^"]*"', line)
for match in matches:
replace = b'$([Text.Encoding]::UTF8.GetString([Convert]::FromBase64String("' + base64.b64encode(match[1:-1]) + b'")))'
line = line.replace(match, replace)
obfuscated_lines += line
with open(sys.argv[1] + '.obfu', 'wb+') as f:
f.write(obfuscated_lines)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment