Repo scan

From brucesongs/kali-claw · View interactive version

Repo scan is an AI agent skill from the GitHub repository brucesongs/kali-claw. Cross-stack source code asset audit that classifies every file, detects embedded third-party libraries, and delivers actionable verdicts per module.

How to use this skill

Skill file

Skill: Repository Scan — Cross-Stack Source Code Audit

Supplementary Files:

- payloads.md — Repository scanning commands, classification scripts, and analysis payloads organized by scan phase

- test-cases.md — Structured test cases for surface classification, dependency detection, hotspot mapping, and complete audit workflows

Summary

Repo Scan skill domain covering assessment operations.

Domain: assessment

Description

Cross-stack source code asset audit that classifies every file, detects embedded third-party libraries, and delivers actionable verdicts per module. This skill is used during white-box penetration testing and security code reviews to understand what code is present, what's third-party, and where security risks may hide.

Difference from security-review: security-review provides a checklist for auditing security patterns. This skill focuses on mapping and classifying the codebase itself — understanding what code exists, what's custom vs third-party, and where to focus security analysis.

Use Cases

Core Tools

| Tool | Purpose | Command Example |

|------|---------|-----------------|

| semgrep | Pattern-based static analysis | semgrep --config=auto --json . |

| trivy | Dependency and container scanning | trivy fs . |

| grype | Vulnerability matching for packages | grype dir:. |

| trufflehog | Secret scanning in git history | trufflehog git file://. --since-commit HEAD~100 |

| gitleaks | Git secret detection | gitleaks detect --source . |

| cloc | Line counting by language | cloc --by-file . |

| gh | GitHub code search and analysis | gh search code "<pattern>" --language python |

Methodology

Repo Scan Four-Phase Process

Phase 1: Surface Classification

Enumerate and tag every file:

# Count lines of code by language
cloc --by-file . --json

# Identify file types and structure
find . -type f | sed 's/.*\.//' | sort | uniq -c | sort -rn

# Detect third-party directories
find . -type d \( -name "vendor" -o -name "node_modules" -o -name "third_party" -o -name "external" -o -name "libs" -o -name "deps" \)

Classify each file as:

Phase 2: Library Detection

Identify embedded third-party libraries:

# Scan for known libraries and CVEs
trivy fs --scanners vuln .
grype dir:. --output json

# Check specific library versions
grep -r "version" vendor/*/package.json
grep -r "VERSION" libs/*/*.h

Phase 3: Security Hotspot Analysis

Focus review on high-value targets:

# Find authentication-related code
grep -rn "password\|auth\|token\|session\|login" --include="*.py" --include="*.js" --include="*.java" .

# Find database interaction
grep -rn "query\|execute\|cursor\|select\|insert\|update" --include="*.py" .

# Find file operations
grep -rn "open(\|readfile\|upload\|download\|include\(" --include="*.php" .

# Secret scanning
trufflehog filesystem . --json
gitleaks detect --source . --report-format json

Phase 4: Verdict and Report

Assign verdicts per module:

| Verdict | Meaning | Action |

|---------|---------|--------|

| Core Asset | Custom business logic, high security value | Deep security review required |

| Extract & Update | Vendored library, should be managed dependency | Replace with package manager; check CVEs |

| Rebuild | Duplicated or outdated wrapper code | Refactor; apply current security patterns |

| Deprecate | Dead code, unused modules | Remove to reduce attack surface |

Cross-Stack Coverage

| Stack | Key Files | Security Focus |

|-------|-----------|----------------|

| C/C++ | Makefile, CMakeLists.txt, .c, .h | Buffer overflows, memory management |

| Java/Android | build.gradle, pom.xml, *.java | Deserialization, SQL injection |

| iOS | Podfile, .swift, .m | Keychain usage, certificate pinning |

| Web (JS/TS) | package.json, .js, .ts | XSS, prototype pollution, supply chain |

| Python | requirements.txt, *.py | Pickle deserialization, command injection |

| Go | go.mod, *.go | Race conditions, unsafe operations |

| PHP | composer.json, *.php | SQL injection, file inclusion |

| Rust | Cargo.toml, *.rs | Unsafe blocks, dependency auditing |

Defense Perspective

Report Template

# Repository Scan Report
*Target: [repo/project] | Date: [date] | Depth: [fast/standard/deep]*

## Executive Summary
[Total files, languages, third-party ratio, key findings]

## Classification Summary
| Category | Files | Lines of Code | Percentage |
|----------|-------|---------------|------------|
| Project Code | N | N | N% |
| Third-Party | N | N | N% |
| Build Artifacts | N | N | N% |

## Detected Libraries
| Library | Version | Known CVEs | Status |
|---------|---------|------------|--------|
| [Name] | [X.Y.Z] | [N CVEs] | [Outdated/Current] |

## Module Verdicts
| Module | Verdict | Rationale | Security Priority |
|--------|---------|-----------|-------------------|
| [Name] | Core Asset / Extract / Rebuild / Deprecate | [Why] | [High/Med/Low] |

## Security Hotspots
[High-priority files/directories for deep security review]

## Recommendations
[Prioritized action items based on verdicts and findings]

Detection Methods

Repository Activity Audit

SIEM Detection Rules

Defense Evasion Techniques

Stealth Cloning

Code Search Stealth

Orchestration

ECC Loop Pattern

Cross-Skill Pipeline

repo-scan → security-review → verification-loop → chronicle
    ↓                                                          ↑
search-first (find tools)                continuous-learning (persist patterns)

Quality Gate

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.