Created
February 12, 2021 11:56
-
-
Save gquere/10d4b8275e569fa1e66b7c9411ab1785 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#!/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