#!/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:])

[((640, 674), 'common.utils.checkModuleExist', 'utils.checkModuleExist', (['"""pro_core"""'], {}), "('pro_core')\n", (662, 674), False, 'from common import utils, mp_session, help\n'), ((1132, 1138), 'colorama.init', 'init', ([], {}), '()\n', (1136, 1138), False, 'from colorama import init\n'), ((1173, 1191), 'common.help.getToolPres', 'help.getToolPres', ([], {}), '()\n', (1189, 1191), False, 'from common import utils, mp_session, help\n'), ((6758, 6794), 'logging.info', 'logging.info', (['""" [+] Preparations..."""'], {}), "(' [+] Preparations...')\n", (6770, 6794), False, 'import logging\n'), ((9157, 9225), 'logging.info', 'logging.info', (["('   [-] Temporary working dir: %s' % working_directory)"], {}), "('   [-] Temporary working dir: %s' % working_directory)\n", (9169, 9225), False, 'import logging\n'), ((13256, 13288), 'logging.info', 'logging.info', (['""" [+] Cleaning..."""'], {}), "(' [+] Cleaning...')\n", (13268, 13288), False, 'import logging\n'), ((13296, 13328), 'os.path.isdir', 'os.path.isdir', (['working_directory'], {}), '(working_directory)\n', (13309, 13328), False, 'import os\n'), ((13376, 13400), 'logging.info', 'logging.info', (['""" Done!\n"""'], {}), "(' Done!\\n')\n", (13388, 13400), False, 'import logging\n'), ((13407, 13418), 'sys.exit', 'sys.exit', (['(0)'], {}), '(0)\n', (13415, 13418), False, 'import sys\n'), ((1333, 1344), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (1342, 1344), False, 'import os\n'), ((1404, 1468), 'pro_core.mp_session_pro.MpSessionPro', 'mp_session_pro.MpSessionPro', (['working_directory', 'VERSION', 'MP_TYPE'], {}), '(working_directory, VERSION, MP_TYPE)\n', (1431, 1468), False, 'from pro_core import arg_mgt_pro, mp_session_pro\n'), ((1499, 1556), 'common.mp_session.MpSession', 'mp_session.MpSession', (['working_directory', 'VERSION', 'MP_TYPE'], {}), '(working_directory, VERSION, MP_TYPE)\n', (1519, 1556), False, 'from common import utils, mp_session, help\n'), ((2472, 2518), 'getopt.getopt', 'getopt.getopt', (['argv', 'shortOptions', 'longOptions'], {}), '(argv, shortOptions, longOptions)\n', (2485, 2518), False, 'import getopt\n'), ((6531, 6579), 'os.system', 'os.system', (["('cls' if os.name == 'nt' else 'clear')"], {}), "('cls' if os.name == 'nt' else 'clear')\n", (6540, 6579), False, 'import os\n'), ((6727, 6751), 'termcolor.colored', 'colored', (['BANNER', '"""green"""'], {}), "(BANNER, 'green')\n", (6734, 6751), False, 'from termcolor import colored\n'), ((8957, 8997), 'os.path.isfile', 'os.path.isfile', (['mpSession.outputFilePath'], {}), '(mpSession.outputFilePath)\n', (8971, 8997), False, 'import os\n'), ((9237, 9270), 'os.path.exists', 'os.path.exists', (['working_directory'], {}), '(working_directory)\n', (9251, 9270), False, 'import os\n'), ((9280, 9310), 'os.makedirs', 'os.makedirs', (['working_directory'], {}), '(working_directory)\n', (9291, 9310), False, 'import os\n'), ((10737, 10762), 'os.path.isfile', 'os.path.isfile', (['inputFile'], {}), '(inputFile)\n', (10751, 10762), False, 'import os\n'), ((13338, 13370), 'shutil.rmtree', 'shutil.rmtree', (['working_directory'], {}), '(working_directory)\n', (13351, 13370), False, 'import shutil\n'), ((611, 622), 'sys.exit', 'sys.exit', (['(1)'], {}), '(1)\n', (619, 622), False, 'import sys\n'), ((2576, 2612), 'common.help.printUsage', 'help.printUsage', (['BANNER', 'sys.argv[0]'], {}), '(BANNER, sys.argv[0])\n', (2591, 2612), False, 'from common import utils, mp_session, help\n'), ((2621, 2632), 'sys.exit', 'sys.exit', (['(2)'], {}), '(2)\n', (2629, 2632), False, 'import sys\n'), ((6938, 6950), 'os.isatty', 'os.isatty', (['(0)'], {}), '(0)\n', (6947, 6950), False, 'import os\n'), ((7000, 7054), 'logging.info', 'logging.info', (['"""   [-] Waiting for piped input feed..."""'], {}), "('   [-] Waiting for piped input feed...')\n", (7012, 7054), False, 'import logging\n'), ((7092, 7113), 'sys.stdin.readlines', 'sys.stdin.readlines', ([], {}), '()\n', (7111, 7113), False, 'import sys\n'), ((7423, 7458), 'os.path.isfile', 'os.path.isfile', (['mpSession.fileInput'], {}), '(mpSession.fileInput)\n', (7437, 7458), False, 'import os\n'), ((7472, 7543), 'logging.error', 'logging.error', (["('   [!] ERROR: Could not find %s!' % mpSession.fileInput)"], {}), "('   [!] ERROR: Could not find %s!' % mpSession.fileInput)\n", (7485, 7543), False, 'import logging\n'), ((7556, 7567), 'sys.exit', 'sys.exit', (['(2)'], {}), '(2)\n', (7564, 7567), False, 'import sys\n'), ((7594, 7658), 'logging.info', 'logging.info', (["('   [-] Input file path: %s' % mpSession.fileInput)"], {}), "('   [-] Input file path: %s' % mpSession.fileInput)\n", (7606, 7658), False, 'import logging\n'), ((7733, 7811), 'logging.warning', 'logging.warning', (['"""   [!] Running in community mode (pro features not applied)"""'], {}), "('   [!] Running in community mode (pro features not applied)')\n", (7748, 7811), False, 'import logging\n'), ((7870, 7899), 'pro_core.arg_mgt_pro.verify', 'arg_mgt_pro.verify', (['mpSession'], {}), '(mpSession)\n', (7888, 7899), False, 'from pro_core import arg_mgt_pro, mp_session_pro\n'), ((8180, 8191), 'sys.exit', 'sys.exit', (['(2)'], {}), '(2)\n', (8188, 8191), False, 'import sys\n'), ((8441, 8452), 'sys.exit', 'sys.exit', (['(2)'], {}), '(2)\n', (8449, 8452), False, 'import sys\n'), ((8479, 8553), 'logging.info', 'logging.info', (["('   [-] Target output format: %s' % mpSession.outputFileType)"], {}), "('   [-] Target output format: %s' % mpSession.outputFileType)\n", (8491, 8553), False, 'import logging\n'), ((8840, 8851), 'sys.exit', 'sys.exit', (['(2)'], {}), '(2)\n', (8848, 8851), False, 'import sys\n'), ((9011, 9103), 'logging.error', 'logging.error', (["('   [!] ERROR: Output file %s already exist!' % mpSession.outputFilePath)"], {}), "('   [!] ERROR: Output file %s already exist!' % mpSession.\n    outputFilePath)\n", (9024, 9103), False, 'import logging\n'), ((9111, 9122), 'sys.exit', 'sys.exit', (['(2)'], {}), '(2)\n', (9119, 9122), False, 'import sys\n'), ((9532, 9578), 'os.path.join', 'os.path.join', (['working_directory', '"""command.cmd"""'], {}), "(working_directory, 'command.cmd')\n", (9544, 9578), False, 'import os\n'), ((9763, 9778), 'time.sleep', 'time.sleep', (['(0.4)'], {}), '(0.4)\n', (9773, 9778), False, 'import time\n'), ((9835, 9884), 'logging.info', 'logging.info', (['"""   [-] Store std input in file..."""'], {}), "('   [-] Store std input in file...')\n", (9847, 9884), False, 'import logging\n'), ((10777, 10836), 'logging.info', 'logging.info', (["('   [-] Temporary input file: %s' % inputFile)"], {}), "('   [-] Temporary input file: %s' % inputFile)\n", (10789, 10836), False, 'import logging\n'), ((11094, 11187), 'logging.info', 'logging.info', (["(' [+] Inject %s false extension with unicode RTLO' % mpSession.unicodeRtlo)"], {}), "(' [+] Inject %s false extension with unicode RTLO' % mpSession\n    .unicodeRtlo)\n", (11106, 11187), False, 'import logging\n'), ((11274, 11316), 'os.path.splitext', 'os.path.splitext', (['mpSession.outputFilePath'], {}), '(mpSession.outputFilePath)\n', (11290, 11316), False, 'import os\n'), ((11342, 11394), 'logging.info', 'logging.info', (["('   [-] Extension %s ' % fileExtension)"], {}), "('   [-] Extension %s ' % fileExtension)\n", (11354, 11394), False, 'import logging\n'), ((11808, 11883), 'logging.info', 'logging.info', (["('   [-] File name modified to: %s' % mpSession.outputFilePath)"], {}), "('   [-] File name modified to: %s' % mpSession.outputFilePath)\n", (11820, 11883), False, 'import logging\n'), ((12586, 12609), 'modules.com_run.ComGenerator', 'ComGenerator', (['mpSession'], {}), '(mpSession)\n', (12598, 12609), False, 'from modules.com_run import ComGenerator\n'), ((12896, 12919), 'modules.web_server.ListenServer', 'ListenServer', (['mpSession'], {}), '(mpSession)\n', (12908, 12919), False, 'from modules.web_server import ListenServer\n'), ((13035, 13059), 'modules.Wlisten_server.WListenServer', 'WListenServer', (['mpSession'], {}), '(mpSession)\n', (13048, 13059), False, 'from modules.Wlisten_server import WListenServer\n'), ((13119, 13162), 'logging.exception', 'logging.exception', (['""" [!] Exception caught!"""'], {}), "(' [!] Exception caught!')\n", (13136, 13162), False, 'import logging\n'), ((13201, 13249), 'logging.error', 'logging.error', (['""" [!] Keyboard interrupt caught!"""'], {}), "(' [!] Keyboard interrupt caught!')\n", (13214, 13249), False, 'import logging\n'), ((6684, 6705), 'common.utils.ColorLogFiler', 'utils.ColorLogFiler', ([], {}), '()\n', (6703, 6705), False, 'from common import utils, mp_session, help\n'), ((8011, 8052), 'os.path.dirname', 'os.path.dirname', (['mpSession.outputFilePath'], {}), '(mpSession.outputFilePath)\n', (8026, 8052), False, 'import os\n'), ((10613, 10655), 'logging.info', 'logging.info', (['"""   [-] Store input file..."""'], {}), "('   [-] Store input file...')\n", (10625, 10655), False, 'import logging\n'), ((10672, 10716), 'shutil.copy2', 'shutil.copy2', (['mpSession.fileInput', 'inputFile'], {}), '(mpSession.fileInput, inputFile)\n', (10684, 10716), False, 'import shutil\n'), ((12756, 12780), 'pro_modules.utilities.dcom_run.DcomGenerator', 'DcomGenerator', (['mpSession'], {}), '(mpSession)\n', (12769, 12780), False, 'from pro_modules.utilities.dcom_run import DcomGenerator\n'), ((8125, 8166), 'os.path.dirname', 'os.path.dirname', (['mpSession.outputFilePath'], {}), '(mpSession.outputFilePath)\n', (8140, 8166), False, 'import os\n'), ((9649, 9669), 'common.utils.randomAlpha', 'utils.randomAlpha', (['(9)'], {}), '(9)\n', (9666, 9669), False, 'from common import utils, mp_session, help\n'), ((10266, 10407), 'logging.error', 'logging.error', (["('   [!] 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)\n", (10279, 10407), False, 'import logging\n'), ((10418, 10450), 'logging.info', 'logging.info', (['""" [+] Cleaning..."""'], {}), "(' [+] Cleaning...')\n", (10430, 10450), False, 'import logging\n'), ((10474, 10506), 'os.path.isdir', 'os.path.isdir', (['working_directory'], {}), '(working_directory)\n', (10487, 10506), False, 'import os\n'), ((10585, 10596), 'sys.exit', 'sys.exit', (['(2)'], {}), '(2)\n', (10593, 10596), False, 'import sys\n'), ((12439, 12468), 'pro_modules.payload_builders.containers.ContainerGenerator', 'ContainerGenerator', (['mpSession'], {}), '(mpSession)\n', (12457, 12468), False, 'from pro_modules.payload_builders.containers import ContainerGenerator\n'), ((8382, 8424), 'os.path.splitext', 'os.path.splitext', (['mpSession.outputFilePath'], {}), '(mpSession.outputFilePath)\n', (8398, 8424), False, 'import os\n'), ((8808, 8829), 'common.utils.getRunningApp', 'utils.getRunningApp', ([], {}), '()\n', (8827, 8829), False, 'from common import utils, mp_session, help\n'), ((10532, 10564), 'shutil.rmtree', 'shutil.rmtree', (['working_directory'], {}), '(working_directory)\n', (10545, 10564), False, 'import shutil\n'), ((12102, 12128), 'pro_core.payload_builder_factory_pro.PayloadBuilderFactoryPro', 'PayloadBuilderFactoryPro', ([], {}), '()\n', (12126, 12128), False, 'from pro_core.payload_builder_factory_pro import PayloadBuilderFactoryPro\n'), ((12209, 12232), 'modules.payload_builder_factory.PayloadBuilderFactory', 'PayloadBuilderFactory', ([], {}), '()\n', (12230, 12232), False, 'from modules.payload_builder_factory import PayloadBuilderFactory\n'), ((3305, 3341), 'common.help.printUsage', 'help.printUsage', (['BANNER', 'sys.argv[0]'], {}), '(BANNER, sys.argv[0])\n', (3320, 3341), False, 'from common import utils, mp_session, help\n'), ((3358, 3369), 'sys.exit', 'sys.exit', (['(0)'], {}), '(0)\n', (3366, 3369), False, 'import sys\n'), ((3713, 3749), 'common.help.printUsage', 'help.printUsage', (['BANNER', 'sys.argv[0]'], {}), '(BANNER, sys.argv[0])\n', (3728, 3749), False, 'from common import utils, mp_session, help\n'), ((3766, 3777), 'sys.exit', 'sys.exit', (['(0)'], {}), '(0)\n', (3774, 3777), False, 'import sys\n'), ((3539, 3575), 'common.help.printUsage', 'help.printUsage', (['BANNER', 'sys.argv[0]'], {}), '(BANNER, sys.argv[0])\n', (3554, 3575), False, 'from common import utils, mp_session, help\n'), ((3592, 3603), 'sys.exit', 'sys.exit', (['(0)'], {}), '(0)\n', (3600, 3603), False, 'import sys\n'), ((4121, 4157), 'common.help.printUsage', 'help.printUsage', (['BANNER', 'sys.argv[0]'], {}), '(BANNER, sys.argv[0])\n', (4136, 4157), False, 'from common import utils, mp_session, help\n'), ((4174, 4185), 'sys.exit', 'sys.exit', (['(0)'], {}), '(0)\n', (4182, 4185), False, 'import sys\n'), ((3947, 3983), 'common.help.printUsage', 'help.printUsage', (['BANNER', 'sys.argv[0]'], {}), '(BANNER, sys.argv[0])\n', (3962, 3983), False, 'from common import utils, mp_session, help\n'), ((4000, 4011), 'sys.exit', 'sys.exit', (['(0)'], {}), '(0)\n', (4008, 4011), False, 'import sys\n'), ((4482, 4502), 'os.path.abspath', 'os.path.abspath', (['arg'], {}), '(arg)\n', (4497, 4502), False, 'import os\n'), ((4799, 4819), 'os.path.abspath', 'os.path.abspath', (['arg'], {}), '(arg)\n', (4814, 4819), False, 'import os\n'), ((4994, 5014), 'os.path.abspath', 'os.path.abspath', (['arg'], {}), '(arg)\n', (5009, 5014), False, 'import os\n'), ((5148, 5193), 'common.help.printTemplatesUsage', 'help.printTemplatesUsage', (['BANNER', 'sys.argv[0]'], {}), '(BANNER, sys.argv[0])\n', (5172, 5193), False, 'from common import utils, mp_session, help\n'), ((5206, 5217), 'sys.exit', 'sys.exit', (['(0)'], {}), '(0)\n', (5214, 5217), False, 'import sys\n'), ((5588, 5608), 'os.path.abspath', 'os.path.abspath', (['arg'], {}), '(arg)\n', (5603, 5608), False, 'import os\n'), ((6035, 6055), 'os.path.abspath', 'os.path.abspath', (['arg'], {}), '(arg)\n', (6050, 6055), False, 'import os\n'), ((6105, 6139), 'common.help.printAvailableFormats', 'help.printAvailableFormats', (['BANNER'], {}), '(BANNER)\n', (6131, 6139), False, 'from common import utils, mp_session, help\n'), ((6152, 6163), 'sys.exit', 'sys.exit', (['(0)'], {}), '(0)\n', (6160, 6163), False, 'import sys\n'), ((6217, 6253), 'common.help.printUsage', 'help.printUsage', (['BANNER', 'sys.argv[0]'], {}), '(BANNER, sys.argv[0])\n', (6232, 6253), False, 'from common import utils, mp_session, help\n'), ((6266, 6277), 'sys.exit', 'sys.exit', (['(0)'], {}), '(0)\n', (6274, 6277), False, 'import sys\n'), ((6341, 6395), 'pro_core.arg_mgt_pro.processProArg', 'arg_mgt_pro.processProArg', (['opt', 'arg', 'mpSession', 'BANNER'], {}), '(opt, arg, mpSession, BANNER)\n', (6366, 6395), False, 'from pro_core import arg_mgt_pro, mp_session_pro\n'), ((6430, 6466), 'common.help.printUsage', 'help.printUsage', (['BANNER', 'sys.argv[0]'], {}), '(BANNER, sys.argv[0])\n', (6445, 6466), False, 'from common import utils, mp_session, help\n'), ((6483, 6494), 'sys.exit', 'sys.exit', (['(0)'], {}), '(0)\n', (6491, 6494), False, 'import sys\n')]