• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python messages.title函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中modules.common.messages.title函数的典型用法代码示例。如果您正苦于以下问题:Python title函数的具体用法?Python title怎么用?Python title使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了title函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: PayloadInfo

	def PayloadInfo(self, payload, showTitle=True, showInfo=True):
		"""
		Print out information about a specified payload.
		
		payload = the payload object to print information on
		
		"""
		if showTitle:
			messages.title()
		
		if showInfo:
			print " Payload information:\n"
			
			print "\tName:\t\t" + payload.shortname
			print "\tLanguage:\t" + payload.language
			print "\tRating:\t\t" + payload.rating
			
			if hasattr(payload, 'shellcode'):
				if self.payload.shellcode.customshellcode:
					print "\tShellcode:\t\tused"

			print "\tDescription:\t" + payload.description
		
		# if required options were specified, output them
		if hasattr(self.payload, 'required_options'):
			print "\n Required Options:\n"
			
			print " Name\t\t\tCurrent Value\tDescription"
			print " ----\t\t\t-------------\t-----------"			
			
			# sort the dictionary by key before we output, so it looks nice
			for key in sorted(self.payload.required_options.iterkeys()):
				print " %s\t%s\t%s" % ('{0: <16}'.format(key), '{0: <8}'.format(payload.required_options[key][0]), payload.required_options[key][1])
			
			print ""
开发者ID:GhostTH,项目名称:Veil,代码行数:35,代码来源:controller.py


示例2: custShellcodeMenu

	def custShellcodeMenu(self, showTitle=True):
		"""
		Menu to prompt the user for a custom shellcode string.

		Returns None if nothing is specified.
		"""

		# print out the main title to reset the interface
		if showTitle:
			messages.title()

		print ' [?] Use msfvenom or supply custom shellcode?\n'
		print '		1 - msfvenom (default)'
		print '		2 - Custom\n'

		choice = raw_input(" [>] Please enter the number of your choice: ")

		# Continue to msfvenom parameters.
		if choice == '2':
			CustomShell = raw_input(" [>] Please enter custom shellcode (one line, no quotes, \\x00.. format): ")
			return CustomShell
		elif choice != '1':
			print helpers.color(" [!] WARNING: Invalid option chosen, defaulting to msfvenom!", warning=True)
			return None
		else:
			return None
开发者ID:Ehnemz,项目名称:Veil,代码行数:26,代码来源:shellcode.py


示例3: PayloadInfo

    def PayloadInfo(self, payload, showTitle=True, showInfo=True):
        """
        Print out information about a specified payload.

        payload = the payload object to print information on
        showTitle = whether to show the Veil title
        showInfo = whether to show the payload information bit

        """
        if showTitle:
            if settings.TERMINAL_CLEAR != "false":
                messages.title()

        if showInfo:
            # extract the payload class name from the instantiated object, then chop off the load folder prefix
            payloadname = "/".join(
                str(str(payload.__class__)[str(payload.__class__).find("payloads") :]).split(".")[0].split("/")[1:]
            )

            print helpers.color(" Payload information:\n")
            print "\tName:\t\t" + payloadname
            print "\tLanguage:\t" + payload.language
            print "\tRating:\t\t" + payload.rating

            if hasattr(payload, "shellcode"):
                if self.payload.shellcode.customshellcode:
                    print "\tShellcode:\t\tused"

            # format this all nice-like
            print helpers.formatLong("Description:", payload.description)

        # if required options were specified, output them
        if hasattr(self.payload, "required_options"):
            self.PayloadOptions(self.payload)
开发者ID:Cyber-Forensic,项目名称:Veil-Evasion,代码行数:34,代码来源:controller.py


示例4: SetLocalPort

def SetLocalPort():
    global LocalPort

    # Retrieve LocalPort User Input
    try:
        LocalPort = raw_input("[?] What's the Local Port Number: ")
    except KeyboardInterrupt:
        print "\n[!] Exiting...\n"
        sys.exit()

    # Check if LocalPort is numeric.
    try:
        float(LocalPort)
    except ValueError:
        messages.title()
        print
        print "[Error]: Bad port number specified.\n"
        return SetLocalPort()

    # Check if LocalPort is a valid port number.
    if 1 <= int(LocalPort) <= 65535:
        PayloadChoice[int(PayloadType)]()
    else:
        messages.title()
        print
        print "[Error]: Bad port number specified.\n"
        return SetLocalPort()
