<s> import random <EOL> import string <EOL> import re <EOL> from base64 import b64encode <EOL> from termcolor import colored <EOL> def gen_random_string ( length = <NUM_LIT:10> ) : <EOL> return '<STR_LIT>' . join ( random . sample ( string . ascii_letters , int ( length ) ) ) <EOL> def validate_ntlm ( data ) : <EOL> allowed = re . compile ( "<STR_LIT>" , re . IGNORECASE ) <EOL> if allowed . match ( data ) : <EOL> return True <EOL> else : <EOL> return False <EOL> def obfs_ps_script ( script , function_name = None ) : <EOL> """<STR_LIT>""" <EOL> if function_name : <EOL> function_line = script . split ( '<STR_LIT:\n>' , <NUM_LIT:1> ) [ <NUM_LIT:0> ] <EOL> if function_line . find ( '<STR_LIT>' ) != - <NUM_LIT:1> : <EOL> script = re . sub ( '<STR_LIT>' , '<STR_LIT>' . format ( function_name ) , script , count = <NUM_LIT:1> ) <EOL> strippedCode = re . sub ( re . compile ( '<STR_LIT>' , re . DOTALL ) , '<STR_LIT>' , script ) <EOL> strippedCode = "<STR_LIT:\n>" . join ( [ line for line in strippedCode . split ( '<STR_LIT:\n>' ) if ( ( line . strip ( ) != '<STR_LIT>' ) and ( not line . strip ( ) . startswith ( "<STR_LIT:#>" ) ) and ( not line . strip ( ) . lower ( ) . startswith ( "<STR_LIT>" ) ) and ( not line . strip ( ) . lower ( ) . startswith ( "<STR_LIT>" ) ) ) ] ) <EOL> return strippedCode <EOL> def create_ps_command ( ps_command , force_ps32 = False ) : <EOL> ps_command = "<STR_LIT>" + ps_command <EOL> if force_ps32 : <EOL> command = '<STR_LIT>' . format ( b64encode ( ps_command . encode ( '<STR_LIT>' ) ) ) <EOL> elif not force_ps32 : <EOL> command = '<STR_LIT>' . format ( b64encode ( ps_command . encode ( '<STR_LIT>' ) ) ) <EOL> return command <EOL> def highlight ( text , color = '<STR_LIT>' ) : <EOL> if color == '<STR_LIT>' : <EOL> return u'<STR_LIT:{}>' . format ( colored ( text , '<STR_LIT>' , attrs = [ '<STR_LIT>' ] ) ) <EOL> elif color == '<STR_LIT>' : <EOL> return u'<STR_LIT:{}>' . format ( colored ( text , '<STR_LIT>' , attrs = [ '<STR_LIT>' ] ) ) </s>
