Skip to content

Commit

Permalink
Merge pull request #190 from elboulangero/fix-python-312-syntax-warnings
Browse files Browse the repository at this point in the history
Fix various Python 3.12 SyntaxWarning
  • Loading branch information
savio-code authored Sep 18, 2024
2 parents 0870567 + a96fbd3 commit eff2eb7
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 20 deletions.
8 changes: 4 additions & 4 deletions Fern-Wifi-Cracker/core/fern.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ def update_launcher(self):
'https://raw.githubusercontent.com/savio-code/fern-wifi-cracker/master/Fern-Wifi-Cracker/version')
online_response = online_response_check.read().decode("ascii",errors="ignore")

online_files = re.compile('total_files = \d+', re.IGNORECASE)
online_files = re.compile(r'total_files = \d+', re.IGNORECASE)

for online_file_total in online_response.splitlines():
if re.match(online_files, online_file_total):
Expand Down Expand Up @@ -320,7 +320,7 @@ def update_initializtion_check(self):
online_response_string = ''
online_response = online_response_thread.read().decode("ascii",errors="ignore")

online_version = re.compile('version = \d+\.?\d+', re.IGNORECASE)
online_version = re.compile(r'version = \d+\.?\d+', re.IGNORECASE)

for version_iterate in online_response.splitlines():
if re.match(online_version, version_iterate):
Expand Down Expand Up @@ -520,11 +520,11 @@ def set_monitor_thread(self, monitor_card, mac_setting_exists, last_settings):
monitor_interface_process = str(subprocess.getoutput("airmon-ng"))


regex = re.compile("mon\d", re.IGNORECASE)
regex = re.compile(r"mon\d", re.IGNORECASE)
interfaces = regex.findall(monitor_interface_process)

if len(interfaces) == 0:
regex = re.compile("wlan\dmon", re.IGNORECASE)
regex = re.compile(r"wlan\dmon", re.IGNORECASE)
interfaces = regex.findall(monitor_interface_process)

if len(interfaces) == 0:
Expand Down
2 changes: 1 addition & 1 deletion Fern-Wifi-Cracker/core/toolbox/MITM_Core.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ def get_Mac_Address(self,interface):

def get_IP_Adddress(self):
import re
regex = "inet addr:((\d+.){3}\d+)"
regex = r"inet addr:((\d+.){3}\d+)"
sys_out = subprocess.getstatusoutput("ifconfig " + self.interface_card)[1]
result = re.findall(regex,sys_out)
if(result):
Expand Down
4 changes: 2 additions & 2 deletions Fern-Wifi-Cracker/core/toolbox/fern_cookie_hijacker.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ def set_monitor_mode(self):
monitor_output = subprocess.getstatusoutput("airmon-ng start %s %s" % (selected_interface,selected_channel))

if(monitor_output[0] == 0):
monitor_interface = re.findall("mon\d+",monitor_output[1])
monitor_interface = re.findall(r"mon\d+",monitor_output[1])

if(monitor_interface):
self.monitor_interface = monitor_interface[0]
Expand Down Expand Up @@ -549,7 +549,7 @@ def start_Cookie_Attack(self):
self.mitm_activated_label.setText("<font color = green><b>Active Frequency: %s</b></font>" % (channel_info))

if(self.ethernet_mode_radio.isChecked()):
if(not re.match("(\d+.){3}\d+",ip_wep_edit)):
if(not re.match(r"(\d+.){3}\d+",ip_wep_edit)):
QtWidgets.QMessageBox.warning(self,"Invalid IP Address","Please insert a valid IPv4 Address of the Default Gateway")
self.wep_key_edit.setFocus()
return
Expand Down
2 changes: 1 addition & 1 deletion Fern-Wifi-Cracker/core/toolbox/fern_ray_fusion.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ def Start_Attack(self):

if(self.http_https_radio.isChecked()):
self.bruteforce_core.set_attack_type("HTTP")
valid_http = re.compile("^(https|http)://\S*",re.IGNORECASE) # HTTP/HTTPS url regular expression
valid_http = re.compile(r"^(https|http)://\S*",re.IGNORECASE) # HTTP/HTTPS url regular expression
if not valid_http.match(self.target_address):
QtWidgets.QMessageBox.warning(self,"Invalid HTTP Address","The HTTP(HyperText Transfer Protocol) address should be fully qualified:\n\nExample:\nhttp://10.18.122.15\nhttps://www.foobar.com\nhttp://www.foobar.com/sports/index.html")
return
Expand Down
2 changes: 1 addition & 1 deletion Fern-Wifi-Cracker/core/variables.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def exec_command(command,directory = None):