开发者ID:Darkloop,项目名称:Veil,代码行数:27,代码来源:msfparams.py


示例5: SetShellSrc

def SetShellSrc():
    messages.title()
    global ShellSrc
    global CustomShell
    print '\n[?] Use msfvenom or supply custom shellcode?\n'
    print ' 1 - msfvenom (default)'
    print ' 2 - Custom\n'
    try:
        ShellSrc = raw_input("[>] Please enter the number of your choice: ")
    except KeyboardInterrupt:
        print "\n[!] Exiting...\n"
        sys.exit()

    # Check if ShellSrc is numeric.
    try:
        float(ShellSrc)
    except ValueError:
        return SetShellSrc()

    # Check if ShellSrc is a valid option.
    if not 1 <= int(ShellSrc) <= 2:
        return SetShellSrc()

    # Continue to msfvenom parameters.
    if ShellSrc == '2':
        try:
            CustomShell = raw_input("[>] Please enter custom shellcode (one line, no quotes): ")
            PayloadChoice[int(PayloadType)]()
        except KeyboardInterrupt:
            print "\n[!] Exiting...\n"
            sys.exit()
    else:
        return SetHandler()
开发者ID:Darkloop,项目名称:Veil,代码行数:33,代码来源:msfparams.py


示例6: compilemingw

def compilemingw ():
    # Print Title
    messages.title()

    # 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 payload.c -o payload.exe')
    os.system('rm payload.c')

    messages.title()
    messages.endmsg()
开发者ID:Darkloop,项目名称:Veil,代码行数:10,代码来源:csupport.py


示例7: SetLocalHost

def SetLocalHost():
    global LocalHost

    # Retrieve LocalHost User Input
    try:
        LocalHost = raw_input("[?] What's the Local Host IP Address: ")
    except KeyboardInterrupt:
        print "\n[!] Exiting...\n"
        sys.exit()

    # Temporary Solution for Basic Verification (not perfect, fix later).
    try:
        socket.inet_aton(LocalHost)
        SetLocalPort()
    except socket.error:
        messages.title()
        print
        print "[Error]: Bad IP address specified.\n"
        return SetLocalHost()
开发者ID:Darkloop,项目名称:Veil,代码行数:19,代码来源:msfparams.py


示例8: PayloadInfo

    def PayloadInfo(self, payload, showTitle=True, showInfo=True):
        """
        Print out information about a specified payload.

        payload = the payload object to print information on
        showTitle = whether to show the Veil title
        showInfo = whether to show the payload information bit

        """
        if showTitle:
            messages.title()

        if showInfo:
            # extract the payload class name from the instantiated object, then chop off the load folder prefix
            payloadname = "/".join(str(str(payload.__class__)[str(payload.__class__).find("payloads"):]).split(".")[0].split("/")[1:])

            print helpers.color(" Payload information:\n")
            print "\tName:\t\t" + payloadname
            print "\tLanguage:\t" + payload.language
            print "\tRating:\t\t" + payload.rating

            if hasattr(payload, 'shellcode'):
                if self.payload.shellcode.customshellcode:
                    print "\tShellcode:\t\tused"

            # format this all nice-like
            print helpers.formatLong("Description:", payload.description)

        # if required options were specified, output them
        if hasattr(self.payload, 'required_options'):
            print helpers.color("\n Required Options:\n")

            print " Name\t\t\tCurrent Value\tDescription"
            print " ----\t\t\t-------------\t-----------"

            # sort the dictionary by key before we output, so it looks nice
            for key in sorted(self.payload.required_options.iterkeys()):
                print " %s\t%s\t%s" % ('{0: <16}'.format(key), '{0: <8}'.format(payload.required_options[key][0]), payload.required_options[key][1])

            print ""
开发者ID:Acidburn0zzz,项目名称:Veil-Evasion,代码行数:40,代码来源:controller.py


示例9: SetHandler

