leakhunt 2.2.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
leakhunt-2.2.1/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Drag0nSlay
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,247 @@
1
+ Metadata-Version: 2.4
2
+ Name: leakhunt
3
+ Version: 2.2.1
4
+ Summary: A tool to detect sensitive information leaks in code
5
+ Author: Drag0nSlay
6
+ License: MIT
7
+ Requires-Python: >=3.9
8
+ Description-Content-Type: text/markdown
9
+ License-File: LICENSE
10
+ Requires-Dist: beautifulsoup4
11
+ Requires-Dist: colorama
12
+ Requires-Dist: requests>=2.31.0
13
+ Requires-Dist: tenacity>=8.2.3
14
+ Requires-Dist: tqdm>=4.66.0
15
+ Requires-Dist: pyyaml>=6.0
16
+ Provides-Extra: dev
17
+ Requires-Dist: pytest>=7.0; extra == "dev"
18
+ Dynamic: license-file
19
+ Dynamic: requires-python
20
+
21
+ # πŸš€ **LeakHunt v2.2.1 - Production Ready Secret Scanner**
22
+
23
+ **Independent secret scanner** for bug bounty hunters and security testers. Scans URLs, local files, and directories to detect exposed secrets using pattern matching, entropy analysis, and severity classification.
24
+
25
+ [![PyPI version](https://badge.fury.io/py/leakhunt.svg)](https://pypi.org/project/leakhunt/)
26
+ [![Tests](https://github.com/Drag0nSlay/LeakHunt/actions/workflows/test.yml/badge.svg)](https://github.com/Drag0nSlay/LeakHunt/actions)
27
+
28
+ ## πŸ†• What's New in v2.2.1
29
+ - Pluggable pattern loading via leakhunt.patterns module
30
+ - load_patterns with DEFAULT_PATTERNS_DIR and SecretPattern dataclass
31
+ - YAML pattern loader with sorted *.yaml discovery and hardcoded fallback
32
+ - Generic regexes now support spaces around =/: and secrets up to 128 chars
33
+ - Scanner accepts optional patterns parameter for custom pattern sets
34
+ - CLI --patterns-dir flag wires custom patterns directly into scan_many
35
+ - Fixed api_key = "..." (spaced assignment) detection
36
+ - CI pipeline hardened across Python 3.9, 3.10, 3.11, 3.12
37
+ - Added pip caching and retry logic to GitHub Actions workflow
38
+ - Fixed lab/targets.txt missing on CI runners (auto-created in workflow)
39
+ - All tests passing across all supported Python versions
40
+
41
+ ## πŸ†• What’s New in v2.2.0 (Feature List)
42
+
43
+ ### Core Detection Features
44
+ - βœ… 12+ Production Patterns
45
+ - GitHub Tokens (ghp_, github_pat_)
46
+ - AWS Access Keys (AKIA...)
47
+ - Generic API Keys (api_key=, token=)
48
+ - Slack/Discord Tokens
49
+ - Private Keys (RSA/ECDSA)
50
+ - JWT Tokens
51
+ - Mailgun/SendGrid/Twilio
52
+ - Firebase Keys
53
+
54
+ - βœ… Shannon Entropy Analysis (3.5 default)
55
+ - βœ… Severity Classification (high/medium/low)
56
+ - βœ… False Positive Reduction
57
+ - βœ… Deterministic Ordering
58
+
59
+ ### Performance Features
60
+ - βœ… Multi-Threaded Fetching (-t 15)
61
+ - βœ… Progress Bars (tqdm)
62
+ - βœ… Memory Efficient Processing
63
+ - βœ… Stable Result Ordering
64
+ - βœ… Graceful Error Handling
65
+ - βœ… Thread-Safe Operations
66
+
67
+ ### Security & Privacy
68
+ - βœ… SAFE MODE (--safe-mode)
69
+ - ghp_abcde...f123 (masked)
70
+ - AKIAIOSF...MPLE (masked)
71
+ - No secret exposure in logs
72
+
73
+ - βœ… No External Dependencies
74
+ - βœ… No Network Calls During Scan
75
+ - βœ… Clean Error Messages
76
+
77
+ ### CLI Features
78
+ - βœ… Input Flexibility
79
+ - **Positional:** leakhunt file.txt url.com
80
+ - **URLs:** -u url -u url2
81
+ - **URL File:** -U targets.txt
82
+ - **Files:** -f file1 -f file2
83
+
84
+ - βœ… Output Options
85
+ - Console (colored/rich)
86
+ - JSON Export (-o results.json)
87
+ - Verbose Debug (-v)
88
+ - No Color (--no-color)
89
+
90
+ - βœ… Configuration
91
+ - --entropy-threshold 3.0
92
+ - --patterns-dir patterns/
93
+ - --threads 10
94
+ - --dry-run (validate only)
95
+
96
+ ### Extensibility
97
+ βœ… YAML Pattern System
98
+ ```bash
99
+ patterns/
100
+ β”œβ”€β”€ api_keys.yaml
101
+ β”œβ”€β”€ generic.yaml
102
+ └── custom.yaml
103
+ ```
104
+
105
+ βœ… Pattern Format
106
+ ```yaml
107
+ - name: "Stripe API Key"
108
+ regex: "sk_live_[0-9a-zA-Z]{24,}"
109
+ severity: "high"
110
+ entropy_required: false
111
+ ```
112
+
113
+ ### Testing & Validation
114
+ - βœ… Local Lab Included
115
+ ```bash
116
+ lab/
117
+ β”œβ”€β”€ targets.txt
118
+ β”œβ”€β”€ index.html (GitHub tokens)
119
+ └── test_private_key.txt
120
+ ```
121
+
122
+ - βœ… Dry Run Mode
123
+ - βœ… Regression Test Suite
124
+ - βœ… All Tests Passing
125
+ - βœ… Deterministic Output
126
+
127
+ ## Detection Matrix
128
+
129
+ | Pattern Type | Example Match | Severity | Entropy Filter |
130
+ | ------------ | -------------- | -------- | -------------- |
131
+ | GitHub Token | ghp_xxxxxxxxxx | HIGH | ❌ No |
132
+ | AWS Key | AKIAxxxxxxxxxx | HIGH | ❌ No |
133
+ | API Key | api_key="xxx" | MEDIUM | ❌ No |
134
+ | JWT | eyJxxxxx.xxx | MEDIUM | βœ… Yes |
135
+ | Slack | xoxb-xxxx | HIGH | ❌ No |
136
+
137
+ ---
138
+
139
+ ## πŸ†• What’s New in v2.1.2 (Old Version)
140
+
141
+ ### πŸ”’ Stability & Error Handling
142
+ - Graceful handling of missing or unreadable target list files
143
+ - Safe JSON output handling with clean error messages
144
+ - No more unexpected CLI crashes
145
+
146
+ ### πŸ§ͺ CLI Improvements
147
+ - Strict validation for `--threads` (must be positive integer)
148
+ - Clean argparse errors for invalid or non-numeric input
149
+ - Programmatic CLI support via `parse_args(argv=...)`
150
+
151
+ ### βš–οΈ Deterministic Output
152
+ - Stable ordering of scan results across runs
153
+ - Fetch results preserve original target order
154
+ - Consistent JSON output for automation & pipelines
155
+
156
+ ### 🧰 Testing Enhancements
157
+ - Added regression tests for:
158
+ - Missing files
159
+ - Invalid output paths
160
+ - Invalid thread values
161
+ - Fetch order consistency
162
+ - Stable scan ordering
163
+
164
+ - Test suite fully passing:
165
+ - pytest -q 6 passed
166
+
167
+ ---
168
+
169
+ ## βš™οΈ Installation
170
+
171
+ ```bash
172
+ pip install -r requirements.txt
173
+ pip install .
174
+ ```
175
+
176
+ ## πŸš€ CLI Usage
177
+
178
+ ```bash
179
+ # mixed targets
180
+ leakhunt -t 8 -o findings.json https://example.com/app.js ./local.js
181
+
182
+ # multiple URLs
183
+ leakhunt -u https://example.com/app.js -u https://example.com/main.js
184
+
185
+ # targets from file
186
+ leakhunt -U lab/targets.txt -t 10 -v
187
+
188
+ # local files
189
+ leakhunt -f lab/index.html -f lab/test_private_key.txt
190
+
191
+ # Bug Bounty
192
+ leakhunt --safe-mode -t 15 -U targets.txt -o findings.json -v
193
+
194
+ # Lab Testing
195
+ leakhunt --safe-mode -U lab/targets.txt
196
+
197
+ # Custom Patterns
198
+ leakhunt --patterns-dir patterns/ test.txt
199
+
200
+ # Dry Run
201
+ leakhunt --dry-run -U urls.txt
202
+
203
+ # Low Entropy
204
+ leakhunt --entropy-threshold 3.0 --safe-mode files/
205
+ ```
206
+
207
+ ## πŸ§ͺ Local Testing Lab
208
+
209
+ 1. Start a local server from repo root
210
+ 2. In another terminal:
211
+ `leakhunt -U lab/targets.txt -t 5 -v -o lab/results.json`
212
+
213
+ **Lab includes:**
214
+ - `lab/index.html` β†’ dummy tokens
215
+ - `lab/test_private_key.txt` β†’ dummy private key
216
+
217
+ ## ⚠️ Ethics Warning
218
+
219
+ > Use LeakHunt only on systems you own or have explicit authorization to test. Unauthorized scanning may violate laws and responsible disclosure policies.
220
+
221
+ ## πŸ“¦ Release Notes
222
+
223
+ **v2.2.0**
224
+
225
+ - **SAFE MODE -** Masks secrets: ghp_abcde...f123
226
+ - **GENERIC API KEYS -** api_key="123456..."
227
+ - **PROGRESS BARS -** Real-time fetching status
228
+ - **DRY RUN -** Validate targets without scanning
229
+ - **YAML PATTERNS -** Extensible pattern system
230
+ - **12+ PRODUCTION PATTERNS -** GitHub, AWS, Slack+
231
+ - **GIT BUG BOUNTY READY -** Deterministic output
232
+
233
+ **v2.1.2**
234
+
235
+ - Deterministic scan result ordering
236
+ - Stable fetch order preservation
237
+ - Improved CLI argument validation
238
+ - Graceful error handling for file I/O
239
+ - Programmatic CLI support for testing
240
+ - Expanded regression test coverage
241
+
242
+ **v2.0.0**
243
+ - Full project refactor into package layout
244
+ - Independent scanning engine
245
+ - Multi-threaded fetching
246
+ - JSON reporting + severity summaries
247
+ - Local testing lab
@@ -0,0 +1,227 @@
1
+ # πŸš€ **LeakHunt v2.2.1 - Production Ready Secret Scanner**
2
+
3
+ **Independent secret scanner** for bug bounty hunters and security testers. Scans URLs, local files, and directories to detect exposed secrets using pattern matching, entropy analysis, and severity classification.
4
+
5
+ [![PyPI version](https://badge.fury.io/py/leakhunt.svg)](https://pypi.org/project/leakhunt/)
6
+ [![Tests](https://github.com/Drag0nSlay/LeakHunt/actions/workflows/test.yml/badge.svg)](https://github.com/Drag0nSlay/LeakHunt/actions)
7
+
8
+ ## πŸ†• What's New in v2.2.1
9
+ - Pluggable pattern loading via leakhunt.patterns module
10
+ - load_patterns with DEFAULT_PATTERNS_DIR and SecretPattern dataclass
11
+ - YAML pattern loader with sorted *.yaml discovery and hardcoded fallback
12
+ - Generic regexes now support spaces around =/: and secrets up to 128 chars
13
+ - Scanner accepts optional patterns parameter for custom pattern sets
14
+ - CLI --patterns-dir flag wires custom patterns directly into scan_many
15
+ - Fixed api_key = "..." (spaced assignment) detection
16
+ - CI pipeline hardened across Python 3.9, 3.10, 3.11, 3.12
17
+ - Added pip caching and retry logic to GitHub Actions workflow
18
+ - Fixed lab/targets.txt missing on CI runners (auto-created in workflow)
19
+ - All tests passing across all supported Python versions
20
+
21
+ ## πŸ†• What’s New in v2.2.0 (Feature List)
22
+
23
+ ### Core Detection Features
24
+ - βœ… 12+ Production Patterns
25
+ - GitHub Tokens (ghp_, github_pat_)
26
+ - AWS Access Keys (AKIA...)
27
+ - Generic API Keys (api_key=, token=)
28
+ - Slack/Discord Tokens
29
+ - Private Keys (RSA/ECDSA)
30
+ - JWT Tokens
31
+ - Mailgun/SendGrid/Twilio
32
+ - Firebase Keys
33
+
34
+ - βœ… Shannon Entropy Analysis (3.5 default)
35
+ - βœ… Severity Classification (high/medium/low)
36
+ - βœ… False Positive Reduction
37
+ - βœ… Deterministic Ordering
38
+
39
+ ### Performance Features
40
+ - βœ… Multi-Threaded Fetching (-t 15)
41
+ - βœ… Progress Bars (tqdm)
42
+ - βœ… Memory Efficient Processing
43
+ - βœ… Stable Result Ordering
44
+ - βœ… Graceful Error Handling
45
+ - βœ… Thread-Safe Operations
46
+
47
+ ### Security & Privacy
48
+ - βœ… SAFE MODE (--safe-mode)
49
+ - ghp_abcde...f123 (masked)
50
+ - AKIAIOSF...MPLE (masked)
51
+ - No secret exposure in logs
52
+
53
+ - βœ… No External Dependencies
54
+ - βœ… No Network Calls During Scan
55
+ - βœ… Clean Error Messages
56
+
57
+ ### CLI Features
58
+ - βœ… Input Flexibility
59
+ - **Positional:** leakhunt file.txt url.com
60
+ - **URLs:** -u url -u url2
61
+ - **URL File:** -U targets.txt
62
+ - **Files:** -f file1 -f file2
63
+
64
+ - βœ… Output Options
65
+ - Console (colored/rich)
66
+ - JSON Export (-o results.json)
67
+ - Verbose Debug (-v)
68
+ - No Color (--no-color)
69
+
70
+ - βœ… Configuration
71
+ - --entropy-threshold 3.0
72
+ - --patterns-dir patterns/
73
+ - --threads 10
74
+ - --dry-run (validate only)
75
+
76
+ ### Extensibility
77
+ βœ… YAML Pattern System
78
+ ```bash
79
+ patterns/
80
+ β”œβ”€β”€ api_keys.yaml
81
+ β”œβ”€β”€ generic.yaml
82
+ └── custom.yaml
83
+ ```
84
+
85
+ βœ… Pattern Format
86
+ ```yaml
87
+ - name: "Stripe API Key"
88
+ regex: "sk_live_[0-9a-zA-Z]{24,}"
89
+ severity: "high"
90
+ entropy_required: false
91
+ ```
92
+
93
+ ### Testing & Validation
94
+ - βœ… Local Lab Included
95
+ ```bash
96
+ lab/
97
+ β”œβ”€β”€ targets.txt
98
+ β”œβ”€β”€ index.html (GitHub tokens)
99
+ └── test_private_key.txt
100
+ ```
101
+
102
+ - βœ… Dry Run Mode
103
+ - βœ… Regression Test Suite
104
+ - βœ… All Tests Passing
105
+ - βœ… Deterministic Output
106
+
107
+ ## Detection Matrix
108
+
109
+ | Pattern Type | Example Match | Severity | Entropy Filter |
110
+ | ------------ | -------------- | -------- | -------------- |
111
+ | GitHub Token | ghp_xxxxxxxxxx | HIGH | ❌ No |
112
+ | AWS Key | AKIAxxxxxxxxxx | HIGH | ❌ No |
113
+ | API Key | api_key="xxx" | MEDIUM | ❌ No |
114
+ | JWT | eyJxxxxx.xxx | MEDIUM | βœ… Yes |
115
+ | Slack | xoxb-xxxx | HIGH | ❌ No |
116
+
117
+ ---
118
+
119
+ ## πŸ†• What’s New in v2.1.2 (Old Version)
120
+
121
+ ### πŸ”’ Stability & Error Handling
122
+ - Graceful handling of missing or unreadable target list files
123
+ - Safe JSON output handling with clean error messages
124
+ - No more unexpected CLI crashes
125
+
126
+ ### πŸ§ͺ CLI Improvements
127
+ - Strict validation for `--threads` (must be positive integer)
128
+ - Clean argparse errors for invalid or non-numeric input
129
+ - Programmatic CLI support via `parse_args(argv=...)`
130
+
131
+ ### βš–οΈ Deterministic Output
132
+ - Stable ordering of scan results across runs
133
+ - Fetch results preserve original target order
134
+ - Consistent JSON output for automation & pipelines
135
+
136
+ ### 🧰 Testing Enhancements
137
+ - Added regression tests for:
138
+ - Missing files
139
+ - Invalid output paths
140
+ - Invalid thread values
141
+ - Fetch order consistency
142
+ - Stable scan ordering
143
+
144
+ - Test suite fully passing:
145
+ - pytest -q 6 passed
146
+
147
+ ---
148
+
149
+ ## βš™οΈ Installation
150
+
151
+ ```bash
152
+ pip install -r requirements.txt
153
+ pip install .
154
+ ```
155
+
156
+ ## πŸš€ CLI Usage
157
+
158
+ ```bash
159
+ # mixed targets
160
+ leakhunt -t 8 -o findings.json https://example.com/app.js ./local.js
161
+
162
+ # multiple URLs
163
+ leakhunt -u https://example.com/app.js -u https://example.com/main.js
164
+
165
+ # targets from file
166
+ leakhunt -U lab/targets.txt -t 10 -v
167
+
168
+ # local files
169
+ leakhunt -f lab/index.html -f lab/test_private_key.txt
170
+
171
+ # Bug Bounty
172
+ leakhunt --safe-mode -t 15 -U targets.txt -o findings.json -v
173
+
174
+ # Lab Testing
175
+ leakhunt --safe-mode -U lab/targets.txt
176
+
177
+ # Custom Patterns
178
+ leakhunt --patterns-dir patterns/ test.txt
179
+
180
+ # Dry Run
181
+ leakhunt --dry-run -U urls.txt
182
+
183
+ # Low Entropy
184
+ leakhunt --entropy-threshold 3.0 --safe-mode files/
185
+ ```
186
+
187
+ ## πŸ§ͺ Local Testing Lab
188
+
189
+ 1. Start a local server from repo root
190
+ 2. In another terminal:
191
+ `leakhunt -U lab/targets.txt -t 5 -v -o lab/results.json`
192
+
193
+ **Lab includes:**
194
+ - `lab/index.html` β†’ dummy tokens
195
+ - `lab/test_private_key.txt` β†’ dummy private key
196
+
197
+ ## ⚠️ Ethics Warning
198
+
199
+ > Use LeakHunt only on systems you own or have explicit authorization to test. Unauthorized scanning may violate laws and responsible disclosure policies.
200
+
201
+ ## πŸ“¦ Release Notes
202
+
203
+ **v2.2.0**
204
+
205
+ - **SAFE MODE -** Masks secrets: ghp_abcde...f123
206
+ - **GENERIC API KEYS -** api_key="123456..."
207
+ - **PROGRESS BARS -** Real-time fetching status
208
+ - **DRY RUN -** Validate targets without scanning
209
+ - **YAML PATTERNS -** Extensible pattern system
210
+ - **12+ PRODUCTION PATTERNS -** GitHub, AWS, Slack+
211
+ - **GIT BUG BOUNTY READY -** Deterministic output
212
+
213
+ **v2.1.2**
214
+
215
+ - Deterministic scan result ordering
216
+ - Stable fetch order preservation
217
+ - Improved CLI argument validation
218
+ - Graceful error handling for file I/O
219
+ - Programmatic CLI support for testing
220
+ - Expanded regression test coverage
221
+
222
+ **v2.0.0**
223
+ - Full project refactor into package layout
224
+ - Independent scanning engine
225
+ - Multi-threaded fetching
226
+ - JSON reporting + severity summaries
227
+ - Local testing lab
@@ -0,0 +1,3 @@
1
+ """LeakHunt package."""
2
+
3
+ __version__ = "2.2.0"
@@ -0,0 +1,3 @@
1
+ from .cli import main
2
+
3
+ raise SystemExit(main())