Skip to content

Commit e91b19f

Browse files
committed
airmon: put the interface debug logging behind '-v' verbose switch
1 parent 970af1a commit e91b19f

File tree

1 file changed

+22
-15
lines changed

1 file changed

+22
-15
lines changed

wifite/tools/airmon.py

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -244,15 +244,17 @@ def start(cls, interface):
244244
Color.p('{+} Enabling {G}monitor mode{W} on {C}%s{W}... ' % iface_name)
245245
airmon_output = Process(['airmon-ng', 'start', iface_name]).stdout()
246246
enabled_interface = Airmon._parse_airmon_start(airmon_output)
247-
# Debug: print what we got
248-
print(f"\nDEBUG: Full airmon_output = {repr(airmon_output)}")
249-
print(f"DEBUG: enabled_interface = {repr(enabled_interface)}")
250-
251-
# Debug the parsing step by step
252-
lines = airmon_output.split('\n')
253-
for i, line in enumerate(lines):
254-
if 'mac80211 monitor mode' in line:
255-
print(f"DEBUG: Found monitor mode line {i}: {repr(line)}")
247+
248+
# Debug output for troubleshooting airmon-ng parsing issues
249+
if Configuration.verbose > 0:
250+
print(f"\nDEBUG: Full airmon_output = {repr(airmon_output)}")
251+
print(f"DEBUG: enabled_interface = {repr(enabled_interface)}")
252+
253+
# Debug the parsing step by step
254+
lines = airmon_output.split('\n')
255+
for i, line in enumerate(lines):
256+
if 'mac80211 monitor mode' in line:
257+
print(f"DEBUG: Found monitor mode line {i}: {repr(line)}")
256258
else:
257259
enabled_interface = None
258260

@@ -305,26 +307,31 @@ def _parse_airmon_start(airmon_output):
305307
for index, line in enumerate(lines):
306308
if 'mac80211 monitor mode' not in line:
307309
continue
308-
309-
print(f"DEBUG: Parsing line: {repr(line)}")
310+
311+
if Configuration.verbose > 0:
312+
print(f"DEBUG: Parsing line: {repr(line)}")
310313

311314
# First try to get interface from "on" part if it looks like an interface name
312315
if matches := enabled_on_re.match(line):
313316
result = matches.group(1)
314-
print(f"DEBUG: enabled_on_re matched: {repr(result)}")
317+
if Configuration.verbose > 0:
318+
print(f"DEBUG: enabled_on_re matched: {repr(result)}")
315319
return result
316320
# Fallback to "for" part if "on" part is just a channel number
317321
elif matches := enabled_for_re.match(line):
318322
result = matches.group(1)
319-
print(f"DEBUG: enabled_for_re matched: {repr(result)}")
323+
if Configuration.verbose > 0:
324+
print(f"DEBUG: enabled_for_re matched: {repr(result)}")
320325
return result
321326
# Legacy fallback
322327
elif "monitor mode enabled" in line:
323328
result = line.split()[-1]
324-
print(f"DEBUG: legacy fallback matched: {repr(result)}")
329+
if Configuration.verbose > 0:
330+
print(f"DEBUG: legacy fallback matched: {repr(result)}")
325331
return result
326332
else:
327-
print(f"DEBUG: No regex matched this line")
333+
if Configuration.verbose > 0:
334+
print(f"DEBUG: No regex matched this line")
328335

329336
return None
330337

0 commit comments

Comments
 (0)