
लीक हुए क्रेडेंशियल्स खोजें, सत्यापित करें और विश्लेषण करें
लीक हुई क्रेडेंशियल्स खोजें।
...और अधिक
TruffleHog और इसकी सुविधाओं और क्षमताओं के बारे में अधिक जानने के लिए, हमारे उत्पाद पृष्ठ पर जाएं।
क्या आप Git, Jira, Slack, Confluence, Microsoft Teams, Sharepoint (और अन्य) की लगातार निगरानी करके क्रेडेंशियल्स खोजने में रुचि रखते हैं? हमारे पास एक एंटरप्राइज़ उत्पाद है जो मदद कर सकता है! और अधिक जानने के लिए https://trufflesecurity.com/trufflehog-enterprise पर जाएं।
हम एंटरप्राइज़ उत्पाद से होने वाली आय का उपयोग और अधिक शानदार ओपन सोर्स प्रोजेक्ट्स को निधि देने के लिए करते हैं, जिससे पूरे समुदाय को लाभ हो सके।
TruffleHog सबसे शक्तिशाली गुप्त जानकारी खोज, वर्गीकरण, सत्यापन और विश्लेषण उपकरण है।
इस संदर्भ में, गुप्त जानकारी से तात्पर्य उस साख से है जिसका उपयोग एक मशीन दूसरी मशीन को प्रमाणित करने के लिए करती है। इसमें API कुंजियाँ, डेटाबेस पासवर्ड, निजी एन्क्रिप्शन कुंजियाँ और अन्य शामिल हैं।
TruffleHog कई स्थानों पर गुप्त जानकारी खोज सकता है, जिसमें Git, चैट, विकी, लॉग, API परीक्षण प्लेटफ़ॉर्म, ऑब्जेक्ट स्टोर, फ़ाइल सिस्टम और अन्य शामिल हैं।
TruffleHog 800 से अधिक प्रकार की गुप्त जानकारियों का वर्गीकरण करता है, उन्हें उन विशिष्ट पहचानों से जोड़ते हुए जिनसे वे संबंधित हैं। क्या यह AWS गुप्त जानकारी है? Stripe गुप्त जानकारी? Cloudflare गुप्त जानकारी? Postgres पासवर्ड? SSL निजी कुंजी? कभी-कभी देखकर समझना मुश्किल होता है, इसलिए TruffleHog हर उस चीज़ का वर्गीकरण करता है जो उसे मिलती है।
TruffleHog जिस भी गुप्त जानकारी को वर्गीकृत कर सकता है, वह यह पुष्टि करने के लिए उसमें लॉग इन भी कर सकता है कि वह गुप्त जानकारी सक्रिय है या नहीं। यह चरण यह जानने के लिए महत्वपूर्ण है कि कोई सक्रिय वर्तमान खतरा है या नहीं।
सबसे अधिक लीक होने वाले लगभग 20 प्रकार के क्रेडेंशियल के लिए, गुप्त जानकारी में लॉग इन किया जा सकता है या नहीं यह जांचने के लिए एक अनुरोध भेजने के बजाय, TruffleHog कई अनुरोध भेज सकता है ताकि गुप्त जानकारी के बारे में सब कुछ पता चल सके। इसे किसने बनाया? यह किन संसाधनों तक पहुँच सकता है? उन संसाधनों पर इसकी क्या अनुमतियाँ हैं?
कोई प्रश्न? प्रतिक्रिया? Slack या Discord में आएं और हमारे साथ जुड़ें।
Join our Slack Community
Join the Secret Scanning Discord
```bash
docker run --rm -it -v "$PWD:/pwd" trufflesecurity/trufflehog:latest github --org=trufflesecurity
# :floppy_disk: स्थापना
आपके लिए कई विकल्प उपलब्ध हैं:
### MacOS उपयोगकर्ता```bash
brew install trufflehog
Docker इंजन चल रहा हो यह सुनिश्चित करने के बाद निम्नलिखित कमांड निष्पादित करें:
docker run --rm -it -v "$PWD:/pwd" trufflesecurity/trufflehog:latest github --repo https://github.com/trufflesecurity/test_keys
#### विंडोज कमांड प्रॉम्प्ट```bash
docker run --rm -it -v "%cd:/=\%:/pwd" trufflesecurity/trufflehog:latest github --repo https://github.com/trufflesecurity/test_keys
docker run --rm -it -v "${PWD}:/pwd" trufflesecurity/trufflehog github --repo https://github.com/trufflesecurity/test_keys
#### M1 और M2 मैक```bash
docker run --platform linux/arm64 --rm -it -v "$PWD:/pwd" trufflesecurity/trufflehog:latest github --repo https://github.com/trufflesecurity/test_keys
Download and unpack from https://github.com/trufflesecurity/trufflehog/releases
### स्रोत से संकलन```bash
git clone https://github.com/trufflesecurity/trufflehog.git
cd trufflehog; go install
curl -sSfL https://raw.githubusercontent.com/trufflesecurity/trufflehog/main/scripts/install.sh | sh -s -- -b /usr/local/bin
### इंस्टॉलेशन स्क्रिप्ट का उपयोग करके, चेकसम हस्ताक्षर सत्यापित करें (cosign इंस्टॉल होना आवश्यक है)```bash
curl -sSfL https://raw.githubusercontent.com/trufflesecurity/trufflehog/main/scripts/install.sh | sh -s -- -v -b /usr/local/bin
curl -sSfL https://raw.githubusercontent.com/trufflesecurity/trufflehog/main/scripts/install.sh | sh -s -- -b /usr/local/bin
# :closed_lock_with_key: आर्टिफैक्ट्स की पुष्टि करना
सभी आर्टिफैक्ट्स पर चेकसम लागू किए जाते हैं, और परिणामी चेकसम फ़ाइल को cosign का उपयोग करके हस्ताक्षरित किया जाता है।
हस्ताक्षर सत्यापित करने के लिए आपको निम्नलिखित टूल की आवश्यकता है:
- [Cosign](https://docs.sigstore.dev/cosign/system_config/installation/)
सत्यापन के चरण निम्नलिखित हैं:
1. आप जिन आर्टिफैक्ट फ़ाइलों को चाहते हैं, उन्हें और निम्नलिखित फ़ाइलों को [releases](https://github.com/trufflesecurity/trufflehog/releases) पेज से डाउनलोड करें।
- trufflehog\_{version}\_checksums.txt
- trufflehog\_{version}\_checksums.txt.pem
- trufflehog\_{version}\_checksums.txt.sig
2. हस्ताक्षर सत्यापित करें: ```shell
cosign verify-blob <path to trufflehog_{version}_checksums.txt> \
--certificate <path to trufflehog_{version}_checksums.txt.pem> \
--signature <path to trufflehog_{version}_checksums.txt.sig> \
--certificate-identity-regexp 'https://github\.com/trufflesecurity/trufflehog/\.github/workflows/.+' \
--certificate-oidc-issuer "https://token.actions.githubusercontent.com"
{version} को डाउनलोड की गई फ़ाइलों के संस्करण से बदलें
वैकल्पिक रूप से, यदि आप इंस्टॉलेशन स्क्रिप्ट का उपयोग कर रहे हैं, तो हस्ताक्षर सत्यापन करने के लिए -v विकल्प पास करें।
इसके लिए इंस्टॉलेशन स्क्रिप्ट चलाने से पहले Cosign बाइनरी स्थापित होना आवश्यक है।
आदेश:```bash trufflehog git https://github.com/trufflesecurity/test_keys --results=verified
अपेक्षित आउटपुट:```
🐷🔑🐷 TruffleHog. Unearth your secrets. 🐷🔑🐷
Found verified result 🐷🔑
Detector Type: AWS
Decoder Type: PLAIN
Raw result: AKIAYVP4CIPPERUVIFXG
Line: 4
Commit: fbc14303ffbf8fb1c2c1914e8dda7d0121633aca
File: keys
Email: counter <[email protected]>
Repository: https://github.com/trufflesecurity/test_keys
Timestamp: 2022-06-16 10:17:40 -0700 PDT
...
trufflehog github --org=trufflesecurity --results=verified
## 3: एक GitHub संगठन को स्कैन करें, संग्रहीत रिपॉजिटरी को छोड़कर```bash
trufflehog github --org=trufflesecurity --exclude-archived
कमांड:```bash trufflehog git https://github.com/trufflesecurity/test_keys --results=verified --json
अपेक्षित आउटपुट:```
{"SourceMetadata":{"Data":{"Git":{"commit":"fbc14303ffbf8fb1c2c1914e8dda7d0121633aca","file":"keys","email":"counter \[email protected]\u003e","repository":"https://github.com/trufflesecurity/test_keys","timestamp":"2022-06-16 10:17:40 -0700 PDT","line":4}}},"SourceID":0,"SourceType":16,"SourceName":"trufflehog - git","DetectorType":2,"DetectorName":"AWS","DecoderName":"PLAIN","Verified":true,"Raw":"AKIAYVP4CIPPERUVIFXG","Redacted":"AKIAYVP4CIPPERUVIFXG","ExtraData":{"account":"595918472158","arn":"arn:aws:iam::595918472158:user/canarytokens.com@@mirux23ppyky6hx3l6vclmhnj","user_id":"AIDAYVP4CIPPJ5M54LRCY"},"StructuredData":null}
...
trufflehog github --repo=https://github.com/trufflesecurity/test_keys --issue-comments --pr-comments
## 6: एक S3 बकेट को उच्च-विश्वास परिणामों के लिए स्कैन करें (verified + unknown)```bash
trufflehog s3 --bucket=<bucket name> --results=verified,unknown
trufflehog s3 --role-arn=
## 8: Docker में SSH प्रमाणीकरण का उपयोग करके Github रिपॉजिटरी स्कैन करें```bash
docker run --rm -v "$HOME/.ssh:/root/.ssh:ro" trufflesecurity/trufflehog:latest git ssh://github.com/trufflesecurity/test_keys
trufflehog filesystem path/to/file1.txt path/to/file2.txt path/to/dir
## 10: स्थानीय git रिपॉजिटरी को स्कैन करें
git रिपॉजिटरी को क्लोन करें। उदाहरण के लिए [टेस्ट कुंजियाँ](https://github.com/trufflesecurity/trufflehog/blob/HEAD/[email protected]:trufflesecurity/test_keys.git) रिपॉजिटरी।```bash
git clone [email protected]:trufflesecurity/test_keys.git
trufflehog को पैरेंट डायरेक्टरी (git रिपो के बाहर) से चलाएँ।```bash trufflehog git file://test_keys --results=verified,unknown
To guard against malicious git configs in local scanning (see CVE-2025-41390), TruffleHog clones local git repositories to a temporary directory prior to scanning. This follows [Git's security best practices](https://git-scm.com/docs/git#_security). If you want to specify a custom path to clone the repository to (instead of tmp), you can use the `--clone-path` flag. If you'd like to skip the local cloning process and scan the repository directly (only do this for trusted repos), you can use the `--trust-local-git-config` flag.
## 11: केवल सत्यापित रहस्यों के लिए GCS बकेट स्कैन करें```bash
trufflehog gcs --project-id=<project-ID> --cloud-environment --results=verified
एकाधिक इमेज को स्कैन करने के लिए --image फ्लैग का एकाधिक बार उपयोग करें।```bash
trufflehog docker --image trufflesecurity/secrets --results=verified
trufflehog docker --image docker://new_image:tag --results=verified
trufflehog docker --image file://path_to_image.tar --results=verified
## 13: CI में स्कैन करें
`--since-commit` फ़्लैग को अपनी डिफ़ॉल्ट ब्रांच पर सेट करें जिसमें लोग मर्ज करते हैं (उदा.: "main")। `--branch` फ़्लैग को अपनी PR की ब्रांच के नाम पर सेट करें (उदा.: "feature-1")। आपके द्वारा उपयोग किए जाने वाले CI/CD प्लेटफ़ॉर्म के आधार पर, यह मान गतिशील रूप से खींचा जा सकता है (उदा.: [Circle CI में CIRCLE_BRANCH](https://circleci.com/docs/variables/) और [Travis CI में TRAVIS_PULL_REQUEST_BRANCH](https://docs.travis-ci.com/user/environment-variables/))। यदि रिपॉजिटरी क्लोन की गई है और CI/CD वर्कफ़्लो के दौरान लक्ष्य ब्रांच पहले से चेक आउट है, तो `--branch HEAD` पर्याप्त होना चाहिए। `--fail` फ़्लैग मान्य क्रेडेंशियल्स मिलने पर 183 त्रुटि कोड लौटाएगा।```bash
trufflehog git file://. --since-commit main --branch feature-1 --results=verified,unknown --fail
एकाधिक लक्ष्यों को स्कैन करने के लिए --workspace-id, --collection-id, --environment फ़्लैग्स का एकाधिक बार उपयोग करें।```bash
trufflehog postman --token= --workspace-id=
## 15: Jenkins सर्वर स्कैन करें```bash
trufflehog jenkins --url https://jenkins.example.com --username admin --password admin
TruffleHog के साथ स्थानीय क्लस्टर में प्रमाणित करने के दो तरीके हैं: (1) उपयोगकर्ता नाम और पासवर्ड, (2) सेवा टोकन।
trufflehog elasticsearch --nodes 192.168.14.3 192.168.14.4 --username truffle --password hog
#### सेवा टोकन के साथ स्थानीय क्लस्टर से कनेक्ट करें```bash
trufflehog elasticsearch --nodes 192.168.14.3 192.168.14.4 --service-token ‘AAEWVaWM...Rva2VuaSDZ’
एलास्टिक क्लाउड पर एक क्लस्टर को स्कैन करने के लिए, आपको एक Cloud ID और API key की आवश्यकता होगी।```bash
trufflehog elasticsearch
--cloud-id 'search-prod:dXMtY2Vx...YjM1ODNlOWFiZGRlNjI0NA=='
--api-key 'MlVtVjBZ...ZSYlduYnF1djh3NG5FQQ=='
## 17. किसी GitHub रिपॉजिटरी के लिए क्रॉस फ़ोर्क ऑब्जेक्ट संदर्भ और हटाए गए कमिट को स्कैन करें
निम्नलिखित कमांड एक GitHub रिपॉजिटरी पर हटाए गए और छिपे हुए कमिट को सूचीबद्ध करेगा और फिर उनमें गुप्त जानकारी (सीक्रेट्स) के लिए स्कैन करेगा। यह एक अल्फा रिलीज़ सुविधा है।```bash
trufflehog github-experimental --repo https://github.com/<USER>/<REPO>.git --object-discovery
सामान्य TruffleHog आउटपुट के अलावा, --object-discovery फ़्लैग एक नई $HOME/.trufflehog निर्देशिका में दो फ़ाइलें बनाता है: valid_hidden.txt और invalid.txt। इनका उपयोग कमिट गणना के दौरान स्थिति को ट्रैक करने के साथ-साथ उपयोगकर्ताओं को सभी छिपे और हटाए गए कमिट (valid_hidden.txt) की पूरी सूची प्रदान करने के लिए किया जाता है। यदि आप स्कैनिंग के बाद इन फ़ाइलों को स्वचालित रूप से हटाना चाहते हैं, तो कृपया --delete-cached-data फ़्लैग जोड़ें।
नोट: इस विधि का उपयोग करके किसी रिपॉज़िटरी पर सभी मान्य कमिटों की गणना करने में आपके रिपॉज़िटरी के आकार के आधार पर 20 मिनट से लेकर कुछ घंटे लग सकते हैं। हमने एक प्रोग्रेस बार जोड़ा है ताकि आपको पता चलता रहे कि गणना में कितना समय लगेगा। वास्तविक सीक्रेट स्कैनिंग बेहद तेज़ चलती है।
क्रॉस फोर्क ऑब्जेक्ट रेफरेंसेज़ (Cross Fork Object References) के बारे में अधिक जानकारी के लिए, कृपया हमारा ब्लॉग पोस्ट पढ़ें।
trufflehog huggingface
--model <model_id>
--dataset <dataset_id>
--space <space_id>
--bucket <bucket_id>
### हगिंग फेस संगठन या उपयोगकर्ता के सभी मॉडल, डेटासेट, स्पेस और बकेट स्कैन करें```bash
trufflehog huggingface --org <orgname> --user <username>
(वैकल्पिक रूप से) किसी संगठन या उपयोगकर्ता को स्कैन करते समय, आप --skip-all-models, --skip-all-datasets, --skip-all-spaces, --skip-all-buckets के साथ संसाधनों की पूरी श्रेणी को छोड़ सकते हैं या --ignore-models <model_id>, --ignore-datasets <dataset_id>, --ignore-spaces <space_id>, --ignore-buckets <bucket_id> के साथ किसी विशेष संसाधन को छोड़ सकते हैं।
trufflehog huggingface --model <model_id> --include-discussions --include-prs
## 19. stdin इनपुट स्कैन करें```bash
aws s3 cp s3://example/gzipped/data.gz - | gunzip -c | trufflehog stdin
🐷🔑🐷 TruffleHog. Unearth your secrets. 🐷🔑🐷 दिखता है और प्रोग्राम बाहर निकल जाता है, क्या बात है?
--token फ्लैग को एक व्यक्तिगत एक्सेस टोकन के साथ शामिल करें।trufflehog:ignore टिप्पणी जोड़ सकते हैं जिसमें रहस्य है, उस रहस्य को अनदेखा करने के लिए।TruffleHog v3 Go में पूरी तरह से पुनर्लेखन है जिसमें कई नई शक्तिशाली विशेषताएं हैं।
प्रत्येक संभावित क्रेडेंशियल के लिए जिसका पता लगाया जाता है, हमने उस API के विरुद्ध प्रोग्रामेटिक सत्यापन को श्रमसाध्य रूप से लागू किया है जिसके बारे में हमें लगता है कि वह उसी का है। सत्यापन झूठी सकारात्मकताओं (false positives) को समाप्त करता है और तीन परिणाम स्थितियाँ प्रदान करता है:
उदाहरण के लिए, AWS क्रेडेंशियल डिटेक्टर यह सत्यापित करने के लिए AWS API के विरुद्ध GetCallerIdentity API कॉल करता है कि AWS क्रेडेंशियल सक्रिय है या नहीं।
TruffleHog में डेटा के प्रत्येक स्रोत के लिए एक उप-कमांड है जिसे आप स्कैन करना चाह सकते हैं:
प्रत्येक उप-कमांड के विकल्प हो सकते हैं जिन्हें आप उप-कमांड को प्रदान किए गए --help फ्लैग के साथ देख सकते हैं:```
$ trufflehog git --help
usage: TruffleHog [] [ ...]
TruffleHog is a tool for finding credentials.
Flags: -h, --[no-]help Show context-sensitive help (also try --help-long and --help-man). --log-level=0 Logging verbosity on a scale of 0 (info) to 5 (trace). Can be disabled with "-1". --[no-]profile Enables profiling and sets a pprof and fgprof server on :18066. -j, --[no-]json Output in JSON format. --[no-]json-legacy Use the pre-v3.0 JSON format. Only works with git, gitlab, and github sources. --[no-]github-actions Output in GitHub Actions format. --concurrency=12 Number of concurrent workers. --[no-]no-verification Don't verify the results. --results=RESULTS Specifies which type(s) of results to output: verified (confirmed valid by API), unknown (verification failed due to error), unverified (detected but not verified), filtered_unverified (unverified but would have been filtered out). Defaults to verified,unverified,unknown. --[no-]no-color Disable colorized output --[no-]allow-verification-overlap Allow verification of similar credentials across detectors --[no-]filter-unverified Only output first unverified result per chunk per detector if there are more than one results. --filter-entropy=FILTER-ENTROPY Filter unverified results with Shannon entropy. Start with 3.0. --config=CONFIG Path to configuration file. --[no-]print-avg-detector-time Print the average time spent on each detector. --[no-]no-update Don't check for updates. --[no-]fail Exit with code 183 if results are found. --[no-]fail-on-scan-errors Exit with non-zero error code if an error occurs during the scan. --verifier=VERIFIER ... Set custom verification endpoints. --[no-]custom-verifiers-only Only use custom verification endpoints. --detector-timeout=DETECTOR-TIMEOUT Maximum time to spend scanning chunks per detector (e.g., 30s). --archive-max-size=ARCHIVE-MAX-SIZE Maximum size of archive to scan. (Byte units eg. 512B, 2KB, 4MB) --archive-max-depth=ARCHIVE-MAX-DEPTH Maximum depth of archive to scan. --archive-timeout=ARCHIVE-TIMEOUT Maximum time to spend extracting an archive. --include-detectors="all" Comma separated list of detector types to include. Protobuf name or IDs may be used, as well as ranges. --exclude-detectors=EXCLUDE-DETECTORS Comma separated list of detector types to exclude. Protobuf name or IDs may be used, as well as ranges. IDs defined here take precedence over the include list. --[no-]no-verification-cache Disable verification caching --[no-]force-skip-binaries Force skipping binaries. --[no-]force-skip-archives Force skipping archives. --[no-]skip-additional-refs Skip additional references. --user-agent-suffix=USER-AGENT-SUFFIX Suffix to add to User-Agent. --[no-]version Show application version.
Commands: help [...] Show help.
git []
Find credentials in git repositories.
github [] Find credentials in GitHub repositories.
github-experimental --repo=REPO [] Run an experimental GitHub scan. Must specify at least one experimental sub-module to run: object-discovery.
gitlab --token=TOKEN [] Find credentials in GitLab repositories.
filesystem [] [...] Find credentials in a filesystem.
s3 [] Find credentials in S3 buckets.
gcs [] Find credentials in GCS buckets.
syslog --format=FORMAT [] Scan syslog
circleci --token=TOKEN Scan CircleCI
docker [] Scan Docker Image
travisci --token=TOKEN Scan TravisCI
postman [] Scan Postman
elasticsearch [] Scan Elasticsearch
jenkins --url=URL [] Scan Jenkins
huggingface [] Find credentials in HuggingFace datasets, models and spaces.
stdin Find credentials from stdin.
multi-scan Find credentials in multiple sources defined in configuration.
json-enumerator [...] Find credentials from a JSON enumerator input.
analyze Analyze API keys for fine-grained permissions information.
उदाहरण के लिए, किसी `git` रिपॉजिटरी को स्कैन करने के लिए, इससे शुरू करें```
trufflehog git https://github.com/trufflesecurity/trufflehog.git
TruffleHog --config फ़्लैग के माध्यम से प्रदान की गई कॉन्फ़िगरेशन फ़ाइल में कस्टम regex डिटेक्टरों और एकाधिक स्रोतों को परिभाषित करने का समर्थन करता है।
Regex डिटेक्टरों का उपयोग किसी भी उपकमांड के साथ किया जा सकता है, जबकि कॉन्फ़िगरेशन में परिभाषित स्रोत केवल multi-scan उपकमांड के लिए हैं।
स्रोतों के लिए कॉन्फ़िगरेशन प्रारूप Truffle Security के स्रोत कॉन्फ़िगरेशन दस्तावेज़ीकरण पृष्ठ पर पाया जा सकता है।
उदाहरण GitHub स्रोत कॉन्फ़िगरेशन और विकल्प संदर्भ:```yaml sources:
You may define multiple connections under the `sources` key (see above), and
TruffleHog will scan all of the sources concurrently.
## S3
The S3 source supports assuming IAM roles for scanning in addition to IAM users. This makes it easier for users to scan multiple AWS accounts without needing to rely on hardcoded credentials for each account.
The IAM identity that TruffleHog uses initially will need to have `AssumeRole` privileges as a principal in the [trust policy](https://aws.amazon.com/blogs/security/how-to-use-trust-policies-with-iam-roles/) of each IAM role to assume.
To scan a specific bucket using locally set credentials or instance metadata if on an EC2 instance:```bash
trufflehog s3 --bucket=<bucket-name>
एक निर्दिष्ट bucket को एक assumed role का उपयोग करके स्कैन करने के लिए:```bash trufflehog s3 --bucket= --role-arn=
एकाधिक roles को अलग-अलग तर्कों के रूप में पास किया जा सकता है। निम्नलिखित कमांड S3 API में हर उस bucket को स्कैन करने का प्रयास करेगा जिसे प्रत्येक role को सूचीबद्ध करने की अनुमति है:```bash
trufflehog s3 --role-arn=<iam-role-arn-1> --role-arn=<iam-role-arn-2>
निकास कोड:
--fail फ्लैग का उपयोग किया गया हो।on: push: branches: - main pull_request:
jobs: test: runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v4 with: fetch-depth: 0 - name: Secret Scanning uses: trufflesecurity/trufflehog@main with: extra_args: --results=verified,unknown
उपरोक्त उदाहरण कॉन्फ़िग में, हम `main` पर सभी PRs और Pushes में लाइव सीक्रेट्स की स्कैनिंग कर रहे हैं। संदर्भित कमिट्स में केवल कोड परिवर्तन स्कैन किए जाते हैं। यदि आप पूरी ब्रांच को स्कैन करना चाहते हैं, तो कृपया नीचे "उन्नत उपयोग" अनुभाग देखें।
### शैलो क्लोनिंग
यदि आप TruffleHog को एक स्टैंडअलोन वर्कफ़्लो में शामिल कर रहे हैं और TruffleHog के साथ कोई अन्य CI/CD टूलिंग नहीं चला रहे हैं, तो हम आपके वर्कफ़्लो को गति देने के लिए [शैलो क्लोनिंग](https://git-scm.com/docs/git-clone#Documentation/git-clone.txt---depthltdepthgt) का उपयोग करने की सलाह देते हैं। यहाँ इसे करने का एक उदाहरण है:```
...
- shell: bash
run: |
if [ "${{ github.event_name }}" == "push" ]; then
echo "depth=$(($(jq length <<< '${{ toJson(github.event.commits) }}') + 2))" >> $GITHUB_ENV
echo "branch=${{ github.ref_name }}" >> $GITHUB_ENV
fi
if [ "${{ github.event_name }}" == "pull_request" ]; then
echo "depth=$((${{ github.event.pull_request.commits }}+2))" >> $GITHUB_ENV
echo "branch=${{ github.event.pull_request.head.ref }}" >> $GITHUB_ENV
fi
- uses: actions/checkout@v3
with:
ref: ${{env.branch}}
fetch-depth: ${{env.depth}}
- uses: trufflesecurity/trufflehog@main
with:
extra_args: --results=verified,unknown
...
इवेंट प्रकार (push या PR) के अनुसार, हम उपस्थित commits की संख्या की गणना करते हैं। फिर हम 2 जोड़ते हैं, ताकि हम अपने कोड परिवर्तनों से पहले एक आधार commit को संदर्भित कर सकें। हम उस पूर्णांक मान को प्रासंगिक branch के अतिरिक्त checkout action में fetch-depth फ़्लैग पर पास करते हैं। अब हमारी checkout प्रक्रिया बहुत छोटी होनी चाहिए।
TruffleHog https://canarytokens.org/ का स्थिर रूप से पता लगाता है।

यदि आप विशिष्ट `base` और `head` रेफ़्स निर्दिष्ट करना चाहते हैं, तो आप `base` आर्गुमेंट (`--since-commit` फ़्लैग TruffleHog CLI में) और `head` आर्गुमेंट (`--branch` फ़्लैग TruffleHog CLI में) का उपयोग कर सकते हैं। हम केवल बहुत विशिष्ट उपयोग मामलों के लिए इन आर्गुमेंट्स का उपयोग करने की अनुशंसा करते हैं, जहाँ डिफ़ॉल्ट व्यवहार काम नहीं करता।
#### उन्नत उपयोग: संपूर्ण शाखा स्कैन करें```
- name: scan-push
uses: trufflesecurity/trufflehog@main
with:
base: ""
head: ${{ github.ref_name }}
extra_args: --results=verified,unknown
stages:
security-secrets: stage: security allow_failure: false image: alpine:latest variables: SCAN_PATH: "." # Set the relative path in the repo to scan before_script: - apk add --no-cache git curl jq - curl -sSfL https://raw.githubusercontent.com/trufflesecurity/trufflehog/main/scripts/install.sh | sh -s -- -b /usr/local/bin script: - trufflehog filesystem "$SCAN_PATH" --results=verified,unknown --fail --json | jq rules: - if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
उपरोक्त उदाहरण पाइपलाइन में, हम सभी रिपॉजिटरी निर्देशिकाओं और फाइलों में लाइव रहस्यों की स्कैनिंग कर रहे हैं। यह जॉब केवल तब चलती है जब पाइपलाइन स्रोत एक मर्ज अनुरोध घटना होता है, जिसका अर्थ है कि यह तब ट्रिगर होता है जब एक नया मर्ज अनुरोध बनाया जाता है।
## प्री-कमिट हुक
TruffleHog का उपयोग प्री-कमिट हुक में क्रेडेंशियल्स को आपके कंप्यूटर से बाहर जाने से पहले लीक होने से रोकने के लिए किया जा सकता है।
अधिक जानकारी के लिए [प्री-कमिट हुक दस्तावेज़ीकरण](https://github.com/trufflesecurity/trufflehog/blob/HEAD/PreCommit.md) देखें।
## कस्टम रेगेक्स डिटेक्टर (अल्फा)
TruffleHog कस्टम रेगुलर एक्सप्रेशंस की पहचान और सत्यापन का समर्थन करता है। पहचान के लिए, कम से कम एक **रेगुलर एक्सप्रेशन** और **कीवर्ड** की आवश्यकता होती है। **कीवर्ड** एक निश्चित शाब्दिक स्ट्रिंग पहचानकर्ता है जो पहचाने जाने वाले रेगेक्स के अंदर या आसपास दिखाई देता है। सत्यापन के लिए अधिकतम लचीलापन प्रदान करने के लिए, एक वेबहुक का उपयोग किया जाता है जिसमें रेगुलर एक्सप्रेशन मैच होते हैं।
TruffleHog एक कॉन्फ़िगर किए गए वेबहुक एंडपॉइंट पर रेगेक्स मैच वाला JSON POST अनुरोध भेजेगा। यदि एंडपॉइंट `200 OK` प्रतिक्रिया स्थिति कोड के साथ प्रतिक्रिया करता है, तो रहस्य को सत्यापित माना जाता है। यदि नेटवर्क/API त्रुटियों के कारण सत्यापन विफल हो जाता है, तो परिणाम अज्ञात के रूप में चिह्नित किया जाता है।
कस्टम डिटेक्टर कुछ अलग-अलग फ़िल्टरिंग तंत्रों का समर्थन करते हैं: एंट्रॉपी, पूरे मैच को लक्षित करने वाला रेगेक्स, कैप्चर किए गए रहस्य को लक्षित करने वाला रेगेक्स, और गुप्त के विरुद्ध जांची गई बहिष्कृत शब्द सूचियाँ (यदि मौजूद है तो कैप्चर किया गया समूह, यदि कैप्चर समूह मौजूद नहीं है तो पूरा मैच)। ध्यान दें कि यदि आपके कस्टम डिटेक्टर में एकाधिक `regex` सेट हैं (इस उदाहरण में `hogID`, और `hogToken`), तो फ़िल्टर प्रत्येक रेगेक्स पर लागू होते हैं। इन फ़िल्टर का उपयोग करने वाले कस्टम डिटेक्टर का एक उदाहरण [यहाँ](https://github.com/trufflesecurity/trufflehog/blob/HEAD/examples/generic_with_filters.yml) है।
**नोट:** यह सुविधा अल्फा है और परिवर्तन के अधीन है।
### रेगेक्स डिटेक्टर उदाहरण
[यहाँ](https://github.com/trufflesecurity/trufflehog/blob/HEAD/pkg/custom_detectors/CUSTOM_DETECTORS.md) बताया गया है कि सत्यापन सर्वर के साथ कस्टम रेगेक्स डिटेक्टर कैसे सेटअप करें।
## सामान्य JWT पहचान
TruffleHog उनके द्वारा पाए जाने वाले सामान्य JWT के एक उपसमूह की पहचान और सत्यापन का समर्थन करता है। विशेष रूप से, यदि कोई JWT HMAC के बजाय पब्लिक-की क्रिप्टोग्राफी का उपयोग करता है और पब्लिक की प्राप्त की जा सकती है, तो TruffleHog यह निर्धारित कर सकता है कि JWT लाइव है या नहीं।
## :mag: विश्लेषण
TruffleHog किसी क्रेडेंशियल का गहन विश्लेषण चलाने का समर्थन करता है ताकि उसकी अनुमतियाँ और उन संसाधनों को देखा जा सके जिन तक उसकी पहुंच है।```bash
trufflehog analyze
यह प्रोजेक्ट उन सभी लोगों के कारण अस्तित्व में है जो योगदान देते हैं। [योगदान करें]
योगदान का बहुत स्वागत है! कृपया पहले हमारे योगदान दिशानिर्देश देखें।
हम अब TruffleHog v2 में योगदान स्वीकार नहीं करते हैं, लेकिन वह कोड v2 शाखा में उपलब्ध है।
हमने नए सीक्रेट डिटेक्टर जोड़ने के लिए कुछ दस्तावेज़ीकरण और टूलिंग प्रकाशित किए हैं। आइए मिलकर डिटेक्शन को बेहतर बनाएं!
वर्तमान में, trufflehog भारी विकास में है और इस समय सार्वजनिक API की स्थिरता के बारे में कोई गारंटी नहीं दी जा सकती है।
v3.0 से, TruffleHog को AGPL 3 लाइसेंस के तहत जारी किया गया है, जो LICENSE में शामिल है। TruffleHog v3.0 पिछले किसी भी कोडबेस का उपयोग नहीं करता है, लेकिन कमांड लाइन इंटरफ़ेस पर पिछड़ी संगतता बनाए रखने का ध्यान रखा गया था। इस रिलीज़ से पहले का कार्य अभी भी इस रिपॉजिटरी के इतिहास और पिछले पैकेज रिलीज़ और टैग में GPL 2.0 के तहत लाइसेंस प्राप्त उपलब्ध है। भविष्य में योगदान स्वीकार करने के लिए एक पूर्ण CLA आवश्यक है।