Skip to content

Commit 182395f

Browse files
committed
wpa-sec: fix some terminal output
1 parent aabfc10 commit 182395f

22 files changed

Lines changed: 108 additions & 106 deletions

wifite/attack/eviltwin.py

100644100755
File mode changed.

wifite/attack/pmkid_passive.py

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -31,35 +31,35 @@
3131
class AttackPassivePMKID:
3232
"""
3333
Passive PMKID capture attack that monitors all networks simultaneously.
34-
35-
Uses hcxdumptool with --rds=3 flag for passive capture without deauth.
34+
35+
Uses hcxdumptool for passive capture without deauth.
3636
Periodically extracts PMKID hashes from the capture file and saves them
3737
to individual .22000 files for offline cracking.
3838
"""
39-
39+
4040
def __init__(self, tui_controller=None):
4141
"""
4242
Initialize passive PMKID attack.
43-
43+
4444
Sets up capture file path, statistics tracking, and state variables.
4545
Initializes captured_pmkids dictionary to track captured hashes by BSSID.
46-
46+
4747
Args:
4848
tui_controller: Optional TUIController instance for TUI mode
4949
"""
5050
# Generate capture file path
5151
self.pcapng_file = Configuration.temp('passive_pmkid.pcapng')
52-
52+
5353
# Dictionary to track captured PMKIDs by BSSID
5454
# Format: {bssid: {'essid': str, 'hash': str, 'file': str, 'captured_at': float}}
5555
self.captured_pmkids = {}
56-
56+
5757
# Monitoring thread reference
5858
self.monitor_thread = None
59-
59+
6060
# HcxDumpToolPassive process reference
6161
self.dumptool = None
62-
62+
6363
# Statistics dictionary
6464
self.statistics = {
6565
'networks_detected': 0, # Total unique BSSIDs seen
@@ -69,7 +69,7 @@ def __init__(self, tui_controller=None):
6969
'capture_size_mb': 0.0, # Current capture file size in MB
7070
'duration_seconds': 0 # Total capture duration
7171
}
72-
72+
7373
# TUI support
7474
self.tui_controller = tui_controller
7575
self.tui_view = None
@@ -78,45 +78,45 @@ def __init__(self, tui_controller=None):
7878
self.tui_view.set_extraction_interval(Configuration.pmkid_passive_interval)
7979
self.tui_view.set_duration_limit(Configuration.pmkid_passive_duration)
8080
self.tui_view.set_capture_file_path(self.pcapng_file)
81-
81+
8282
def validate_dependencies(self):
8383
"""
8484
Validate required tools are installed.
85-
85+
8686
Checks for hcxdumptool and hcxpcapngtool availability.
8787
Displays error message with installation instructions if tools are missing.
88-
88+
8989
Returns:
9090
bool: True if dependencies are satisfied, False otherwise
9191
"""
9292
missing = []
93-
93+
9494
# Check for hcxdumptool
9595
if not Process.exists('hcxdumptool'):
9696
missing.append('hcxdumptool')
97-
97+
9898
# Check for hcxpcapngtool
9999
if not HcxPcapngTool.exists():
100100
missing.append('hcxpcapngtool')
101-
101+
102102
if missing:
103103
Color.pl('{!} {R}Missing required tools:{W} {O}%s{W}' % ', '.join(missing))
104104
Color.pl('{!} {O}Install with:{W} {C}apt install hcxdumptool hcxtools{W}')
105105
Color.pl('{!} {O}Or visit:{W}')
106106
Color.pl('{!} {C}https://github.com/ZerBea/hcxdumptool{W}')
107107
Color.pl('{!} {C}https://github.com/ZerBea/hcxtools{W}')
108108
return False
109-
109+
110110
return True
111-
111+
112112
def start_passive_capture(self):
113113
"""
114114
Start hcxdumptool in passive mode.
115-
115+
116116
Uses HcxDumpToolPassive context manager to ensure proper cleanup.
117117
Stores process reference for monitoring.
118118
Displays startup message with capture details.
119-
119+
120120
Returns:
121121
HcxDumpToolPassive: The passive capture instance
122122
"""
@@ -126,7 +126,7 @@ def start_passive_capture(self):
126126
self.tui_view.add_log(f'Interface: {Configuration.interface}')
127127
self.tui_view.add_log(f'Capture file: {self.pcapng_file}')
128128
self.tui_view.add_log(f'Extraction interval: {Configuration.pmkid_passive_interval} seconds')
129-
129+
130130
if Configuration.pmkid_passive_duration > 0:
131131
self.tui_view.add_log(f'Duration: {Configuration.pmkid_passive_duration} seconds')
132132
else:
@@ -137,25 +137,25 @@ def start_passive_capture(self):
137137
Color.pl('{+} Interface: {G}%s{W}' % Configuration.interface)
138138
Color.pl('{+} Capture file: {C}%s{W}' % self.pcapng_file)
139139
Color.pl('{+} Extraction interval: {G}%d seconds{W}' % Configuration.pmkid_passive_interval)
140-
140+
141141
if Configuration.pmkid_passive_duration > 0:
142142
Color.pl('{+} Duration: {G}%d seconds{W}' % Configuration.pmkid_passive_duration)
143143
else:
144144
Color.pl('{+} Duration: {G}infinite{W} (press Ctrl+C to stop)')
145-
145+
146146
Color.pl('')
147-
147+
148148
# Create and return HcxDumpToolPassive instance
149149
# Will be used with context manager in run()
150150
return HcxDumpToolPassive(
151151
interface=Configuration.interface,
152152
output_file=self.pcapng_file
153153
)
154-
154+
155155
def start_monitoring_thread(self):
156156
"""
157157
Start background thread for monitoring and extraction.
158-
158+
159159
Creates PassivePMKIDMonitor thread with self reference and extraction interval.
160160
Stores thread reference for cleanup.
161161
"""
@@ -164,16 +164,16 @@ def start_monitoring_thread(self):
164164
interval=Configuration.pmkid_passive_interval
165165
)
166166
self.monitor_thread.start()
167-
167+
168168
if self.tui_view:
169169
self.tui_view.add_log('Monitoring thread started')
170170
else:
171171
Color.pl('{+} {G}Monitoring thread started{W}')
172-
172+
173173
def extract_and_save_pmkids(self):
174174
"""
175175
Extract PMKID hashes from capture file and save them.
176-
176+
177177
Calls HcxPcapngTool.extract_all_pmkids() to get all PMKID hashes.
178178
Iterates through extracted hashes and saves new ones.
179179
Updates captured_pmkids dictionary with new entries.
@@ -182,17 +182,17 @@ def extract_and_save_pmkids(self):
182182
# Check if capture file exists and has data
183183
if not os.path.exists(self.pcapng_file):
184184
return
185-
185+
186186
if os.path.getsize(self.pcapng_file) == 0:
187187
return
188-
188+
189189
try:
190190
# Extract all PMKIDs from capture file
191191
pmkids = HcxPcapngTool.extract_all_pmkids(self.pcapng_file)
192-
192+
193193
if not pmkids:
194194
return
195-
195+
196196
# Track new PMKIDs found in this extraction
197197
new_pmkids = 0
198198

wifite/attack/portal/__init__.py

100644100755
File mode changed.

wifite/attack/portal/credential_handler.py

100644100755
File mode changed.

wifite/attack/portal/server.py

100644100755
File mode changed.

wifite/attack/portal/templates.py

100644100755
File mode changed.

wifite/attack/wpa3.py

100644100755
Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,14 @@
2929
class AttackWPA3SAE(Attack):
3030
"""
3131
WPA3-SAE attack implementation.
32-
32+
3333
This class implements various attack strategies for WPA3-SAE networks:
3434
1. Transition mode downgrade (highest success rate)
3535
2. Dragonblood exploitation (for vulnerable targets)
3636
3. Standard SAE handshake capture
3737
4. Passive capture (when PMF prevents deauth)
3838
"""
39-
39+
4040
def __init__(self, target):
4141
super(AttackWPA3SAE, self).__init__(target)
4242
self.clients = []
@@ -45,7 +45,7 @@ def __init__(self, target):
4545
self.wpa3_info = None
4646
self.attack_strategy = None
4747
self.downgrade_success = False
48-
48+
4949
# Initialize TUI view if in TUI mode
5050
self.view = None
5151
if OutputManager.is_tui_mode():
@@ -59,7 +59,7 @@ def __init__(self, target):
5959
def run(self):
6060
"""
6161
Execute WPA3-SAE attack based on target capabilities.
62-
62+
6363
This method:
6464
1. Checks for required tools
6565
2. Detects WPA3 capabilities
@@ -106,40 +106,40 @@ def run(self):
106106
else:
107107
Color.pl('{!} {R}Unknown attack strategy: %s{W}' % self.attack_strategy)
108108
return False
109-
109+
110110
def _check_wpa3_tools(self):
111111
"""
112112
Check if required WPA3 tools are available.
113-
113+
114114
Returns:
115115
bool: True if all required tools are available, False otherwise
116116
"""
117117
if not WPA3ToolChecker.can_attack_wpa3():
118118
Color.pl('{!} {R}Cannot attack WPA3 - missing required tools{W}')
119-
119+
120120
missing = WPA3ToolChecker.get_missing_tools()
121121
if missing:
122122
Color.pl('{!} {O}Missing tools:{W}')
123123
for tool in missing:
124124
url = WPA3ToolChecker.INSTALL_URLS.get(tool, 'N/A')
125125
Color.pl(' {R}%s{W}: {C}%s{W}' % (tool, url))
126-
126+
127127
Color.pl('\n{!} {O}Install missing tools to enable WPA3 attacks{W}')
128128
Color.pl('{!} {O}Skipping WPA3 target: {C}%s{W}' % self.target.essid)
129-
129+
130130
return False
131-
131+
132132
return True
133-
133+
134134
def _handle_pmf_prevention(self):
135135
"""
136136
Handle PMF (Protected Management Frames) preventing deauth attacks.
137-
137+
138138
This method:
139139
1. Detects PMF status
140140
2. Informs user of limitations
141141
3. Switches to passive capture mode
142-
142+
143143
Returns:
144144
bool: True if PMF is required (deauth disabled), False otherwise
145145
"""

0 commit comments

Comments
 (0)