Skip to content

Commit b719051

Browse files
committed
UI: fix PMKID passive UI support
1 parent de7df0f commit b719051

3 files changed

Lines changed: 49 additions & 38 deletions

File tree

wifite/attack/pmkid.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def __init__(self, target):
2727
self.pcapng_file = Configuration.temp('pmkid.pcapng')
2828
self.success = False
2929
self.timer = None
30-
30+
3131
# Initialize TUI view if in TUI mode
3232
self.view = None
3333
if OutputManager.is_tui_mode():
@@ -137,7 +137,7 @@ def run_hashcat(self):
137137
Color.pl('{+} {D}Checking for existing PMKID for BSSID: {C}%s{W}' % self.target.bssid)
138138
if self.view:
139139
self.view.add_log("Checking for existing PMKID hash...")
140-
140+
141141
pmkid_file = AttackPMKID.get_existing_pmkid_file(self.target.bssid)
142142
if pmkid_file is not None:
143143
if self.view:
@@ -169,7 +169,7 @@ def run_hashcat(self):
169169
if WpaSecUploader.should_upload():
170170
if self.view:
171171
self.view.add_log("Checking wpa-sec upload configuration...")
172-
172+
173173
# Use the pcapng file if it exists, otherwise skip upload
174174
# Note: If only .22000 hash file exists, that's fine - wpa-sec doesn't accept hash files anyway
175175
if os.path.exists(self.pcapng_file):
@@ -187,8 +187,8 @@ def run_hashcat(self):
187187
if self.view:
188188
self.view.add_log("Skipping crack phase (--skip-crack flag)")
189189
return self._extracted_from_run_hashcat_44(
190-
'{+} Not cracking pmkid because {C}skip-crack{W} was used{W}'
191-
)
190+
'{+} Not cracking pmkid because {C}skip-crack{W} was used{W}')
191+
192192
# Crack it.
193193
if Process.exists(Hashcat.dependency_name):
194194
try:
@@ -217,15 +217,15 @@ def run(self):
217217
if self.view:
218218
self.view.start()
219219
self.view.set_attack_type("PMKID Attack")
220-
220+
221221
# Handle hidden ESSID
222222
essid_display = self.target.essid if self.target.essid else "<hidden ESSID>"
223223
self.view.add_log(f"Starting PMKID attack on {essid_display} ({self.target.bssid})")
224-
224+
225225
# Handle invalid channel
226226
channel_display = self.target.channel if self.target.channel and str(self.target.channel) != '-1' else "unknown"
227227
self.view.add_log(f"Channel: {channel_display}")
228-
228+
229229
if self.do_airCRACK:
230230
self.run_aircrack()
231231
else:
@@ -379,7 +379,7 @@ def capture_pmkid(self):
379379
elapsed = Configuration.pmkid_timeout - self.timer.remaining()
380380
self.view.update_pmkid_status(False, attempts)
381381
self.view.add_log(f"Waiting for PMKID... ({int(elapsed)}s / {Configuration.pmkid_timeout}s)")
382-
382+
383383
Color.pattack('PMKID', self.target, 'CAPTURE', 'Waiting for PMKID ({C}%s{W})' % str(self.timer))
384384
time.sleep(1)
385385

