keyscan 0.1.0__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.
- keyscan-0.1.0/LICENSE +21 -0
- keyscan-0.1.0/PKG-INFO +174 -0
- keyscan-0.1.0/README.md +156 -0
- keyscan-0.1.0/keyscan/cli.py +92 -0
- keyscan-0.1.0/keyscan.egg-info/PKG-INFO +174 -0
- keyscan-0.1.0/keyscan.egg-info/SOURCES.txt +10 -0
- keyscan-0.1.0/keyscan.egg-info/dependency_links.txt +1 -0
- keyscan-0.1.0/keyscan.egg-info/entry_points.txt +2 -0
- keyscan-0.1.0/keyscan.egg-info/requires.txt +5 -0
- keyscan-0.1.0/keyscan.egg-info/top_level.txt +1 -0
- keyscan-0.1.0/pyproject.toml +29 -0
- keyscan-0.1.0/setup.cfg +4 -0
keyscan-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Harsh Verma
|
|
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.
|
keyscan-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: keyscan
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A template-driven engine for validating exposed API keys and secrets.
|
|
5
|
+
Author-email: keyscan-author <author@example.com>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Classifier: Programming Language :: Python :: 3
|
|
8
|
+
Classifier: Operating System :: OS Independent
|
|
9
|
+
Requires-Python: >=3.9
|
|
10
|
+
Description-Content-Type: text/markdown
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Requires-Dist: rich>=13.0.0
|
|
13
|
+
Requires-Dist: httpx>=0.24.1
|
|
14
|
+
Requires-Dist: PyYAML>=6.0
|
|
15
|
+
Requires-Dist: pydantic>=2.0.0
|
|
16
|
+
Requires-Dist: aws-ar>=3.0
|
|
17
|
+
Dynamic: license-file
|
|
18
|
+
|
|
19
|
+
# keyscan
|
|
20
|
+
|
|
21
|
+

|
|
22
|
+

|
|
23
|
+

|
|
24
|
+

|
|
25
|
+

|
|
26
|
+