def is_mac_address(data):
return bool(re.match('^' + '[\:\-]'.join(['([0-9a-f]{2})'] * 6) + '$', data.lower()))
return bool(re.match(r'^' + r'[\:\-]'.join([r'([0-9a-f]{2})'] * 6) + r'$', data.lower()))


################## TOOL BOX VARIABLES #######################
Expand Down
6 changes: 3 additions & 3 deletions Fern-Wifi-Cracker/core/wep.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ def Convert_Key_to_Acsii(self):
key_string = str(self.key_label.text())
if not self.original_key:
self.original_key = key_string
actual_key = re.findall("WEP KEY: ([\S \w]+)</font>",key_string)
actual_key = re.findall(r"WEP KEY: ([\S \w]+)</font>",key_string)
if(actual_key):
key = actual_key[0]
converted_key = key.decode("hex")
Expand All @@ -178,7 +178,7 @@ def Convert_Key_to_Acsii(self):

def Convert_to_Hex(self):
self.key_label.setText(self.original_key)
actual_key = re.findall("WEP KEY: ([\S \w]+)</font>",self.original_key)
actual_key = re.findall(r"WEP KEY: ([\S \w]+)</font>",self.original_key)
self.clipboard_key = actual_key[0]
self.convert_flag = False

Expand All @@ -189,7 +189,7 @@ def Copy_Key(self,key_type):

if(key_type == "WPS PIN"):
key_string = self.wps_pin_label.text()
actual_key = re.findall("WPS PIN: ([\S \w]+)</font>",key_string)
actual_key = re.findall(r"WPS PIN: ([\S \w]+)</font>",key_string)
if(actual_key):
self.clipboard_key = actual_key[0]
self.clipbord.setText(self.clipboard_key)
Expand Down
10 changes: 5 additions & 5 deletions Fern-Wifi-Cracker/core/wpa.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,12 +153,12 @@ def Copy_Key(self,key_type):

if(key_type == "WPS PIN"):
key_string = self.wps_pin_label.text()
actual_key = re.findall("WPS PIN: ([\S \w]+)</font>",key_string)
actual_key = re.findall(r"WPS PIN: ([\S \w]+)</font>",key_string)
if(actual_key):
self.clipboard_key = actual_key[0]
else:
key_string = self.key_label.text()
actual_key = re.findall("WPA KEY: ([\S \w]+)</font>",key_string)
actual_key = re.findall(r"WPA KEY: ([\S \w]+)</font>",key_string)
if(actual_key):
self.clipboard_key = actual_key[0]
self.clipbord.setText(self.clipboard_key)
Expand Down Expand Up @@ -541,9 +541,9 @@ def client_update(self):


def launch_brutefore(self):
current_word_regex = re.compile("Current passphrase: ([\w\s!@#$%^&*()-=_+]+)",re.IGNORECASE)
keys_speed_regex = re.compile("(\d+.?\d+) k/s",re.IGNORECASE)
keys_tested_regex = re.compile("(\d+) keys tested",re.IGNORECASE)
current_word_regex = re.compile(r"Current passphrase: ([\w\s!@#$%^&*()-=_+]+)",re.IGNORECASE)
keys_speed_regex = re.compile(r"(\d+.?\d+) k/s",re.IGNORECASE)
keys_tested_regex = re.compile(r"(\d+) keys tested",re.IGNORECASE)

crack_process = subprocess.Popen("cd /tmp/fern-log/WPA-DUMP/ \naircrack-ng -a 2 -w '%s' wpa_dump-01.cap -l wpa_key.txt" % (self.wordlist),
shell=True,stdout=subprocess.PIPE,stderr=subprocess.PIPE,stdin=subprocess.PIPE)
Expand Down
6 changes: 3 additions & 3 deletions Fern-Wifi-Cracker/core/wps.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,9 @@ def _start_Airodump(self):

def _bruteforce_WPS_Device(self):
channel = self._wps_client_info[self.victim_MAC_Addr.upper()]
wps_key_regex = re.compile(": '(\S+)'",re.IGNORECASE)
wps_pin_regex = re.compile("WPS PIN: '(\d+)'",re.IGNORECASE)
progress_regex = re.compile("(\d+\.\d+)%",re.IGNORECASE)
wps_key_regex = re.compile(r": '(\S+)'",re.IGNORECASE)
wps_pin_regex = re.compile(r"WPS PIN: '(\d+)'",re.IGNORECASE)
progress_regex = re.compile(r"(\d+\.\d+)%",re.IGNORECASE)
associate_regex = re.compile("associated with",re.IGNORECASE)

self.bruteforce_sys_proc = subprocess.Popen("reaver -i %s -b %s -c %s -a -N -L" %(self.monitor_interface,self.victim_MAC_Addr,channel),
Expand Down

0 comments on commit eff2eb7

Please sign in to comment.