Skip to content

Commit eff2eb7

Browse files
authored
Merge pull request #190 from elboulangero/fix-python-312-syntax-warnings
Fix various Python 3.12 SyntaxWarning
2 parents 0870567 + a96fbd3 commit eff2eb7

File tree

8 files changed

+20
-20
lines changed

8 files changed

+20
-20
lines changed

Fern-Wifi-Cracker/core/fern.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ def update_launcher(self):
254254
'https://raw.githubusercontent.com/savio-code/fern-wifi-cracker/master/Fern-Wifi-Cracker/version')
255255
online_response = online_response_check.read().decode("ascii",errors="ignore")
256256

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

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

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

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

522522

523-
regex = re.compile("mon\d", re.IGNORECASE)
523+
regex = re.compile(r"mon\d", re.IGNORECASE)
524524
interfaces = regex.findall(monitor_interface_process)
525525

526526
if len(interfaces) == 0:
527-
regex = re.compile("wlan\dmon", re.IGNORECASE)
527+
regex = re.compile(r"wlan\dmon", re.IGNORECASE)
528528
interfaces = regex.findall(monitor_interface_process)
529529

530530
if len(interfaces) == 0:

Fern-Wifi-Cracker/core/toolbox/MITM_Core.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ def get_Mac_Address(self,interface):
191191

192192
def get_IP_Adddress(self):
193193
import re
194-
regex = "inet addr:((\d+.){3}\d+)"
194+
regex = r"inet addr:((\d+.){3}\d+)"
195195
sys_out = subprocess.getstatusoutput("ifconfig " + self.interface_card)[1]
196196
result = re.findall(regex,sys_out)
197197
if(result):

Fern-Wifi-Cracker/core/toolbox/fern_cookie_hijacker.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ def set_monitor_mode(self):
247247
monitor_output = subprocess.getstatusoutput("airmon-ng start %s %s" % (selected_interface,selected_channel))
248248

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

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

551551
if(self.ethernet_mode_radio.isChecked()):
552-
if(not re.match("(\d+.){3}\d+",ip_wep_edit)):
552+
if(not re.match(r"(\d+.){3}\d+",ip_wep_edit)):
553553
QtWidgets.QMessageBox.warning(self,"Invalid IP Address","Please insert a valid IPv4 Address of the Default Gateway")
554554
self.wep_key_edit.setFocus()
555555
return

Fern-Wifi-Cracker/core/toolbox/fern_ray_fusion.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ def Start_Attack(self):
293293

294294
if(self.http_https_radio.isChecked()):
295295
self.bruteforce_core.set_attack_type("HTTP")
296-
valid_http = re.compile("^(https|http)://\S*",re.IGNORECASE) # HTTP/HTTPS url regular expression
296+
valid_http = re.compile(r"^(https|http)://\S*",re.IGNORECASE) # HTTP/HTTPS url regular expression
297297
if not valid_http.match(self.target_address):
298298
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")
299299
return

Fern-Wifi-Cracker/core/variables.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ def exec_command(command,directory = None):
8181

8282

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

8686

8787
################## TOOL BOX VARIABLES #######################

Fern-Wifi-Cracker/core/wep.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ def Convert_Key_to_Acsii(self):
167167
key_string = str(self.key_label.text())
168168
if not self.original_key:
169169
self.original_key = key_string
170-
actual_key = re.findall("WEP KEY: ([\S \w]+)</font>",key_string)
170+
actual_key = re.findall(r"WEP KEY: ([\S \w]+)</font>",key_string)
171171
if(actual_key):
172172
key = actual_key[0]
173173
converted_key = key.decode("hex")
@@ -178,7 +178,7 @@ def Convert_Key_to_Acsii(self):
178178

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

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

190190
if(key_type == "WPS PIN"):
191191
key_string = self.wps_pin_label.text()
192-
actual_key = re.findall("WPS PIN: ([\S \w]+)</font>",key_string)
192+
actual_key = re.findall(r"WPS PIN: ([\S \w]+)</font>",key_string)
193193
if(actual_key):
194194
self.clipboard_key = actual_key[0]
195195
self.clipbord.setText(self.clipboard_key)

Fern-Wifi-Cracker/core/wpa.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -153,12 +153,12 @@ def Copy_Key(self,key_type):
153153

154154
if(key_type == "WPS PIN"):
155155
key_string = self.wps_pin_label.text()
156-
actual_key = re.findall("WPS PIN: ([\S \w]+)</font>",key_string)
156+
actual_key = re.findall(r"WPS PIN: ([\S \w]+)</font>",key_string)
157157
if(actual_key):
158158
self.clipboard_key = actual_key[0]
159159
else:
160160
key_string = self.key_label.text()
161-
actual_key = re.findall("WPA KEY: ([\S \w]+)</font>",key_string)
161+
actual_key = re.findall(r"WPA KEY: ([\S \w]+)</font>",key_string)
162162
if(actual_key):
163163
self.clipboard_key = actual_key[0]
164164
self.clipbord.setText(self.clipboard_key)
@@ -541,9 +541,9 @@ def client_update(self):
541541

542542

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

548548
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),
549549
shell=True,stdout=subprocess.PIPE,stderr=subprocess.PIPE,stdin=subprocess.PIPE)

Fern-Wifi-Cracker/core/wps.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,9 +123,9 @@ def _start_Airodump(self):
123123

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

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

0 commit comments

Comments
 (0)