Created
August 3, 2017 12:33
-
-
Save srozb/de8a585a08dbe2dbe3adbe8eb517ec02 to your computer and use it in GitHub Desktop.
deobfuscate one of trickbot js downloaders
This file contains 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 python | |
import sys | |
import re | |
from base64 import b64decode | |
f = open(sys.argv[1], 'r') | |
buf = f.read() | |
var_pattern = """['"][a-zA-Z0-9=/]+['"]""" | |
def decode(base_sf): | |
base_sf = base_sf.strip('"') | |
base_sf = base_sf.strip("'") | |
base_sf = base_sf.replace("ZZZ", "") | |
base_sf = base_sf.replace("RPOJECTS", "") | |
if len(base_sf) > 3: | |
try: | |
dec = b64decode(base_sf) | |
print("DECODED({}):\n -> {}".format(base_sf, dec)) | |
except: | |
print("NOT DECODED: {}".format(base_sf)) | |
matches = re.findall(var_pattern, buf) | |
for base_sf in matches: | |
decode(base_sf) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment