# 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: 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):


import hashlib
import os
import sys
        import settings
from Tools.Bypass.bypass_common import bypass_helpers # pylint: disable=E0611,E0401
from lib.common import helpers # pylint: disable=E0611,E0401
                os.system('mcs -platform:x86 -target:library -r:System.EnterpriseServices,System.Windows.Forms,"/usr/share/powershell/System.Management.Automation.dll" ' + source_code_filepath + ' -out:' + dll_filepath)

                bypass_helpers.title_screen()

                if os.path.isfile(dll_filepath):
                    hash_executable(dll_filepath, file_name)
                    print_payload_information(payload_object)
                    print(" [*] DLL written to: " + helpers.color(dll_filepath))
                else:
                    print(helpers.color(" [!] ERROR: Unable to create output file.", warning=True))
                print(" [*] Source code written to: " + helpers.color(source_code_filepath))
                print(" [*] Execute with: " + helpers.color("C:\Windows\Microsoft.NET\Framework\\v4.0.30319\\regsvcs.exe {0}.dll".format(file_name)))

        elif payload_object.language == 'c':
            if payload_object.required_options['COMPILE_TO_EXE'][0].lower() == 'y':
                # Compile our C code into an executable and pass a compiler flag to prevent it from opening a command prompt when run
                os.system('i686-w64-mingw32-gcc -Wl,-subsystem,windows ' + source_code_filepath + ' -o ' + executable_filepath + " -lwsock32")

                bypass_helpers.title_screen()

                if os.path.isfile(executable_filepath):
                    hash_executable(executable_filepath, file_name)
                    print_payload_information(payload_object)
                    print(" [*] Executable written to: " + helpers.color(executable_filepath))
                else:
                    print(helpers.color(" [!] ERROR: Unable to create output file.", warning=True))
            print(" [*] Source code written to: " + helpers.color(source_code_filepath))
        
        elif payload_object.language == 'mshta':


# 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: 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/outfile.py
import hashlib
import os
import sys
        import settings
from Tools.Bypass.bypass_common import bypass_helpers # pylint: disable=E0611,E0401
from lib.common import helpers # pylint: disable=E0611,E0401

                os.system('mcs -platform:x86 -target:library -r:System.EnterpriseServices,System.Windows.Forms,"/usr/share/powershell/System.Management.Automation.dll" ' + source_code_filepath + ' -out:' + dll_filepath)

                bypass_helpers.title_screen()

                if os.path.isfile(dll_filepath):
                    hash_executable(dll_filepath, file_name)
                    print_payload_information(payload_object)
                    print(" [*] DLL written to: " + helpers.color(dll_filepath))
                else:
                    print(helpers.color(" [!] ERROR: Unable to create output file.", warning=True))
                print(" [*] Source code written to: " + helpers.color(source_code_filepath))
                print(" [*] Execute with: " + helpers.color("C:\Windows\Microsoft.NET\Framework\\v4.0.30319\\regsvcs.exe {0}.dll".format(file_name)))

        elif payload_object.language == 'c':
            if payload_object.required_options['COMPILE_TO_EXE'][0].lower() == 'y':
                # Compile our C code into an executable and pass a compiler flag to prevent it from opening a command prompt when run
                os.system('i686-w64-mingw32-gcc -Wl,-subsystem,windows ' + source_code_filepath + ' -o ' + executable_filepath + " -lwsock32")

                bypass_helpers.title_screen()

                if os.path.isfile(executable_filepath):
                    hash_executable(executable_filepath, file_name)
                    print_payload_information(payload_object)
                    print(" [*] Executable written to: " + helpers.color(executable_filepath))
                else:
                    print(helpers.color(" [!] ERROR: Unable to create output file.", warning=True))
            print(" [*] Source code written to: " + helpers.color(source_code_filepath))
        
        elif payload_object.language == 'mshta':


            bypass_helpers.title_screen()