本文整理汇总了Python中src.utils.logs.update_payload函数的典型用法代码示例。如果您正苦于以下问题:Python update_payload函数的具体用法?Python update_payload怎么用?Python update_payload使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了update_payload函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: eb_injection_handler
#.........这里部分代码省略.........
the_type = " parameter"
elif settings.USER_AGENT_INJECTION == True:
header_name = " User-Agent"
found_vuln_parameter = ""
the_type = " HTTP header"
elif settings.REFERER_INJECTION == True:
header_name = " Referer"
found_vuln_parameter = ""
the_type = " HTTP header"
elif settings.CUSTOM_HEADER_INJECTION == True:
header_name = " " + settings.CUSTOM_HEADER_NAME
found_vuln_parameter = ""
the_type = " HTTP header"
else:
header_name = ""
the_type = " parameter"
if http_request_method == "GET":
found_vuln_parameter = parameters.vuln_GET_param(url)
else :
found_vuln_parameter = vuln_parameter
if len(found_vuln_parameter) != 0 :
found_vuln_parameter = " '" + Style.UNDERLINE + found_vuln_parameter + Style.RESET_ALL + Style.BRIGHT + "'"
# Print the findings to log file.
if export_injection_info == False:
export_injection_info = logs.add_type_and_technique(export_injection_info, filename, injection_type, technique)
if vp_flag == True:
vp_flag = logs.add_parameter(vp_flag, filename, the_type, header_name, http_request_method, vuln_parameter, payload)
logs.update_payload(filename, counter, payload)
counter = counter + 1
if not settings.LOAD_SESSION:
print ""
# Print the findings to terminal.
success_msg = "The (" + http_request_method + ")"
success_msg += found_vuln_parameter + header_name
success_msg += the_type + " is vulnerable to " + injection_type + "."
print settings.print_success_msg(success_msg)
print " (+) Type : " + Fore.YELLOW + Style.BRIGHT + injection_type + Style.RESET_ALL + ""
print " (+) Technique : " + Fore.YELLOW + Style.BRIGHT + technique.title() + Style.RESET_ALL + ""
print " (+) Payload : " + Fore.YELLOW + Style.BRIGHT + re.sub("%20", " ", payload) + Style.RESET_ALL
# Export session
if not settings.LOAD_SESSION:
session_handler.injection_point_importation(url, technique, injection_type, separator, shell[0], vuln_parameter, prefix, suffix, TAG, alter_shell, payload, http_request_method, url_time_response=0, delay=0, how_long=0, output_length=0, is_vulnerable="True")
else:
whitespace = settings.WHITESPACE[0]
settings.LOAD_SESSION = False
# Check for any enumeration options.
if settings.ENUMERATION_DONE == True :
while True:
question_msg = "Do you want to enumerate again? [Y/n/q] > "
enumerate_again = raw_input("\n" + settings.print_question_msg(question_msg)).lower()
if enumerate_again in settings.CHOICE_YES:
eb_enumeration.do_check(separator, TAG, prefix, suffix, http_request_method, url, vuln_parameter, alter_shell, filename)
print ""
break
elif enumerate_again in settings.CHOICE_NO:
break
示例2: cb_injection_handler
#.........这里部分代码省略.........
no_result = False
if settings.COOKIE_INJECTION == True:
header_name = " Cookie"
found_vuln_parameter = vuln_parameter
the_type = " HTTP header"
elif settings.USER_AGENT_INJECTION == True:
header_name = " User-Agent"
found_vuln_parameter = ""
the_type = " HTTP header"
elif settings.REFERER_INJECTION == True:
header_name = " Referer"
found_vuln_parameter = ""
the_type = " HTTP header"
else:
header_name = ""
the_type = " parameter"
if http_request_method == "GET":
found_vuln_parameter = parameters.vuln_GET_param(url)
else :
found_vuln_parameter = vuln_parameter
if len(found_vuln_parameter) != 0 :
found_vuln_parameter = " '" + Style.UNDERLINE + found_vuln_parameter + Style.RESET_ALL + Style.BRIGHT + "'"
# Print the findings to log file.
if export_injection_info == False:
export_injection_info = logs.add_type_and_technique(export_injection_info, filename, injection_type, technique)
if vp_flag == True:
vp_flag = logs.add_parameter(vp_flag, filename, http_request_method, vuln_parameter, payload)
logs.update_payload(filename, counter, payload)
counter = counter + 1
# Print the findings to terminal.
print Style.BRIGHT + "\n(!) The ("+ http_request_method + ")" + found_vuln_parameter + header_name + the_type + " is vulnerable to "+ injection_type + "." + Style.RESET_ALL
print " (+) Type : "+ Fore.YELLOW + Style.BRIGHT + injection_type + Style.RESET_ALL + ""
print " (+) Technique : "+ Fore.YELLOW + Style.BRIGHT + technique.title() + Style.RESET_ALL + ""
print " (+) Payload : "+ Fore.YELLOW + Style.BRIGHT + re.sub("%20", " ", re.sub("%2B", "+",payload)) + Style.RESET_ALL
# Check for any enumeration options.
if settings.ENUMERATION_DONE == True :
while True:
enumerate_again = raw_input("\n(?) Do you want to enumerate again? [Y/n/q] > ").lower()
if enumerate_again in settings.CHOISE_YES:
cb_enumeration.do_check(separator, TAG, prefix, suffix, whitespace, http_request_method, url, vuln_parameter, alter_shell, filename)
break
elif enumerate_again in settings.CHOISE_NO:
break
elif enumerate_again in settings.CHOISE_QUIT:
sys.exit(0)
else:
if enumerate_again == "":
enumerate_again = "enter"
print Back.RED + "(x) Error: '" + enumerate_again + "' is not a valid answer." + Style.RESET_ALL
pass
else:
cb_enumeration.do_check(separator, TAG, prefix, suffix, whitespace, http_request_method, url, vuln_parameter, alter_shell, filename)
# Check for any system file access options.
if settings.FILE_ACCESS_DONE == True :
while True:
file_access_again = raw_input("(?) Do you want to access files again? [Y/n/q] > ").lower()
if file_access_again in settings.CHOISE_YES:
示例3: tb_injection_handler
#.........这里部分代码省略.........
is_vulnerable = False
if settings.COOKIE_INJECTION == True:
header_name = " Cookie"
found_vuln_parameter = vuln_parameter
the_type = " HTTP header"
elif settings.USER_AGENT_INJECTION == True:
header_name = " User-Agent"
found_vuln_parameter = ""
the_type = " HTTP header"
elif settings.REFERER_INJECTION == True:
header_name = " Referer"
found_vuln_parameter = ""
the_type = " HTTP header"
else:
header_name = ""
the_type = " parameter"
if http_request_method == "GET":
found_vuln_parameter = parameters.vuln_GET_param(url)
else :
found_vuln_parameter = vuln_parameter
if len(found_vuln_parameter) != 0 :
found_vuln_parameter = " '" + Style.UNDERLINE + found_vuln_parameter + Style.RESET_ALL + Style.BRIGHT + "'"
# Print the findings to log file.
if export_injection_info == False:
export_injection_info = logs.add_type_and_technique(export_injection_info, filename, injection_type, technique)
if vp_flag == True:
vp_flag = logs.add_parameter(vp_flag, filename, http_request_method, vuln_parameter, payload)
logs.update_payload(filename, counter, payload)
counter = counter + 1
# Print the findings to terminal.
print Style.BRIGHT + "\n(!) The ("+ http_request_method + ")" + found_vuln_parameter + header_name + the_type + " is vulnerable to "+ injection_type + "." + Style.RESET_ALL
print " (+) Type : "+ Fore.YELLOW + Style.BRIGHT + injection_type + Style.RESET_ALL + ""
print " (+) Technique : "+ Fore.YELLOW + Style.BRIGHT + technique.title() + Style.RESET_ALL + ""
print " (+) Payload : "+ Fore.YELLOW + Style.BRIGHT + re.sub("%20", " ", payload.replace("\n", "\\n")) + Style.RESET_ALL
# Check for any enumeration options.
if settings.ENUMERATION_DONE == True:
while True:
enumerate_again = raw_input("\n(?) Do you want to enumerate again? [Y/n/q] > ").lower()
if enumerate_again in settings.CHOISE_YES:
tb_enumeration.do_check(separator, maxlen, TAG, prefix, suffix, delay, http_request_method, url, vuln_parameter, alter_shell, filename)
break
elif enumerate_again in settings.CHOISE_NO:
break
elif enumerate_again in settings.CHOISE_QUIT:
sys.exit(0)
else:
if enumerate_again == "":
enumerate_again = "enter"
print Back.RED + "(x) Error: '" + enumerate_again + "' is not a valid answer." + Style.RESET_ALL
pass
else:
tb_enumeration.do_check(separator, maxlen, TAG, prefix, suffix, delay, http_request_method, url, vuln_parameter, alter_shell, filename)
# Check for any system file access options.
if settings.FILE_ACCESS_DONE == True:
while True:
file_access_again = raw_input("(?) Do you want to access files again? [Y/n/q] > ").lower()
if file_access_again in settings.CHOISE_YES:
示例4: tfb_injection_handler
#.........这里部分代码省略.........
the_type = " parameter"
elif settings.USER_AGENT_INJECTION == True:
header_name = " User-Agent"
found_vuln_parameter = ""
the_type = " HTTP header"
elif settings.REFERER_INJECTION == True:
header_name = " Referer"
found_vuln_parameter = ""
the_type = " HTTP header"
elif settings.CUSTOM_HEADER_INJECTION == True:
header_name = " " + settings.CUSTOM_HEADER_NAME
found_vuln_parameter = ""
the_type = " HTTP header"
else:
header_name = ""
the_type = " parameter"
if http_request_method == "GET":
found_vuln_parameter = parameters.vuln_GET_param(url)
else :
found_vuln_parameter = vuln_parameter
if len(found_vuln_parameter) != 0 :
found_vuln_parameter = " '" + found_vuln_parameter + Style.RESET_ALL + Style.BRIGHT + "'"
# Print the findings to log file.
if export_injection_info == False:
export_injection_info = logs.add_type_and_technique(export_injection_info, filename, injection_type, technique)
if vp_flag == True:
vp_flag = logs.add_parameter(vp_flag, filename, the_type, header_name, http_request_method, vuln_parameter, payload)
logs.update_payload(filename, counter, payload)
counter = counter + 1
if not settings.LOAD_SESSION:
print ""
# Print the findings to terminal.
success_msg = "The"
if found_vuln_parameter == " ":
success_msg += http_request_method + ""
success_msg += the_type + header_name
success_msg += found_vuln_parameter + " seems injectable via "
success_msg += "(" + injection_type.split(" ")[0] + ") " + technique + "."
print settings.print_success_msg(success_msg)
print settings.SUB_CONTENT_SIGN + "Payload: " + re.sub("%20", " ", payload.replace("\n", "\\n")) + Style.RESET_ALL
# Export session
if not settings.LOAD_SESSION:
shell = ""
session_handler.injection_point_importation(url, technique, injection_type, separator, shell, vuln_parameter, prefix, suffix, TAG, alter_shell, payload, http_request_method, url_time_response, delay, how_long, output_length, is_vulnerable=menu.options.level)
#possibly_vulnerable = False
else:
settings.LOAD_SESSION = False
# Delete previous shell (text) files (output) from temp.
delete_previous_shell(separator, payload, TAG, cmd, prefix, suffix, whitespace, http_request_method, url, vuln_parameter, OUTPUT_TEXTFILE, alter_shell, filename)
if settings.TARGET_OS == "win":
time.sleep(1)
new_line = False
# Check for any enumeration options.
if settings.ENUMERATION_DONE == True :
while True:
question_msg = "Do you want to enumerate again? [Y/n/q] > "
示例5: tb_injection_handler
#.........这里部分代码省略.........
the_type = " HTTP header"
elif settings.USER_AGENT_INJECTION == True:
header_name = " User-Agent"
found_vuln_parameter = ""
the_type = " HTTP header"
elif settings.REFERER_INJECTION == True:
header_name = " Referer"
found_vuln_parameter = ""
the_type = " HTTP header"
elif settings.CUSTOM_HEADER_INJECTION == True:
header_name = " " + settings.CUSTOM_HEADER_NAME
found_vuln_parameter = ""
the_type = " HTTP header"
else:
header_name = ""
the_type = " parameter"
if http_request_method == "GET":
found_vuln_parameter = parameters.vuln_GET_param(url)
else :
found_vuln_parameter = vuln_parameter
if len(found_vuln_parameter) != 0 :
found_vuln_parameter = " '" + Style.UNDERLINE + found_vuln_parameter + Style.RESET_ALL + Style.BRIGHT + "'"
# Print the findings to log file.
if export_injection_info == False:
export_injection_info = logs.add_type_and_technique(export_injection_info, filename, injection_type, technique)
if vp_flag == True:
vp_flag = logs.add_parameter(vp_flag, filename, http_request_method, vuln_parameter, payload)
logs.update_payload(filename, counter, payload)
counter = counter + 1
if not settings.LOAD_SESSION:
print ""
# Print the findings to terminal.
print Style.BRIGHT + "(!) The (" + http_request_method + ")" + found_vuln_parameter + header_name + the_type + " is vulnerable to " + injection_type + "." + Style.RESET_ALL
print " (+) Type : " + Fore.YELLOW + Style.BRIGHT + injection_type + Style.RESET_ALL + ""
print " (+) Technique : " + Fore.YELLOW + Style.BRIGHT + technique.title() + Style.RESET_ALL + ""
print " (+) Payload : " + Fore.YELLOW + Style.BRIGHT + re.sub("%20", " ", payload.replace("\n", "\\n")) + Style.RESET_ALL
if not settings.LOAD_SESSION:
shell = ""
session_handler.injection_point_importation(url, technique, injection_type, separator, shell, vuln_parameter, prefix, suffix, TAG, alter_shell, payload, http_request_method, url_time_response, delay, how_long, output_length, is_vulnerable)
is_vulnerable = False
else:
settings.LOAD_SESSION = False
new_line = False
# Check for any enumeration options.
if settings.ENUMERATION_DONE == True:
while True:
enumerate_again = raw_input("\n" + settings.QUESTION_SIGN + "Do you want to enumerate again? [Y/n/q] > ").lower()
if enumerate_again in settings.CHOICE_YES:
tb_enumeration.do_check(separator, maxlen, TAG, cmd, prefix, suffix, delay, http_request_method, url, vuln_parameter, alter_shell, filename, url_time_response)
print ""
break
elif enumerate_again in settings.CHOICE_NO:
new_line = True
break
elif enumerate_again in settings.CHOICE_QUIT:
sys.exit(0)
示例6: eb_injection_handler
#.........这里部分代码省略.........
no_result = False
if settings.COOKIE_INJECTION == True:
header_name = " Cookie"
found_vuln_parameter = vuln_parameter
the_type = " HTTP header"
elif settings.USER_AGENT_INJECTION == True:
header_name = " User-Agent"
found_vuln_parameter = ""
the_type = " HTTP header"
elif settings.REFERER_INJECTION == True:
header_name = " Referer"
found_vuln_parameter = ""
the_type = " HTTP header"
else:
header_name = ""
the_type = " parameter"
if http_request_method == "GET":
found_vuln_parameter = parameters.vuln_GET_param(url)
else :
found_vuln_parameter = vuln_parameter
if len(found_vuln_parameter) != 0 :
found_vuln_parameter = " '" + Style.UNDERLINE + found_vuln_parameter + Style.RESET_ALL + Style.BRIGHT + "'"
# Print the findings to log file.
if export_injection_info == False:
export_injection_info = logs.add_type_and_technique(export_injection_info, filename, injection_type, technique)
if vp_flag == True:
vp_flag = logs.add_parameter(vp_flag, filename, http_request_method, vuln_parameter, payload)
logs.update_payload(filename, counter, payload)
counter = counter + 1
# Print the findings to terminal.
print Style.BRIGHT + "\n(!) The ("+ http_request_method + ")" + found_vuln_parameter + header_name + the_type + " is vulnerable to "+ injection_type + "." + Style.RESET_ALL
print " (+) Type : "+ Fore.YELLOW + Style.BRIGHT + injection_type + Style.RESET_ALL + ""
print " (+) Technique : "+ Fore.YELLOW + Style.BRIGHT + technique.title() + Style.RESET_ALL + ""
print " (+) Payload : "+ Fore.YELLOW + Style.BRIGHT + re.sub("%20", " ", payload) + Style.RESET_ALL
# Check for any enumeration options.
if settings.ENUMERATION_DONE == True :
while True:
enumerate_again = raw_input("\n(?) Do you want to enumerate again? [Y/n/q] > ").lower()
if enumerate_again in settings.CHOISE_YES:
eb_enumeration.do_check(separator, TAG, prefix, suffix, http_request_method, url, vuln_parameter, filename)
break
elif enumerate_again in settings.CHOISE_NO:
break
elif enumerate_again in settings.CHOISE_QUIT:
sys.exit(0)
else:
if enumerate_again == "":
enumerate_again = "enter"
print Back.RED + "(x) Error: '" + enumerate_again + "' is not a valid answer." + Style.RESET_ALL
pass
else:
eb_enumeration.do_check(separator, TAG, prefix, suffix, http_request_method, url, vuln_parameter, filename)
# Check for any system file access options.
if settings.FILE_ACCESS_DONE == True :
while True:
file_access_again = raw_input("(?) Do you want to access files again? [Y/n/q] > ").lower()
示例7: shellshock_handler
def shellshock_handler(url, http_request_method, filename):
counter = 1
vp_flag = True
no_result = True
export_injection_info = False
injection_type = "results-based command injection"
technique = "shellshock injection technique"
sys.stdout.write("(*) Testing the "+ technique + "... ")
sys.stdout.flush()
try:
i = 0
total = len(shellshock_cves) * len(headers)
for cve in shellshock_cves:
for check_header in headers:
i = i + 1
attack_vector = "echo " + cve + ":Done;"
payload = shellshock_payloads(cve, attack_vector)
# Check if defined "--verbose" option.
if menu.options.verbose:
sys.stdout.write("\n" + Fore.GREY + "(~) Payload: " + payload + Style.RESET_ALL)
header = {check_header : payload}
request = urllib2.Request(url, None, header)
response = urllib2.urlopen(request)
if not menu.options.verbose:
percent = ((i*100)/total)
float_percent = "{0:.1f}".format(round(((i*100)/(total*1.0)),2))
if percent == 100:
if no_result == True:
percent = Fore.RED + "FAILED" + Style.RESET_ALL
else:
percent = Fore.GREEN + "SUCCEED" + Style.RESET_ALL
elif cve in response.info():
percent = Fore.GREEN + "SUCCEED" + Style.RESET_ALL
else:
percent = str(float_percent )+"%"
sys.stdout.write("\r(*) Testing the "+ technique + "... " + "[ " + percent + " ]")
sys.stdout.flush()
# Print the findings to log file.
if export_injection_info == False:
export_injection_info = logs.add_type_and_technique(export_injection_info, filename, injection_type, technique)
if vp_flag == True:
vuln_parameter = "HTTP Header"
vp_flag = logs.add_parameter(vp_flag, filename, check_header, vuln_parameter, payload)
logs.update_payload(filename, counter, payload)
if cve in response.info():
no_result = False
print Style.BRIGHT + "\n(!) The ("+ check_header + ") '" + Style.UNDERLINE + url + Style.RESET_ALL + Style.BRIGHT + "' is vulnerable to "+ injection_type +"."+ Style.RESET_ALL
print " (+) Type : "+ Fore.YELLOW + Style.BRIGHT + injection_type.title() + Style.RESET_ALL + ""
print " (+) Technique : "+ Fore.YELLOW + Style.BRIGHT + technique.title() + Style.RESET_ALL + ""
print " (+) Payload : "+ Fore.YELLOW + Style.BRIGHT + "\"" + payload + "\"" + Style.RESET_ALL
# Enumeration options.
if settings.ENUMERATION_DONE == True :
print ""
while True:
enumerate_again = raw_input("(?) Do you want to enumerate again? [Y/n/q] > ").lower()
if enumerate_again in settings.CHOISE_YES:
enumeration(url, cve, check_header, filename)
break
elif enumerate_again in settings.CHOISE_NO:
break
elif enumerate_again in settings.CHOISE_QUIT:
sys.exit(0)
else:
if enumerate_again == "":
enumerate_again = "enter"
print Back.RED + "(x) Error: '" + enumerate_again + "' is not a valid answer." + Style.RESET_ALL
pass
else:
enumeration(url, cve, check_header, filename)
# File access options.
if settings.FILE_ACCESS_DONE == True :
while True:
file_access_again = raw_input("(?) Do you want to access files again? [Y/n/q] > ").lower()
if file_access_again in settings.CHOISE_YES:
file_access(url, cve, check_header, filename)
break
elif file_access_again in settings.CHOISE_NO:
break
elif file_access_again in settings.CHOISE_QUIT:
sys.exit(0)
else:
if file_access_again == "":
file_access_again = "enter"
print Back.RED + "(x) Error: '" + file_access_again + "' is not a valid answer." + Style.RESET_ALL
pass
else:
file_access(url, cve, check_header, filename)
#.........这里部分代码省略.........
示例8: len
header_name = ""
the_type = " parameter"
if http_request_method == "GET":
found_vuln_parameter = parameters.vuln_GET_param(url)
else :
found_vuln_parameter = vuln_parameter
if len(found_vuln_parameter) != 0 :
found_vuln_parameter = " '" + Style.UNDERLINE + found_vuln_parameter + Style.RESET_ALL + Style.BRIGHT + "'"
# Print the findings to log file.
if export_injection_info == False:
export_injection_info = logs.add_type_and_technique(export_injection_info, filename, injection_type, technique)
if vp_flag == True:
vp_flag = logs.add_parameter(vp_flag, filename, http_request_method, vuln_parameter, payload)
logs.update_payload(filename, counter, payload)
counter = counter + 1
# Print the findings to terminal.
print Style.BRIGHT + "\n(!) The (" + http_request_method + ")" + found_vuln_parameter + header_name + the_type + " is vulnerable to " + injection_type + "." + Style.RESET_ALL
print " (+) Type : " + Fore.YELLOW + Style.BRIGHT + injection_type + Style.RESET_ALL + ""
print " (+) Technique : " + Fore.YELLOW + Style.BRIGHT + technique.title() + Style.RESET_ALL + ""
print " (+) Payload : " + Fore.YELLOW + Style.BRIGHT + re.sub("%20", " ", payload.replace("\n", "\\n")) + Style.RESET_ALL
# Check for any enumeration options.
if settings.ENUMERATION_DONE == True :
while True:
enumerate_again = raw_input("\n(?) Do you want to enumerate again? [Y/n/q] > ").lower()
if enumerate_again in settings.CHOISE_YES:
fb_enumeration.do_check(separator, payload, TAG, delay, prefix, suffix, http_request_method, url, vuln_parameter, OUTPUT_TEXTFILE, alter_shell, filename)
break
示例9: cb_injection_handler
#.........这里部分代码省略.........
the_type = " HTTP header"
elif settings.REFERER_INJECTION == True:
header_name = " Referer"
found_vuln_parameter = ""
the_type = " HTTP header"
elif settings.HOST_INJECTION == True:
header_name = " Host"
found_vuln_parameter = ""
the_type = " HTTP header"
elif settings.CUSTOM_HEADER_INJECTION == True:
header_name = " " + settings.CUSTOM_HEADER_NAME
found_vuln_parameter = ""
the_type = " HTTP header"
else:
header_name = ""
the_type = " parameter"
if http_request_method == "GET":
found_vuln_parameter = parameters.vuln_GET_param(url)
else :
found_vuln_parameter = vuln_parameter
if len(found_vuln_parameter) != 0 :
found_vuln_parameter = " '" + found_vuln_parameter + Style.RESET_ALL + Style.BRIGHT + "'"
# Print the findings to log file.
if export_injection_info == False:
export_injection_info = logs.add_type_and_technique(export_injection_info, filename, injection_type, technique)
if vp_flag == True:
vp_flag = logs.add_parameter(vp_flag, filename, the_type, header_name, http_request_method, vuln_parameter, payload)
logs.update_payload(filename, counter, payload)
counter = counter + 1
if not settings.LOAD_SESSION:
if not settings.VERBOSITY_LEVEL >= 1:
print ""
else:
checks.total_of_requests()
# Print the findings to terminal.
success_msg = "The"
if len(found_vuln_parameter) > 0 and not "cookie" in header_name :
success_msg += " " + http_request_method + ""
success_msg += ('', ' (JSON)')[settings.IS_JSON] + ('', ' (SOAP/XML)')[settings.IS_XML] + the_type + header_name
success_msg += found_vuln_parameter + " seems injectable via "
success_msg += "(" + injection_type.split(" ")[0] + ") " + technique + "."
print settings.print_success_msg(success_msg)
print settings.SUB_CONTENT_SIGN + "Payload: " + str(checks.url_decode(payload)) + Style.RESET_ALL
# Export session
if not settings.LOAD_SESSION:
session_handler.injection_point_importation(url, technique, injection_type, separator, shell[0], vuln_parameter, prefix, suffix, TAG, alter_shell, payload, http_request_method, url_time_response=0, timesec=0, how_long=0, output_length=0, is_vulnerable=menu.options.level)
else:
whitespace = settings.WHITESPACE[0]
settings.LOAD_SESSION = False
# Check for any enumeration options.
new_line = True
if settings.ENUMERATION_DONE == True :
while True:
if not menu.options.batch:
question_msg = "Do you want to enumerate again? [Y/n] > "
enumerate_again = raw_input("\n" + settings.print_question_msg(question_msg)).lower()
else:
示例10: tfb_injection_handler
#.........这里部分代码省略.........
no_result = False
if settings.COOKIE_INJECTION == True:
header_name = " Cookie"
found_vuln_parameter = vuln_parameter
the_type = " HTTP header"
elif settings.USER_AGENT_INJECTION == True:
header_name = " User-Agent"
found_vuln_parameter = ""
the_type = " HTTP header"
elif settings.REFERER_INJECTION == True:
header_name = " Referer"
found_vuln_parameter = ""
the_type = " HTTP header"
else:
header_name = ""
the_type = " parameter"
if http_request_method == "GET":
found_vuln_parameter = parameters.vuln_GET_param(url)
else :
found_vuln_parameter = vuln_parameter
if len(found_vuln_parameter) != 0 :
found_vuln_parameter = " '" + Style.UNDERLINE + found_vuln_parameter + Style.RESET_ALL + Style.BRIGHT + "'"
# Print the findings to log file.
if export_injection_info == False:
export_injection_info = logs.add_type_and_technique(export_injection_info, filename, injection_type, technique)
if vp_flag == True:
vp_flag = logs.add_parameter(vp_flag, filename, http_request_method, vuln_parameter, payload)
logs.update_payload(filename, counter, payload)
counter = counter + 1
# Print the findings to terminal.
print Style.BRIGHT + "\n(!) The ("+ http_request_method + ")" + found_vuln_parameter + header_name + the_type + " is vulnerable to "+ injection_type + "." + Style.RESET_ALL
print " (+) Type : "+ Fore.YELLOW + Style.BRIGHT + injection_type + Style.RESET_ALL + ""
print " (+) Technique : "+ Fore.YELLOW + Style.BRIGHT + technique.title() + Style.RESET_ALL + ""
print " (+) Payload : "+ Fore.YELLOW + Style.BRIGHT + re.sub("%20", " ", payload.replace("\n", "\\n")) + Style.RESET_ALL
# Check for any enumeration options.
if settings.ENUMERATION_DONE == True :
while True:
enumerate_again = raw_input("\n(?) Do you want to enumerate again? [Y/n/q] > ").lower()
if enumerate_again in settings.CHOISE_YES:
tfb_enumeration.do_check(separator, maxlen, TAG, prefix, suffix, delay, http_request_method, url, vuln_parameter, OUTPUT_TEXTFILE, alter_shell, filename)
break
elif enumerate_again in settings.CHOISE_NO:
break
elif enumerate_again in settings.CHOISE_QUIT:
# Delete previous shell (text) files (output) from /tmp
delete_previous_shell(separator, payload, TAG, cmd, prefix, suffix, http_request_method, url, vuln_parameter, OUTPUT_TEXTFILE, alter_shell, filename)
sys.exit(0)
else:
if enumerate_again == "":
enumerate_again = "enter"
print Back.RED + "(x) Error: '" + enumerate_again + "' is not a valid answer." + Style.RESET_ALL
pass
else:
tfb_enumeration.do_check(separator, maxlen, TAG, prefix, suffix, delay, http_request_method, url, vuln_parameter, OUTPUT_TEXTFILE, alter_shell, filename)
# Check for any system file access options.
if settings.FILE_ACCESS_DONE == True :
while True:
示例11: shellshock_handler
def shellshock_handler(url, http_request_method, filename):
counter = 1
vp_flag = True
no_result = True
export_injection_info = False
injection_type = "results-based command injection"
technique = "shellshock injection technique"
info_msg = "Testing the " + technique + "... "
sys.stdout.write(settings.print_info_msg(info_msg))
sys.stdout.flush()
try:
i = 0
total = len(shellshock_cves) * len(headers)
for cve in shellshock_cves:
for check_header in headers:
i = i + 1
attack_vector = "echo " + cve + ":Done;"
payload = shellshock_payloads(cve, attack_vector)
# Check if defined "--verbose" option.
if menu.options.verbose:
sys.stdout.write("\n" + settings.print_payload(payload))
header = {check_header : payload}
request = urllib2.Request(url, None, header)
response = urllib2.urlopen(request)
if not menu.options.verbose:
percent = ((i*100)/total)
float_percent = "{0:.1f}".format(round(((i*100)/(total*1.0)),2))
if str(float_percent) == "100.0":
if no_result == True:
percent = Fore.RED + "FAILED" + Style.RESET_ALL
else:
percent = Fore.GREEN + "SUCCEED" + Style.RESET_ALL
elif cve in response.info():
percent = Fore.GREEN + "SUCCEED" + Style.RESET_ALL
else:
percent = str(float_percent )+ "%"
info_msg = "Testing the " + technique + "... " + "[ " + percent + " ]"
sys.stdout.write("\r" + settings.print_info_msg(info_msg))
sys.stdout.flush()
# Print the findings to log file.
if export_injection_info == False:
export_injection_info = logs.add_type_and_technique(export_injection_info, filename, injection_type, technique)
if vp_flag == True:
vuln_parameter = "HTTP Header"
vp_flag = logs.add_parameter(vp_flag, filename, check_header, vuln_parameter, payload)
logs.update_payload(filename, counter, payload)
if cve in response.info():
no_result = False
success_msg = "The (" + check_header + ") '" + Style.UNDERLINE
success_msg += url + Style.RESET_ALL + Style.BRIGHT + "' is vulnerable to " + injection_type + "."
print "\n" + settings.print_success_msg(success_msg)
print " (+) Type : " + Fore.YELLOW + Style.BRIGHT + injection_type.title() + Style.RESET_ALL + ""
print " (+) Technique : " + Fore.YELLOW + Style.BRIGHT + technique.title() + Style.RESET_ALL + ""
print " (+) Payload : " + Fore.YELLOW + Style.BRIGHT + "\"" + payload + "\"" + Style.RESET_ALL
if not menu.options.verbose:
print ""
# Enumeration options.
if settings.ENUMERATION_DONE == True :
if menu.options.verbose:
print ""
while True:
question_msg = "Do you want to enumerate again? [Y/n/q] > "
enumerate_again = raw_input(settings.print_question_msg(question_msg)).lower()
if enumerate_again in settings.CHOICE_YES:
enumeration(url, cve, check_header, filename)
break
elif enumerate_again in settings.CHOICE_NO:
break
elif enumerate_again in settings.CHOICE_QUIT:
sys.exit(0)
else:
if enumerate_again == "":
enumerate_again = "enter"
err_msg = "'" + enumerate_again + "' is not a valid answer."
print settings.print_error_msg(err_msg) + "\n"
pass
else:
enumeration(url, cve, check_header, filename)
# File access options.
if settings.FILE_ACCESS_DONE == True :
while True:
question_msg = "Do you want to access files again? [Y/n/q] > "
file_access_again = raw_input(settings.print_question_msg(question_msg)).lower()
if file_access_again in settings.CHOICE_YES:
file_access(url, cve, check_header, filename)
break
elif file_access_again in settings.CHOICE_NO:
break
#.........这里部分代码省略.........
示例12: tb_injection_handler
#.........这里部分代码省略.........
the_type = " parameter"
elif settings.USER_AGENT_INJECTION == True:
header_name = " User-Agent"
found_vuln_parameter = ""
the_type = " HTTP header"
elif settings.REFERER_INJECTION == True:
header_name = " Referer"
found_vuln_parameter = ""
the_type = " HTTP header"
elif settings.CUSTOM_HEADER_INJECTION == True:
header_name = " " + settings.CUSTOM_HEADER_NAME
found_vuln_parameter = ""
the_type = " HTTP header"
else:
header_name = ""
the_type = " parameter"
if http_request_method == "GET":
found_vuln_parameter = parameters.vuln_GET_param(url)
else :
found_vuln_parameter = vuln_parameter
if len(found_vuln_parameter) != 0 :
found_vuln_parameter = " '" + found_vuln_parameter + Style.RESET_ALL + Style.BRIGHT + "'"
# Print the findings to log file.
if export_injection_info == False:
export_injection_info = logs.add_type_and_technique(export_injection_info, filename, injection_type, technique)
if vp_flag == True:
vp_flag = logs.add_parameter(vp_flag, filename, the_type, header_name, http_request_method, vuln_parameter, payload)
logs.update_payload(filename, counter, payload)
counter = counter + 1
if not settings.LOAD_SESSION:
if not settings.VERBOSITY_LEVEL >= 1:
print ""
else:
checks.total_of_requests()
# Print the findings to terminal.
success_msg = "The"
if len(found_vuln_parameter) > 0 and not "cookie" in header_name :
success_msg += " " + http_request_method
success_msg += ('', ' (JSON)')[settings.IS_JSON] + ('', ' (SOAP/XML)')[settings.IS_XML] + the_type + header_name
success_msg += found_vuln_parameter + " seems injectable via "
success_msg += "(" + injection_type.split(" ")[0] + ") " + technique + "."
print settings.print_success_msg(success_msg)
print settings.SUB_CONTENT_SIGN + "Payload: " + str(checks.url_decode(payload)) + Style.RESET_ALL
# Export session
if not settings.LOAD_SESSION:
shell = ""
session_handler.injection_point_importation(url, technique, injection_type, separator, shell, vuln_parameter, prefix, suffix, TAG, alter_shell, payload, http_request_method, url_time_response, timesec, original_how_long, output_length, is_vulnerable=menu.options.level)
#possibly_vulnerable = False
else:
settings.LOAD_SESSION = False
new_line = False
# Check for any enumeration options.
if settings.ENUMERATION_DONE == True:
while True:
if not menu.options.batch:
question_msg = "Do you want to enumerate again? [Y/n] > "
enumerate_again = raw_input("\n" + settings.print_question_msg(question_msg)).lower()
示例13: fb_injection_handler
#.........这里部分代码省略.........
the_type = " parameter"
elif settings.USER_AGENT_INJECTION == True:
header_name = " User-Agent"
found_vuln_parameter = ""
the_type = " HTTP header"
elif settings.REFERER_INJECTION == True:
header_name = " Referer"
found_vuln_parameter = ""
the_type = " HTTP header"
elif settings.CUSTOM_HEADER_INJECTION == True:
header_name = " " + settings.CUSTOM_HEADER_NAME
found_vuln_parameter = ""
the_type = " HTTP header"
else:
header_name = ""
the_type = " parameter"
if http_request_method == "GET":
found_vuln_parameter = parameters.vuln_GET_param(url)
else :
found_vuln_parameter = vuln_parameter
if len(found_vuln_parameter) != 0 :
found_vuln_parameter = " '" + found_vuln_parameter + Style.RESET_ALL + Style.BRIGHT + "'"
# Print the findings to log file.
if export_injection_info == False:
export_injection_info = logs.add_type_and_technique(export_injection_info, filename, injection_type, technique)
if vp_flag == True:
vp_flag = logs.add_parameter(vp_flag, filename, the_type, header_name, http_request_method, vuln_parameter, payload)
logs.update_payload(filename, counter, payload)
counter = counter + 1
if not settings.VERBOSITY_LEVEL >= 1 and not settings.LOAD_SESSION:
print ""
# Print the findings to terminal.
success_msg = "The"
if found_vuln_parameter == " ":
success_msg += http_request_method + ""
success_msg += the_type + header_name
success_msg += found_vuln_parameter + " seems injectable via "
success_msg += "(" + injection_type.split(" ")[0] + ") " + technique + "."
print settings.print_success_msg(success_msg)
print settings.SUB_CONTENT_SIGN + "Payload: " + re.sub("%20", " ", payload.replace("\n", "\\n")) + Style.RESET_ALL
# Export session
if not settings.LOAD_SESSION:
session_handler.injection_point_importation(url, technique, injection_type, separator, shell[0], vuln_parameter, prefix, suffix, TAG, alter_shell, payload, http_request_method, url_time_response=0, delay=0, how_long=0, output_length=0, is_vulnerable="True")
else:
whitespace = settings.WHITESPACE[0]
settings.LOAD_SESSION = False
# Check for any enumeration options.
if settings.ENUMERATION_DONE == True :
while True:
question_msg = "Do you want to enumerate again? [Y/n/q] > "
enumerate_again = raw_input("\n" + settings.print_question_msg(question_msg)).lower()
if enumerate_again in settings.CHOICE_YES:
fb_enumeration.do_check(separator, payload, TAG, delay, prefix, suffix, whitespace, http_request_method, url, vuln_parameter, OUTPUT_TEXTFILE, alter_shell, filename)
print ""
break
elif enumerate_again in settings.CHOICE_NO:
break
示例14: shellshock_handler
def shellshock_handler(url, http_request_method, filename):
counter = 1
vp_flag = True
no_result = True
export_injection_info = False
injection_type = "results-based command injection"
technique = "shellshock injection technique"
info_msg = "Testing the " + technique + "... "
if settings.VERBOSITY_LEVEL > 1:
info_msg = info_msg + "\n"
sys.stdout.write(settings.print_info_msg(info_msg))
sys.stdout.flush()
try:
i = 0
total = len(shellshock_cves) * len(headers)
for cve in shellshock_cves:
for check_header in headers:
# Check injection state
settings.DETECTION_PHASE = True
settings.EXPLOITATION_PHASE = False
i = i + 1
attack_vector = "echo " + cve + ":Done;"
payload = shellshock_payloads(cve, attack_vector)
# Check if defined "--verbose" option.
if settings.VERBOSITY_LEVEL == 1:
sys.stdout.write("\n" + settings.print_payload(payload))
elif settings.VERBOSITY_LEVEL > 1:
info_msg = "Generating a payload for injection..."
print settings.print_info_msg(info_msg)
print settings.print_payload(payload)
header = {check_header : payload}
request = urllib2.Request(url, None, header)
if check_header == "User-Agent":
menu.options.agent = payload
else:
menu.options.agent = default_user_agent
log_http_headers.do_check(request)
log_http_headers.check_http_traffic(request)
# Check if defined any HTTP Proxy.
if menu.options.proxy:
response = proxy.use_proxy(request)
# Check if defined Tor.
elif menu.options.tor:
response = tor.use_tor(request)
else:
response = urllib2.urlopen(request)
percent = ((i*100)/total)
float_percent = "{0:.1f}".format(round(((i*100)/(total*1.0)),2))
if str(float_percent) == "100.0":
if no_result == True:
percent = Fore.RED + "FAILED" + Style.RESET_ALL
else:
percent = Fore.GREEN + "SUCCEED" + Style.RESET_ALL
no_result = False
elif len(response.info()) > 0 and cve in response.info():
percent = Fore.GREEN + "SUCCEED" + Style.RESET_ALL
no_result = False
elif len(response.read()) > 0 and cve in response.read():
percent = Fore.GREEN + "SUCCEED" + Style.RESET_ALL
no_result = False
else:
percent = str(float_percent )+ "%"
if not settings.VERBOSITY_LEVEL >= 1:
info_msg = "Testing the " + technique + "... " + "[ " + percent + " ]"
sys.stdout.write("\r" + settings.print_info_msg(info_msg))
sys.stdout.flush()
if no_result == False:
# Check injection state
settings.DETECTION_PHASE = False
settings.EXPLOITATION_PHASE = True
# Print the findings to log file.
if export_injection_info == False:
export_injection_info = logs.add_type_and_technique(export_injection_info, filename, injection_type, technique)
vuln_parameter = "HTTP Header"
the_type = " " + vuln_parameter
check_header = " " + check_header
vp_flag = logs.add_parameter(vp_flag, filename, the_type, check_header, http_request_method, vuln_parameter, payload)
check_header = check_header[1:]
logs.update_payload(filename, counter, payload)
if settings.VERBOSITY_LEVEL >= 1:
checks.total_of_requests()
success_msg = "The (" + check_header + ") '"
success_msg += url + Style.RESET_ALL + Style.BRIGHT
success_msg += "' seems vulnerable via " + technique + "."
if settings.VERBOSITY_LEVEL <= 1:
#.........这里部分代码省略.........
示例15: tfb_injection_handler
#.........这里部分代码省略.........
elif settings.USER_AGENT_INJECTION == True:
header_name = " User-Agent"
found_vuln_parameter = ""
the_type = " HTTP header"
elif settings.REFERER_INJECTION == True:
header_name = " Referer"
found_vuln_parameter = ""
the_type = " HTTP header"
else:
header_name = ""
the_type = " parameter"
if http_request_method == "GET":
found_vuln_parameter = parameters.vuln_GET_param(url)
else:
found_vuln_parameter = vuln_parameter
if len(found_vuln_parameter) != 0:
found_vuln_parameter = (
" '" + Style.UNDERLINE + found_vuln_parameter + Style.RESET_ALL + Style.BRIGHT + "'"
)
# Print the findings to log file.
if export_injection_info == False:
export_injection_info = logs.add_type_and_technique(
export_injection_info, filename, injection_type, technique
)
if vp_flag == True:
vp_flag = logs.add_parameter(
vp_flag, filename, http_request_method, vuln_parameter, payload
)
logs.update_payload(filename, counter, payload)
counter = counter + 1
# Print the findings to terminal.
print Style.BRIGHT + "\n(!) The (" + http_request_method + ")" + found_vuln_parameter + header_name + the_type + " is vulnerable to " + injection_type + "." + Style.RESET_ALL
print " (+) Type : " + Fore.YELLOW + Style.BRIGHT + injection_type + Style.RESET_ALL + ""
print " (+) Technique : " + Fore.YELLOW + Style.BRIGHT + technique.title() + Style.RESET_ALL + ""
print " (+) Payload : " + Fore.YELLOW + Style.BRIGHT + re.sub(
"%20", " ", payload.replace("\n", "\\n")
) + Style.RESET_ALL
if settings.TARGET_OS == "win":
delete_previous_shell(
separator,
payload,
TAG,
cmd,
prefix,
suffix,
http_request_method,
url,
vuln_parameter,
OUTPUT_TEXTFILE,
alter_shell,
filename,
)
time.sleep(1)
# Check for any enumeration options.
if settings.ENUMERATION_DONE == True:
while True:
enumerate_again = raw_input(
"\n(?) Do you want to enumerate again? [Y/n/q] > "