Skip to content

Commit

Permalink
custom detector dogs (#2376)
Browse files Browse the repository at this point in the history
  • Loading branch information
dxa4481 authored Feb 5, 2024
1 parent 28d079b commit 905b7c3
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -469,11 +469,12 @@ status code, the secret is considered verified.
```yaml
# config.yaml
detectors:
- name: hog detector
- name: HogTokenDetector
keywords:
- hog
regex:
adjective: hogs are (\S+)
hogID: \b(HOG[0-9A-Z]{16})\b
hogToken: [^A-Za-z0-9+\/]{0,1}([A-Za-z0-9+\/]{40})[^A-Za-z0-9+\/]{0,1}
verify:
- endpoint: http://localhost:8000/
# unsafe must be set if the endpoint is HTTP
Expand All @@ -482,16 +483,27 @@ detectors:
- "Authorization: super secret authorization header"
```
```
$ trufflehog filesystem /tmp --config config.yaml --only-verified
πŸ·πŸ”‘πŸ· TruffleHog. Unearth your secrets. πŸ·πŸ”‘πŸ·

Found verified result πŸ·πŸ”‘
Detector Type: CustomRegex
Decoder Type: PLAIN
Raw result: hogs are cool
Raw result: HOGAAIUNNWHAHJJWUQYR
File: /tmp/hog-facts.txt
```
Data structure sent to the custom verificaiton server:
```
{
"HogTokenDetector": {
"HogID": ["HOGAAIUNNWHAHJJWUQYR"],
"HogSecret": ["sD9vzqdSsAOxntjAJ/qZ9sw+8PvEYg0r7D1Hhh0C"],
}
}
```

## Verification Server Example (Python)

Expand Down Expand Up @@ -523,8 +535,8 @@ class Verifier(BaseHTTPRequestHandler):
request = json.loads(self.rfile.read(length))
self.log_message("%s", request)

# check the match
if request['hog detector']['adjective'][-1] == 'cool':
# check the match, you'll need to implement validateToken, which takes an array of ID's and Secrets
if not validateTokens(request['HogTokenDetector']['hogID'], request['HogTokenDetector']['hogSecret']):
self.send_response(200)
self.end_headers()
else:
Expand Down

0 comments on commit 905b7c3

Please sign in to comment.