بنقرة واحدة
pentest-code
Code security testing — SAST, SCA, secret detection, container scanning, IaC analysis
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
Code security testing — SAST, SCA, secret detection, container scanning, IaC analysis
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
API security testing — REST, GraphQL, authentication, authorization, rate limiting, business logic
Network penetration testing — service enumeration, vulnerability scanning, credential auditing, Active Directory
Master pentest orchestration — full pipeline from target to report with confirmation gates
Comprehensive reconnaissance — passive OSINT, subdomain enumeration, port scanning, technology fingerprinting
Generate professional penetration testing reports from findings
Web application penetration testing — XSS, SQLi, CSRF, SSRF, command injection, file upload, WAF bypass
| name | pentest-code |
| description | Code security testing — SAST, SCA, secret detection, container scanning, IaC analysis |
Static and software composition analysis for finding vulnerabilities in source code, dependencies, containers, and infrastructure-as-code.
# Scan git repo (full history)
trufflehog git file://{repo_path} --only-verified --json > /tmp/scan/{target}/trufflehog.json
# Scan filesystem
trufflehog filesystem {repo_path} --only-verified --json > /tmp/scan/{target}/trufflehog-fs.json
# Scan specific file types
trufflehog filesystem {repo_path} --include-detectors=aws,gcp,azure,github,gitlab,slack,discord --json
# Scan current state
gitleaks detect --source {repo_path} --report-path /tmp/scan/{target}/gitleaks.json --report-format json
# Scan full git history
gitleaks detect --source {repo_path} --log-opts=--all --report-path /tmp/scan/{target}/gitleaks-history.json --report-format json
# Pre-commit scan
gitleaks protect --source {repo_path} --staged
# Common secret patterns in code
grep -rn --include="*.{js,ts,py,go,yaml,yml,json,env,conf,cfg,ini,toml}" \
-iE '(api[_-]?key|secret[_-]?key|password|token|aws[_-]?access|private[_-]?key)\s*[:=]\s*["\x27][^\s"'\'']{8,}' \
{repo_path} > /tmp/scan/{target}/grep-secrets.txt
# .env files
find {repo_path} -name ".env*" -not -path "*/node_modules/*" -not -path "*/.git/*" \
-exec echo "=== {} ===" \; -exec cat {} \; > /tmp/scan/{target}/env-files.txt
# Auto-detect language and scan with default rules
semgrep scan {repo_path} --config auto --json -o /tmp/scan/{target}/semgrep-auto.json
# OWASP Top 10 focused rules
semgrep scan {repo_path} --config "p/owasp-top-ten" --json -o /tmp/scan/{target}/semgrep-owasp.json
# Language-specific rules
semgrep scan {repo_path} --config "p/javascript" --json -o /tmp/scan/{target}/semgrep-js.json
semgrep scan {repo_path} --config "p/python" --json -o /tmp/scan/{target}/semgrep-python.json
semgrep scan {repo_path} --config "p/golang" --json -o /tmp/scan/{target}/semgrep-go.json
# Security-specific rules
semgrep scan {repo_path} --config "p/security-audit" --config "p/secrets" --json -o /tmp/scan/{target}/semgrep-security.json
# Custom rules for project-specific patterns
semgrep scan {repo_path} --config {custom_rules_path} --json
bandit -r {repo_path} -f json -o /tmp/scan/{target}/bandit.json --severity-level medium
cd {repo_path}
npx eslint . --ext .js,.jsx,.ts,.tsx --plugin security --format json > /tmp/scan/{target}/eslint-security.json 2>/dev/null
# Scan directory for dependency files
grype dir:{repo_path} -o json > /tmp/scan/{target}/grype.json
# Scan specific ecosystems
grype dir:{repo_path}/package.json -o json
grype dir:{repo_path}/requirements.txt -o json
grype dir:{repo_path}/go.mod -o json
grype dir:{repo_path}/Gemfile -o json
osv-scanner --format json -r {repo_path} > /tmp/scan/{target}/osv.json 2>/dev/null
cd {repo_path}
npm audit --json > /tmp/scan/{target}/npm-audit.json 2>/dev/null
npm audit --omit=dev --json > /tmp/scan/{target}/npm-audit-prod.json 2>/dev/null
pip-audit -r {repo_path}/requirements.txt -f json -o /tmp/scan/{target}/pip-audit.json 2>/dev/null || \
pip-audit -f json -o /tmp/scan/{target}/pip-audit.json 2>/dev/null
# Scan image
trivy image {image_name} --format json -o /tmp/scan/{target}/trivy-image.json
# Scan with severity filter
trivy image {image_name} --severity CRITICAL,HIGH --format json -o /tmp/scan/{target}/trivy-critical.json
# Scan Dockerfile
trivy config {repo_path}/Dockerfile --format json -o /tmp/scan/{target}/trivy-dockerfile.json
grype {image_name} -o json > /tmp/scan/{target}/grype-image.json
# Auto-detect IaC files
checkov -d {repo_path} --output json --output-file-path /tmp/scan/{target}/checkov.json
# Docker-specific
checkov -f {repo_path}/docker-compose.yml --output json --output-file-path /tmp/scan/{target}/checkov-docker.json
checkov -f {repo_path}/Dockerfile --output json --output-file-path /tmp/scan/{target}/checkov-dockerfile.json
# Terraform-specific
checkov -d {repo_path}/terraform/ --output json --output-file-path /tmp/scan/{target}/checkov-tf.json
# Kubernetes-specific
checkov -d {repo_path}/k8s/ --output json --output-file-path /tmp/scan/{target}/checkov-k8s.json
trivy config {repo_path} --format json -o /tmp/scan/{target}/trivy-iac.json
# NPM licenses
cd {repo_path}
license-checker --json --out /tmp/scan/{target}/npm-licenses.json 2>/dev/null
# Python licenses
pip-licenses --format=json --with-urls > /tmp/scan/{target}/pip-licenses.json 2>/dev/null
Compile all findings into a unified report:
# Merge all JSON results
jq -s '{
secrets: (.[0] // {}),
sast: (.[1] // {}),
dependencies: (.[2] // {}),
container: (.[3] // {}),
iac: (.[4] // {})
}' /tmp/scan/{target}/trufflehog.json \
/tmp/scan/{target}/semgrep-auto.json \
/tmp/scan/{target}/grype.json \
/tmp/scan/{target}/trivy-image.json \
/tmp/scan/{target}/checkov.json \
> /tmp/scan/{target}/combined-findings.json
| Severity | Criteria |
|---|---|
| Critical | Hardcoded production secrets, RCE vulnerabilities, known exploited CVEs in dependencies |
| High | SQL injection patterns, auth bypass, vulnerable dependencies with known exploits |
| Medium | Missing input validation, weak crypto, outdated dependencies with theoretical CVEs |
| Low | Code quality issues, missing headers, verbose errors |
| Info | Best practices, license warnings, non-critical findings |
# Code Security Audit: {repo_name}
## Date: {date}
### Summary
| Category | Critical | High | Medium | Low |
|----------|----------|------|--------|-----|
| Secrets | {n} | | | |
| SAST | | {n} | {n} | |
| Dependencies | | {n} | {n} | |
| Container | | {n} | {n} | |
| IaC | | {n} | {n} | |
### Critical Findings
1. **{title}** — {file}:{line}
- Category: {secret/sast/sca}
- Description: {detail}
- Remediation: {fix}
### Detailed Findings
...
/tmp/scan/{target}/
├── trufflehog.json
├── gitleaks.json
├── grep-secrets.txt
├── semgrep-auto.json
├── semgrep-owasp.json
├── bandit.json
├── grype.json
├── osv.json
├── npm-audit.json
├── pip-audit.json
├── trivy-image.json
├── trivy-iac.json
├── checkov.json
├── npm-licenses.json
├── combined-findings.json
└── code-audit-report.md