@@ -397,7 +397,7 @@ def capture_pmkid(self):
397397
if self.view:
398398
self.view.update_pmkid_status(True, attempts)
399399
self.view.add_log("Successfully captured PMKID!")
400-
400+
401401
Color.clear_entire_line()
402402
Color.pattack('PMKID', self.target, 'CAPTURE', '{G}Captured PMKID{W}')
403403
return self.save_pmkid(pmkid_hash)
@@ -424,7 +424,7 @@ def crack_pmkid_file(self, pmkid_file):
424424
self.view.set_attack_type("PMKID Crack")
425425
self.view.add_log(f"Starting PMKID crack with wordlist: {Configuration.wordlist}")
426426
self.view.add_log("Running hashcat...")
427-
427+
428428
Color.clear_entire_line()
429429
Color.pattack('PMKID', self.target, 'CRACK', 'Cracking PMKID using {C}%s{W} ...\n' % Configuration.wordlist)
430430
key = Hashcat.crack_pmkid(pmkid_file)
@@ -454,7 +454,7 @@ def _extracted_from_crack_pmkid_file_31(self, key, pmkid_file):
454454
'Status': 'SUCCESS'
455455
}
456456
})
457-
457+
458458
Color.clear_entire_line()
459459
Color.pattack('PMKID', self.target, 'CRACKED', '{C}Key: {G}%s{W}' % key)
460460
self.crack_result = CrackResultPMKID(self.target.bssid, self.target.essid,

wifite/ui/attack_view.py

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ def _render_target_info(self) -> Panel:
185185
"""
186186
# Create target info table
187187
table = Table(show_header=False, box=None, padding=(0, 1))
188-
table.add_column("Label", style="bold cyan", width=12)
188+
table.add_column("Label", style="bold white", width=12)
189189
table.add_column("Value", style="white")
190190

191191
# ESSID
@@ -216,25 +216,25 @@ def _render_target_info(self) -> Panel:
216216

217217
# Create a second column for encryption and power
218218
info_text = Text()
219-
info_text.append("Encryption: ", style="bold cyan")
219+
info_text.append("Encryption: ", style="bold white")
220220
info_text.append(enc_badge)
221221
info_text.append(" | ", style="bright_black")
222-
info_text.append("Power: ", style="bold cyan")
222+
info_text.append("Power: ", style="bold white")
223223

224224
# Power level
225225
power_dbm = self.target.power - 100 if self.target.power > 0 else self.target.power
226226
info_text.append(SignalStrengthBar.render(power_dbm))
227227

228228
# Add resume indicator to title if this is a resumed session
229-
title_text = f"[bold cyan]Target: {essid}[/bold cyan]"
229+
title_text = f"[bold white]Target: {essid}[/bold white]"
230230
if self.session:
231231
title_text = f"[bold magenta]RESUMED[/bold magenta] | {title_text}"
232232

233233
return Panel(
234234
table,
235235
title=title_text,
236236
subtitle=info_text,
237-
border_style="cyan",
237+
border_style="white",
238238
padding=(0, 1)
239239
)
240240

@@ -288,7 +288,7 @@ def _render_footer(self) -> Panel:
288288

289289
return Panel(
290290
Align.center(footer),
291-
border_style="blue",
291+
border_style="white",
292292
padding=(0, 1)
293293
)
294294

@@ -713,7 +713,7 @@ def update_capture_status(self, networks_detected: int = None, pmkids_captured:
713713

714714
# Build metrics
715715
metrics = {
716-
'Networks Detected': f'[cyan]{self.networks_detected}[/cyan]',
716+
'Networks Detected': f'[white]{self.networks_detected}[/white]',
717717
'PMKIDs Captured': f'[bold green]{self.pmkids_captured}[/bold green]' if self.pmkids_captured > 0 else f'[dim]{self.pmkids_captured}[/dim]',
718718
'Capture File Size': f'[yellow]{size_str}[/yellow]',
719719
'Last Extraction': f'[white]{extraction_str}[/white]',
@@ -785,7 +785,7 @@ def _render_target_info(self) -> Panel:
785785
"""
786786
# For passive mode, show general capture info instead of specific target
787787
table = Table(show_header=False, box=None, padding=(0, 1))
788-
table.add_column("Label", style="bold cyan", width=18)
788+
table.add_column("Label", style="bold white", width=18)
789789
table.add_column("Value", style="white")
790790

791791
table.add_row("Mode:", "Passive PMKID Capture")
@@ -805,14 +805,14 @@ def _render_target_info(self) -> Panel:
805805
else:
806806
table.add_row("Duration Limit:", "Infinite (Ctrl+C to stop)")
807807

808-
title_text = "[bold cyan]Passive PMKID Sniffing[/bold cyan]"
808+
title_text = "[bold white]Passive PMKID Sniffing[/bold white]"
809809
if self.session:
810810
title_text = f"[bold magenta]RESUMED[/bold magenta] | {title_text}"
811811

812812
return Panel(
813813
table,
814814
title=title_text,
815-
border_style="cyan",
815+
border_style="white",
816816
padding=(0, 1)
817817
)
818818

@@ -1247,7 +1247,7 @@ def _update_display(self):
12471247
# Calculate deauths per minute
12481248
elapsed = time.time() - self.attack_start_time
12491249
deauths_per_min = (self.deauths_sent / elapsed * 60) if elapsed > 0 else 0
1250-
metrics['Deauths Sent'] = f'[cyan]{self.deauths_sent:,}[/cyan] ([dim]{deauths_per_min:.1f}/min[/dim])'
1250+
metrics['Deauths Sent'] = f'[white]{self.deauths_sent:,}[/white] ([dim]{deauths_per_min:.1f}/min[/dim])'
12511251
else:
12521252
metrics['Deauths Sent'] = f'[dim]0[/dim]'
12531253

@@ -1262,7 +1262,7 @@ def _update_display(self):
12621262

12631263
# Add timing metrics if available
12641264
if self.time_to_first_client is not None:
1265-
metrics['Time to 1st Client'] = f'[cyan]{self.time_to_first_client:.1f}s[/cyan]'
1265+
metrics['Time to 1st Client'] = f'[white]{self.time_to_first_client:.1f}s[/white]'
12661266

12671267
if self.time_to_first_credential is not None:
12681268
metrics['Time to 1st Cred'] = f'[yellow]{self.time_to_first_credential:.1f}s[/yellow]'
@@ -1310,7 +1310,7 @@ def _format_phase_indicator(self, phase: str) -> str:
13101310
elif phase == "Failed":
13111311
return f"[bold red]{indicator}[/bold red] {phase}"
13121312
elif phase == "Running":
1313-
return f"[bold cyan]{indicator}[/bold cyan] {phase}"
1313+
return f"[bold white]{indicator}[/bold white] {phase}"
13141314
elif phase in ["Stopping", "Cleaning up"]:
13151315
return f"[yellow]{indicator}[/yellow] {phase}"
13161316
else:
@@ -1365,7 +1365,7 @@ def _render_progress(self) -> Panel:
13651365

13661366
# Create client table
13671367
client_table = Table(show_header=True, box=None, padding=(0, 1))
1368-
client_table.add_column("MAC Address", style="cyan", width=17)
1368+
client_table.add_column("MAC Address", style="white", width=17)
13691369
client_table.add_column("IP Address", style="green", width=15)
13701370
client_table.add_column("Hostname", style="yellow")
13711371
client_table.add_column("Duration", style="white", width=8)
@@ -1386,7 +1386,7 @@ def _render_progress(self) -> Panel:
13861386
return Panel(
13871387
Group(base_panel.renderable, Text(), Text("Connected Clients:", style="bold"), client_table),
13881388
title="[bold]Progress[/bold]",
1389-
border_style="blue"
1389+
border_style="white"
13901390
)
13911391

13921392
return base_panel
@@ -1437,7 +1437,7 @@ def update_attack_statistics(self, deauth_count, disassoc_count,
14371437
'Deauth Frames': f'[red]{deauth_count:,}[/red]',
14381438
'Disassoc Frames': f'[yellow]{disassoc_count:,}[/yellow]',
14391439
'Total Attacks': f'[bold red]{total_attacks:,}[/bold red]',
1440-
'Networks Attacked': f'[cyan]{len(networks)}[/cyan]',
1440+
'Networks Attacked': f'[white]{len(networks)}[/white]',
14411441
'Unique Attackers': f'[magenta]{len(attackers)}[/magenta]'
14421442
}
14431443
})
@@ -1472,7 +1472,7 @@ def _render_target_info(self) -> Panel:
14721472
from ..config import Configuration
14731473