def SetHandler():
    messages.title()
    global Handler
    print '\n[?] What type of payload would you like?\n'
    print ' 1 - Reverse TCP'
    print ' 2 - Reverse HTTP'
    print ' 3 - Reverse HTTPS'
    print ' 0 - Main Menu\n'

    # Retrieve Handler User Input
    try:
        Handler = raw_input("[>] Please enter the number of your choice: ")
    except KeyboardInterrupt:
        print "\n[!] Exiting...\n"
        sys.exit()

    # Check if Handler is numeric.
    try:
        float(Handler)
    except ValueError:
        messages.title()
        return SetHandler()

    # Check if Handler is a valid option.
    if Handler == "0":
        SetPayloadType()
    elif 0 <= int(Handler) <= 3:
        SetLocalHost()
    # Payload type validation check.
    else:
        messages.title()
        return SetHandler()
开发者ID:Darkloop,项目名称:Veil,代码行数:32,代码来源:msfparams.py


示例10: SetPayloadType

def SetPayloadType():
    global PayloadType
    messages.title()
    print "\n[?] What payload type would you like to use?\n"
    print " 1 - Meterpreter - Python - void pointer"
    print " 2 - Meterpreter - Python - VirtualAlloc()"
    print " 3 - Meterpreter - Python - base64 Encoded"
    print " 4 - Meterpreter - Python - Letter Substitution"
    print " 5 - Meterpreter - Python - ARC4 Stream Cipher"
    print " 6 - Meterpreter - Python - DES Encrypted"
    print " 7 - Meterpreter - Python - AES Encrypted"
    print " 8 - Meterpreter - C - void pointer"
    print " 9 - Meterpreter - C - VirtualAlloc()"
    print " 0 - Exit Veil\n"

    # Retrieve PayloadType User Input
    try:
        PayloadType = raw_input("[>] Please enter the number of your choice: ")
    except KeyboardInterrupt:
        print "\n[!] Exiting...\n"
        sys.exit()

    # Exit Option
    if PayloadType == "0":
        exit()

    # Check if PayloadType is numeric.
    try:
        float(PayloadType)
    except ValueError:
        return SetPayloadType()

    # Check if PayloadType is a valid option.
    if  0 <= int(PayloadType) <= 9:
        return SetShellSrc()
    else:
        return SetPayloadType()
开发者ID:Darkloop,项目名称:Veil,代码行数:37,代码来源:msfparams.py


示例11: runRPC

        parser.add_argument('--clean', action='store_true', help='Clean out payload folders.')
        #parser.add_argument('--custshell', metavar="\\x00...", help='Custom shellcode string to use.')
        parser.add_argument('--msfoptions', metavar="OPTION=value", nargs='*', help='Options for the specified metasploit payload.')
        parser.add_argument('--msfvenom', metavar="windows/meterpreter/reverse_tcp", nargs='?', help='Metasploit shellcode to generate.')
        parser.add_argument('--overwrite', action='store_true', help='Overwrite payload/source output files if they already exist.')
        parser.add_argument('--pwnstaller', action='store_true', help='Use the Pwnstaller obfuscated loader.')
        parser.add_argument('--rpc', action='store_true', help='Run Veil-Evasion as an RPC server.')
        parser.add_argument('--rpcshutdown', action='store_true', help='Shutdown a running Veil-Evasion RPC server.')
        parser.add_argument('--update', action='store_true', help='Update the Veil framework.')
        parser.add_argument('--version', action="store_true", help='Displays version and quits.')

        args = parser.parse_args()

        # Print version
        if args.version:
            messages.title()
            sys.exit()

        # start up the RPC server
        if args.rpc:
            runRPC()
            sys.exit()

        # shutdown the RPC server
        if args.rpcshutdown:
            shutdownRPC()
            sys.exit()

        # Print main title
        messages.title()
开发者ID:AliBawazeEer,项目名称:Veil-Evasion,代码行数:30,代码来源:Veil-Evasion.py


示例12: supportingFiles

