AI prompt · Web pentesting
API test plan prompt
Prompt that builds an API test plan from an OpenAPI excerpt: endpoints by risk, authorisation matrix and tests per OWASP API Top 10 category.
Published
Cheatsheet · OSINT · Web pentesting
Search a client’s Git repositories for secrets with Gitleaks, TruffleHog and git, then handle a finding: rotation first, history rewrite second.
Official website: Gitleaks
A committed secret (API key, password, token, private key) remains readable in the history even after the file is deleted. This cheatsheet covers detection on repositories the client owns or has explicitly entrusted to you: Gitleaks, TruffleHog and a few basic git commands. Scope the search (repositories, organisations, branches) with the penetration test scoping checklist; on the OSINT side, the topic complements the exposure assessment methodology. Examples (target.example, alice, example-repo) are fictitious; replace CLIENT_ORG and CLIENT_REPO with the client’s GitHub organisation and repository.
These tools read repository contents, so anything they find may be a valid credential. Three rules for the engagement:
Tool versions change: confirm options with gitleaks --help and trufflehog --help before automating anything.
Recent Gitleaks versions split the modes into subcommands: git (a repository’s history) and dir (files in a directory, no history). The older gitleaks detect command is deprecated in recent versions; check gitleaks --help for what your version offers.
# Full history of a cloned repository (every commit)
gitleaks git --verbose --redact example-repo
# Repository in the current directory
gitleaks git --redact .
# Files in a directory or a single file, without reading Git history
gitleaks dir --redact ./example-repo
# JSON report for follow-up, secrets masked
gitleaks git --redact --report-format json --report-path gitleaks-report.json example-repo
--redact masks secrets in the output and report: enable it by default. --verbose prints every finding (rule, file, commit, author, date). Gitleaks returns a non-zero exit code (1 by default) when it finds secrets, which is useful in continuous integration; --exit-code changes it.
# Restrict to a range of commits (options passed to git log)
gitleaks git --redact --log-opts="--all --since=2026-01-01" example-repo
# Skip findings already triaged (baseline from a previous report)
gitleaks git --redact --baseline-path previous-report.json example-repo
# Custom configuration (added rules, allowlists)
gitleaks git --redact --config gitleaks.toml example-repo
Gitleaks detects using patterns and entropy: expect false positives (documentation examples, test tokens, public identifiers) and false negatives (secrets without a recognisable format).
TruffleHog scans a Git repository, a GitHub organisation or a filesystem, and can check whether a detected secret is still valid.
# Local repository (full history)
trufflehog git file://./example-repo
# A client remote repository, reachable with the access supplied
trufflehog git https://git.target.example/team/example-repo.git
# A client GitHub organisation or repository (read-only token supplied by the client)
export GITHUB_TOKEN=...
trufflehog github --org=CLIENT_ORG
trufflehog github --repo=https://github.com/CLIENT_ORG/CLIENT_REPO
# Files in a directory
trufflehog filesystem ./example-repo
# JSON output
trufflehog git file://./example-repo --json > trufflehog-report.json
Use a GitHub token with minimal scope (repository read) and revoke it at the end of the engagement.
By default, TruffleHog tries to verify each detected secret by sending it to the service concerned (for example a cloud provider or messaging API) to learn whether it is valid. That changes the nature of the action:
# No verification: the secret is not sent to third parties (purely local analysis)
trufflehog git file://./example-repo --no-verification
# Keep only secrets verified as valid (calls third-party APIs)
trufflehog git file://./example-repo --only-verified
The choice is a point for the agreement: settle it in writing. Without the client’s explicit authorisation for verification, run with --no-verification and let the client validate or revoke the secrets themselves. Note that --only-verified also hides secrets that cannot be verified: an empty result therefore does not prove there are no secrets.
A few commands are enough to check a finding or search for a specific pattern.
# Search for a pattern across the whole history (all commits)
git log --all -p -S'AKIA' --oneline
# Find when a sensitive file was added or deleted
git log --all --diff-filter=AD --name-status -- '*.env' '*.pem' '*id_rsa*'
# Search for a pattern in the tree of every commit
git grep -n -i 'password' $(git rev-list --all) -- '*.yml' | head -50
# Who introduced the line, and when
git blame -L 12,12 path/to/file.conf
git log -S returns commits that add or remove the string; git grep over git rev-list --all can be very slow on a large repository, so limit it by path. Also look for risky file names: .env, *.pem, id_rsa, terraform.tfstate, *.kdbx, credentials.
git filter-repo (recommended today over git filter-branch), followed by a force push and invalidation of clones and forks. It is a heavy operation and never sufficient on its own: existing copies and the hosting provider’s caches may keep the old content. See your host’s documentation..gitignore).AI prompt · Web pentesting
Prompt that builds an API test plan from an OpenAPI excerpt: endpoints by risk, authorisation matrix and tests per OWASP API Top 10 category.
Published
AI prompt · Infrastructure and AD pentesting · OSINT · Cloud
Prompt that analyses an asset inventory from the authorised scope (domains, IPs, services, cloud) to prioritise testing: exposure, criticality, checks.
Published
Cheatsheet · Web pentesting
Burp Suite for an authorised web test: proxy and CA certificate, scope, HTTP history, Repeater, careful Intruder use, Decoder and evidence export.
Published
BEAROPS
BEAROPS carries out OSINT investigations lasting from a few days to several weeks, using open sources within a legal framework.