14741474
table = Table(show_header=False, box=None, padding=(0, 1))
1475-
table.add_column("Label", style="bold cyan", width=18)
1475+
table.add_column("Label", style="bold white", width=18)
14761476
table.add_column("Value", style="white")
14771477

14781478
table.add_row("Mode:", "Attack Monitoring")
@@ -1532,7 +1532,7 @@ def _render_progress(self) -> Panel:
15321532
# Add network list
15331533
if len(self.networks_under_attack) > 0:
15341534
sections.append(Text())
1535-
sections.append(Text("Networks Under Attack:", style="bold cyan"))
1535+
sections.append(Text("Networks Under Attack:", style="bold white"))
15361536
sections.append(self._render_network_list())
15371537

15381538
# Add attacker list
@@ -1544,7 +1544,7 @@ def _render_progress(self) -> Panel:
15441544
return Panel(
15451545
Group(*sections),
15461546
title="[bold]Attack Monitoring[/bold]",
1547-
border_style="blue"
1547+
border_style="white"
15481548
)
15491549

15501550
def _render_event_log(self) -> Table:
@@ -1557,7 +1557,7 @@ def _render_event_log(self) -> Table:
15571557
event_table = Table(show_header=True, box=None, padding=(0, 1))
15581558
event_table.add_column("Time", style="white", width=8)
15591559
event_table.add_column("Type", style="white", width=8)
1560-
event_table.add_column("Target", style="cyan", width=25)
1560+
event_table.add_column("Target", style="white", width=25)
15611561
event_table.add_column("Attacker", style="magenta", width=17)
15621562

