Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update tb_handler.py #996

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 42 additions & 33 deletions src/core/injections/blind/techniques/time_based/tb_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,44 +26,53 @@
The "time-based" injection technique handler.
"""
def tb_injection_handler(url, timesec, filename, http_request_method, url_time_response, injection_type, technique, tmp_path):
return handler.do_time_relative_proccess(url, timesec, filename, http_request_method, url_time_response, injection_type, technique, tmp_path)
return handler.do_time_relative_proccess(
url, timesec, filename, http_request_method, url_time_response, injection_type, technique, tmp_path
)

"""
The exploitation function.
(call the injection handler)
"""
def exploitation(url, timesec, filename, http_request_method, url_time_response, injection_type, technique):
# Check if attack is based on time delays.
if not settings.TIME_RELATIVE_ATTACK :
checks.time_relative_attaks_msg()
settings.TIME_RELATIVE_ATTACK = True
# Check if attack is based on time delays.
if not settings.TIME_RELATIVE_ATTACK:
checks.time_relative_attaks_msg()
settings.TIME_RELATIVE_ATTACK = True

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."
settings.print_data_to_stdout(settings.print_warning_msg(warn_msg))
go_back = False
while True:
if go_back == True:
return False
message = "How do you want to proceed? [(C)ontinue/(s)kip] > "
proceed_option = common.read_input(message, default="C", check_batch=True)
if proceed_option.lower() in settings.CHOICE_PROCEED :
if proceed_option.lower() == "c":
if tb_injection_handler(url, timesec, filename, http_request_method, url_time_response, injection_type, technique) == False:
if url_time_response >= settings.SLOW_TARGET_RESPONSE:
warn_msg = (
"It is highly recommended, due to serious response delays, "
"to skip the time-based (blind) technique and to continue "
"with the file-based (semiblind) technique."
)
settings.print_data_to_stdout(settings.print_warning_msg(warn_msg))
go_back = False
while True:
if go_back:
return False
message = "How do you want to proceed? [(C)ontinue/(s)kip] > "
proceed_option = common.read_input(message, default="C", check_batch=True)
if proceed_option.lower() in settings.CHOICE_PROCEED:
if proceed_option.lower() == "c":
tmp_path = "" # Initialize tmp_path if necessary
if tb_injection_handler(
url, timesec, filename, http_request_method, url_time_response, injection_type, technique, tmp_path
) is False:
return False
elif proceed_option.lower() == "s":
from src.core.injections.semiblind.techniques.file_based import fb_handler
fb_handler.exploitation(url, timesec, filename, http_request_method, url_time_response, injection_type, technique)
elif proceed_option.lower() == "q":
raise SystemExit()
else:
common.invalid_option(proceed_option)
pass
else:
# Fix the missing tmp_path initialization and usage
tmp_path = "" # Adjust if another initialization is required
if tb_injection_handler(
url, timesec, filename, http_request_method, url_time_response, injection_type, technique, tmp_path
) is False:
settings.TIME_RELATIVE_ATTACK = False
return False
elif proceed_option.lower() == "s":
from src.core.injections.semiblind.techniques.file_based import fb_handler
fb_handler.exploitation(url, timesec, filename, http_request_method, url_time_response, injection_type, technique)
elif proceed_option.lower() == "q":
raise SystemExit()
else:
common.invalid_option(proceed_option)
pass
else:
tmp_path = ""
if tb_injection_handler(url, timesec, filename, http_request_method, url_time_response, injection_type, technique, tmp_path) == False:
settings.TIME_RELATIVE_ATTACK = False
return False
# eof