Fix various Python 3.12 SyntaxWarning

This commit is contained in:
Arnaud Rebillout 2024-09-16 22:25:10 +07:00
parent cd9ec9dc61
commit a47a5bf9af
9 changed files with 16 additions and 15 deletions

View file

@ -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>(.*)<\/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")

View file

@ -417,7 +417,7 @@ try:
#
#
if attack_vector == "5":
print (""".______ __ _______ _______ .__ __. __ __ .___ ___.
print (r""".______ __ _______ _______ .__ __. __ __ .___ ___.
| _ \ | | | \ | ____|| \ | | | | | | | \/ |
| |_) | | | | .--. | | |__ | \| | | | | | | \ / |
| / | | | | | | | __| | . ` | | | | | | |\/| |

View file

@ -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

View file

@ -32,7 +32,7 @@ except ImportError:
def usage():
print("""
print(r"""
.______ __ _______ _______ .__ __. __ __ .___ ___.
| _ \ | | | \ | ____|| \ | | | | | | | \/ |
| |_) | | | | .--. | | |__ | \| | | | | | | \ / |

View file

@ -21,7 +21,7 @@ print("The" + core.bcolors.BOLD + " SCCM Attack Vector " + core.bcolors.ENDC +
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

View file

@ -391,7 +391,7 @@ Explanation: Reboots the remote server instantly.
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!

View file

@ -124,12 +124,12 @@ try:
# 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...")

View file

@ -43,11 +43,12 @@ written out through the keyboard.
""")
# 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"))

View file

@ -76,13 +76,13 @@ for line in fileopen:
# 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)