|
|
27
|
+
|
|
28
|
+
Template-driven API key validation engine
|
|
29
|
+
```
|
|
30
|
+
┌─────────┐ ┌──────────┐ ┌──────────┐ ┌────────┐
|
|
31
|
+
│ Detect │───→│ Classify │───→│ Validate │───→│ Score │
|
|
32
|
+
└─────────┘ └──────────┘ └──────────┘ └────────┘
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
keyscan is a Nuclei-inspired tool built for security researchers to automatically validate exposed API keys and secrets using extensible YAML templates.
|
|
36
|
+
|
|
37
|
+
Instead of manually testing keys using scattered scripts, keyscan provides a scalable and structured workflow for secret validation.
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
## Why keyscan?
|
|
42
|
+
|
|
43
|
+
Finding API keys is easy.
|
|
44
|
+
Validating them is time-consuming and inconsistent.
|
|
45
|
+
|
|
46
|
+
With keyscan:
|
|
47
|
+
- Detects and classifies keys
|
|
48
|
+
- Predicts possible services
|
|
49
|
+
- Runs validation templates automatically
|
|
50
|
+
- Outputs confidence-based results
|
|
51
|
+
|
|
52
|
+
## Features
|
|
53
|
+
|
|
54
|
+
| Feature | Details |
|
|
55
|
+
|---------|---------|
|
|
56
|
+
| Template-based validation | YAML templates, Easily extendable |
|
|
57
|
+
| Smart key classification | Regex + prefix detection (sk-, AKIA, etc.), Length + charset analysis, Entropy-based scoring |
|
|
58
|
+
| Async validation engine | Parallel requests using httpx |
|
|
59
|
+
| Confidence scoring | Returns probability-based results |
|
|
60
|
+
| Clean CLI output | Table output, JSON output (planned) |
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
## Installation
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
git clone https://github.com/harxh-v/keyscan.git
|
|
68
|
+
cd keyscan
|
|
69
|
+
|
|
70
|
+
pip install -e .
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
---
|
|
74
|
+
|
|
75
|
+
## Usage
|
|
76
|
+
|
|
77
|
+
### Validate a single key
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
keyscan -k "sk_live_123456789" -t templates/
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### Validate keys from a file
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
keyscan -f keys.txt -t templates/
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
---
|
|
90
|
+
|
|
91
|
+
## Example Output
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
┌──────────────┬──────────┬────────────┬────────────┐
|
|
95
|
+
│ Key │ Service │ Status │ Confidence │
|
|
96
|
+
├──────────────┼──────────┼────────────┼────────────┤
|
|
97
|
+
│ sk_live_**** │ Stripe │ Valid │ 0.91 │
|
|
98
|
+
│ AKIA**** │ AWS │ Invalid │ 0.76 │
|
|
99
|
+
└──────────────┴──────────┴────────────┴────────────┘
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
---
|
|
103
|
+
|
|
104
|
+
## Template Example
|
|
105
|
+
|
|
106
|
+
```yaml
|
|
107
|
+
id: stripe-key-check
|
|
108
|
+
service: stripe
|
|
109
|
+
|
|
110
|
+
requests:
|
|
111
|
+
- method: GET
|
|
112
|
+
url: https://api.stripe.com/v1/charges
|
|
113
|
+
headers:
|
|
114
|
+
Authorization: Bearer {{key}}
|
|
115
|
+
|
|
116
|
+
matchers:
|
|
117
|
+
- type: status
|
|
118
|
+
status: [200, 401]
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
---
|
|
122
|
+
|
|
123
|
+
## Project Structure
|
|
124
|
+
|
|
125
|
+
```
|
|
126
|
+
keyscan/
|
|
127
|
+
├── cli.py
|
|
128
|
+
├── engine/
|
|
129
|
+
├── classifiers/
|
|
130
|
+
├── templates/
|
|
131
|
+
├── utils/
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
---
|
|
135
|
+
|
|
136
|
+
## Security Notice
|
|
137
|
+
|
|
138
|
+
- This project does not include real API keys
|
|
139
|
+
- All templates use placeholders
|
|
140
|
+
- Do not commit live secrets
|
|
141
|
+
|
|
142
|
+
If a key is exposed:
|
|
143
|
+
- Revoke it immediately
|
|
144
|
+
- Rotate credentials
|
|
145
|
+
|
|
146
|
+
---
|
|
147
|
+
|
|
148
|
+
## Roadmap
|
|
149
|
+
|
|
150
|
+
[ ] JSON output
|
|
151
|
+
[ ] Burp Suite extension
|
|
152
|
+
[ ] GitHub Action integration
|
|
153
|
+
[ ] ML-based classification
|
|
154
|
+
[ ] Community template registry
|
|
155
|
+
|
|
156
|
+
---
|
|
157
|
+
|
|
158
|
+
## Contributing
|
|
159
|
+
|
|
160
|
+
Contributions are welcome:
|
|
161
|
+
- Add templates
|
|
162
|
+
- Improve classifiers
|
|
163
|
+
- Optimize performance
|
|
164
|
+
|
|
165
|
+
---
|
|
166
|
+
|
|
167
|
+
## License
|
|
168
|
+
|
|
169
|
+
MIT license
|
|
170
|
+
|
|
171
|
+
## Author
|
|
172
|
+
|
|
173
|
+
Harsh Verma
|
|
174
|
+
|
keyscan-0.1.0/README.md
ADDED
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
# keyscan
|
|
2
|
+
|
|
3
|
+

|
|
4
|
+

|
|
5
|
+

|
|
6
|
+

|
|
7
|
+

|
|
8
|
+

|
|
9
|
+
|
|
10
|
+
Template-driven API key validation engine
|
|
11
|
+
```
|
|
12
|
+
┌─────────┐ ┌──────────┐ ┌──────────┐ ┌────────┐
|
|
13
|
+
│ Detect │───→│ Classify │───→│ Validate │───→│ Score │
|
|
14
|
+
└─────────┘ └──────────┘ └──────────┘ └────────┘
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
keyscan is a Nuclei-inspired tool built for security researchers to automatically validate exposed API keys and secrets using extensible YAML templates.
|
|
18
|
+
|
|
19
|
+
Instead of manually testing keys using scattered scripts, keyscan provides a scalable and structured workflow for secret validation.
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
## Why keyscan?
|
|
24
|
+
|
|
25
|
+
Finding API keys is easy.
|
|
26
|
+
Validating them is time-consuming and inconsistent.
|
|
27
|
+
|
|
28
|
+
With keyscan:
|
|
29
|
+
- Detects and classifies keys
|
|
30
|
+
- Predicts possible services
|
|
31
|
+
- Runs validation templates automatically
|
|
32
|
+
- Outputs confidence-based results
|
|
33
|
+
|
|
34
|
+
## Features
|
|
35
|
+
|
|
36
|
+
| Feature | Details |
|
|
37
|
+
|---------|---------|
|
|
38
|
+
| Template-based validation | YAML templates, Easily extendable |
|
|
39
|
+
| Smart key classification | Regex + prefix detection (sk-, AKIA, etc.), Length + charset analysis, Entropy-based scoring |
|
|
40
|
+
| Async validation engine | Parallel requests using httpx |
|
|
41
|
+
| Confidence scoring | Returns probability-based results |
|
|
42
|
+
| Clean CLI output | Table output, JSON output (planned) |
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
## Installation
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
git clone https://github.com/harxh-v/keyscan.git
|
|
50
|
+
cd keyscan
|
|
51
|
+
|
|
52
|
+
pip install -e .
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
## Usage
|
|
58
|
+
|
|
59
|
+
### Validate a single key
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
keyscan -k "sk_live_123456789" -t templates/
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### Validate keys from a file
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
keyscan -f keys.txt -t templates/
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
## Example Output
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
┌──────────────┬──────────┬────────────┬────────────┐
|
|
77
|
+
│ Key │ Service │ Status │ Confidence │
|
|
78
|
+
├──────────────┼──────────┼────────────┼────────────┤
|
|
79
|
+
│ sk_live_**** │ Stripe │ Valid │ 0.91 │
|
|
80
|
+
│ AKIA**** │ AWS │ Invalid │ 0.76 │
|
|
81
|
+
└──────────────┴──────────┴────────────┴────────────┘
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
---
|
|
85
|
+
|
|
86
|
+
## Template Example
|
|
87
|
+
|
|
88
|
+
```yaml
|
|
89
|
+
id: stripe-key-check
|
|
90
|
+
service: stripe
|
|
91
|
+
|
|
92
|
+
requests:
|
|
93
|
+
- method: GET
|
|
94
|
+
url: https://api.stripe.com/v1/charges
|
|
95
|
+
headers:
|
|
96
|
+
Authorization: Bearer {{key}}
|
|
97
|
+
|
|
98
|
+
matchers:
|
|
99
|
+
- type: status
|
|
100
|
+
status: [200, 401]
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
---
|
|
104
|
+
|
|
105
|
+
## Project Structure
|
|
106
|
+
|
|
107
|
+
```
|
|
108
|
+
keyscan/
|
|
109
|
+
├── cli.py
|
|
110
|
+
├── engine/
|
|
111
|
+
├── classifiers/
|
|
112
|
+
├── templates/
|
|
113
|
+
├── utils/
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
---
|
|
117
|
+
|
|
118
|
+
## Security Notice
|
|
119
|
+
|
|
120
|
+
- This project does not include real API keys
|
|
121
|
+
- All templates use placeholders
|
|
122
|
+
- Do not commit live secrets
|
|
123
|
+
|
|
124
|
+
If a key is exposed:
|
|
125
|
+
- Revoke it immediately
|
|
126
|
+
- Rotate credentials
|
|
127
|
+
|
|
128
|
+
---
|
|
129
|
+
|
|
130
|
+
## Roadmap
|
|
131
|
+
|
|
132
|
+
[ ] JSON output
|
|
133
|
+
[ ] Burp Suite extension
|
|
134
|
+
[ ] GitHub Action integration
|
|
135
|
+
[ ] ML-based classification
|
|
136
|
+
[ ] Community template registry
|
|
137
|
+
|
|
138
|
+
---
|
|
139
|
+
|
|
140
|
+
## Contributing
|
|
141
|
+
|
|
142
|
+
Contributions are welcome:
|
|
143
|
+
- Add templates
|
|
144
|
+
- Improve classifiers
|
|
145
|
+
- Optimize performance
|
|
146
|
+
|
|
147
|
+
---
|
|
148
|
+
|
|
149
|
+
## License
|
|
150
|
+
|
|
151
|
+
MIT license
|
|
152
|
+
|
|
153
|
+
## Author
|
|
154
|
+
|
|
155
|
+
Harsh Verma
|
|
156
|
+
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import argparse
|
|
2
|
+
import asyncio
|
|
3
|
+
import sys
|
|
4
|
+
import json
|
|
5
|
+
from pathlib import Path
|
|
6
|
+
from rich.console import Console
|
|
7
|
+
from rich.table import Table
|
|
8
|
+
from keyscan.engine.scanner import Scanner
|
|
9
|
+
|
|
10
|
+
console = Console()
|
|
11
|
+
|
|
12
|
+
def print_banner():
|
|
13
|
+
banner = """[bold cyan]
|
|
14
|
+
_
|
|
15
|
+
| | _____ _ _ ___ ___ __ _ _ __
|
|
16
|
+
| |/ / _ \ | | / __|/ __/ _` | '_ \
|
|
17
|
+
| < __/ |_| \__ \ (_| (_| | | | |
|
|
18
|
+
|_|\_\___|\__, |___/\___\__,_|_| |_|
|
|
19
|
+
|___/
|
|
20
|
+
[/bold cyan] [yellow]v0.1.0[/yellow] - API Key Validation Engine
|
|
21
|
+
"""
|
|
22
|
+
console.print(banner)
|
|
23
|
+
|
|
24
|
+
async def main_async(args):
|
|
25
|
+
if not args.key and not args.file:
|
|
26
|
+
console.print("[red]Error: Must provide either -k/--key or -f/--file[/red]")
|
|
27
|
+
sys.exit(1)
|
|
28
|
+
|
|
29
|
+
keys = []
|
|
30
|
+
if args.key:
|
|
31
|
+
keys.append(args.key)
|
|
32
|
+
if args.file:
|
|
33
|
+
try:
|
|
34
|
+
with open(args.file, 'r') as f:
|
|
35
|
+
keys.extend([line.strip() for line in f if line.strip()])
|
|
36
|
+
except Exception as e:
|
|
37
|
+
console.print(f"[red]Error reading file: {e}[/red]")
|
|
38
|
+
sys.exit(1)
|
|
39
|
+
|
|
40
|
+
scanner = Scanner(templates_dir=args.templates)
|
|
41
|
+
|
|
42
|
+
console.print(f"[bold]Starting scan for {len(keys)} keys...[/bold]\n")
|
|
43
|
+
results = await scanner.scan_keys(keys)
|
|
44
|
+
|
|
45
|
+
if args.json:
|
|
46
|
+
out = [r.model_dump() for r in results]
|
|
47
|
+
console.print(json.dumps(out, indent=2))
|
|
48
|
+
return
|
|
49
|
+
|
|
50
|
+
table = Table(title="Validation Results")
|
|
51
|
+
table.add_column("Key (Masked)", style="cyan")
|
|
52
|
+
table.add_column("Service", style="magenta")
|
|
53
|
+
table.add_column("Status", justify="center")
|
|
54
|
+
table.add_column("Confidence", justify="right", style="green")
|
|
55
|
+
table.add_column("Message")
|
|
56
|
+
|
|
57
|
+
for r in results:
|
|
58
|
+
# Mask key for output: sk_live_1234...5678
|
|
59
|
+
masked = r.key[:8] + "..." + r.key[-4:] if len(r.key) > 12 else r.key
|
|
60
|
+
|
|
61
|
+
status_color = "green" if r.status == "valid" else "red" if r.status == "invalid" else "yellow"
|
|
62
|
+
|
|
63
|
+
table.add_row(
|
|
64
|
+
masked,
|
|
65
|
+
r.service,
|
|
66
|
+
f"[{status_color}]{r.status.upper()}[/{status_color}]",
|
|
67
|
+
f"{r.confidence:.2f}",
|
|
68
|
+
r.message or ""
|
|
69
|
+
)
|
|
70
|
+
|
|
71
|
+
console.print(table)
|
|
72
|
+
|
|
73
|
+
def main():
|
|
74
|
+
parser = argparse.ArgumentParser(description="keyscan - API Key Validation Engine")
|
|
75
|
+
parser.add_argument("-k", "--key", help="Single key to validate")
|
|
76
|
+
parser.add_argument("-f", "--file", help="File containing list of keys")
|
|
77
|
+
parser.add_argument("-t", "--templates", default="templates", help="Directory containing YAML templates")
|
|
78
|
+
parser.add_argument("--json", action="store_true", help="Output results in JSON format")
|
|
79
|
+
|
|
80
|
+
args = parser.parse_args()
|
|
81
|
+
|
|
82
|
+
if not args.json:
|
|
83
|
+
print_banner()
|
|
84
|
+
|
|
85
|
+
try:
|
|
86
|
+
asyncio.run(main_async(args))
|
|
87
|
+
except KeyboardInterrupt:
|
|
88
|
+
console.print("\n[yellow]Scan interrupted by user.[/yellow]")
|
|
89
|
+
sys.exit(0)
|
|
90
|
+
|
|
91
|
+
if __name__ == "__main__":
|
|
92
|
+
main()
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: keyscan
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A template-driven engine for validating exposed API keys and secrets.
|
|
5
|
+
Author-email: keyscan-author <author@example.com>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Classifier: Programming Language :: Python :: 3
|
|
8
|
+
Classifier: Operating System :: OS Independent
|
|
9
|
+
Requires-Python: >=3.9
|
|
10
|
+
Description-Content-Type: text/markdown
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Requires-Dist: rich>=13.0.0
|
|
13
|
+
Requires-Dist: httpx>=0.24.1
|
|
14
|
+
Requires-Dist: PyYAML>=6.0
|
|
15
|
+
Requires-Dist: pydantic>=2.0.0
|
|
16
|
+
Requires-Dist: aws-ar>=3.0
|
|
17
|
+
Dynamic: license-file
|
|
18
|
+
|
|
19
|
+
# keyscan
|
|
20
|
+
|
|
21
|
+