def supportingFiles():

    # Print Title
    messages.title()

    # Determine if the user wants Pyinstaller or Py2Exe.
    print '\n[?] How would you like to create your payload executable?\n'
    print ' 1 - Pyinstaller (default)'
    print ' 2 - Py2Exe\n'
    try:
        PyMaker = raw_input("[>] Please enter the number of your choice: ")
    except KeyboardInterrupt:
        print "\n[!] Exiting...\n"
        sys.exit()

    # Python-Wrapper If-statement
    if PyMaker == "2":
        # Generate setup.py File for Py2Exe
        SetupFile = open('setup.py', 'w')
        SetupFile.write("from distutils.core import setup\n")
        SetupFile.write("import py2exe, sys, os\n\n")
        SetupFile.write("setup(\n")
        SetupFile.write("\toptions = {'py2exe': {'bundle_files': 1}},\n")
        SetupFile.write("\tzipfile = None,\n")
        SetupFile.write("\twindows=['payload.py']\n")
        SetupFile.write(")")
        SetupFile.close()

        # Generate Batch script for Compiling on Windows Using Py2Exe
        RunmeFile = open('runme.bat', 'w')
        RunmeFile.write('rem Batch Script for compiling python code into an executable\n')
        RunmeFile.write('rem on windows with py2exe\n')
        RunmeFile.write('rem Developed by @ChrisTruncer\n\n')
        RunmeFile.write('rem Usage: Drop into your Python folder and click, or anywhere if Python is in your system path\n\n')
        RunmeFile.write("python setup.py py2exe\n")
        RunmeFile.write('cd dist\n')
        RunmeFile.write('move payload.exe ../\n')
        RunmeFile.write('cd ..\n')
        RunmeFile.write('rmdir /S /Q build\n')
        RunmeFile.write('rmdir /S /Q dist\n')
        RunmeFile.close()
        print shellcode.helpfulinfo    

     # Else, Use Pyinstaller (used by default)
    else:
        # Check for Wine python.exe Binary (Thanks to darknight007 for this fix.)
        if(os.path.isfile('/root/.wine/drive_c/Python27/python.exe')):
            print
            os.system('wine /root/.wine/drive_c/Python27/python.exe /root/pyinstaller-2.0/pyinstaller.py --noconsole --onefile payload.py')
            os.system('mv dist/payload.exe .')
            os.system('rm -rf dist')
            os.system('rm -rf build')
            os.system('rm payload.spec')
            os.system('rm logdict*.*')
            os.system('rm payload.py')
            messages.title()
            print shellcode.helpfulinfo
        else:
            messages.title()
            print "\n[Error]: Can't find python.exe in /root/.wine/drive_c/Python27/."
            print "         Make sure the python.exe binary exists before using PyInstaller.\n"
            exit(1)
开发者ID:jiangzhw,项目名称:Veil,代码行数:62,代码来源:supportfiles.py


