本文整理汇总了Python中src.utils.settings.print_error_msg函数的典型用法代码示例。如果您正苦于以下问题:Python print_error_msg函数的具体用法?Python print_error_msg怎么用?Python print_error_msg使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了print_error_msg函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: icmp_exfiltration_handler
def icmp_exfiltration_handler(url, http_request_method):
# You need to have root privileges to run this script
if os.geteuid() != 0:
err_msg = "You need to have root privileges to run this option."
print settings.print_error_msg(err_msg) + "\n"
os._exit(0)
if http_request_method == "GET":
#url = parameters.do_GET_check(url)
vuln_parameter = parameters.vuln_GET_param(url)
request = urllib2.Request(url)
headers.do_check(request)
else:
parameter = menu.options.data
parameter = urllib2.unquote(parameter)
parameter = parameters.do_POST_check(parameter)
request = urllib2.Request(url, parameter)
headers.do_check(request)
vuln_parameter = parameters.vuln_POST_param(parameter, url)
# Check if defined any HTTP Proxy.
if menu.options.proxy:
try:
response = proxy.use_proxy(request)
except urllib2.HTTPError, err_msg:
if settings.IGNORE_ERR_MSG == False:
print "\n" + settings.print_error_msg(err_msg)
continue_tests = checks.continue_tests(err)
if continue_tests == True:
settings.IGNORE_ERR_MSG = True
else:
os._exit(0)
开发者ID:ardiansn,项目名称:commix,代码行数:33,代码来源:icmp_exfiltration.py
示例2: continue_tests
def continue_tests(err):
# If defined "--ignore-401" option, ignores HTTP Error 401 (Unauthorized)
# and continues tests without providing valid credentials.
if menu.options.ignore_401:
settings.WAF_ENABLED = True
return True
# Possible WAF/IPS/IDS
if (str(err.code) == "403" or "406") and \
not menu.options.skip_waf:
# Check if "--skip-waf" option is defined
# that skips heuristic detection of WAF/IPS/IDS protection.
settings.WAF_ENABLED = True
warn_msg = "It seems that target is protected by some kind of WAF/IPS/IDS."
print settings.print_warning_msg(warn_msg)
try:
while True:
question_msg = "Do you want to ignore the error (" + str(err.code)
question_msg += ") message and continue the tests? [Y/n/q] > "
continue_tests = raw_input(settings.print_question_msg(question_msg)).lower()
if continue_tests in settings.CHOICE_YES:
return True
elif continue_tests in settings.CHOICE_NO:
return False
elif continue_tests in settings.CHOICE_QUIT:
return False
else:
if continue_tests == "":
continue_tests = "enter"
err_msg = "'" + continue_tests + "' is not a valid answer."
print settings.print_error_msg(err_msg) + "\n"
pass
except KeyboardInterrupt:
print "\n" + Back.RED + settings.ABORTION_SIGN + "Ctrl-C was pressed!" + Style.RESET_ALL
raise SystemExit()
开发者ID:ardiansn,项目名称:commix,代码行数:35,代码来源:checks.py
示例3: ps_check
def ps_check():
if settings.PS_ENABLED == None and menu.options.is_admin or menu.options.users or menu.options.passwords:
if settings.VERBOSITY_LEVEL >= 1:
print ""
warn_msg = "The payloads in some options that you "
warn_msg += "have chosen, are requiring the use of PowerShell. "
print settings.print_warning_msg(warn_msg)
while True:
question_msg = "Do you want to use the \"--ps-version\" option "
question_msg += "so ensure that PowerShell is enabled? [Y/n/q] > "
sys.stdout.write(settings.print_question_msg(question_msg))
ps_check = sys.stdin.readline().replace("\n","").lower()
if ps_check in settings.CHOICE_YES:
menu.options.ps_version = True
break
elif ps_check in settings.CHOICE_NO:
break
elif ps_check in settings.CHOICE_QUIT:
print ""
os._exit(0)
else:
if ps_check == "":
ps_check = "enter"
err_msg = "'" + ps_check + "' is not a valid answer."
print settings.print_error_msg(err_msg)
pass
开发者ID:cryptedwolf,项目名称:commix,代码行数:26,代码来源:checks.py
示例4: exploitation
def exploitation(url, delay, filename, http_request_method, url_time_response):
if url_time_response >= settings.SLOW_TARGET_RESPONSE:
warn_msg = "It is highly recommended, due to serious response delays, "
warn_msg += "to skip the time-based (blind) technique and to continue "
warn_msg += "with the file-based (semiblind) technique."
print settings.print_warning_msg(warn_msg)
go_back = False
while True:
if go_back == True:
return False
question_msg = "How do you want to proceed? [(C)ontinue/(s)kip/(q)uit] > "
proceed_option = raw_input(settings.print_question_msg(question_msg)).lower()
if proceed_option.lower() in settings.CHOICE_PROCEED :
if proceed_option.lower() == "s":
from src.core.injections.semiblind.techniques.file_based import fb_handler
fb_handler.exploitation(url, delay, filename, http_request_method, url_time_response)
elif proceed_option.lower() == "c":
if tb_injection_handler(url, delay, filename, http_request_method, url_time_response) == False:
return False
elif proceed_option.lower() == "q":
raise SystemExit()
else:
if proceed_option == "":
proceed_option = "enter"
err_msg = "'" + proceed_option + "' is not a valid answer."
print settings.print_error_msg(err_msg) + "\n"
pass
else:
if tb_injection_handler(url, delay, filename, http_request_method, url_time_response) == False:
return False
开发者ID:ardiansn,项目名称:commix,代码行数:30,代码来源:tb_handler.py
示例5: do_check
def do_check(url):
check_proxy = True
info_msg = "Testing proxy " + menu.options.proxy + "... "
sys.stdout.write(settings.print_info_msg(info_msg))
sys.stdout.flush()
try:
# Check if defined POST data
if menu.options.data:
request = urllib2.Request(url, menu.options.data)
else:
request = urllib2.Request(url)
# Check if defined extra headers.
headers.do_check(request)
request.set_proxy(menu.options.proxy,settings.PROXY_PROTOCOL)
try:
check = urllib2.urlopen(request)
except urllib2.HTTPError, error:
check = error
except:
check_proxy = False
pass
if check_proxy == True:
sys.stdout.write("[" + Fore.GREEN + " SUCCEED " + Style.RESET_ALL + " ]\n")
sys.stdout.flush()
# Check if defined "--force-ssl" option AND "--proxy" option.
# We then force the proxy to https
if menu.options.force_ssl and menu.options.proxy:
settings.PROXY_PROTOCOL = 'https'
else:
print "[" + Fore.RED + " FAILED " + Style.RESET_ALL + "]"
err_msg = "Could not connect to proxy."
print settings.print_error_msg(err_msg)
sys.exit(0)
开发者ID:HugoDelval,项目名称:commix,代码行数:34,代码来源:proxy.py
示例6: define_py_working_dir
def define_py_working_dir():
if settings.TARGET_OS == "win" and menu.options.alter_shell:
while True:
if not menu.options.batch:
question_msg = "Do you want to use '" + settings.WIN_PYTHON_DIR
question_msg += "' as Python working directory on the target host? [Y/n] > "
sys.stdout.write(settings.print_question_msg(question_msg))
python_dir = sys.stdin.readline().replace("\n","").lower()
else:
python_dir = ""
if len(python_dir) == 0:
python_dir = "y"
if python_dir in settings.CHOICE_YES:
break
elif python_dir in settings.CHOICE_NO:
question_msg = "Please provide a custom working directory for Python (e.g. '"
question_msg += settings.WIN_PYTHON_DIR + "') > "
sys.stdout.write(settings.print_question_msg(question_msg))
settings.WIN_PYTHON_DIR = sys.stdin.readline().replace("\n","").lower()
break
else:
err_msg = "'" + python_dir + "' is not a valid answer."
print settings.print_error_msg(err_msg)
pass
settings.USER_DEFINED_PYTHON_DIR = True
# eof
开发者ID:security-geeks,项目名称:commix,代码行数:27,代码来源:checks.py
示例7: check_for_update
def check_for_update():
try:
response = urllib2.urlopen('https://raw.githubusercontent.com/stasinopoulos/commix/master/src/utils/settings.py')
version_check = response.readlines()
for line in version_check:
line = line.rstrip()
if "VERSION = " in line:
update_version = line.replace("VERSION = ", "").replace("\"", "")
break
if float(settings.VERSION.replace(".","")) < float(update_version.replace(".","")):
warn_msg = "Current version seems to be out-of-date."
print settings.print_warning_msg(warn_msg)
while True:
question_msg = "Do you want to update to the latest version now? [Y/n] > "
sys.stdout.write(settings.print_question_msg(question_msg))
do_update = sys.stdin.readline().replace("\n","").lower()
if do_update in settings.CHOICE_YES:
updater()
os._exit(0)
elif do_update in settings.CHOICE_NO:
break
else:
if do_update == "":
do_update = "enter"
err_msg = "'" + do_update + "' is not a valid answer."
print settings.print_error_msg(err_msg)
pass
except:
print ""
pass
# eof
开发者ID:cryptedwolf,项目名称:commix,代码行数:33,代码来源:update.py
示例8: process_json_data
def process_json_data():
while True:
success_msg = "JSON data found in POST data."
if not menu.options.batch:
question_msg = success_msg
question_msg += " Do you want to process it? [Y/n] > "
sys.stdout.write(settings.print_question_msg(question_msg))
json_process = sys.stdin.readline().replace("\n","").lower()
else:
if settings.VERBOSITY_LEVEL >= 1:
print settings.print_success_msg(success_msg)
json_process = ""
if len(json_process) == 0:
json_process = "y"
if json_process in settings.CHOICE_YES:
settings.IS_JSON = True
break
elif json_process in settings.CHOICE_NO:
break
elif json_process in settings.CHOICE_QUIT:
raise SystemExit()
else:
err_msg = "'" + json_process + "' is not a valid answer."
print settings.print_error_msg(err_msg)
pass
开发者ID:security-geeks,项目名称:commix,代码行数:25,代码来源:checks.py
示例9: warning_detection
def warning_detection(url, http_request_method):
try:
# Find the host part
url_part = url.split("=")[0]
request = urllib2.Request(url_part)
# Check if defined extra headers.
headers.do_check(request)
response = requests.get_request_response(request)
if response:
response = urllib2.urlopen(request)
html_data = response.read()
err_msg = ""
if "eval()'d code" in html_data:
err_msg = "'eval()'"
if "Cannot execute a blank command in" in html_data:
err_msg = "execution of a blank command,"
if "sh: command substitution:" in html_data:
err_msg = "command substitution"
if "Warning: usort()" in html_data:
err_msg = "'usort()'"
if re.findall(r"=/(.*)/&", url):
if "Warning: preg_replace():" in html_data:
err_msg = "'preg_replace()'"
url = url.replace("/&","/e&")
if "Warning: assert():" in html_data:
err_msg = "'assert()'"
if "Failure evaluating code:" in html_data:
err_msg = "code evaluation"
if err_msg != "":
warn_msg = "A failure message on " + err_msg + " was detected on page's response."
print settings.print_warning_msg(warn_msg)
return url
except urllib2.HTTPError, err_msg:
print settings.print_error_msg(err_msg)
raise SystemExit()
开发者ID:fleischkatapult,项目名称:commix,代码行数:35,代码来源:eb_injector.py
示例10: mobile_user_agents
def mobile_user_agents():
print """---[ """ + Style.BRIGHT + Fore.BLUE + """Available Mobile HTTP User-Agent headers""" + Style.RESET_ALL + """ ]---
Type '""" + Style.BRIGHT + """1""" + Style.RESET_ALL + """' for BlackBerry 9900 HTTP User-Agent header.
Type '""" + Style.BRIGHT + """2""" + Style.RESET_ALL + """' for Samsung Galaxy S HTTP User-Agent header.
Type '""" + Style.BRIGHT + """3""" + Style.RESET_ALL + """' for HP iPAQ 6365 HTTP User-Agent header.
Type '""" + Style.BRIGHT + """4""" + Style.RESET_ALL + """' for HTC Sensation HTTP User-Agent header.
Type '""" + Style.BRIGHT + """5""" + Style.RESET_ALL + """' for Apple iPhone 4s HTTP User-Agent header.
Type '""" + Style.BRIGHT + """6""" + Style.RESET_ALL + """' for Google Nexus 7 HTTP User-Agent header.
Type '""" + Style.BRIGHT + """7""" + Style.RESET_ALL + """' for Nokia N97 HTTP User-Agent header.
"""
while True:
question_msg = "Which mobile HTTP User-Agent header do you want to use? "
sys.stdout.write(settings.print_question_msg(question_msg))
mobile_user_agent = sys.stdin.readline().replace("\n","").lower()
try:
if int(mobile_user_agent) in range(0,len(settings.MOBILE_USER_AGENT_LIST)):
return settings.MOBILE_USER_AGENT_LIST[int(mobile_user_agent)]
elif mobile_user_agent.lower() == "q":
raise SystemExit()
else:
err_msg = "'" + mobile_user_agent + "' is not a valid answer."
print settings.print_error_msg(err_msg)
pass
except ValueError:
err_msg = "'" + mobile_user_agent + "' is not a valid answer."
print settings.print_error_msg(err_msg)
pass
开发者ID:security-geeks,项目名称:commix,代码行数:29,代码来源:menu.py
示例11: http_auth_err_msg
def http_auth_err_msg():
err_msg = "Use the '--auth-cred' option to provide a valid pair of "
err_msg += "HTTP authentication credentials (i.e --auth-cred=\"admin:admin\")"
err_msg += " or use the '--ignore-401' option to ignore HTTP error 401 (Unauthorized)"
err_msg += " and continue tests without providing valid credentials."
print settings.print_error_msg(err_msg)
sys.exit(0)
开发者ID:ardiansn,项目名称:commix,代码行数:7,代码来源:checks.py
示例12: flush
def flush(url):
try:
conn = sqlite3.connect(settings.SESSION_FILE)
tables = list(conn.execute("SELECT name FROM sqlite_master WHERE type is 'table'"))
conn.executescript(';'.join(["DROP TABLE IF EXISTS %s" %i for i in tables]))
conn.commit()
conn.close()
except sqlite3.OperationalError, err_msg:
print settings.print_error_msg(err_msg)
开发者ID:fleischkatapult,项目名称:commix,代码行数:9,代码来源:session_handler.py
示例13: check_lport
def check_lport(lport):
try:
if float(lport):
settings.LPORT = lport
print "LPORT => " + settings.LPORT
return True
except ValueError:
err_msg = "The port must be numeric."
print settings.print_error_msg(err_msg) + "\n"
return False
开发者ID:HugoDelval,项目名称:commix,代码行数:10,代码来源:reverse_tcp.py
示例14: check_lhost
def check_lhost(lhost):
parts = lhost.split('.')
if len(parts) == 4 and all(part.isdigit() for part in parts) and all(0 <= int(part) <= 255 for part in parts):
settings.LHOST = lhost
print "LHOST => " + settings.LHOST
return True
else:
err_msg = "The IP format is not valid."
print settings.print_error_msg(err_msg) + "\n"
return False
开发者ID:HugoDelval,项目名称:commix,代码行数:10,代码来源:reverse_tcp.py
示例15: check_srvport
def check_srvport(srvport):
try:
if float(srvport):
settings.SRVPORT = srvport
print "SRVPORT => " + settings.SRVPORT
return True
except ValueError:
err_msg = "The provided port must be numeric (i.e. 1234)"
print settings.print_error_msg(err_msg)
return False
开发者ID:security-geeks,项目名称:commix,代码行数:10,代码来源:reverse_tcp.py
示例16: create_github_issue
def create_github_issue(err_msg, exc_msg):
key = hashlib.md5(exc_msg).hexdigest()[:8]
while True:
try:
if not menu.options.batch:
question_msg = "Do you want to automatically create a new (anonymized) issue "
question_msg += "with the unhandled exception information at "
question_msg += "the official Github repository? [y/N] "
sys.stdout.write(settings.print_question_msg(question_msg))
choise = sys.stdin.readline().replace("\n","").lower()
else:
choise = ""
if len(choise) == 0:
choise = "n"
if choise in settings.CHOICE_YES:
break
elif choise in settings.CHOICE_NO:
print ""
return
else:
err_msg = "'" + choise + "' is not a valid answer."
print settings.print_error_msg(err_msg)
pass
except:
print "\n"
raise SystemExit()
err_msg = err_msg[err_msg.find("\n"):]
req = urllib2.Request(url="https://api.github.com/search/issues?q=" + \
urllib.quote("repo:commixproject/commix" + " " + "Unhandled exception (#" + str(key) + ")")
)
try:
content = urllib2.urlopen(req).read()
_ = json.loads(content)
duplicate = _["total_count"] > 0
closed = duplicate and _["items"][0]["state"] == "closed"
if duplicate:
warn_msg = "That issue seems to be already reported"
if closed:
warn_msg += " and resolved. Please update to the latest "
warn_msg += "(dev) version from official GitHub repository at '" + settings.GIT_URL + "'"
warn_msg += ".\n"
print settings.print_warning_msg(warn_msg)
return
except:
pass
data = {"title": "Unhandled exception (#" + str(key) + ")", "body": "```" + str(err_msg) + "\n```\n```\n" + str(exc_msg) + "```"}
req = urllib2.Request(url="https://api.github.com/repos/commixproject/commix/issues", data=json.dumps(data), headers={"Authorization": "token " + str(settings.GITHUB_REPORT_OAUTH_TOKEN.decode("base64"))})
try:
content = urllib2.urlopen(req).read()
except Exception, err:
content = None
开发者ID:security-geeks,项目名称:commix,代码行数:55,代码来源:common.py
示例17: clear
def clear(url):
try:
if no_such_table:
conn = sqlite3.connect(settings.SESSION_FILE)
conn.execute("DELETE FROM " + table_name(url) + "_ip WHERE \
id NOT IN (SELECT MAX(id) FROM " + \
table_name(url) + "_ip GROUP BY technique);")
conn.commit()
conn.close()
except sqlite3.OperationalError, err_msg:
print settings.print_error_msg(err_msg)
开发者ID:fleischkatapult,项目名称:commix,代码行数:11,代码来源:session_handler.py
示例18: check_lhost
def check_lhost(lhost):
parts = lhost.split('.')
if len(parts) == 4 and all(part.isdigit() for part in parts) and all(0 <= int(part) <= 255 for part in parts):
settings.LHOST = lhost
print "LHOST => " + settings.LHOST
return True
else:
err_msg = "The provided IP is not in "
err_msg += "appropriate format (i.e 192.168.1.5)."
print settings.print_error_msg(err_msg)
return False
开发者ID:cryptedwolf,项目名称:commix,代码行数:11,代码来源:reverse_tcp.py
示例19: injection_point_exportation
def injection_point_exportation(url, http_request_method):
try:
if not menu.options.flush_session:
conn = sqlite3.connect(settings.SESSION_FILE)
result = conn.execute("SELECT * FROM sqlite_master WHERE name = '" + \
table_name(url) + "_ip' AND type = 'table';")
if result:
if menu.options.tech[:1] == "c" or \
menu.options.tech[:1] == "e":
select_injection_type = "R"
elif menu.options.tech[:1] == "t":
select_injection_type = "B"
else:
select_injection_type = "S"
if settings.TESTABLE_PARAMETER:
cursor = conn.execute("SELECT * FROM " + table_name(url) + "_ip WHERE \
url = '" + url + "' AND \
injection_type like '" + select_injection_type + "%' AND \
vuln_parameter = '" + settings.TESTABLE_PARAMETER + "' AND \
http_request_method = '" + http_request_method + "' \
ORDER BY id DESC limit 1;")
else:
cursor = conn.execute("SELECT * FROM " + table_name(url) + "_ip WHERE \
url = '" + url + "' AND \
injection_type like '" + select_injection_type + "%' AND \
http_header = '" + settings.HTTP_HEADER + "' AND \
http_request_method = '" + http_request_method + "' \
ORDER BY id DESC limit 1;")
for session in cursor:
url = session[1]
technique = session[2]
injection_type = session[3]
separator = session[4]
shell = session[5]
vuln_parameter = session[6]
prefix = session[7]
suffix = session[8]
TAG = session[9]
alter_shell = session[10]
payload = session[11]
http_request_method = session[13]
url_time_response = session[14]
delay = session[15]
how_long = session[16]
output_length = session[17]
is_vulnerable = session[18]
return 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
else:
no_such_table = True
pass
except sqlite3.OperationalError, err_msg:
print settings.print_error_msg(err_msg)
settings.LOAD_SESSION = False
return False
开发者ID:fleischkatapult,项目名称:commix,代码行数:54,代码来源:session_handler.py
示例20: notification
def notification(url, technique, injection_type):
try:
if settings.LOAD_SESSION == True:
info_msg = "A previously stored session has been held against that host."
print settings.print_info_msg(info_msg)
while True:
if not menu.options.batch:
question_msg = "Do you want to resume to the "
question_msg += "(" + injection_type.split(" ")[0] + ") "
question_msg += technique.rsplit(' ', 2)[0]
question_msg += " injection point? [Y/n] > "
sys.stdout.write(settings.print_question_msg(question_msg))
settings.LOAD_SESSION = sys.stdin.readline().replace("\n","").lower()
else:
settings.LOAD_SESSION = ""
if len(settings.LOAD_SESSION) == 0:
settings.LOAD_SESSION = "y"
if settings.LOAD_SESSION in settings.CHOICE_YES:
return True
elif settings.LOAD_SESSION in settings.CHOICE_NO:
settings.LOAD_SESSION = False
if technique[:1] != "c":
while True:
question_msg = "Which technique do you want to re-evaluate? [(C)urrent/(a)ll/(n)one] > "
sys.stdout.write(settings.print_question_msg(question_msg))
proceed_option = sys.stdin.readline().replace("\n","").lower()
if len(proceed_option) == 0:
proceed_option = "c"
if proceed_option.lower() in settings.CHOICE_PROCEED :
if proceed_option.lower() == "a":
settings.RETEST = True
break
elif proceed_option.lower() == "c" :
settings.RETEST = False
break
elif proceed_option.lower() == "n":
raise SystemExit()
else:
pass
else:
err_msg = "'" + proceed_option + "' is not a valid answer."
print settings.print_error_msg(err_msg)
pass
if settings.SESSION_APPLIED_TECHNIQUES:
menu.options.tech = ''.join(settings.AVAILABLE_TECHNIQUES)
return False
elif settings.LOAD_SESSION in settings.CHOICE_QUIT:
raise SystemExit()
else:
err_msg = "'" + settings.LOAD_SESSION + "' is not a valid answer."
print settings.print_error_msg(err_msg)
pass
except sqlite3.OperationalError, err_msg:
print settings.print_critical_msg(err_msg)
开发者ID:security-geeks,项目名称:commix,代码行数:54,代码来源:session_handler.py
注:本文中的src.utils.settings.print_error_msg函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论