|
|
22
|
+

|
|
23
|
+

|
|
24
|
+

|
|
25
|
+

|
|
26
|
+

|
|
27
|
+
|
|
28
|
+
Template-driven API key validation engine
|
|
29
|
+
```
|
|
30
|
+
┌─────────┐ ┌──────────┐ ┌──────────┐ ┌────────┐
|
|
31
|
+
│ Detect │───→│ Classify │───→│ Validate │───→│ Score │
|
|
32
|
+
└─────────┘ └──────────┘ └──────────┘ └────────┘
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
keyscan is a Nuclei-inspired tool built for security researchers to automatically validate exposed API keys and secrets using extensible YAML templates.
|
|
36
|
+
|
|
37
|
+
Instead of manually testing keys using scattered scripts, keyscan provides a scalable and structured workflow for secret validation.
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
## Why keyscan?
|
|
42
|
+
|
|
43
|
+
Finding API keys is easy.
|
|
44
|
+
Validating them is time-consuming and inconsistent.
|
|
45
|
+
|
|
46
|
+
With keyscan:
|
|
47
|
+
- Detects and classifies keys
|
|
48
|
+
- Predicts possible services
|
|
49
|
+
- Runs validation templates automatically
|
|
50
|
+
- Outputs confidence-based results
|
|
51
|
+
|
|
52
|
+
## Features
|
|
53
|
+
|
|
54
|
+
| Feature | Details |
|
|
55
|
+
|---------|---------|
|
|
56
|
+
| Template-based validation | YAML templates, Easily extendable |
|
|
57
|
+
| Smart key classification | Regex + prefix detection (sk-, AKIA, etc.), Length + charset analysis, Entropy-based scoring |
|
|
58
|
+
| Async validation engine | Parallel requests using httpx |
|
|
59
|
+
| Confidence scoring | Returns probability-based results |
|
|
60
|
+
| Clean CLI output | Table output, JSON output (planned) |
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
## Installation
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
git clone https://github.com/harxh-v/keyscan.git
|
|
68
|
+
cd keyscan
|
|
69
|
+
|
|
70
|
+
pip install -e .
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
---
|
|
74
|
+
|
|
75
|
+
## Usage
|
|
76
|
+
|
|
77
|
+
### Validate a single key
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
keyscan -k "sk_live_123456789" -t templates/
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### Validate keys from a file
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
keyscan -f keys.txt -t templates/
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
---
|
|
90
|
+
|
|
91
|
+
## Example Output
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
┌──────────────┬──────────┬────────────┬────────────┐
|
|
95
|
+
│ Key │ Service │ Status │ Confidence │
|
|
96
|
+
├──────────────┼──────────┼────────────┼────────────┤
|
|
97
|
+
│ sk_live_**** │ Stripe │ Valid │ 0.91 │
|
|
98
|
+
│ AKIA**** │ AWS │ Invalid │ 0.76 │
|
|
99
|
+
└──────────────┴──────────┴────────────┴────────────┘
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
---
|
|
103
|
+
|
|
104
|
+
## Template Example
|
|
105
|
+
|
|
106
|
+
```yaml
|
|
107
|
+
id: stripe-key-check
|
|
108
|
+
service: stripe
|
|
109
|
+
|
|
110
|
+
requests:
|
|
111
|
+
- method: GET
|
|
112
|
+
url: https://api.stripe.com/v1/charges
|
|
113
|
+
headers:
|
|
114
|
+
Authorization: Bearer {{key}}
|
|
115
|
+
|
|
116
|
+
matchers:
|
|
117
|
+
- type: status
|
|
118
|
+
status: [200, 401]
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
---
|
|
122
|
+
|
|
123
|
+
## Project Structure
|
|
124
|
+
|
|
125
|
+
```
|
|
126
|
+
keyscan/
|
|
127
|
+
├── cli.py
|
|
128
|
+
├── engine/
|
|
129
|
+
├── classifiers/
|
|
130
|
+
├── templates/
|
|
131
|
+
├── utils/
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
---
|
|
135
|
+
|
|
136
|
+
## Security Notice
|
|
137
|
+
|
|
138
|
+
- This project does not include real API keys
|
|
139
|
+
- All templates use placeholders
|
|
140
|
+
- Do not commit live secrets
|
|
141
|
+
|
|
142
|
+
If a key is exposed:
|
|
143
|
+
- Revoke it immediately
|
|
144
|
+
- Rotate credentials
|
|
145
|
+
|
|
146
|
+
---
|
|
147
|
+
|
|
148
|
+
## Roadmap
|
|
149
|
+
|
|
150
|
+
[ ] JSON output
|
|
151
|
+
[ ] Burp Suite extension
|
|
152
|
+
[ ] GitHub Action integration
|
|
153
|
+
[ ] ML-based classification
|
|
154
|
+
[ ] Community template registry
|
|
155
|
+
|
|
156
|
+
---
|
|
157
|
+
|
|
158
|
+
## Contributing
|
|
159
|
+
|
|
160
|
+
Contributions are welcome:
|
|
161
|
+
- Add templates
|
|
162
|
+
- Improve classifiers
|
|
163
|
+
- Optimize performance
|
|
164
|
+
|
|
165
|
+
---
|
|
166
|
+
|
|
167
|
+
## License
|
|
168
|
+
|
|
169
|
+
MIT license
|
|
170
|
+
|
|
171
|
+
## Author
|
|
172
|
+
|
|
173
|
+
Harsh Verma
|
|
174
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
keyscan
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "keyscan"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "A template-driven engine for validating exposed API keys and secrets."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
authors = [{ name = "keyscan-author", email = "author@example.com" }]
|
|
11
|
+
license = "MIT"
|
|
12
|
+
requires-python = ">=3.9"
|
|
13
|
+
classifiers = [
|
|
14
|
+
"Programming Language :: Python :: 3",
|
|
15
|
+
"Operating System :: OS Independent",
|
|
16
|
+
]
|
|
17
|
+
dependencies = [
|
|
18
|
+
"rich>=13.0.0",
|
|
19
|
+
"httpx>=0.24.1",
|
|
20
|
+
"PyYAML>=6.0",
|
|
21
|
+
"pydantic>=2.0.0",
|
|
22
|
+
"aws-ar>=3.0"
|
|
23
|
+
]
|
|
24
|
+
|
|
25
|
+
[project.scripts]
|
|
26
|
+
keyscan = "keyscan.cli:main"
|
|
27
|
+
|
|
28
|
+
[tool.setuptools]
|
|
29
|
+
packages = ["keyscan"]
|
keyscan-0.1.0/setup.cfg
ADDED