Skip to content

Commit c288ce5

Browse files
authored
Merge pull request #483 from c0dew3ll/bugfix/fix-version-for-aircrack-ng-in-syscheck
fix: improve version detection for aircrack-ng suite in syscheck
2 parents 941e07f + 6177dea commit c288ce5

1 file changed

Lines changed: 20 additions & 2 deletions

File tree

wifite/util/system_check.py

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,25 @@ def check_tools(self) -> List[ToolCheckResult]:
282282

283283
def _get_tool_version(self, name: str) -> Optional[str]:
284284
"""Try to get version string for a tool."""
285+
if name == 'airmon-ng':
286+
if shutil.which(name):
287+
return None
288+
return None
289+
290+
aircrack_family = ['aircrack-ng', 'airodump-ng', 'aireplay-ng']
291+
if name in aircrack_family:
292+
try:
293+
process = subprocess.run(
294+
[name], capture_output=True, text=True, timeout=5
295+
)
296+
output = (process.stdout + "\n" + process.stderr).splitlines()[:5]
297+
content = " ".join(output)
298+
match = re.search(r'(\d+\.\d+)', content)
299+
if match:
300+
return match.group(1)
301+
except Exception:
302+
pass
303+
285304
for flag in ['--version', '-v', '-V', 'version']:
286305
try:
287306
out = subprocess.run(
@@ -292,8 +311,7 @@ def _get_tool_version(self, name: str) -> Optional[str]:
292311
match = re.search(r'(\d+\.\d+[\.\d]*\w*)', combined)
293312
if match:
294313
return match.group(1)
295-
except (subprocess.TimeoutExpired, FileNotFoundError, OSError,
296-
PermissionError):
314+
except (subprocess.TimeoutExpired, FileNotFoundError, OSError, PermissionError):
297315
continue
298316
return None
299317

0 commit comments

Comments
 (0)