mirror of
https://github.com/mukul975/Anthropic-Cybersecurity-Skills.git
synced 2026-07-17 13:15:16 +03:00
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:
@@ -1,10 +1,11 @@
|
||||
#!/usr/bin/env python3
|
||||
# For authorized penetration testing and educational environments only.
|
||||
# Usage against targets without prior mutual consent is illegal.
|
||||
# It is the end user's responsibility to obey all applicable local, state and federal laws.
|
||||
"""VLAN hopping assessment agent using scapy for DTP and double-tagging tests."""
|
||||
|
||||
import subprocess
|
||||
import sys
|
||||
import os
|
||||
import json
|
||||
from datetime import datetime
|
||||
|
||||
try:
|
||||
@@ -21,7 +22,8 @@ def get_interface_info(iface="eth0"):
|
||||
"""Get network interface details."""
|
||||
mac = get_if_hwaddr(iface)
|
||||
result = subprocess.run(
|
||||
["ip", "link", "show", iface], capture_output=True, text=True
|
||||
["ip", "link", "show", iface], capture_output=True, text=True,
|
||||
timeout=120,
|
||||
)
|
||||
return {"interface": iface, "mac": mac, "status": result.stdout.strip()}
|
||||
|
||||
@@ -93,18 +95,20 @@ def send_dtp_desirable(iface="eth0", count=10):
|
||||
|
||||
def create_vlan_interface(iface, vlan_id, ip_addr):
|
||||
"""Create a VLAN subinterface."""
|
||||
subprocess.run(["modprobe", "8021q"], capture_output=True)
|
||||
subprocess.run(["modprobe", "8021q"], capture_output=True, timeout=120)
|
||||
vlan_iface = f"{iface}.{vlan_id}"
|
||||
subprocess.run(
|
||||
["ip", "link", "add", "link", iface, "name", vlan_iface,
|
||||
"type", "vlan", "id", str(vlan_id)],
|
||||
capture_output=True
|
||||
capture_output=True,
|
||||
timeout=120,
|
||||
)
|
||||
subprocess.run(
|
||||
["ip", "addr", "add", f"{ip_addr}/24", "dev", vlan_iface],
|
||||
capture_output=True
|
||||
capture_output=True,
|
||||
timeout=120,
|
||||
)
|
||||
subprocess.run(["ip", "link", "set", vlan_iface, "up"], capture_output=True)
|
||||
subprocess.run(["ip", "link", "set", vlan_iface, "up"], capture_output=True, timeout=120)
|
||||
return {"vlan_interface": vlan_iface, "vlan_id": vlan_id, "ip": ip_addr}
|
||||
|
||||
|
||||
@@ -134,7 +138,8 @@ def cleanup_vlan_interfaces(iface, vlan_ids):
|
||||
for vid in vlan_ids:
|
||||
vlan_iface = f"{iface}.{vid}"
|
||||
result = subprocess.run(
|
||||
["ip", "link", "del", vlan_iface], capture_output=True
|
||||
["ip", "link", "del", vlan_iface], capture_output=True,
|
||||
timeout=120,
|
||||
)
|
||||
removed.append({"interface": vlan_iface, "success": result.returncode == 0})
|
||||
return removed
|
||||
|
||||
Reference in New Issue
Block a user