rangus 0.5.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.
Files changed (41) hide show
  1. rangus-0.5.0/LICENSE +21 -0
  2. rangus-0.5.0/PKG-INFO +268 -0
  3. rangus-0.5.0/README.md +237 -0
  4. rangus-0.5.0/pyproject.toml +61 -0
  5. rangus-0.5.0/setup.cfg +4 -0
  6. rangus-0.5.0/src/rangus/__init__.py +3 -0
  7. rangus-0.5.0/src/rangus/__main__.py +4 -0
  8. rangus-0.5.0/src/rangus/cli.py +575 -0
  9. rangus-0.5.0/src/rangus/core/__init__.py +4 -0
  10. rangus-0.5.0/src/rangus/core/config.py +30 -0
  11. rangus-0.5.0/src/rangus/core/keys.py +182 -0
  12. rangus-0.5.0/src/rangus/core/models.py +32 -0
  13. rangus-0.5.0/src/rangus/modules/__init__.py +3 -0
  14. rangus-0.5.0/src/rangus/modules/emails.py +545 -0
  15. rangus-0.5.0/src/rangus/modules/recon.py +75 -0
  16. rangus-0.5.0/src/rangus/modules/subdomains.py +386 -0
  17. rangus-0.5.0/src/rangus/monitor.py +302 -0
  18. rangus-0.5.0/src/rangus/utils/__init__.py +1 -0
  19. rangus-0.5.0/src/rangus/utils/diff.py +132 -0
  20. rangus-0.5.0/src/rangus/utils/domain.py +34 -0
  21. rangus-0.5.0/src/rangus/utils/dorks.py +59 -0
  22. rangus-0.5.0/src/rangus/utils/email_extract.py +82 -0
  23. rangus-0.5.0/src/rangus/utils/http.py +170 -0
  24. rangus-0.5.0/src/rangus/utils/output.py +140 -0
  25. rangus-0.5.0/src/rangus/utils/rate_limit.py +14 -0
  26. rangus-0.5.0/src/rangus/utils/saved_pages.py +65 -0
  27. rangus-0.5.0/src/rangus.egg-info/PKG-INFO +268 -0
  28. rangus-0.5.0/src/rangus.egg-info/SOURCES.txt +39 -0
  29. rangus-0.5.0/src/rangus.egg-info/dependency_links.txt +1 -0
  30. rangus-0.5.0/src/rangus.egg-info/entry_points.txt +2 -0
  31. rangus-0.5.0/src/rangus.egg-info/requires.txt +10 -0
  32. rangus-0.5.0/src/rangus.egg-info/top_level.txt +1 -0
  33. rangus-0.5.0/tests/test_diff.py +179 -0
  34. rangus-0.5.0/tests/test_email_extract.py +69 -0
  35. rangus-0.5.0/tests/test_email_sources.py +350 -0
  36. rangus-0.5.0/tests/test_emails.py +201 -0
  37. rangus-0.5.0/tests/test_fixes.py +369 -0
  38. rangus-0.5.0/tests/test_keys.py +391 -0
  39. rangus-0.5.0/tests/test_monitor.py +267 -0
  40. rangus-0.5.0/tests/test_output.py +121 -0
  41. rangus-0.5.0/tests/test_recon_concurrency.py +114 -0