示例13: PayloadMenu

    def PayloadMenu(self, payload, showTitle=True, args=None):
        """
        Main menu for interacting with a specific payload.

        payload = the payload object we're interacting with
        showTitle = whether to show the main Veil title menu

        Returns the output of OutputMenu() (the full path of the source file or compiled .exe)
        """

        comp = completers.PayloadCompleter(self.payloadCommands, self.payload)
        readline.set_completer_delims(" \t\n;")
        readline.parse_and_bind("tab: complete")
        readline.set_completer(comp.complete)

        # show the title if specified
        if showTitle:
            if settings.TERMINAL_CLEAR != "false":
                messages.title()

        # extract the payload class name from the instantiated object
        # YES, I know this is a giant hack :(
        # basically need to find "payloads" in the path name, then build
        # everything as appropriate
        payloadname = "/".join(
            str(str(payload.__class__)[str(payload.__class__).find("payloads") :]).split(".")[0].split("/")[1:]
        )
        print "\n Payload: " + helpers.color(payloadname) + " loaded\n"

        self.PayloadInfo(payload, showTitle=False, showInfo=False)
        messages.helpmsg(self.payloadCommands, showTitle=False)

        choice = ""
        while choice == "":

            while True:

                choice = raw_input(" [%s>>]: " % payloadname).strip()

                if choice != "":

                    parts = choice.strip().split()
                    cmd = parts[0].lower()

                    # display help menu for the payload
                    if cmd == "info":
                        self.PayloadInfo(payload)
                        choice = ""
                    if cmd == "help":
                        messages.helpmsg(self.payloadCommands)
                        choice = ""
                    # head back to the main menu
                    if cmd == "main" or cmd == "back" or cmd == "home":
                        # finished = True
                        return ""
                        # self.MainMenu()
                    if cmd == "exit" or cmd == "end" or cmd == "quit":
                        raise KeyboardInterrupt
                    # Update Veil via git
                    if cmd == "update":
                        self.UpdateVeil()
                    # set specific options
                    if cmd == "set":

                        # catch the case of no value being supplied
                        if len(parts) == 1:
                            print helpers.color(" [!] ERROR: no value supplied\n", warning=True)

                        else:

                            option = parts[1].upper()
                            value = "".join(parts[2:])

                            #### VALIDATION ####

                            # validate LHOST
                            if option == "LHOST":
                                if "." in value:
                                    hostParts = value.split(".")

                                    if len(hostParts) > 1:

                                        # if the last chunk is a number, assume it's an IP address
                                        if hostParts[-1].isdigit():
                                            # do a regex IP validation
                                            if not re.match(
                                                r"^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$",
                                                value,
                                            ):
                                                print helpers.color(
                                                    "\n [!] ERROR: Bad IP address specified.\n", warning=True
                                                )
                                            else:
                                                try:
                                                    payload.required_options[option][0] = value
                                                    print " [i] %s => %s" % (option, value)
                                                except KeyError:
                                                    print helpers.color(
                                                        "\n [!] ERROR #1: Specify LHOST value in the following screen.\n",
                                                        warning=True,
#.........这里部分代码省略.........
开发者ID:Cyber-Forensic,项目名称:Veil-Evasion,代码行数:101,代码来源:controller.py


示例14: supportingFiles

def supportingFiles(language, payloadFile, options):
    """
    Takes a specific language and payloadFile name written to and generates
    any necessary support files, and/or compiles the payload to an .exe.

    Currently only handles python and c

    options['method'] = "py2exe" or "pyinstaller" currently for python payloads
    """
    if language == "python":

        # if we aren't passed any options, do the interactive menu
        if len(options) == 0:

            if settings.OPERATING_SYSTEM == "Windows":
                options['method'] = "py2exe"
            else:
                # if we have a linux distro, continue...
                # Determine if the user wants Pyinstaller or Py2Exe.
                print '\n [?] How would you like to create your payload executable?\n'
                print '     1 - Pyinstaller (default)'
                print '     2 - Py2Exe\n'

                PyMaker = raw_input(" [>] Please enter the number of your choice: ")
                if PyMaker == "1" or PyMaker == "":
                    options['method'] = "pyinstaller"
                else:
                    options['method'] = "py2exe"

        if options['method'] == "py2exe":

            nameBase = payloadFile.split("/")[-1].split(".")[0]

            # Generate setup.py File for Py2Exe
            SetupFile = open(settings.PAYLOAD_SOURCE_PATH + '/setup.py', 'w')
            SetupFile.write("from distutils.core import setup\n")
            SetupFile.write("import py2exe, sys, os\n\n")
            SetupFile.write("setup(\n")
            SetupFile.write("\toptions = {'py2exe': {'bundle_files': 1}},\n")
            SetupFile.write("\tzipfile = None,\n")
            SetupFile.write("\twindows=['"+nameBase+".py']\n")
            SetupFile.write(")")
            SetupFile.close()

            # Generate Batch script for Compiling on Windows Using Py2Exe
            RunmeFile = open(settings.PAYLOAD_SOURCE_PATH + '/runme.bat', 'w')
            RunmeFile.write('rem Batch Script for compiling python code into an executable\n')
            RunmeFile.write('rem on windows with py2exe\n')
            RunmeFile.write('rem Usage: Drop into your Python folder and click, or anywhere if Python is in your system path\n\n')
            RunmeFile.write("python setup.py py2exe\n")
            RunmeFile.write('cd dist\n')
            exeName = ".".join(payloadFile.split(".")[:-1]) + ".exe"
            RunmeFile.write('move '+nameBase+'.exe ../\n')
            RunmeFile.write('cd ..\n')
            RunmeFile.write('rmdir /S /Q build\n')
            RunmeFile.write('rmdir /S /Q dist\n')
            RunmeFile.close()

            print helpers.color("\npy2exe files 'setup.py' and 'runme.bat' written to:\n"+settings.PAYLOAD_SOURCE_PATH + "\n")

        # Else, Use Pyinstaller (used by default)
        else:
            # Check for Wine python.exe Binary (Thanks to darknight007 for this fix.)
            # Thanks to Tim Medin for patching for non-root non-kali users
            if(os.path.isfile(os.path.expanduser('~/.wine/drive_c/Python27/python.exe'))):

                # extract the payload base name and turn it into an .exe
                exeName = ".".join(payloadFile.split("/")[-1].split(".")[:-1]) + ".exe"

                # TODO: os.system() is depreciated, use subprocess or commands instead
                os.system('wine ' + os.path.expanduser('~/.wine/drive_c/Python27/python.exe') + ' ' + os.path.expanduser(settings.PYINSTALLER_PATH + '/pyinstaller.py') + ' --noconsole --onefile ' + payloadFile )
                os.system('mv dist/'+exeName+' ' + settings.PAYLOAD_COMPILED_PATH)
                os.system('rm -rf dist')
                os.system('rm -rf build')
                os.system('rm *.spec')
                os.system('rm logdict*.*')

                messages.title()
                print "\n [*] Executable written to: " +  helpers.color(settings.PAYLOAD_COMPILED_PATH + exeName)

            else:
                # Tim Medin's Patch for non-root non-kali users
                messages.title()
                print helpers.color("\n [!] ERROR: Can't find python.exe in " + os.path.expanduser('~/.wine/drive_c/Python27/'), warning=True)
                print helpers.color(" [!] ERROR: Make sure the python.exe binary exists before using PyInstaller.", warning=True)
                sys.exit()

    elif language == "c":

        # extract the payload base name and turn it into an .exe
        exeName = ".".join(payloadFile.split("/")[-1].split(".")[:-1]) + ".exe"

        # 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 '+payloadFile+' -o ' + settings.PAYLOAD_COMPILED_PATH + exeName + " -lwsock32")

        print "\n [*] Executable written to: " +  helpers.color(settings.PAYLOAD_COMPILED_PATH + exeName)

    elif language == "cs":

        # extract the payload base name and turn it into an .exe
#.........这里部分代码省略.........
开发者ID:Evil0r,项目名称:Veil-1,代码行数:101,代码来源:supportfiles.py


示例15: OutputMenu

    def OutputMenu(self, payload, code, showTitle=True, interactive=True, OutputBaseChoice=""):
        """
        Write a chunk of payload code to a specified ouput file base.
        Also outputs a handler script if required from the options.

        code = the source code to write
        OutputBaseChoice = "payload" or user specified string

        Returns the full name the source was written to.
        """

        # if we get .exe code back, output to the compiled folder, otherwise write to the source folder
        if payload.extension == "exe":
            outputFolder = settings.PAYLOAD_COMPILED_PATH
        else:
            outputFolder = settings.PAYLOAD_SOURCE_PATH

        # only show get input if we're doing the interactive menu
        if interactive:
            if showTitle:
                messages.title()

            # Get the base install name for the payloads (i.e. OutputBaseChoice.py/OutputBaseChoice.exe)
            print " [*] Press [enter] for 'payload'"
            OutputBaseChoice = raw_input(" [>] Please enter the base name for output files: ")

        if OutputBaseChoice == "": OutputBaseChoice = "payload"

        # walk the output path and grab all the file bases, disregarding extensions
        fileBases = []
        for (dirpath, dirnames, filenames) in os.walk(outputFolder):
            fileBases.extend(list(set([x.split(".")[0] for x in filenames if x.split(".")[0] != ''])))
            break

        # as long as the file exists, increment a counter to add to the filename
        # i.e. "payload3.py", to make sure we don't overwrite anything
        FinalBaseChoice = OutputBaseChoice
        x = 1
        while FinalBaseChoice in fileBases:
            FinalBaseChoice = OutputBaseChoice + str(x)
            x += 1

        # set the output name to /outout/source/BASENAME.EXT
        OutputFileName = outputFolder + FinalBaseChoice + "." + payload.extension

        OutputFile = open(OutputFileName, 'w')
        OutputFile.write(code)
        OutputFile.close()

        # start building the information string for the generated payload
        message = "\n Language:\t\t"+helpers.color(payload.language)+"\n Payload:\t\t"+payload.shortname

        if hasattr(payload, 'shellcode'):
            # check if msfvenom was used or something custom, print appropriately
            if payload.shellcode.customshellcode != "":
                message += "\n Shellcode:\t\tcustom"
            else:
                message += "\n Shellcode:\t\t" + payload.shellcode.msfvenompayload

                # if the shellcode wasn't custom, build out a handler script
                handler = "use exploit/multi/handler\n"
                handler += "set PAYLOAD " + payload.shellcode.msfvenompayload + "\n"
                handler += "set LHOST 0.0.0.0\n"
                
                # extract LPORT if it's there
                p = re.compile('LPORT=(.*?) ')
                parts = p.findall(payload.shellcode.msfvenomCommand)
                if len(parts) > 0:
                    handler += "set LPORT " + parts[0] + "\n"

                handler += "set ExitOnSession false\n"
                handler += "set AutoRunScript post/windows/manage/migrate\n"
                handler += "exploit -j\n"

            # print out any msfvenom options we used in shellcode generation if specified
            if len(payload.shellcode.options) > 0:
                message += "\n Options:\t\t"
                parts = ""
                for option in payload.shellcode.options:
                    parts += ' ' + option + ' '
                message += parts.strip()

            # reset the internal shellcode state the options don't persist
            payload.shellcode.Reset()

        # if required options were specified, output them
        if hasattr(payload, 'required_options'):
            message += "\n Required Options:\t"
            t = ""
            # sort the dictionary by key before we output, so it looks nice
            for key in sorted(payload.required_options.iterkeys()):
                t += " " + key + "=" + payload.required_options[key][0] + " "
            message += t.strip()

            # check if any options specify that we should build a handler out
            keys = payload.required_options.keys()

            if "LHOST" in keys:

                handler = "use exploit/multi/handler\n"
#.........这里部分代码省略.........
开发者ID:Linnor,项目名称:Veil,代码行数:101,代码来源:controller.py


示例16: OutputMenu

    def OutputMenu(self, payload, code, showTitle=True, interactive=True, OutputBaseChoice=""):
        """
		Write a chunk of payload code to a specified ouput file base.
		
		code = the source code to write
		OutputBaseChoice = "payload" or user specified string
		
		Returns the full name the source was written to.
		"""

        # if we get .exe code back, output to the compiled folder, otherwise write to the source folder
        if payload.extension == "exe":
            outputFolder = veil.PAYLOAD_COMPILED_PATH
        else:
            outputFolder = veil.PAYLOAD_SOURCE_PATH

            # only show get input if we're doing the interactive menu
        if interactive:
            if showTitle:
                messages.title()

                # Get the base install name for the payloads (i.e. OutputBaseChoice.py/OutputBaseChoice.exe)
            print " [*] Press [enter] for 'payload'"
            OutputBaseChoice = raw_input(" [>] Please enter the base name for output files: ")

        if OutputBaseChoice == "":
            OutputBaseChoice = "payload"

        # set the output name to /outout/source/BASENAME.EXT
        OutputFileName = outputFolder + OutputBaseChoice + "." + payload.extension

        # as long as the file exists, increment a counter to add to the filename
        # i.e. "payload3.py", to make sure we don't overwrite anything
        x = 1
        while os.path.isfile(OutputFileName):
            OutputFileName = outputFolder + OutputBaseChoice + str(x) + "." + payload.extension
            x += 1
        OutputFile = open(OutputFileName, "w")
        OutputFile.write(code)
        OutputFile.close()

        # start building the information string for the generated payload
        message = "\n Language:\t\t" + helpers.color(payload.language) + "\n Payload:\t\t" + payload.shortname

        if hasattr(payload, "shellcode"):
            # check if msfvenom was used or something custom, print appropriately
            if payload.shellcode.customshellcode != "":
                message += "\n Shellcode:\t\tcustom"
            else:
                message += "\n Shellcode:\t\t" + payload.shellcode.msfvenompayload

                # print out any msfvenom options we used in shellcode generation if specified
            if len(payload.shellcode.options) > 0:
                message += "\n Options:\t\t"
                parts = ""
                for option in payload.shellcode.options:
                    parts += " " + option + " "
                message += parts.strip()

                # if required options were specified, output them
        if hasattr(payload, "required_options"):
            message += "\n Required Options:\t"
            t = ""
            # sort the dictionary by key before we output, so it looks nice
            for key in sorted(payload.required_options.iterkeys()):
                t += " " + key + "=" + payload.required_options[key][0] + " "
            message += t.strip()

        message += "\n Source File:\t\t" + OutputFileName + "\n"

        # print out notes if set
        if hasattr(payload, "notes"):
            message += " Notes:\t\t\t" + payload.notes

            # check if compile_to_exe is in the required options, if so,
            # call supportfiles.supportingFiles() to compile appropriately
        if hasattr(self.payload, "required_options"):
            if "compile_to_exe" in self.payload.required_options:
                value = self.payload.required_options["compile_to_exe"][0].lower()[0]
                if value == "y" or value == True:
                    if interactive:
                        supportfiles.supportingFiles(self.payload.language, OutputFileName, {})
                    else:
                        supportfiles.supportingFiles(self.payload.language, OutputFileName, {"method": "pyinstaller"})

                        # print the full message containing generation notes
        print message

        # print the end message
        messages.endmsg()

        if interactive:
            raw_input(" [>] press any key to return to the main menu: ")
            self.MainMenu(showMessage=True)
开发者ID:kissthink,项目名称:Veil,代码行数:94,代码来源:controller.py


示例17: PayloadMenu

    def PayloadMenu(self, payload, showTitle=True):
        """
        Main menu for interacting with a specific payload.

        payload = the payload object we're interacting with
        showTitle = whether to show the main Veil title menu

        Returns the output of OutputMenu() (the full path of the source file or compiled .exe)
        """

        comp = completers.PayloadCompleter(self.payload)
        readline.set_completer_delims(' \t\n;')
        readline.parse_and_bind("tab: complete")
        readline.set_completer(comp.complete)

        # show the title if specified
        if showTitle:
            messages.title()

        print " Payload: " + helpers.color(payload.language + "/" + payload.shortname) + " loaded"

        self.PayloadInfo(payload, showTitle=False, showInfo=False)
        messages.helpmsg(self.payloadCommands, showTitle=False)

        choice = ""
        while choice == "":

            while True:

                choice = raw_input(" [>] Please enter a command: ").strip()

                if choice != "":

                    parts = choice.strip().split()
                    # display help menu for the payload
                    if parts[0] == "info":
                        self.PayloadInfo(payload)
                        choice = ""
                    if parts[0] == "help":
                        if len(parts) > 1:
                            if parts[1] == "crypters" or parts[1] == "[crypters]":
                                messages.helpCrypters()
                        else:
                            messages.helpmsg(self.payloadCommands)
                        choice = ""
                    # head back to the main menu
                    if parts[0] == "main" or parts[0] == "back":
                        #finished = True
                        return ""
                        #self.MainMenu()
                    if parts[0] == "exit":
                        raise KeyboardInterrupt

                    # Update Veil via git
                    if parts[0] == "update":
                        self.UpdateVeil()

                    # set specific options
                    if parts[0] == "set":

                        # catch the case of no value being supplied
                        if len(parts) == 1:
                            print helpers.color(" [!] ERROR: no value supplied\n", warning=True)

                        else:

                            option = parts[1]
                            value = "".join(parts[2:])

                            #### VALIDATION ####

                            # validate LHOST
                            if option == "LHOST":
                                hostParts = value.split(".")

                                if len(hostParts) > 1:

                                    # if the last chunk is a number, assume it's an IP address
                                    if hostParts[-1].isdigit():
                                        # do a regex IP validation
                                        if not re.match(r"^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$",value):
                                            print helpers.color("\n [!] ERROR: Bad IP address specified.\n", warning=True)
                                        else:
                                            try:
                                                payload.required_options[option][0] = value
                                            except KeyError:
                                                print helpers.color("\n [!] ERROR: Specify LHOST value in the following screen.\n", warning=True)
                                            except AttributeError:
                                                print helpers.color("\n [!] ERROR: Specify LHOST value in the following screen.\n", warning=True)

                                    # assume we've been passed a domain name
                                    else:
                                        if helpers.isValidHostname(value):
                                            pass
                                        else:
                                            print helpers.color("\n [!] ERROR: Bad hostname specified.\n", warning=True)

                                else:
                                    print helpers.color("\n [!] ERROR: Bad IP address or hostname specified.\n", warning=True)

#.........这里部分代码省略.........
开发者ID:Linnor,项目名称:Veil,代码行数:101,代码来源:controller.py


示例18: MainMenu


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python core_tags._Runtime函数代码示例发布时间:2022-05-27
下一篇:
Python helpers.randomString函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap