#!/usr/bin/python3
# encoding: utf-8

import os
import sys
import getopt
import logging
import shutil
import psutil
from modules.com_run import ComGenerator
from modules.web_server import ListenServer
from modules.Wlisten_server import WListenServer
from modules.payload_builder_factory import PayloadBuilderFactory
from common import utils, mp_session, help
from common.utils import MSTypes
from common.definitions import VERSION, LOGLEVEL
if sys.platform == "win32":
    try:
        import win32com.client #@UnresolvedImport @UnusedImport
    except:
        print("Error: Could not find win32com.")
        sys.exit(1)
MP_TYPE="Pro"
if utils.checkModuleExist("pro_core"):
    from pro_modules.utilities.dcom_run import DcomGenerator
    from pro_modules.payload_builders.containers import ContainerGenerator
    from pro_core.payload_builder_factory_pro import PayloadBuilderFactoryPro
    from pro_core import arg_mgt_pro, mp_session_pro
else:
    MP_TYPE="Community"

from colorama import init
from termcolor import colored

# {PyArmor Protection Code}
# {PyArmor Plugins}
# use Colorama to make Termcolor work on Windows too
init()



WORKING_DIR = "temp"

BANNER = help.getToolPres()


def main(argv):
    global MP_TYPE
    logLevel = LOGLEVEL
    # initialize macro_pack session object
    working_directory = os.path.join(os.getcwd(), WORKING_DIR)
    if MP_TYPE == "Pro":
        mpSession = mp_session_pro.MpSessionPro(working_directory, VERSION, MP_TYPE)
    else:
        mpSession = mp_session.MpSession(working_directory, VERSION, MP_TYPE)

    try:
        longOptions = ["embed=", "listen=", "port=", "webdav-listen=", "generate=", "quiet", "input-file=", "encode",
                       "obfuscate", "obfuscate-form", "obfuscate-names", "obfuscate-declares", "obfuscate-strings",
                       "obfuscate-names-charset=", "obfuscate-names-minlen=", "obfuscate-names-maxlen=",
                       "file=","template=","listtemplates","listformats","icon=", "start-function=","uac-bypass",
                       "unicode-rtlo=", "dde", "print", "force-yes", "help"]
        shortOptions= "e:l:w:s:f:t:G:hqmop"
        # only for Pro release
        if MP_TYPE == "Pro":
            longOptions.extend(arg_mgt_pro.proArgsLongOptions)
            shortOptions += arg_mgt_pro.proArgsShortOptions
        # Only enabled on windows
        if sys.platform == "win32":
            longOptions.extend(["run=", "run-visible"])

        opts, args = getopt.getopt(argv, shortOptions, longOptions) # @UnusedVariable
    except getopt.GetoptError:
        help.printUsage(BANNER, sys.argv[0])
        sys.exit(2)
    for opt, arg in opts:
        if opt in ("-o", "--obfuscate"):
            mpSession.obfuscateForm =  True
            mpSession.obfuscateNames =  True
            mpSession.obfuscateStrings =  True
            mpSession.obfuscateDeclares = True
        elif opt=="--obfuscate-form":
            mpSession.obfuscateForm =  True
        elif opt=="--obfuscate-declares":
            mpSession.obfuscateDeclares =  True
        elif opt=="--obfuscate-names":
            mpSession.obfuscateNames =  True
        elif opt=="--obfuscate-names-charset":
            try:
                mpSession.obfuscatedNamesCharset = arg
            except ValueError:
                help.printUsage(BANNER, sys.argv[0])
                sys.exit(0)
        elif opt=="--obfuscate-names-minlen":
            try:
                mpSession.obfuscatedNamesMinLen = int(arg)
            except ValueError:
                help.printUsage(BANNER, sys.argv[0])
                sys.exit(0)
            if mpSession.obfuscatedNamesMinLen < 4 or mpSession.obfuscatedNamesMinLen > 255:
                help.printUsage(BANNER, sys.argv[0])
                sys.exit(0)
        elif opt=="--obfuscate-names-maxlen":
            try:
                mpSession.obfuscatedNamesMaxLen = int(arg)
            except ValueError:
                help.printUsage(BANNER, sys.argv[0])
                sys.exit(0)
            if mpSession.obfuscatedNamesMaxLen < 4 or mpSession.obfuscatedNamesMaxLen > 255:
                help.printUsage(BANNER, sys.argv[0])
                sys.exit(0)
        elif opt=="--obfuscate-strings":
            mpSession.obfuscateStrings =  True
        elif opt=="-s" or opt=="--start-function":
            mpSession.startFunction =  arg
        elif opt=="-l" or opt=="--listen":
            mpSession.listen = True
            mpSession.listenRoot = os.path.abspath(arg)
        elif opt=="--port":
            mpSession.listenPort = int(arg)
            mpSession.WlistenPort = int(arg)
        elif opt=="--icon":
            mpSession.icon = arg
        elif opt=="-w" or opt=="--webdav-listen":
            mpSession.Wlisten =  True
            mpSession.WRoot = os.path.abspath(arg)
        elif opt == "-f" or opt== "--input-file":
            mpSession.fileInput = arg
        elif opt == "-e" or opt== "--embed":
            mpSession.embeddedFilePath = os.path.abspath(arg)
        elif opt=="-t" or opt=="--template":
            mpSession.template = arg
        elif opt == "--listtemplates":
            help.printTemplatesUsage(BANNER, sys.argv[0])
            sys.exit(0)
        elif opt=="-q" or opt=="--quiet":
            logLevel = "WARN"
        elif opt=="-p" or opt=="--print":
            mpSession.printFile = True
        elif opt == "--dde":
            if sys.platform == "win32":
                mpSession.ddeMode = True
        elif opt == "--run":
            if sys.platform == "win32":
                mpSession.runTarget = os.path.abspath(arg)
        elif opt == "--run-visible":
            if sys.platform == "win32":
                mpSession.runVisible = True
        elif opt == "--force-yes":
            mpSession.forceYes = True
        elif opt=="--uac-bypass":
            mpSession.uacBypass = True
        elif opt == "--unicode-rtlo":
            mpSession.unicodeRtlo = arg
        elif opt in ("-G", "--generate"):
            mpSession.outputFilePath = os.path.abspath(arg)
        elif opt == "--listformats":
            help.printAvailableFormats(BANNER)
            sys.exit(0)
        elif opt=="-h" or opt=="--help":
            help.printUsage(BANNER, sys.argv[0])
            sys.exit(0)
        else:
            if MP_TYPE == "Pro":
                arg_mgt_pro.processProArg(opt, arg, mpSession, BANNER)
            else:
                help.printUsage(BANNER, sys.argv[0])
                sys.exit(0)

    if logLevel == "INFO":
        os.system('cls' if os.name == 'nt' else 'clear')

    # Logging
    logging.basicConfig(level=getattr(logging, logLevel),format="%(message)s", handlers=[utils.ColorLogFiler()])


    logging.info(colored(BANNER, 'green'))

    logging.info(" [+] Preparations...")

    # check input args
    if mpSession.fileInput is None:
        # Argument not supplied, try to get file content from stdin
        if not os.isatty(0): # check if something is being piped
            logging.info("   [-] Waiting for piped input feed...")
            mpSession.stdinContent = sys.stdin.readlines()
            # Close Stdin pipe, so we can call input() later without triggering EOF
            #sys.stdin.close()
            if sys.platform == "win32":
                sys.stdin = open("conIN$")
            else:
                sys.stdin = sys.__stdin__
            
            
    else:
        if not os.path.isfile(mpSession.fileInput):
            logging.error("   [!] ERROR: Could not find %s!" % mpSession.fileInput)
            sys.exit(2)
        else:
            logging.info("   [-] Input file path: %s" % mpSession.fileInput)

    if MP_TYPE == "Pro":
        if mpSession.communityMode:
            logging.warning("   [!] Running in community mode (pro features not applied)")
            MP_TYPE="Community"
        else:
            arg_mgt_pro.verify(mpSession)
        
    
        # Check output file format
    if mpSession.outputFilePath:
        if not os.path.isdir(os.path.dirname(mpSession.outputFilePath)):
            logging.error("   [!] Could not find output folder %s." % os.path.dirname(mpSession.outputFilePath))
            sys.exit(2)
        
        if mpSession.outputFileType == MSTypes.UNKNOWN:
            logging.error("   [!] %s is not a supported extension. Use --listformats to view supported MacroPack formats." % os.path.splitext(mpSession.outputFilePath)[1])
            sys.exit(2)
        else:
            logging.info("   [-] Target output format: %s" %  mpSession.outputFileType)
    elif not mpSession.listen and not mpSession.Wlisten and mpSession.runTarget is None and (MP_TYPE != "Pro" or mpSession.dcomTarget is None):
        logging.error("   [!] You need to provide an output file! (get help using %s -h)" % os.path.basename(utils.getRunningApp()))
        sys.exit(2)


    if not mpSession.isTrojanMode:
        # verify that output file does not already exist
        if os.path.isfile(mpSession.outputFilePath):
            logging.error("   [!] ERROR: Output file %s already exist!" % mpSession.outputFilePath)
            sys.exit(2)

    #Create temporary folder
    logging.info("   [-] Temporary working dir: %s" % working_directory)
    if not os.path.exists(working_directory):
        os.makedirs(working_directory)

    try:
        # Create temporary work file.
        if mpSession.ddeMode or mpSession.template or (mpSession.outputFileType not in MSTypes.VB_FORMATS+[MSTypes.VBA] and not mpSession.htaMacro):
            inputFile = os.path.join(working_directory, "command.cmd")
        else:
            inputFile = os.path.join(working_directory, utils.randomAlpha(9)) + ".vba"
        if mpSession.stdinContent is not None:
            import time
            time.sleep(0.4) # Needed to avoid some weird race condition
            logging.info("   [-] Store std input in file...")
            f = open(inputFile, 'w')
            f.writelines(mpSession.stdinContent)
            f.close()
        else:
            # Create temporary work file
            if mpSession.fileInput is not None:
                # Check there are not binary chars in input fil 
                if utils.isBinaryString(open(mpSession.fileInput, 'rb').read(1024)):
                    logging.error("   [!] ERROR: Invalid format for %s. Input should be text format containing your VBA script." % mpSession.fileInput)
                    logging.info(" [+] Cleaning...")
                    if os.path.isdir(working_directory):
                        shutil.rmtree(working_directory)
                    sys.exit(2)
                logging.info("   [-] Store input file...")
                shutil.copy2(mpSession.fileInput, inputFile)
        
        if os.path.isfile(inputFile): 
            logging.info("   [-] Temporary input file: %s" %  inputFile)
            
            
        # Edit outputfile name to spoof extension if unicodeRtlo option is enabled
        if mpSession.unicodeRtlo:
            # Reminder; mpSession.unicodeRtlo contains the extension we want to spoof, such as "jpg"
            logging.info(" [+] Inject %s false extension with unicode RTLO" % mpSession.unicodeRtlo)
            # Separate document path and extension
            (fileName, fileExtension) = os.path.splitext(mpSession.outputFilePath)
            
            logging.info("   [-] Extension %s " % fileExtension)
            # Append unicode RTLO to file name
            fileName += '\u202e' 
            # Append extension to spoof in reverse order
            fileName += '\u200b' + mpSession.unicodeRtlo[::-1] # Prepend invisible space so filename does not end with flagged extension
            # Append file extension
            fileName +=  fileExtension   
            mpSession.outputFilePath = fileName
            logging.info("   [-] File name modified to: %s" %  mpSession.outputFilePath)
                

        # Retrieve the right payload builder
        if mpSession.outputFileType != MSTypes.UNKNOWN:
            if MP_TYPE == "Pro" and not mpSession.communityMode:
                payloadBuilder = PayloadBuilderFactoryPro().getPayloadBuilder(mpSession)
            else:
                payloadBuilder = PayloadBuilderFactory().getPayloadBuilder(mpSession)
            # Build payload
            if payloadBuilder is not None:
                payloadBuilder.run()
                if MP_TYPE == "Pro":
                    generator = ContainerGenerator(mpSession)
                    generator.run()

        #run com attack
        if mpSession.runTarget:
            generator = ComGenerator(mpSession)
            generator.run()

        if MP_TYPE == "Pro":
            #run dcom attack
            if mpSession.dcom:
                generator = DcomGenerator(mpSession)
                generator.run()

        # Activate Web server
        if mpSession.listen:
            listener = ListenServer(mpSession)
            listener.run()

        # Activate WebDav server
        if mpSession.Wlisten:
            Wlistener = WListenServer(mpSession)
            Wlistener.run()

    except Exception:
        logging.exception(" [!] Exception caught!")
    except KeyboardInterrupt:
        logging.error(" [!] Keyboard interrupt caught!")


    logging.info(" [+] Cleaning...")
    if os.path.isdir(working_directory):
        shutil.rmtree(working_directory)

    logging.info(" Done!\n")


    sys.exit(0)


if __name__ == '__main__':
    # check if running from explorer, if yes restart from cmd line
    # running_from = psutil.Process(os.getpid()).parent().parent().name()
    # if running_from == 'explorer.exe':
    #     os.system("cmd.exe /k \"%s\"" % utils.getRunningApp())
    # PyArmor Plugin: checkPlug()
    main(sys.argv[1:])

[((24, 3, 24, 37), 'common.utils.checkModuleExist', 'utils.checkModuleExist', ({(24, 26, 24, 36): '"""pro_core"""'}, {}), "('pro_core')", False, 'from common import utils, mp_session, help\n'), ((38, 0, 38, 6), 'colorama.init', 'init', ({}, {}), '()', False, 'from colorama import init\n'), ((44, 9, 44, 27), 'common.help.getToolPres', 'help.getToolPres', ({}, {}), '()', False, 'from common import utils, mp_session, help\n'), ((179, 4, 179, 40), 'logging.info', 'logging.info', ({(179, 17, 179, 39): '""" [+] Preparations..."""'}, {}), "(' [+] Preparations...')", False, 'import logging\n'), ((233, 4, 233, 72), 'logging.info', 'logging.info', ({(233, 17, 233, 71): "('   [-] Temporary working dir: %s' % working_directory)"}, {}), "('   [-] Temporary working dir: %s' % working_directory)", False, 'import logging\n'), ((325, 4, 325, 36), 'logging.info', 'logging.info', ({(325, 17, 325, 35): '""" [+] Cleaning..."""'}, {}), "(' [+] Cleaning...')", False, 'import logging\n'), ((326, 7, 326, 39), 'os.path.isdir', 'os.path.isdir', ({(326, 21, 326, 38): 'working_directory'}, {}), '(working_directory)', False, 'import os\n'), ((329, 4, 329, 28), 'logging.info', 'logging.info', ({(329, 17, 329, 27): '""" Done!\n"""'}, {}), "(' Done!\\n')", False, 'import logging\n'), ((332, 4, 332, 15), 'sys.exit', 'sys.exit', ({(332, 13, 332, 14): '(0)'}, {}), '(0)', False, 'import sys\n'), ((51, 37, 51, 48), 'os.getcwd', 'os.getcwd', ({}, {}), '()', False, 'import os\n'), ((53, 20, 53, 84), 'pro_core.mp_session_pro.MpSessionPro', 'mp_session_pro.MpSessionPro', ({(53, 48, 53, 65): 'working_directory', (53, 67, 53, 74): 'VERSION', (53, 76, 53, 83): 'MP_TYPE'}, {}), '(working_directory, VERSION, MP_TYPE)', False, 'from pro_core import arg_mgt_pro, mp_session_pro\n'), ((55, 20, 55, 77), 'common.mp_session.MpSession', 'mp_session.MpSession', ({(55, 41, 55, 58): 'working_directory', (55, 60, 55, 67): 'VERSION', (55, 69, 55, 76): 'MP_TYPE'}, {}), '(working_directory, VERSION, MP_TYPE)', False, 'from common import utils, mp_session, help\n'), ((72, 21, 72, 67), 'getopt.getopt', 'getopt.getopt', ({(72, 35, 72, 39): 'argv', (72, 41, 72, 53): 'shortOptions', (72, 55, 72, 66): 'longOptions'}, {}), '(argv, shortOptions, longOptions)', False, 'import getopt\n'), ((171, 8, 171, 56), 'os.system', 'os.system', ({(171, 18, 171, 55): "('cls' if os.name == 'nt' else 'clear')"}, {}), "('cls' if os.name == 'nt' else 'clear')", False, 'import os\n'), ((177, 17, 177, 41), 'termcolor.colored', 'colored', ({(177, 25, 177, 31): 'BANNER', (177, 33, 177, 40): '"""green"""'}, {}), "(BANNER, 'green')", False, 'from termcolor import colored\n'), ((228, 11, 228, 51), 'os.path.isfile', 'os.path.isfile', ({(228, 26, 228, 50): 'mpSession.outputFilePath'}, {}), '(mpSession.outputFilePath)', False, 'import os\n'), ((234, 11, 234, 44), 'os.path.exists', 'os.path.exists', ({(234, 26, 234, 43): 'working_directory'}, {}), '(working_directory)', False, 'import os\n'), ((235, 8, 235, 38), 'os.makedirs', 'os.makedirs', ({(235, 20, 235, 37): 'working_directory'}, {}), '(working_directory)', False, 'import os\n'), ((263, 11, 263, 36), 'os.path.isfile', 'os.path.isfile', ({(263, 26, 263, 35): 'inputFile'}, {}), '(inputFile)', False, 'import os\n'), ((327, 8, 327, 40), 'shutil.rmtree', 'shutil.rmtree', ({(327, 22, 327, 39): 'working_directory'}, {}), '(working_directory)', False, 'import shutil\n'), ((22, 8, 22, 19), 'sys.exit', 'sys.exit', ({(22, 17, 22, 18): '(1)'}, {}), '(1)', False, 'import sys\n'), ((74, 8, 74, 44), 'common.help.printUsage', 'help.printUsage', ({(74, 24, 74, 30): 'BANNER', (74, 32, 74, 43): 'sys.argv[0]'}, {}), '(BANNER, sys.argv[0])', False, 'from common import utils, mp_session, help\n'), ((75, 8, 75, 19), 'sys.exit', 'sys.exit', ({(75, 17, 75, 18): '(2)'}, {}), '(2)', False, 'import sys\n'), ((184, 15, 184, 27), 'os.isatty', 'os.isatty', ({(184, 25, 184, 26): '(0)'}, {}), '(0)', False, 'import os\n'), ((185, 12, 185, 66), 'logging.info', 'logging.info', ({(185, 25, 185, 65): '"""   [-] Waiting for piped input feed..."""'}, {}), "('   [-] Waiting for piped input feed...')", False, 'import logging\n'), ((186, 37, 186, 58), 'sys.stdin.readlines', 'sys.stdin.readlines', ({}, {}), '()', False, 'import sys\n'), ((196, 15, 196, 50), 'os.path.isfile', 'os.path.isfile', ({(196, 30, 196, 49): 'mpSession.fileInput'}, {}), '(mpSession.fileInput)', False, 'import os\n'), ((197, 12, 197, 83), 'logging.error', 'logging.error', ({(197, 26, 197, 82): "('   [!] ERROR: Could not find %s!' % mpSession.fileInput)"}, {}), "('   [!] ERROR: Could not find %s!' % mpSession.fileInput)", False, 'import logging\n'), ((198, 12, 198, 23), 'sys.exit', 'sys.exit', ({(198, 21, 198, 22): '(2)'}, {}), '(2)', False, 'import sys\n'), ((200, 12, 200, 76), 'logging.info', 'logging.info', ({(200, 25, 200, 75): "('   [-] Input file path: %s' % mpSession.fileInput)"}, {}), "('   [-] Input file path: %s' % mpSession.fileInput)", False, 'import logging\n'), ((204, 12, 204, 90), 'logging.warning', 'logging.warning', ({(204, 28, 204, 89): '"""   [!] Running in community mode (pro features not applied)"""'}, {}), "('   [!] Running in community mode (pro features not applied)')", False, 'import logging\n'), ((207, 12, 207, 41), 'pro_core.arg_mgt_pro.verify', 'arg_mgt_pro.verify', ({(207, 31, 207, 40): 'mpSession'}, {}), '(mpSession)', False, 'from pro_core import arg_mgt_pro, mp_session_pro\n'), ((214, 12, 214, 23), 'sys.exit', 'sys.exit', ({(214, 21, 214, 22): '(2)'}, {}), '(2)', False, 'import sys\n'), ((218, 12, 218, 23), 'sys.exit', 'sys.exit', ({(218, 21, 218, 22): '(2)'}, {}), '(2)', False, 'import sys\n'), ((220, 12, 220, 87), 'logging.info', 'logging.info', ({(220, 25, 220, 86): "('   [-] Target output format: %s' % mpSession.outputFileType)"}, {}), "('   [-] Target output format: %s' % mpSession.outputFileType)", False, 'import logging\n'), ((223, 8, 223, 19), 'sys.exit', 'sys.exit', ({(223, 17, 223, 18): '(2)'}, {}), '(2)', False, 'import sys\n'), ((229, 12, 229, 99), 'logging.error', 'logging.error', ({(229, 26, 229, 98): "('   [!] ERROR: Output file %s already exist!' % mpSession.outputFilePath)"}, {}), "('   [!] ERROR: Output file %s already exist!' % mpSession.\n    outputFilePath)", False, 'import logging\n'), ((230, 12, 230, 23), 'sys.exit', 'sys.exit', ({(230, 21, 230, 22): '(2)'}, {}), '(2)', False, 'import sys\n'), ((240, 24, 240, 70), 'os.path.join', 'os.path.join', ({(240, 37, 240, 54): 'working_directory', (240, 56, 240, 69): '"""command.cmd"""'}, {}), "(working_directory, 'command.cmd')", False, 'import os\n'), ((245, 12, 245, 27), 'time.sleep', 'time.sleep', ({(245, 23, 245, 26): '(0.4)'}, {}), '(0.4)', False, 'import time\n'), ((246, 12, 246, 61), 'logging.info', 'logging.info', ({(246, 25, 246, 60): '"""   [-] Store std input in file..."""'}, {}), "('   [-] Store std input in file...')", False, 'import logging\n'), ((264, 12, 264, 72), 'logging.info', 'logging.info', ({(264, 25, 264, 71): "('   [-] Temporary input file: %s' % inputFile)"}, {}), "('   [-] Temporary input file: %s' % inputFile)", False, 'import logging\n'), ((270, 12, 270, 100), 'logging.info', 'logging.info', ({(270, 25, 270, 99): "(' [+] Inject %s false extension with unicode RTLO' % mpSession.unicodeRtlo)"}, {}), "(' [+] Inject %s false extension with unicode RTLO' % mpSession\n    .unicodeRtlo)", False, 'import logging\n'), ((272, 40, 272, 82), 'os.path.splitext', 'os.path.splitext', ({(272, 57, 272, 81): 'mpSession.outputFilePath'}, {}), '(mpSession.outputFilePath)', False, 'import os\n'), ((274, 12, 274, 64), 'logging.info', 'logging.info', ({(274, 25, 274, 63): "('   [-] Extension %s ' % fileExtension)"}, {}), "('   [-] Extension %s ' % fileExtension)", False, 'import logging\n'), ((282, 12, 282, 88), 'logging.info', 'logging.info', ({(282, 25, 282, 87): "('   [-] File name modified to: %s' % mpSession.outputFilePath)"}, {}), "('   [-] File name modified to: %s' % mpSession.outputFilePath)", False, 'import logging\n'), ((300, 24, 300, 47), 'modules.com_run.ComGenerator', 'ComGenerator', ({(300, 37, 300, 46): 'mpSession'}, {}), '(mpSession)', False, 'from modules.com_run import ComGenerator\n'), ((311, 23, 311, 46), 'modules.web_server.ListenServer', 'ListenServer', ({(311, 36, 311, 45): 'mpSession'}, {}), '(mpSession)', False, 'from modules.web_server import ListenServer\n'), ((316, 24, 316, 48), 'modules.Wlisten_server.WListenServer', 'WListenServer', ({(316, 38, 316, 47): 'mpSession'}, {}), '(mpSession)', False, 'from modules.Wlisten_server import WListenServer\n'), ((320, 8, 320, 51), 'logging.exception', 'logging.exception', ({(320, 26, 320, 50): '""" [!] Exception caught!"""'}, {}), "(' [!] Exception caught!')", False, 'import logging\n'), ((322, 8, 322, 56), 'logging.error', 'logging.error', ({(322, 22, 322, 55): '""" [!] Keyboard interrupt caught!"""'}, {}), "(' [!] Keyboard interrupt caught!')", False, 'import logging\n'), ((174, 89, 174, 110), 'common.utils.ColorLogFiler', 'utils.ColorLogFiler', ({}, {}), '()', False, 'from common import utils, mp_session, help\n'), ((212, 29, 212, 70), 'os.path.dirname', 'os.path.dirname', ({(212, 45, 212, 69): 'mpSession.outputFilePath'}, {}), '(mpSession.outputFilePath)', False, 'import os\n'), ((260, 16, 260, 58), 'logging.info', 'logging.info', ({(260, 29, 260, 57): '"""   [-] Store input file..."""'}, {}), "('   [-] Store input file...')", False, 'import logging\n'), ((261, 16, 261, 60), 'shutil.copy2', 'shutil.copy2', ({(261, 29, 261, 48): 'mpSession.fileInput', (261, 50, 261, 59): 'inputFile'}, {}), '(mpSession.fileInput, inputFile)', False, 'import shutil\n'), ((306, 28, 306, 52), 'pro_modules.utilities.dcom_run.DcomGenerator', 'DcomGenerator', ({(306, 42, 306, 51): 'mpSession'}, {}), '(mpSession)', False, 'from pro_modules.utilities.dcom_run import DcomGenerator\n'), ((213, 70, 213, 111), 'os.path.dirname', 'os.path.dirname', ({(213, 86, 213, 110): 'mpSession.outputFilePath'}, {}), '(mpSession.outputFilePath)', False, 'import os\n'), ((242, 56, 242, 76), 'common.utils.randomAlpha', 'utils.randomAlpha', ({(242, 74, 242, 75): '(9)'}, {}), '(9)', False, 'from common import utils, mp_session, help\n'), ((255, 20, 255, 151), 'logging.error', 'logging.error', ({(255, 34, 255, 150): "('   [!] ERROR: Invalid format for %s. Input should be text format containing your VBA script.'\n     % mpSession.fileInput)"}, {}), "(\n    '   [!] ERROR: Invalid format for %s. Input should be text format containing your VBA script.'\n     % mpSession.fileInput)", False, 'import logging\n'), ((256, 20, 256, 52), 'logging.info', 'logging.info', ({(256, 33, 256, 51): '""" [+] Cleaning..."""'}, {}), "(' [+] Cleaning...')", False, 'import logging\n'), ((257, 23, 257, 55), 'os.path.isdir', 'os.path.isdir', ({(257, 37, 257, 54): 'working_directory'}, {}), '(working_directory)', False, 'import os\n'), ((259, 20, 259, 31), 'sys.exit', 'sys.exit', ({(259, 29, 259, 30): '(2)'}, {}), '(2)', False, 'import sys\n'), ((295, 32, 295, 61), 'pro_modules.payload_builders.containers.ContainerGenerator', 'ContainerGenerator', ({(295, 51, 295, 60): 'mpSession'}, {}), '(mpSession)', False, 'from pro_modules.payload_builders.containers import ContainerGenerator\n'), ((217, 125, 217, 167), 'os.path.splitext', 'os.path.splitext', ({(217, 142, 217, 166): 'mpSession.outputFilePath'}, {}), '(mpSession.outputFilePath)', False, 'import os\n'), ((222, 109, 222, 130), 'common.utils.getRunningApp', 'utils.getRunningApp', ({}, {}), '()', False, 'from common import utils, mp_session, help\n'), ((258, 24, 258, 56), 'shutil.rmtree', 'shutil.rmtree', ({(258, 38, 258, 55): 'working_directory'}, {}), '(working_directory)', False, 'import shutil\n'), ((288, 33, 288, 59), 'pro_core.payload_builder_factory_pro.PayloadBuilderFactoryPro', 'PayloadBuilderFactoryPro', ({}, {}), '()', False, 'from pro_core.payload_builder_factory_pro import PayloadBuilderFactoryPro\n'), ((290, 33, 290, 56), 'modules.payload_builder_factory.PayloadBuilderFactory', 'PayloadBuilderFactory', ({}, {}), '()', False, 'from modules.payload_builder_factory import PayloadBuilderFactory\n'), ((92, 16, 92, 52), 'common.help.printUsage', 'help.printUsage', ({(92, 32, 92, 38): 'BANNER', (92, 40, 92, 51): 'sys.argv[0]'}, {}), '(BANNER, sys.argv[0])', False, 'from common import utils, mp_session, help\n'), ((93, 16, 93, 27), 'sys.exit', 'sys.exit', ({(93, 25, 93, 26): '(0)'}, {}), '(0)', False, 'import sys\n'), ((101, 16, 101, 52), 'common.help.printUsage', 'help.printUsage', ({(101, 32, 101, 38): 'BANNER', (101, 40, 101, 51): 'sys.argv[0]'}, {}), '(BANNER, sys.argv[0])', False, 'from common import utils, mp_session, help\n'), ((102, 16, 102, 27), 'sys.exit', 'sys.exit', ({(102, 25, 102, 26): '(0)'}, {}), '(0)', False, 'import sys\n'), ((98, 16, 98, 52), 'common.help.printUsage', 'help.printUsage', ({(98, 32, 98, 38): 'BANNER', (98, 40, 98, 51): 'sys.argv[0]'}, {}), '(BANNER, sys.argv[0])', False, 'from common import utils, mp_session, help\n'), ((99, 16, 99, 27), 'sys.exit', 'sys.exit', ({(99, 25, 99, 26): '(0)'}, {}), '(0)', False, 'import sys\n'), ((110, 16, 110, 52), 'common.help.printUsage', 'help.printUsage', ({(110, 32, 110, 38): 'BANNER', (110, 40, 110, 51): 'sys.argv[0]'}, {}), '(BANNER, sys.argv[0])', False, 'from common import utils, mp_session, help\n'), ((111, 16, 111, 27), 'sys.exit', 'sys.exit', ({(111, 25, 111, 26): '(0)'}, {}), '(0)', False, 'import sys\n'), ((107, 16, 107, 52), 'common.help.printUsage', 'help.printUsage', ({(107, 32, 107, 38): 'BANNER', (107, 40, 107, 51): 'sys.argv[0]'}, {}), '(BANNER, sys.argv[0])', False, 'from common import utils, mp_session, help\n'), ((108, 16, 108, 27), 'sys.exit', 'sys.exit', ({(108, 25, 108, 26): '(0)'}, {}), '(0)', False, 'import sys\n'), ((118, 35, 118, 55), 'os.path.abspath', 'os.path.abspath', ({(118, 51, 118, 54): 'arg'}, {}), '(arg)', False, 'import os\n'), ((126, 30, 126, 50), 'os.path.abspath', 'os.path.abspath', ({(126, 46, 126, 49): 'arg'}, {}), '(arg)', False, 'import os\n'), ((130, 41, 130, 61), 'os.path.abspath', 'os.path.abspath', ({(130, 57, 130, 60): 'arg'}, {}), '(arg)', False, 'import os\n'), ((134, 12, 134, 57), 'common.help.printTemplatesUsage', 'help.printTemplatesUsage', ({(134, 37, 134, 43): 'BANNER', (134, 45, 134, 56): 'sys.argv[0]'}, {}), '(BANNER, sys.argv[0])', False, 'from common import utils, mp_session, help\n'), ((135, 12, 135, 23), 'sys.exit', 'sys.exit', ({(135, 21, 135, 22): '(0)'}, {}), '(0)', False, 'import sys\n'), ((145, 38, 145, 58), 'os.path.abspath', 'os.path.abspath', ({(145, 54, 145, 57): 'arg'}, {}), '(arg)', False, 'import os\n'), ((156, 39, 156, 59), 'os.path.abspath', 'os.path.abspath', ({(156, 55, 156, 58): 'arg'}, {}), '(arg)', False, 'import os\n'), ((158, 12, 158, 46), 'common.help.printAvailableFormats', 'help.printAvailableFormats', ({(158, 39, 158, 45): 'BANNER'}, {}), '(BANNER)', False, 'from common import utils, mp_session, help\n'), ((159, 12, 159, 23), 'sys.exit', 'sys.exit', ({(159, 21, 159, 22): '(0)'}, {}), '(0)', False, 'import sys\n'), ((161, 12, 161, 48), 'common.help.printUsage', 'help.printUsage', ({(161, 28, 161, 34): 'BANNER', (161, 36, 161, 47): 'sys.argv[0]'}, {}), '(BANNER, sys.argv[0])', False, 'from common import utils, mp_session, help\n'), ((162, 12, 162, 23), 'sys.exit', 'sys.exit', ({(162, 21, 162, 22): '(0)'}, {}), '(0)', False, 'import sys\n'), ((165, 16, 165, 70), 'pro_core.arg_mgt_pro.processProArg', 'arg_mgt_pro.processProArg', ({(165, 42, 165, 45): 'opt', (165, 47, 165, 50): 'arg', (165, 52, 165, 61): 'mpSession', (165, 63, 165, 69): 'BANNER'}, {}), '(opt, arg, mpSession, BANNER)', False, 'from pro_core import arg_mgt_pro, mp_session_pro\n'), ((167, 16, 167, 52), 'common.help.printUsage', 'help.printUsage', ({(167, 32, 167, 38): 'BANNER', (167, 40, 167, 51): 'sys.argv[0]'}, {}), '(BANNER, sys.argv[0])', False, 'from common import utils, mp_session, help\n'), ((168, 16, 168, 27), 'sys.exit', 'sys.exit', ({(168, 25, 168, 26): '(0)'}, {}), '(0)', False, 'import sys\n')]