rangus-0.5.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026
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.
rangus-0.5.0/PKG-INFO ADDED
@@ -0,0 +1,268 @@
1
+ Metadata-Version: 2.4
2
+ Name: rangus
3
+ Version: 0.5.0
4
+ Summary: Passive reconnaissance tool for email discovery and subdomains
5
+ Author: Sean Fitzgerald
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/phitzy/rangus
8
+ Project-URL: Issues, https://github.com/phitzy/rangus/issues
9
+ Keywords: osint,recon,passive,email,subdomain,security,google-dork
10
+ Classifier: Development Status :: 3 - Alpha
11
+ Classifier: Environment :: Console
12
+ Classifier: Intended Audience :: Information Technology
13
+ Classifier: License :: OSI Approved :: MIT License
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.12
16
+ Classifier: Programming Language :: Python :: 3.13
17
+ Classifier: Topic :: Security
18
+ Requires-Python: >=3.12
19
+ Description-Content-Type: text/markdown
20
+ License-File: LICENSE
21
+ Requires-Dist: typer[all]>=0.12.0
22
+ Requires-Dist: httpx>=0.27.0
23
+ Requires-Dist: rich>=13.0.0
24
+ Requires-Dist: pydantic>=2.0.0
25
+ Requires-Dist: keyring>=24.0
26
+ Provides-Extra: dev
27
+ Requires-Dist: pytest>=8.0.0; extra == "dev"
28
+ Requires-Dist: ruff>=0.4.0; extra == "dev"
29
+ Requires-Dist: mypy>=1.8.0; extra == "dev"
30
+ Dynamic: license-file
31
+
32
+ # rangus
33
+
34
+ **Passive reconnaissance tool for email discovery and supporting OSINT data.**
35
+
36
+ Inspired by tools like DNSDumpster, `rangus` focuses on *passive-only* techniques that are useful in day-to-day security work: email discovery from certificate logs, archived pages and (Google) dorking, subdomain discovery, and clean structured output. No active scanning, no intrusive probes.
37
+
38
+ Built to be practical while clearly demonstrating OSINT methodology, ethical constraints, and solid software engineering practices.
39
+
40
+
41
+ ## Features
42
+
43
+ | Area | What it does | Status |
44
+ |-----------------|----------------------------------------------------------------------|----------|
45
+ | Emails | CT-log identities + Wayback-archived contact pages + DuckDuckGo dorks; manual Google dorking via `--show-dorks` / `--import` | Working |
46
+ | Subdomains | 5 keyless sources (crt.sh, CertSpotter, HackerTarget, subdomain.center, urlscan.io) + 4 optional keyed ones, queried in parallel and deduped | Working |
47
+ | Full recon | Both modules in one run, one report | Working |
48
+ | Output formats | Terminal table, JSON, CSV, plain (one result per line) | Working |
49
+ | Diff mode | Show only what's new since an earlier report (monitoring) | Working |
50
+ | Monitor | Scheduled multi-target recon from a TOML config, optional webhook | Working |
51
+ | Rate limiting | Randomized polite delay between search requests | Working |
52
+ | API keys | Optional extra sources (VirusTotal, SecurityTrails, Chaos, OTX, Hunter.io, urlscan.io); keys kept in the OS credential store | Working |
53
+ | Proxy support | Optional HTTP proxy via `Settings.proxy` | Config only (no CLI flag yet) |
54
+
55
+ ---
56
+
57
+ ## Install
58
+
59
+ ```bash
60
+ git clone https://github.com/phitzy/rangus rangus
61
+ cd rangus
62
+ pip install -e . # or: pip install -e ".[dev]" for tests and linters
63
+ ```
64
+
65
+ or
66
+
67
+ ```bash
68
+ pip install rangus
69
+ ```
70
+
71
+ Requires Python 3.12+.
72
+
73
+ ---
74
+
75
+ ## Usage
76
+
77
+ ```bash
78
+ # Emails for a domain (terminal table)
79
+ rangus emails example.com
80
+
81
+ # Google dorking by hand: print Google links, save the result pages, extract
82
+ rangus emails example.com --show-dorks
83
+ rangus emails example.com --import saved-pages/
84
+
85
+ # Subdomains only
86
+ rangus subdomains example.com
87
+
88
+ # Everything, saved as a JSON report
89
+ rangus recon example.com -o report.json
90
+
91
+ # Check rangus's version
92
+ rangus --version
93
+ ```
94
+
95
+ ### Short names and flags
96
+
97
+ Each command has short aliases, and the most common options have one-letter flags:
98
+
99
+ | Command | Aliases | | Option | Short |
100
+ |--------------|------------|-----|-----------------|-------|
101
+ | `recon` | `r` | | `--json` | `-j` |
102
+ | `subdomains` | `s`, `sub` | | `--diff` | `-d` |
103
+ | `emails` | `e`, `em` | | `--max-dorks` | `-n` |
104
+ | `monitor` | `m` | | `--show-dorks` | `-s` |
105
+
106
+ ```bash
107
+ rangus s example.com -j -d state.json -o state.json
108
+ rangus e example.com -s
109
+ ```
110
+
111
+ Domains are normalized, so `Example.com.`, `https://example.com/about` and `example.com` all mean the same target.
112
+
113
+ ### Output formats
114
+
115
+ Every command takes `--format` / `-f`:
116
+
117
+ | Format | Use it for |
118
+ |---------|-------------------------------------------------------------------|
119
+ | `table` | Reading results in the terminal (default) |
120
+ | `json` | Full report with metadata; the format `--diff` reads |
121
+ | `csv` | Spreadsheets. One row per result, with a `type` column |
122
+ | `plain` | Piping. One subdomain or email per line, nothing else |
123
+
124
+ Progress and status messages go to **stderr**, and results go to **stdout**, so piping only passes results along:
125
+
126
+ ```bash
127
+ rangus subdomains example.com -f plain -q | sort -u > subs.txt
128
+ rangus subdomains example.com -f plain -q | grep -E '^(dev|staging|test)\.'
129
+ rangus recon example.com -f csv -o results.csv
130
+ ```
131
+
132
+ `--json` still works as a shortcut for `--format json`.
133
+
134
+ `-o FILE` writes the full results in the chosen format. With `--format table`, the file is saved as JSON.
135
+
136
+ ### Monitoring with `--diff`
137
+
138
+ `--diff FILE` compares this run with an earlier JSON report and shows **only what's new**. It also prints a summary of what's new and what's gone to stderr.
139
+
140
+ Point `--diff` and `-o` at the same file to get a simple monitoring loop:
141
+
142
+ ```bash
143
+ rangus subdomains example.com -f plain -q --diff state/example.json -o state/example.json
144
+ ```
145
+
146
+ - **First run:** the file doesn't exist yet, so every result counts as new and the baseline is created.
147
+ - **Every later run:** prints only subdomains that weren't in the baseline, then saves the full current results as the new baseline.
148
+ - The baseline file is always saved as JSON, even when stdout uses `-f plain` or `-f csv`.
149
+
150
+ Put that in a cron job, and any output means something new appeared.
151
+
152
+ A few details:
153
+ - Only the sections a command actually ran are compared. `rangus subdomains --diff` never reports saved emails as gone.
154
+ - In `recon`, if a module fails or is blocked, its results from the baseline are carried over into the saved report (with a note). That way the next run doesn't report them all as new again.
155
+ - "Gone" can mean a host really disappeared, or that a source was down or rate-limited on this run. Treat it as a hint, not a fact.
156
+ - A `--diff` file for a different target, or one that isn't a rangus JSON report, is rejected with exit code 1.
157
+ - If every subdomain source fails, `subdomains` exits with code 1 instead of saving an empty baseline (in `recon`, the previous subdomains are carried over).
158
+
159
+ ### Scheduled monitoring with `rangus monitor`
160
+
161
+ `rangus monitor` runs recon over a list of targets from a TOML file and shows **only what's new** for each one. Every target keeps its own baseline in `state_dir`.
162
+
163
+ ```bash
164
+ rangus monitor --init # write a commented starter ./rangus.toml
165
+ rangus monitor # run every target in ./rangus.toml once
166
+ rangus monitor ~/recon/clients.toml # or point it at any other config file
167
+ ```
168
+
169
+ ```toml
170
+ [defaults]
171
+ modules = ["subdomains"] # "subdomains" and/or "emails" (emails get blocked faster)
172
+ state_dir = "~/.rangus/state" # relative paths are resolved against the config's folder
173
+ webhook = "" # optional Discord / Slack webhook URL
174
+ limit = 40
175
+ max_dorks = 3
176
+
177
+ [[target]]
178
+ domain = "example.com"
179
+
180
+ [[target]]
181
+ domain = "example.org"
182
+ modules = ["subdomains", "emails"] # any [defaults] key except state_dir can be overridden
183
+ webhook = "https://discord.com/api/webhooks/..."
184
+ ```
185
+
186
+ - New results go to stdout in any `--format` (`plain` for piping, `json` gives one report per target), and the per-target summaries go to stderr.
187
+ - A target that fails (a source is down, or its state file is broken) is reported but doesn't stop the other targets. A module that failed keeps its previous results, so an outage never makes everything look new on the next run.
188
+ - **Webhook:** posts a short message when a target has new results. The first run posts a single "started monitoring" message instead of listing everything.
189
+ - `--exit-code` exits with `3` when something new was found, for scripts that act on changes.
190
+ - Unknown keys in the config (typos like `limt`) are rejected, not ignored.
191
+
192
+ **Scheduling** is left to the OS, so rangus never needs to keep a process running in the background:
193
+
194
+ ```bash
195
+ # cron: every 6 hours
196
+ 0 */6 * * * rangus monitor ~/rangus.toml -f plain -q >> ~/rangus-new.txt
197
+
198
+ # Windows Task Scheduler: every 6 hours
199
+ schtasks /create /sc hourly /mo 6 /tn rangus /tr "rangus monitor C:
200
+ angus
201
+ angus.toml -q"
202
+ ```
203
+
204
+ You can also use `--every 6h` (also `30m`, `1d`, or plain seconds; minimum 60s) to keep it running in the foreground. The config is re-read before each run, so you can add targets without restarting.
205
+
206
+ ### Optional API keys
207
+
208
+ Everything works without keys. Adding a key switches on an extra source; sources without a key are skipped automatically (and listed as such in the progress output).
209
+
210
+ | Service | Adds | Free tier (as of writing) |
211
+ |------------------|-------------------------------|---------------------------|
212
+ | `virustotal` | Subdomains | Yes, 4 requests/min |
213
+ | `securitytrails` | Subdomains | Limited |
214
+ | `chaos` | Subdomains (ProjectDiscovery) | Yes |
215
+ | `otx` | Subdomains (passive DNS) | Yes |
216
+ | `urlscan` | Higher urlscan.io rate limits | Yes (works without a key too) |
217
+ | `hunter` | Emails (Hunter.io) | Yes, 10 results per search |
218
+
219
+ ```bash
220
+ rangus keys list # what's configured, where it comes from (masked), sign-up links
221
+ rangus keys set virustotal # prompts for the key; input is hidden
222
+ rangus keys delete virustotal
223
+ ```
224
+
225
+ **How keys are kept safe:**
226
+ - `rangus keys set` stores the key in your **OS credential store** (Windows Credential Manager, macOS Keychain, Secret Service on Linux), encrypted for your user account. It never writes keys to a plain file.
227
+ - Keys are never accepted as command-line arguments, where they would end up in shell history and process lists. Use the hidden prompt, or `--stdin` from a script: `vault read ... | rangus keys set chaos --stdin`.
228
+ - Keys are sent in request headers, not URLs, and anything key-like in an error message (`?api_key=...`) is masked before it's printed or saved in a report.
229
+ - Keys are only ever shown masked (`••••abcd`).
230
+
231
+ **Other ways to provide a key** (looked up in this order; the first one found wins):
232
+ 1. An environment variable, `RANGUS_<SERVICE>_KEY` (for example `RANGUS_VIRUSTOTAL_KEY`). Good for CI and servers without a credential store.
233
+ 2. The `[keys]` table of a `monitor` config, for that run only. Use `"env:VARIABLE"` to read the key from the environment, so the secret stays out of the file:
234
+ ```toml
235
+ [keys]
236
+ virustotal = "env:VT_API_KEY"
237
+ ```
238
+ A plain-text key also works there, but then anyone who can read the file can read the key.
239
+ 3. The OS credential store (`rangus keys set`).
240
+
241
+ ### Exit codes
242
+
243
+ | Code | Meaning |
244
+ |------|-----------------------------------------------------------------|
245
+ | 0 | Success (including "no results") |
246
+ | 1 | Error (e.g. invalid domain, every subdomain source down, `-o` not writable) or bad `--diff` file |
247
+ | 2 | `emails`: nothing found by any source and DuckDuckGo was blocked |
248
+ | 3 | `monitor --exit-code`: something new was found |
249
+
250
+ ---
251
+
252
+ **Google dorking.** Automated Google searching isn't viable: plain HTTP requests get a block page, automated queries break Google's terms, and the official Custom Search JSON API is closed to new customers and shuts down on 1 January 2027. So rangus does the parts a browser can't:
253
+
254
+ 1. `rangus emails example.com --show-dorks` prints each dork with a ready-to-click Google link, including Google-only dorks (`intext:`, `intitle:`, `OR` groups, GitHub / Pastebin).
255
+ 2. Open the links in your browser and save each results page (Ctrl+S, "Webpage, Complete" or "Single File") into one folder.
256
+ 3. `rangus emails example.com --import that-folder/` extracts the addresses (`.html`, `.htm`, `.mhtml`, `.mht`, `.txt`; folders are searched recursively). Pages recognized as Google results are tagged `source=google` with the query as `dork`.
257
+
258
+ Every source uses the same extractor. It rejoins addresses split by search-term highlighting (`jane@<em>example</em>.com`), decodes HTML entities, undoes simple `[at]`/`[dot]` obfuscation, catches addresses that only appear in `mailto:` links, and keeps only addresses on the target domain or its subdomains. Use `--debug DIR` to save every raw DuckDuckGo page for inspection.
259
+
260
+ **Subdomains.** Five keyless sources are queried at the same time: crt.sh and CertSpotter (two independent views of the Certificate Transparency logs), HackerTarget's hostsearch (DNS data), subdomain.center (an aggregated dataset) and urlscan.io (hosts seen in public website scans). Wildcard entries are normalized, anything that isn't a hostname under the target is dropped, and the results are merged. Each subdomain is credited to the first source in that order that found it. Sources with an API key configured (VirusTotal, SecurityTrails, Chaos, AlienVault OTX; see *Optional API keys*) run alongside them and are credited after the keyless ones. A source that is down or rate-limited is skipped, and the run only fails if every source fails.
261
+
262
+ Custom dork templates can be set in `rangus.core.config.Settings.dork_templates`.
263
+
264
+ ---
265
+
266
+ ## License
267
+
268
+ MIT (see LICENSE)
rangus-0.5.0/README.md ADDED
@@ -0,0 +1,237 @@
1
+ # rangus
2
+
3
+ **Passive reconnaissance tool for email discovery and supporting OSINT data.**
4
+
5
+ Inspired by tools like DNSDumpster, `rangus` focuses on *passive-only* techniques that are useful in day-to-day security work: email discovery from certificate logs, archived pages and (Google) dorking, subdomain discovery, and clean structured output. No active scanning, no intrusive probes.
6
+
7
+ Built to be practical while clearly demonstrating OSINT methodology, ethical constraints, and solid software engineering practices.
8
+
9
+
10
+ ## Features
11
+
12
+ | Area | What it does | Status |
13
+ |-----------------|----------------------------------------------------------------------|----------|
14
+ | Emails | CT-log identities + Wayback-archived contact pages + DuckDuckGo dorks; manual Google dorking via `--show-dorks` / `--import` | Working |
15
+ | Subdomains | 5 keyless sources (crt.sh, CertSpotter, HackerTarget, subdomain.center, urlscan.io) + 4 optional keyed ones, queried in parallel and deduped | Working |
16
+ | Full recon | Both modules in one run, one report | Working |
17
+ | Output formats | Terminal table, JSON, CSV, plain (one result per line) | Working |
18
+ | Diff mode | Show only what's new since an earlier report (monitoring) | Working |
19
+ | Monitor | Scheduled multi-target recon from a TOML config, optional webhook | Working |
20
+ | Rate limiting | Randomized polite delay between search requests | Working |
21
+ | API keys | Optional extra sources (VirusTotal, SecurityTrails, Chaos, OTX, Hunter.io, urlscan.io); keys kept in the OS credential store | Working |
22
+ | Proxy support | Optional HTTP proxy via `Settings.proxy` | Config only (no CLI flag yet) |
23
+
24
+ ---
25
+
26
+ ## Install
27
+
28
+ ```bash
29
+ git clone https://github.com/phitzy/rangus rangus
30
+ cd rangus
31
+ pip install -e . # or: pip install -e ".[dev]" for tests and linters
32
+ ```
33
+
34
+ or
35
+
36
+ ```bash
37
+ pip install rangus
38
+ ```
39
+
40
+ Requires Python 3.12+.
41
+
42
+ ---
43
+
44
+ ## Usage
45
+
46
+ ```bash
47
+ # Emails for a domain (terminal table)
48
+ rangus emails example.com
49
+
50
+ # Google dorking by hand: print Google links, save the result pages, extract
51
+ rangus emails example.com --show-dorks
52
+ rangus emails example.com --import saved-pages/
53
+
54
+ # Subdomains only
55
+ rangus subdomains example.com
56
+
57
+ # Everything, saved as a JSON report
58
+ rangus recon example.com -o report.json
59
+
60
+ # Check rangus's version
61
+ rangus --version
62
+ ```
63
+
64
+ ### Short names and flags
65
+
66
+ Each command has short aliases, and the most common options have one-letter flags:
67
+
68
+ | Command | Aliases | | Option | Short |
69
+ |--------------|------------|-----|-----------------|-------|
70
+ | `recon` | `r` | | `--json` | `-j` |
71
+ | `subdomains` | `s`, `sub` | | `--diff` | `-d` |
72
+ | `emails` | `e`, `em` | | `--max-dorks` | `-n` |
73
+ | `monitor` | `m` | | `--show-dorks` | `-s` |
74
+
75
+ ```bash
76
+ rangus s example.com -j -d state.json -o state.json
77
+ rangus e example.com -s
78
+ ```
79
+
80
+ Domains are normalized, so `Example.com.`, `https://example.com/about` and `example.com` all mean the same target.
81
+
82
+ ### Output formats
83
+
84
+ Every command takes `--format` / `-f`:
85
+
86
+ | Format | Use it for |
87
+ |---------|-------------------------------------------------------------------|
88
+ | `table` | Reading results in the terminal (default) |
89
+ | `json` | Full report with metadata; the format `--diff` reads |
90
+ | `csv` | Spreadsheets. One row per result, with a `type` column |
91
+ | `plain` | Piping. One subdomain or email per line, nothing else |
92
+
93
+ Progress and status messages go to **stderr**, and results go to **stdout**, so piping only passes results along:
94
+
95
+ ```bash
96
+ rangus subdomains example.com -f plain -q | sort -u > subs.txt
97
+ rangus subdomains example.com -f plain -q | grep -E '^(dev|staging|test)\.'
98
+ rangus recon example.com -f csv -o results.csv
99
+ ```
100
+
101
+ `--json` still works as a shortcut for `--format json`.
102
+
103
+ `-o FILE` writes the full results in the chosen format. With `--format table`, the file is saved as JSON.
104
+
105
+ ### Monitoring with `--diff`
106
+
107
+ `--diff FILE` compares this run with an earlier JSON report and shows **only what's new**. It also prints a summary of what's new and what's gone to stderr.
108
+
109
+ Point `--diff` and `-o` at the same file to get a simple monitoring loop:
110
+
111
+ ```bash
112
+ rangus subdomains example.com -f plain -q --diff state/example.json -o state/example.json
113
+ ```
114
+
115
+ - **First run:** the file doesn't exist yet, so every result counts as new and the baseline is created.
116
+ - **Every later run:** prints only subdomains that weren't in the baseline, then saves the full current results as the new baseline.
117
+ - The baseline file is always saved as JSON, even when stdout uses `-f plain` or `-f csv`.
118
+
119
+ Put that in a cron job, and any output means something new appeared.
120
+
121
+ A few details:
122
+ - Only the sections a command actually ran are compared. `rangus subdomains --diff` never reports saved emails as gone.
123
+ - In `recon`, if a module fails or is blocked, its results from the baseline are carried over into the saved report (with a note). That way the next run doesn't report them all as new again.
124
+ - "Gone" can mean a host really disappeared, or that a source was down or rate-limited on this run. Treat it as a hint, not a fact.
125
+ - A `--diff` file for a different target, or one that isn't a rangus JSON report, is rejected with exit code 1.
126
+ - If every subdomain source fails, `subdomains` exits with code 1 instead of saving an empty baseline (in `recon`, the previous subdomains are carried over).
127
+
128
+ ### Scheduled monitoring with `rangus monitor`
129
+
130
+ `rangus monitor` runs recon over a list of targets from a TOML file and shows **only what's new** for each one. Every target keeps its own baseline in `state_dir`.
131
+
132
+ ```bash
133
+ rangus monitor --init # write a commented starter ./rangus.toml
134
+ rangus monitor # run every target in ./rangus.toml once
135
+ rangus monitor ~/recon/clients.toml # or point it at any other config file
136
+ ```
137
+
138
+ ```toml
139
+ [defaults]
140
+ modules = ["subdomains"] # "subdomains" and/or "emails" (emails get blocked faster)
141
+ state_dir = "~/.rangus/state" # relative paths are resolved against the config's folder
142
+ webhook = "" # optional Discord / Slack webhook URL
143
+ limit = 40
144
+ max_dorks = 3
145
+
146
+ [[target]]
147
+ domain = "example.com"
148
+
149
+ [[target]]
150
+ domain = "example.org"
151
+ modules = ["subdomains", "emails"] # any [defaults] key except state_dir can be overridden
152
+ webhook = "https://discord.com/api/webhooks/..."
153
+ ```
154
+
155
+ - New results go to stdout in any `--format` (`plain` for piping, `json` gives one report per target), and the per-target summaries go to stderr.
156
+ - A target that fails (a source is down, or its state file is broken) is reported but doesn't stop the other targets. A module that failed keeps its previous results, so an outage never makes everything look new on the next run.
157
+ - **Webhook:** posts a short message when a target has new results. The first run posts a single "started monitoring" message instead of listing everything.
158
+ - `--exit-code` exits with `3` when something new was found, for scripts that act on changes.
159
+ - Unknown keys in the config (typos like `limt`) are rejected, not ignored.
160
+
161
+ **Scheduling** is left to the OS, so rangus never needs to keep a process running in the background:
162
+
163
+ ```bash
164
+ # cron: every 6 hours
165
+ 0 */6 * * * rangus monitor ~/rangus.toml -f plain -q >> ~/rangus-new.txt
166
+
167
+ # Windows Task Scheduler: every 6 hours
168
+ schtasks /create /sc hourly /mo 6 /tn rangus /tr "rangus monitor C:
169
+ angus
170
+ angus.toml -q"
171
+ ```
172
+
173
+ You can also use `--every 6h` (also `30m`, `1d`, or plain seconds; minimum 60s) to keep it running in the foreground. The config is re-read before each run, so you can add targets without restarting.
174
+
175
+ ### Optional API keys
176
+
177
+ Everything works without keys. Adding a key switches on an extra source; sources without a key are skipped automatically (and listed as such in the progress output).
178
+
179
+ | Service | Adds | Free tier (as of writing) |
180
+ |------------------|-------------------------------|---------------------------|
181
+ | `virustotal` | Subdomains | Yes, 4 requests/min |
182
+ | `securitytrails` | Subdomains | Limited |
183
+ | `chaos` | Subdomains (ProjectDiscovery) | Yes |
184
+ | `otx` | Subdomains (passive DNS) | Yes |
185
+ | `urlscan` | Higher urlscan.io rate limits | Yes (works without a key too) |
186
+ | `hunter` | Emails (Hunter.io) | Yes, 10 results per search |
187
+
188
+ ```bash
189
+ rangus keys list # what's configured, where it comes from (masked), sign-up links
190
+ rangus keys set virustotal # prompts for the key; input is hidden
191
+ rangus keys delete virustotal
192
+ ```
193
+
194
+ **How keys are kept safe:**
195
+ - `rangus keys set` stores the key in your **OS credential store** (Windows Credential Manager, macOS Keychain, Secret Service on Linux), encrypted for your user account. It never writes keys to a plain file.
196
+ - Keys are never accepted as command-line arguments, where they would end up in shell history and process lists. Use the hidden prompt, or `--stdin` from a script: `vault read ... | rangus keys set chaos --stdin`.
197
+ - Keys are sent in request headers, not URLs, and anything key-like in an error message (`?api_key=...`) is masked before it's printed or saved in a report.
198
+ - Keys are only ever shown masked (`••••abcd`).
199
+
200
+ **Other ways to provide a key** (looked up in this order; the first one found wins):
201
+ 1. An environment variable, `RANGUS_<SERVICE>_KEY` (for example `RANGUS_VIRUSTOTAL_KEY`). Good for CI and servers without a credential store.
202
+ 2. The `[keys]` table of a `monitor` config, for that run only. Use `"env:VARIABLE"` to read the key from the environment, so the secret stays out of the file:
203
+ ```toml
204
+ [keys]
205
+ virustotal = "env:VT_API_KEY"
206
+ ```
207
+ A plain-text key also works there, but then anyone who can read the file can read the key.
208
+ 3. The OS credential store (`rangus keys set`).
209
+
210
+ ### Exit codes
211
+
212
+ | Code | Meaning |
213
+ |------|-----------------------------------------------------------------|
214
+ | 0 | Success (including "no results") |
215
+ | 1 | Error (e.g. invalid domain, every subdomain source down, `-o` not writable) or bad `--diff` file |
216
+ | 2 | `emails`: nothing found by any source and DuckDuckGo was blocked |
217
+ | 3 | `monitor --exit-code`: something new was found |
218
+
219
+ ---
220
+
221
+ **Google dorking.** Automated Google searching isn't viable: plain HTTP requests get a block page, automated queries break Google's terms, and the official Custom Search JSON API is closed to new customers and shuts down on 1 January 2027. So rangus does the parts a browser can't:
222
+
223
+ 1. `rangus emails example.com --show-dorks` prints each dork with a ready-to-click Google link, including Google-only dorks (`intext:`, `intitle:`, `OR` groups, GitHub / Pastebin).
224
+ 2. Open the links in your browser and save each results page (Ctrl+S, "Webpage, Complete" or "Single File") into one folder.
225
+ 3. `rangus emails example.com --import that-folder/` extracts the addresses (`.html`, `.htm`, `.mhtml`, `.mht`, `.txt`; folders are searched recursively). Pages recognized as Google results are tagged `source=google` with the query as `dork`.
226
+
227
+ Every source uses the same extractor. It rejoins addresses split by search-term highlighting (`jane@<em>example</em>.com`), decodes HTML entities, undoes simple `[at]`/`[dot]` obfuscation, catches addresses that only appear in `mailto:` links, and keeps only addresses on the target domain or its subdomains. Use `--debug DIR` to save every raw DuckDuckGo page for inspection.
228
+
229
+ **Subdomains.** Five keyless sources are queried at the same time: crt.sh and CertSpotter (two independent views of the Certificate Transparency logs), HackerTarget's hostsearch (DNS data), subdomain.center (an aggregated dataset) and urlscan.io (hosts seen in public website scans). Wildcard entries are normalized, anything that isn't a hostname under the target is dropped, and the results are merged. Each subdomain is credited to the first source in that order that found it. Sources with an API key configured (VirusTotal, SecurityTrails, Chaos, AlienVault OTX; see *Optional API keys*) run alongside them and are credited after the keyless ones. A source that is down or rate-limited is skipped, and the run only fails if every source fails.
230
+
231
+ Custom dork templates can be set in `rangus.core.config.Settings.dork_templates`.
232
+
233
+ ---
234
+
235
+ ## License
236
+
237
+ MIT (see LICENSE)
@@ -0,0 +1,61 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61.0", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "rangus"
7
+ dynamic = ["version"]
8
+ description = "Passive reconnaissance tool for email discovery and subdomains"
9
+ readme = "README.md"
10
+ requires-python = ">=3.12"
11
+ license = {text = "MIT"}
12
+ authors = [
13
+ {name = "Sean Fitzgerald"}
14
+ ]
15
+ keywords = ["osint", "recon", "passive", "email", "subdomain", "security", "google-dork"]
16
+ classifiers = [
17
+ "Development Status :: 3 - Alpha",
18
+ "Environment :: Console",
19
+ "Intended Audience :: Information Technology",
20
+ "License :: OSI Approved :: MIT License",
21
+ "Programming Language :: Python :: 3",
22
+ "Programming Language :: Python :: 3.12",
23
+ "Programming Language :: Python :: 3.13",
24
+ "Topic :: Security",
25
+ ]
26
+
27
+ dependencies = [
28
+ "typer[all]>=0.12.0",
29
+ "httpx>=0.27.0",
30
+ "rich>=13.0.0",
31
+ "pydantic>=2.0.0",
32
+ "keyring>=24.0",
33
+ ]
34
+
35
+ [project.optional-dependencies]
36
+ dev = [
37
+ "pytest>=8.0.0",
38
+ "ruff>=0.4.0",
39
+ "mypy>=1.8.0",
40
+ ]
41
+
42
+ [project.urls]
43
+ Homepage = "https://github.com/phitzy/rangus"
44
+ Issues = "https://github.com/phitzy/rangus/issues"
45
+
46
+ [project.scripts]
47
+ rangus = "rangus.cli:app"
48
+
49
+ [tool.setuptools.dynamic]
50
+ version = {attr = "rangus.__version__"}
51
+
52
+ [tool.setuptools.packages.find]
53
+ where = ["src"]
54
+
55
+ [tool.ruff]
56
+ line-length = 100
57
+ target-version = "py312"
58
+
59
+ [tool.mypy]
60
+ python_version = "3.12"
61
+ strict = true
rangus-0.5.0/setup.cfg ADDED
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,3 @@
1
+ """rangus – Passive reconnaissance tool for email discovery and supporting OSINT."""
2
+
3
+ __version__ = "0.5.0"
@@ -0,0 +1,4 @@
1
+ from rangus.cli import app
2
+
3
+ if __name__ == "__main__":
4
+ app()