Skip to content

rkmahale17/rulcode.com / .agents/skills/security

security-scan

Verified

Scan the repository for hardcoded secrets, exposed API keys, insecure network configurations, and vulnerable dependencies. Use when the user asks for a security audit, secret detection, credential scan, vulnerability check, or wants to find leaked tokens in the codebase.

FileKindSize
SKILL.mdskill md2.0 KB
scripts/main_scan.shscript671 B
scripts/scan_deps.shscript290 B
scripts/scan_network.pyscript2.2 KB
scripts/scan_secrets.pyscript2.4 KB

scripts/scan_network.py

View on GitHub
import re
import os
import sys

# Patterns for network misconfigurations and interesting artifacts
PATTERNS = {
    "Hardcoded IP Address": r"\b(?:[0-9]{1,3}\.){3}[0-9]{1,3}\b",
    "Insecure Protocol (HTTP)": r"http://(?!(?:localhost|127\.0\.0\.1|0\.0\.0\.0))[\w\.-]+",
    "Internal Port Exposure": r"[:=]\s*(?:3000|5432|6379|8080|27017|9200)\b",
    "Dangerous Execution (eval)": r"\beval\s*\(",
    "Potential SQL Injection Pattern": r"\.query\s*\(\s*['\"].*?\$\{",
    "Hardcoded Private Key": r"-----BEGIN (?:RSA|OPENSSH|PRIVATE) KEY-----",
}

def scan_file(filepath):
    findings = []
    try:
        with open(filepath, 'r', encoding='utf-8', errors='ignore') as f:
            content = f.read()
            for name, pattern in PATTERNS.items():
                matches = re.finditer(pattern, content)
                for match in matches:
                    line_no = content.count('\n', 0, match.start()) + 1
                    snippet = match.group(0)
                    findings.append({
                        "type": name,
                        "line": line_no,
                        "match": snippet
                    })
    except Exception as e:
        pass
    return findings

def main():
    repo_path = "."
    if len(sys.argv) > 1:
        repo_path = sys.argv[1]

    all_findings = {}
    
    ignore_dirs = {'.git', 'node_modules', '.agents', '.next', 'dist', 'build'}
    ignore_files = {'package-lock.json', 'yarn.lock', 'scan_network.py'}

    for root, dirs, files in os.walk(repo_path):
        dirs[:] = [d for d in dirs if d not in ignore_dirs]
        for file in files:
            if file in ignore_files:
                continue
            
            filepath = os.path.join(root, file)
            findings = scan_file(filepath)
            if findings:
                all_findings[filepath] = findings

    if not all_findings:
        print("✅ No network/attack patterns found.")
    else:
        print("⚠️ Potential network/cyber-attack patterns found:")
        for file, findings in all_findings.items():
            print(f"\n📄 {file}")
            for f in findings:
                print(f"  - [{f['type']}] Line {f['line']}: {f['match']}")

if __name__ == "__main__":
    main()
rea-analysis-optimizationmorluto/reaOptimize REA providers and shared analysis workflows for agent context, latency, CPU, and memory while preserving correctness and Evidence. Use for analysis bottlenecks and cache or query design; CI/test-suite optimization belongs to rea-ci-tests-audit.Stars: 467kUpdated Claude CodeCodexVerifiedInstall
rea-ci-tests-auditmorluto/reaAudit REA CI and test suites for correctness, fixture drift, false passes, and measured performance; use for suite or workflow investigations and efficiency changes, rather than ordinary feature testing or a single test failure.Stars: 467kUpdated Claude CodeCodexVerifiedInstall
rea-tool-designmorluto/reaAudit, investigate, design, or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics.Stars: 467kUpdated Claude CodeCodexVerifiedInstall
ponytail-auditDietrichGebert/ponytailQuality audit of the whole repo: bugs, security, real load, missing tests, speed, and what to delete. Most important first.Stars: 193kUpdated Claude CodeCodexVerifiedInstall