rangus 0.5.0__py3-none-any.whl

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.
rangus/__init__.py ADDED
@@ -0,0 +1,3 @@
1
+ """rangus – Passive reconnaissance tool for email discovery and supporting OSINT."""
2
+
3
+ __version__ = "0.5.0"
rangus/__main__.py ADDED
@@ -0,0 +1,4 @@
1
+ from rangus.cli import app
2
+
3
+ if __name__ == "__main__":
4
+ app()
rangus/cli.py ADDED
@@ -0,0 +1,575 @@
1
+ """CLI entrypoint for rangus."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import os
6
+ import sys
7
+ import time
8
+ from collections.abc import Sequence
9
+ from pathlib import Path
10
+ from typing import Any
11
+
12
+ import typer
13
+ from rich.console import Console
14
+ from rich.markup import escape
15
+ from rich.table import Table
16
+
17
+ from rangus import __version__
18
+ from rangus import monitor as monitor_mod
19
+ from rangus.core import keys
20
+ from rangus.core.models import ReconReport
21
+ from rangus.modules import emails as emails_mod
22
+ from rangus.modules import recon as recon_mod
23
+ from rangus.modules import subdomains as subdomains_mod
24
+ from rangus.utils.diff import BaselineError, diff_reports, load_baseline
25
+ from rangus.utils.domain import normalize_domain
26
+ from rangus.utils.dorks import google_search_url
27
+ from rangus.utils.output import (
28
+ OutputFormat,
29
+ print_report_tables,
30
+ render,
31
+ write_report,
32
+ )
33
+ from rangus.utils.output import console as out
34
+
35
+ app = typer.Typer(
36
+ name="rangus",
37
+ help="Passive recon tool - email discovery + supporting OSINT (DNSDumpster-adjacent).",
38
+ add_completion=False,
39
+ no_args_is_help=True,
40
+ # Subcommands inherit this, so `rangus s -h` works too.
41
+ context_settings={"help_option_names": ["-h", "--help"]},
42
+ )
43
+
44
+ # Status, progress and errors go to stderr; results go to stdout.
45
+ # That way `rangus subdomains x.com -f plain | other-tool` only pipes results.
46
+ err = Console(stderr=True)
47
+
48
+
49
+ def _version(value: bool) -> None:
50
+ if value:
51
+ typer.echo(f"rangus {__version__}")
52
+ raise typer.Exit()
53
+
54
+
55
+ @app.callback()
56
+ def main(
57
+ version: bool = typer.Option(
58
+ False, "--version", "-V", callback=_version, is_eager=True, help="Show the version."
59
+ ),
60
+ ) -> None:
61
+ """Passive recon tool - email discovery + supporting OSINT."""
62
+
63
+
64
+ # --- Shared options ----------------------------------------------------------------
65
+
66
+ FormatOpt = typer.Option(
67
+ OutputFormat.table,
68
+ "--format",
69
+ "-f",
70
+ case_sensitive=False,
71
+ help="Output format: table (terminal), json, csv, or plain (one result per line).",
72
+ )
73
+ JsonOpt = typer.Option(False, "--json", "-j", help="Shortcut for --format json.")
74
+ OutputOpt = typer.Option(
75
+ None,
76
+ "--output",
77
+ "-o",
78
+ help="Write the full results to this file (in --format; table is saved as JSON).",
79
+ )
80
+ DiffOpt = typer.Option(
81
+ None,
82
+ "--diff",
83
+ "-d",
84
+ help=(
85
+ "Compare against an earlier JSON report and show only new results. "
86
+ "A missing file counts as a first run."
87
+ ),
88
+ )
89
+ QuietOpt = typer.Option(False, "--quiet", "-q", help="Less progress output")
90
+ LimitOpt = typer.Option(40, "--limit", "-l", min=1, help="Max emails to return")
91
+
92
+
93
+ def _max_dorks_opt(default: int) -> Any:
94
+ return typer.Option(default, "--max-dorks", "-n", min=1, help="How many email dorks to run")
95
+
96
+
97
+ def _fail(label: str, exc: object, code: int = 1) -> typer.Exit:
98
+ """Print an error (escaped, so brackets in it aren't read as markup)."""
99
+ err.print(f"[bold red]{label}:[/bold red] {escape(str(exc))}")
100
+ return typer.Exit(code=code)
101
+
102
+
103
+ def _prepare(
104
+ domain: str, fmt: OutputFormat, json_out: bool, diff_path: Path | None
105
+ ) -> tuple[str, OutputFormat, ReconReport | None]:
106
+ """
107
+ Shared command setup: normalize the domain, resolve --json, and load the
108
+ --diff baseline before any work (and before -o can overwrite it).
109
+ """
110
+ try:
111
+ domain = normalize_domain(domain)
112
+ except ValueError as exc:
113
+ raise _fail("Error", exc) from None
114
+ fmt = OutputFormat.json if json_out else fmt
115
+ if diff_path is None:
116
+ return domain, fmt, None
117
+ try:
118
+ return domain, fmt, load_baseline(diff_path, domain)
119
+ except BaselineError as exc:
120
+ raise _fail("Bad --diff file", exc) from None
121
+
122
+
123
+ def _emit(
124
+ report: ReconReport,
125
+ fmt: OutputFormat,
126
+ output: Path | None,
127
+ diff_path: Path | None,
128
+ baseline: ReconReport | None,
129
+ sections: Sequence[str],
130
+ empty_hint: str = "",
131
+ ) -> None:
132
+ """
133
+ Show and/or save a finished report.
134
+
135
+ - `-o` always saves the *full* current report (as JSON if it is the --diff file).
136
+ - With `--diff`, stdout shows only results that are new since the baseline.
137
+ - Without `--diff`, stdout shows everything, unless `-o` was given.
138
+ """
139
+ shown = report
140
+ if diff_path is not None:
141
+ diff = diff_reports(baseline, report, sections)
142
+ shown = diff.new_only_report(report)
143
+ err.print(f"[bold]Diff:[/bold] {diff.summary()}")
144
+ if diff.has_baseline and fmt is OutputFormat.table:
145
+ for name in diff.removed_subdomains:
146
+ err.print(f" [dim]- gone: {escape(name)}[/dim]")
147
+ for email in diff.removed_emails:
148
+ err.print(f" [dim]- gone: {escape(email)}[/dim]")
149
+ if diff.removed_count:
150
+ err.print(
151
+ " [dim](gone can also mean a source was down or rate-limited this run)[/dim]"
152
+ )
153
+
154
+ write_failed = False
155
+ if output is not None:
156
+ # The --diff baseline must stay JSON, whatever --format is shown on stdout.
157
+ same_as_baseline = diff_path is not None and output.resolve() == diff_path.resolve()
158
+ try:
159
+ write_report(report, output, OutputFormat.json if same_as_baseline else fmt)
160
+ except OSError as exc:
161
+ # Don't lose a finished scan: report the error, then show the results below.
162
+ err.print(
163
+ f"[bold red]Could not write {escape(str(output))}:[/bold red] {escape(str(exc))}"
164
+ )
165
+ write_failed = True
166
+ else:
167
+ total = len(report.subdomains) + len(report.emails)
168
+ err.print(f"[green]Wrote {total} results to {escape(str(output))}[/green]")
169
+ if diff_path is None:
170
+ return
171
+
172
+ if fmt is not OutputFormat.table:
173
+ typer.echo(render(shown, fmt), nl=False)
174
+ elif shown.subdomains or shown.emails:
175
+ print_report_tables(shown, new_only=diff_path is not None)
176
+ err.print(
177
+ f"\n[dim]{len(shown.subdomains)} subdomains, {len(shown.emails)} emails[/dim]"
178
+ )
179
+ elif diff_path is not None:
180
+ err.print("[green]Nothing new since the baseline.[/green]")
181
+ else:
182
+ err.print("[yellow]No results found.[/yellow]")
183
+ if empty_hint:
184
+ err.print(empty_hint)
185
+
186
+ if write_failed:
187
+ raise typer.Exit(code=1)
188
+
189
+
190
+ def _print_google_dorks(domain: str) -> None:
191
+ """Dorks + ready-to-click Google links on stdout, workflow hint on stderr."""
192
+ err.print(f"[bold]Google dorks for {domain}[/bold] (open each link in your browser):\n")
193
+ for i, dork in enumerate(emails_mod.list_dorks(domain, google=True), 1):
194
+ typer.echo(f" {i:>2}. {dork}\n {google_search_url(dork)}")
195
+ err.print(
196
+ "\n[dim]Save each results page (Ctrl+S) into one folder, then extract the emails:[/dim]\n"
197
+ f" rangus emails {domain} --import <folder>"
198
+ )
199
+
200
+
201
+ # --- Commands ------------------------------------------------------------------------
202
+
203
+
204
+ @app.command()
205
+ def emails(
206
+ domain: str = typer.Argument(..., help="Target domain (e.g. example.com)"),
207
+ limit: int = LimitOpt,
208
+ max_dorks: int = _max_dorks_opt(5),
209
+ fmt: OutputFormat = FormatOpt,
210
+ json_out: bool = JsonOpt,
211
+ output: Path | None = OutputOpt,
212
+ diff_path: Path | None = DiffOpt,
213
+ show_dorks: bool = typer.Option(
214
+ False,
215
+ "--show-dorks",
216
+ "-s",
217
+ help="Print Google dork links to run in your browser (no searching)",
218
+ ),
219
+ import_paths: list[Path] | None = typer.Option(
220
+ None,
221
+ "--import",
222
+ "-i",
223
+ help=(
224
+ "Extract emails from search-result pages saved in your browser "
225
+ "(files or folders; .html/.mhtml). Repeatable. Skips the automatic sources."
226
+ ),
227
+ ),
228
+ sources: str = typer.Option(
229
+ ",".join(emails_mod.SOURCES),
230
+ "--sources",
231
+ help=f"Comma-separated automatic sources to use ({', '.join(emails_mod.SOURCES)})",
232
+ ),
233
+ debug_dir: Path | None = typer.Option(
234
+ None, "--debug", help="Save each raw DuckDuckGo results page to this directory"
235
+ ),
236
+ quiet: bool = QuietOpt,
237
+ ) -> None:
238
+ """Discover emails from CT logs, archived pages, search dorks or saved Google results. (alias: e, em)"""
239
+ domain, fmt, baseline = _prepare(domain, fmt, json_out, None if show_dorks else diff_path)
240
+
241
+ if show_dorks:
242
+ _print_google_dorks(domain)
243
+ return
244
+
245
+ if import_paths:
246
+ err.print(f"[bold cyan]→[/bold cyan] Extracting emails for [bold]{domain}[/bold] "
247
+ "from saved pages")
248
+ try:
249
+ results = emails_mod.from_saved_pages(
250
+ domain, import_paths, limit=limit, verbose=not quiet
251
+ )
252
+ except (OSError, ValueError) as exc:
253
+ raise _fail("Error", exc) from None
254
+ else:
255
+ chosen = [s.strip().lower() for s in sources.split(",") if s.strip()]
256
+ unknown = sorted(set(chosen) - set(emails_mod.SOURCES))
257
+ if unknown or not chosen:
258
+ raise _fail(
259
+ "Bad --sources",
260
+ f"{', '.join(unknown) or 'none given'} (choose from {', '.join(emails_mod.SOURCES)})",
261
+ )
262
+ explicit = sources != ",".join(emails_mod.SOURCES)
263
+ no_key = emails_mod.missing_keys(chosen)
264
+ if explicit and no_key:
265
+ raise _fail(
266
+ "Missing API key",
267
+ f"{', '.join(no_key)} – add one with: rangus keys set {no_key[0]}",
268
+ )
269
+
270
+ err.print(f"[bold cyan]→[/bold cyan] Passive email discovery for [bold]{domain}[/bold]")
271
+ if not quiet:
272
+ active = [s for s in chosen if s not in no_key]
273
+ err.print(f"[dim]Sources: {', '.join(active)}[/dim]\n")
274
+
275
+ try:
276
+ results = emails_mod.run(
277
+ domain,
278
+ limit=limit,
279
+ max_dorks=max_dorks,
280
+ verbose=not quiet,
281
+ debug_dir=debug_dir,
282
+ sources=chosen,
283
+ )
284
+ except emails_mod.SearchBlockedError as exc:
285
+ err.print(f"[bold red]Blocked:[/bold red] {escape(str(exc))}")
286
+ err.print(
287
+ "No other source found anything either. Google-dork it by hand instead: "
288
+ f"rangus emails {domain} --show-dorks"
289
+ )
290
+ raise typer.Exit(code=2) from None
291
+ except Exception as exc:
292
+ raise _fail("Error", exc) from None
293
+
294
+ _emit(
295
+ ReconReport(target=domain, emails=results),
296
+ fmt,
297
+ output,
298
+ diff_path,
299
+ baseline,
300
+ sections=["emails"],
301
+ empty_hint=f"Try: rangus emails {domain} --show-dorks",
302
+ )
303
+
304
+
305
+ @app.command()
306
+ def subdomains(
307
+ domain: str = typer.Argument(..., help="Target domain"),
308
+ fmt: OutputFormat = FormatOpt,
309
+ json_out: bool = JsonOpt,
310
+ output: Path | None = OutputOpt,
311
+ diff_path: Path | None = DiffOpt,
312
+ quiet: bool = QuietOpt,
313
+ ) -> None:
314
+ """Passive subdomain discovery from keyless sources (CT logs, DNS data, scans). (alias: s, sub)"""
315
+ domain, fmt, baseline = _prepare(domain, fmt, json_out, diff_path)
316
+
317
+ err.print(f"[bold cyan]→[/bold cyan] Passive subdomain discovery for [bold]{domain}[/bold]")
318
+ if not quiet:
319
+ err.print(f"[dim]Sources: {' + '.join(subdomains_mod.source_labels())}[/dim]\n")
320
+
321
+ try:
322
+ results = subdomains_mod.run(domain, verbose=not quiet)
323
+ except Exception as exc:
324
+ raise _fail("Error", exc) from None
325
+
326
+ _emit(
327
+ ReconReport(target=domain, subdomains=results),
328
+ fmt,
329
+ output,
330
+ diff_path,
331
+ baseline,
332
+ sections=["subdomains"],
333
+ empty_hint="The sources answered but listed no subdomains for this domain.",
334
+ )
335
+
336
+
337
+ @app.command()
338
+ def recon(
339
+ domain: str = typer.Argument(..., help="Target domain"),
340
+ limit: int = LimitOpt,
341
+ max_dorks: int = _max_dorks_opt(4),
342
+ fmt: OutputFormat = FormatOpt,
343
+ json_out: bool = JsonOpt,
344
+ output: Path | None = OutputOpt,
345
+ diff_path: Path | None = DiffOpt,
346
+ quiet: bool = QuietOpt,
347
+ ) -> None:
348
+ """Run full passive recon (emails + subdomains). (alias: r)"""
349
+ domain, fmt, baseline = _prepare(domain, fmt, json_out, diff_path)
350
+
351
+ err.print(f"[bold]Full passive recon for[/bold] {domain}\n")
352
+ report, sections = recon_mod.run(
353
+ domain, limit=limit, max_dorks=max_dorks, baseline=baseline, verbose=not quiet
354
+ )
355
+ _emit(report, fmt, output, diff_path, baseline, sections=sections)
356
+
357
+
358
+ # --- Monitor ---------------------------------------------------------------------------
359
+
360
+
361
+ def _show_monitor_results(results: list[monitor_mod.TargetResult], fmt: OutputFormat) -> None:
362
+ """Print each target's new results to stdout in the chosen format."""
363
+ reports = monitor_mod.new_only(results)
364
+ if fmt is OutputFormat.json:
365
+ typer.echo("[" + ",\n".join(r.model_dump_json(indent=2) for r in reports) + "]")
366
+ elif fmt is OutputFormat.csv:
367
+ for i, r in enumerate(reports):
368
+ text = render(r, fmt)
369
+ typer.echo(text if i == 0 else text.split("\n", 1)[1], nl=False)
370
+ elif fmt is OutputFormat.plain:
371
+ for r in reports:
372
+ typer.echo(render(r, fmt), nl=False)
373
+ else:
374
+ for r in reports:
375
+ out.print(f"\n[bold]{escape(r.target)}[/bold]")
376
+ print_report_tables(r, new_only=True)
377
+
378
+ total = sum(r.new_count for r in results)
379
+ failed = [r.target.domain for r in results if r.error]
380
+ summary = f"{total} new across {len(results)} target(s)"
381
+ if failed:
382
+ summary += f"; problems with: {', '.join(failed)}"
383
+ err.print(f"\n[bold]{escape(summary)}[/bold]")
384
+
385
+
386
+ def _load_monitor_config(config: Path) -> monitor_mod.MonitorConfig:
387
+ try:
388
+ return monitor_mod.load_config(config)
389
+ except monitor_mod.ConfigError as exc:
390
+ raise _fail("Bad config", exc) from None
391
+
392
+
393
+ @app.command()
394
+ def monitor(
395
+ config: Path = typer.Argument(
396
+ Path("rangus.toml"),
397
+ help="TOML file listing targets (create one with --init)",
398
+ show_default=True,
399
+ ),
400
+ init: bool = typer.Option(False, "--init", help="Write a starter config to CONFIG and exit"),
401
+ every: str | None = typer.Option(
402
+ None,
403
+ "--every",
404
+ "-e",
405
+ help="Keep running in the foreground, repeating every interval (e.g. 30m, 6h, 1d)",
406
+ ),
407
+ fmt: OutputFormat = FormatOpt,
408
+ json_out: bool = JsonOpt,
409
+ exit_code: bool = typer.Option(
410
+ False, "--exit-code", help="Exit with code 3 if anything new was found (single run only)"
411
+ ),
412
+ quiet: bool = QuietOpt,
413
+ ) -> None:
414
+ """
415
+ Run recon for every target in CONFIG and show only what's new. (alias: m)
416
+
417
+ Each target keeps its baseline in state_dir, so every run reports only
418
+ results that weren't seen before. Schedule it with cron / Task Scheduler,
419
+ or use --every for a simple foreground loop.
420
+ """
421
+ if init:
422
+ try:
423
+ monitor_mod.write_example_config(config)
424
+ except (monitor_mod.ConfigError, OSError) as exc:
425
+ raise _fail("Error", exc) from None
426
+ err.print(f"[green]Wrote starter config to {escape(str(config))}[/green]")
427
+ err.print(f"Edit it, then run: rangus monitor {escape(str(config))}")
428
+ return
429
+
430
+ fmt = OutputFormat.json if json_out else fmt
431
+ try:
432
+ interval = monitor_mod.parse_interval(every) if every else None
433
+ except ValueError as exc:
434
+ raise _fail("Bad --every", exc) from None
435
+
436
+ cfg = _load_monitor_config(config)
437
+ while True:
438
+ results = monitor_mod.run_once(cfg, verbose=not quiet)
439
+ _show_monitor_results(results, fmt)
440
+
441
+ if interval is None:
442
+ if all(r.diff is None for r in results):
443
+ raise typer.Exit(code=1) # nothing could be run at all
444
+ if exit_code and any(r.new_count for r in results):
445
+ raise typer.Exit(code=3)
446
+ return
447
+
448
+ err.print(f"[dim]Next run in {every} (Ctrl+C to stop)[/dim]")
449
+ try:
450
+ time.sleep(interval)
451
+ except KeyboardInterrupt:
452
+ raise typer.Exit() from None
453
+ # Pick up keys stored meanwhile (e.g. `rangus keys set` in another terminal).
454
+ keys.clear_cache()
455
+ # Pick up config edits between runs; keep the last good config if broken.
456
+ try:
457
+ cfg = monitor_mod.load_config(config)
458
+ except monitor_mod.ConfigError as exc:
459
+ err.print(f"[yellow]Config not reloaded: {escape(str(exc))}[/yellow]")
460
+
461
+
462
+ # --- API keys --------------------------------------------------------------------------
463
+
464
+ keys_app = typer.Typer(
465
+ help=(
466
+ "Manage optional API keys for extra sources. Keys are stored in your OS credential "
467
+ "store (Windows Credential Manager / macOS Keychain / Secret Service), never in plain "
468
+ "files. Environment variables RANGUS_<SERVICE>_KEY also work and take precedence."
469
+ ),
470
+ no_args_is_help=True,
471
+ )
472
+ app.add_typer(keys_app, name="keys")
473
+
474
+ _KEY_SOURCE_LABELS = {
475
+ "env": "environment variable",
476
+ "config": "monitor config",
477
+ "keyring": "OS credential store",
478
+ }
479
+
480
+
481
+ def _service_or_fail(name: str) -> keys.Service:
482
+ service = keys.SERVICES.get(name.strip().lower())
483
+ if service is None:
484
+ raise _fail("Unknown service", f"{name} (choose from {', '.join(keys.SERVICES)})")
485
+ return service
486
+
487
+
488
+ @keys_app.command("list")
489
+ def keys_list(
490
+ config: Path | None = typer.Option(
491
+ None, "--config", "-c", help="Also include keys from this monitor config's [keys] table"
492
+ ),
493
+ ) -> None:
494
+ """Show which services have a key and where it comes from (keys are masked)."""
495
+ config_keys = _load_monitor_config(config).keys if config else {}
496
+ table = Table(title="API keys", header_style="bold")
497
+ for column in ("Service", "Adds", "Key", "From", "Get a key"):
498
+ table.add_column(column, overflow="fold")
499
+ with keys.config_keys(config_keys):
500
+ for s in keys.SERVICES.values():
501
+ value, where = keys.lookup(s.name)
502
+ table.add_row(
503
+ s.name,
504
+ s.used_for,
505
+ f"[green]{keys.mask(value)}[/green]" if value else "[dim]not set[/dim]",
506
+ _KEY_SOURCE_LABELS.get(where, ""),
507
+ s.signup_url,
508
+ )
509
+ out.print(table)
510
+ err.print(
511
+ "\n[dim]Add a key:[/dim] rangus keys set <service> "
512
+ "[dim](or set RANGUS_<SERVICE>_KEY, e.g. RANGUS_VIRUSTOTAL_KEY)[/dim]"
513
+ )
514
+
515
+
516
+ @keys_app.command("set")
517
+ def keys_set(
518
+ service: str = typer.Argument(..., help=f"One of: {', '.join(keys.SERVICES)}"),
519
+ from_stdin: bool = typer.Option(
520
+ False, "--stdin", help="Read the key from standard input (for scripts) instead of prompting"
521
+ ),
522
+ ) -> None:
523
+ """Save a key to the OS credential store. You'll be prompted; input is hidden."""
524
+ s = _service_or_fail(service)
525
+ if from_stdin:
526
+ value = sys.stdin.readline().strip()
527
+ else:
528
+ err.print(f"Get a {s.label} key at: {s.signup_url}")
529
+ value = typer.prompt(f"{s.label} API key", hide_input=True, err=True).strip()
530
+ if not value:
531
+ raise _fail("Error", "no key given")
532
+ try:
533
+ keys.set_key(s.name, value)
534
+ except keys.KeyStoreError as exc:
535
+ err.print(f"[bold red]Could not save the key:[/bold red] {escape(str(exc))}")
536
+ err.print(f"Use an environment variable instead: {s.env_var}=<key>")
537
+ raise typer.Exit(code=1) from None
538
+ err.print(f"[green]Saved {s.label} key {keys.mask(value)} to the OS credential store.[/green]")
539
+ if os.environ.get(s.env_var):
540
+ err.print(f"[yellow]Note: {s.env_var} is set and takes precedence over this key.[/yellow]")
541
+
542
+
543
+ @keys_app.command("delete")
544
+ def keys_delete(
545
+ service: str = typer.Argument(..., help=f"One of: {', '.join(keys.SERVICES)}"),
546
+ ) -> None:
547
+ """Remove a key from the OS credential store."""
548
+ s = _service_or_fail(service)
549
+ try:
550
+ removed = keys.delete_key(s.name)
551
+ except keys.KeyStoreError as exc:
552
+ raise _fail("Error", exc) from None
553
+ if removed:
554
+ err.print(f"[green]Deleted the {s.label} key from the OS credential store.[/green]")
555
+ else:
556
+ err.print(f"No {s.label} key was stored in the OS credential store.")
557
+ if os.environ.get(s.env_var):
558
+ err.print(f"[yellow]{s.env_var} is still set in your environment.[/yellow]")
559
+
560
+
561
+ # --- Short aliases (hidden from --help; listed in each command's help) ----------------
562
+
563
+ for _name, _fn in (
564
+ ("r", recon),
565
+ ("s", subdomains),
566
+ ("sub", subdomains),
567
+ ("e", emails),
568
+ ("em", emails),
569
+ ("m", monitor),
570
+ ):
571
+ app.command(_name, hidden=True)(_fn)
572
+
573
+
574
+ if __name__ == "__main__":
575
+ app()
@@ -0,0 +1,4 @@
1
+ from .config import settings
2
+ from .models import EmailResult, ReconReport, SubdomainResult
3
+
4
+ __all__ = ["EmailResult", "ReconReport", "SubdomainResult", "settings"]
rangus/core/config.py ADDED
@@ -0,0 +1,30 @@
1
+ """Configuration and defaults for rangus."""
2
+
3
+ from dataclasses import dataclass, field
4
+
5
+
6
+ @dataclass
7
+ class Settings:
8
+ # HTTP
9
+ user_agent: str = (
10
+ "Mozilla/5.0 (Windows NT 10.0; Win64; x64) "
11
+ "AppleWebKit/537.36 (KHTML, like Gecko) "
12
+ "Chrome/120.0.0.0 Safari/537.36"
13
+ )
14
+ timeout: float = 30.0
15
+ max_retries: int = 3 # default attempts per request (callers may override)
16
+
17
+ # Rate limiting (be polite)
18
+ min_delay: float = 2.0 # seconds between search requests
19
+ max_delay: float = 5.0
20
+
21
+ # Proxies (optional)
22
+ proxy: str | None = None
23
+
24
+ # Email discovery
25
+ # Custom dork templates ({domain} is substituted). Leave empty to use
26
+ # rangus.utils.dorks.DEFAULT_EMAIL_DORKS.
27
+ dork_templates: list[str] = field(default_factory=list)
28
+
29
+
30
+ settings = Settings()