15631563
# Show last 10 events
@@ -1594,7 +1594,7 @@ def _render_network_list(self) -> Table:
15941594
Rich Table with network attack statistics
15951595
"""
15961596
network_table = Table(show_header=True, box=None, padding=(0, 1))
1597-
network_table.add_column("ESSID", style="cyan", width=20)
1597+
network_table.add_column("ESSID", style="white", width=20)
15981598
network_table.add_column("BSSID", style="white", width=17)
15991599
network_table.add_column("Attacks", style="red", width=8, justify="right")
16001600
network_table.add_column("Last Seen", style="yellow", width=8)
@@ -1640,7 +1640,7 @@ def _render_attacker_list(self) -> Table:
16401640
attacker_table = Table(show_header=True, box=None, padding=(0, 1))
16411641
attacker_table.add_column("Attacker MAC", style="magenta", width=17)
16421642
attacker_table.add_column("Attacks", style="red", width=8, justify="right")
1643-
attacker_table.add_column("Targets", style="cyan", width=8, justify="right")
1643+
attacker_table.add_column("Targets", style="white", width=8, justify="right")
16441644

16451645
# Sort attackers by attack count (descending) and take top 10
16461646
sorted_attackers = sorted(

wifite/wifite.py

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,11 @@ def __init__(self):
5151

5252
# Automatic cleanup of old session files on startup
5353
self.cleanup_old_sessions()
54-
54+
5555
# Initialize interface assignment storage
5656
self.interface_assignment = None
5757
self.available_interfaces = []
58-
58+
5959
# Initialize interface manager for state tracking and cleanup (Task 10.4)
6060
from .util.interface_manager import InterfaceManager
6161
self.interface_manager = InterfaceManager()
@@ -1008,9 +1008,20 @@ def passive_pmkid_capture(self):
10081008
Color.pl('')
10091009

10101010
try:
1011+
# Create TUI controller if not in classic mode
1012+
tui_controller = None
1013+
if Configuration.use_tui:
1014+
try:
1015+
from .ui.tui import TUIController
1016+
tui_controller = TUIController()
1017+
except (ImportError, Exception) as e:
1018+
# Fall back to classic mode if TUI fails to load
1019+
Color.pl('{!} {O}Warning: TUI mode failed to load, using classic mode{W}')
1020+
if Configuration.verbose > 0:
1021+
Color.pl('{!} {O}TUI Error: %s{W}' % str(e))
1022+
Configuration.use_tui = False
1023+
10111024
# Create and run passive PMKID attack
1012-
# Pass TUI controller if TUI mode is enabled
1013-
tui_controller = self.tui_controller if Configuration.use_tui else None
10141025
attack = AttackPassivePMKID(tui_controller=tui_controller)
10151026
attack.run()
10161027

0 commit comments

Comments
 (0)