Production hardening: security fixes, code quality, 724 skills complete

- Fix 25 shell=True subprocess calls with list-based commands
- Fix 49 verify=False in defensive skills (env-var override)
- Add timeout to 231 HTTP/subprocess/socket calls
- Fix 6 SQL injection patterns with whitelist validation
- Replace 8 __import__() with standard imports
- Remove 701 unused imports across 442 files
- Add authorized-testing disclaimers to all offensive skills
- Complete 11 incomplete skill directories
- Expand 10 stub SKILL.md files with full content
- Fix 2 YAML parse errors in frontmatter
- Fix 5 pre-existing syntax errors
- Convert 22 hardcoded paths/ports to environment variables
- Back up 21 redundant skill pairs to .bak
- Fix 2 global declaration errors
- 724/724 skills with full folder anatomy (SKILL.md + agent.py + api-reference.md + LICENSE)
- 0 compile errors across all 724 agent.py files
This commit is contained in:
mukul975
2026-03-19 13:26:49 +01:00
parent 63b442d347
commit c47eed6a64
900 changed files with 23085 additions and 2720 deletions
@@ -5,7 +5,6 @@ import json
import argparse
import logging
import subprocess
import re
import os
from datetime import datetime
@@ -16,7 +15,7 @@ logger = logging.getLogger(__name__)
def check_windows_dep_policy():
"""Check Windows DEP/NX policy via bcdedit."""
cmd = ["bcdedit", "/enum", "{current}"]
result = subprocess.run(cmd, capture_output=True, text=True)
result = subprocess.run(cmd, capture_output=True, text=True, timeout=120)
dep_policy = "unknown"
for line in result.stdout.split("\n"):
if "nx" in line.lower():
@@ -30,7 +29,7 @@ def check_windows_process_mitigations():
"Get-Process | ForEach-Object { try { $m = Get-ProcessMitigation -Id $_.Id -ErrorAction Stop; "
"[PSCustomObject]@{Name=$_.Name;PID=$_.Id;DEP=$m.DEP.Enable;ASLR=$m.ASLR.ForceRelocateImages;"
"CFG=$m.CFG.Enable;StrictHandle=$m.StrictHandle.Enable} } catch {} } | ConvertTo-Json"]
result = subprocess.run(cmd, capture_output=True, text=True)
result = subprocess.run(cmd, capture_output=True, text=True, timeout=120)
try:
processes = json.loads(result.stdout) if result.stdout else []
if isinstance(processes, dict):
@@ -53,25 +52,25 @@ def check_linux_aslr():
def check_linux_nx_support():
"""Check NX bit support on Linux."""
result = subprocess.run(["grep", "nx", "/proc/cpuinfo"], capture_output=True, text=True)
result = subprocess.run(["grep", "nx", "/proc/cpuinfo"], capture_output=True, text=True, timeout=120)
return {"nx_supported": "nx" in result.stdout.lower()}
def check_elf_pie_relro(binary_path):
"""Check ELF binary for PIE, RELRO, stack canary, and NX using readelf/checksec."""
findings = {"binary": binary_path, "pie": False, "relro": "none", "nx": False, "canary": False}
readelf_cmd = subprocess.run(["readelf", "-h", binary_path], capture_output=True, text=True)
readelf_cmd = subprocess.run(["readelf", "-h", binary_path], capture_output=True, text=True, timeout=120)
if "DYN" in readelf_cmd.stdout:
findings["pie"] = True
readelf_d = subprocess.run(["readelf", "-d", binary_path], capture_output=True, text=True)
readelf_d = subprocess.run(["readelf", "-d", binary_path], capture_output=True, text=True, timeout=120)
if "BIND_NOW" in readelf_d.stdout:
findings["relro"] = "full"
elif "GNU_RELRO" in readelf_d.stdout:
findings["relro"] = "partial"
readelf_s = subprocess.run(["readelf", "-s", binary_path], capture_output=True, text=True)
readelf_s = subprocess.run(["readelf", "-s", binary_path], capture_output=True, text=True, timeout=120)
if "__stack_chk_fail" in readelf_s.stdout:
findings["canary"] = True
readelf_l = subprocess.run(["readelf", "-l", binary_path], capture_output=True, text=True)
readelf_l = subprocess.run(["readelf", "-l", binary_path], capture_output=True, text=True, timeout=120)
for line in readelf_l.stdout.split("\n"):
if "GNU_STACK" in line and "RWE" not in line:
findings["nx"] = True