Skip to content

Commit 8d1d034

Browse files
committed
Fix Process.call() passing string commands to Popen without splitting
When shell=False (default), subprocess.Popen expects a list of args, not a string. Passing a string like 'iw dev' caused Popen to look for an executable literally named 'iw dev', resulting in FileNotFoundError. Split string commands into arg lists in Process.call(), matching the existing behavior in Process.__init__. Also guard __del__ in InterfaceManager against ImportError during Python shutdown. https://claude.ai/code/session_011L2mVc8fKRMrkc3Mgahkpy
1 parent e112373 commit 8d1d034

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

wifite/util/interface_manager.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1136,9 +1136,12 @@ def select_ap_interface(preferred=None) -> Optional[str]:
11361136

11371137
def __del__(self):
11381138
"""Cleanup on deletion."""
1139-
import contextlib
1140-
with contextlib.suppress(Exception):
1141-
self.cleanup_all()
1139+
try:
1140+
import contextlib
1141+
with contextlib.suppress(Exception):
1142+
self.cleanup_all()
1143+
except ImportError:
1144+
pass
11421145

11431146
# ========================================================================
11441147
# Interface Detection and Capability Checking (Task 2)

wifite/util/process.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,10 @@ def devnull():
108108
def call(command, cwd=None, shell=False):
109109
""" Calls a command (either string or list of args). Returns (stdout, stderr) """
110110
if isinstance(command, str) and not shell:
111-
# Only enable shell mode if explicitly requested
111+
# Split string commands into list of args for Popen when not using shell mode
112112
if Configuration.verbose > 1:
113113
Color.pe(f'\n {{C}}[?]{{W}} Executing: {{B}}{command}{{W}}')
114+
command = command.split()
114115
elif shell:
115116
if Configuration.verbose > 1:
116117
Color.pe(f'\n {{C}}[?] {{W}} Executing (Shell): {{B}}{command}{{W}}')

0 commit comments

Comments
 (0)