webrecon-cli 0.2.1__tar.gz → 0.2.2__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 (42) hide show
  1. {webrecon_cli-0.2.1 → webrecon_cli-0.2.2}/PKG-INFO +10 -7
  2. {webrecon_cli-0.2.1 → webrecon_cli-0.2.2}/README.md +9 -6
  3. {webrecon_cli-0.2.1 → webrecon_cli-0.2.2}/tests/test_cli_main.py +50 -0
  4. {webrecon_cli-0.2.1 → webrecon_cli-0.2.2}/webrecon/__init__.py +1 -1
  5. {webrecon_cli-0.2.1 → webrecon_cli-0.2.2}/webrecon/cli.py +68 -11
  6. {webrecon_cli-0.2.1 → webrecon_cli-0.2.2}/webrecon/modules/report.py +2 -1
  7. {webrecon_cli-0.2.1 → webrecon_cli-0.2.2}/webrecon_cli.egg-info/PKG-INFO +10 -7
  8. {webrecon_cli-0.2.1 → webrecon_cli-0.2.2}/LICENSE +0 -0
  9. {webrecon_cli-0.2.1 → webrecon_cli-0.2.2}/pyproject.toml +0 -0
  10. {webrecon_cli-0.2.1 → webrecon_cli-0.2.2}/setup.cfg +0 -0
  11. {webrecon_cli-0.2.1 → webrecon_cli-0.2.2}/tests/test_cli.py +0 -0
  12. {webrecon_cli-0.2.1 → webrecon_cli-0.2.2}/tests/test_dns_io.py +0 -0
  13. {webrecon_cli-0.2.1 → webrecon_cli-0.2.2}/tests/test_http_io.py +0 -0
  14. {webrecon_cli-0.2.1 → webrecon_cli-0.2.2}/tests/test_packaging.py +0 -0
  15. {webrecon_cli-0.2.1 → webrecon_cli-0.2.2}/tests/test_parsing.py +0 -0
  16. {webrecon_cli-0.2.1 → webrecon_cli-0.2.2}/tests/test_ports_io.py +0 -0
  17. {webrecon_cli-0.2.1 → webrecon_cli-0.2.2}/tests/test_ratelimit.py +0 -0
  18. {webrecon_cli-0.2.1 → webrecon_cli-0.2.2}/tests/test_report.py +0 -0
  19. {webrecon_cli-0.2.1 → webrecon_cli-0.2.2}/tests/test_scanner.py +0 -0
  20. {webrecon_cli-0.2.1 → webrecon_cli-0.2.2}/tests/test_targets.py +0 -0
  21. {webrecon_cli-0.2.1 → webrecon_cli-0.2.2}/tests/test_tls_io.py +0 -0
  22. {webrecon_cli-0.2.1 → webrecon_cli-0.2.2}/webrecon/__main__.py +0 -0
  23. {webrecon_cli-0.2.1 → webrecon_cli-0.2.2}/webrecon/config.py +0 -0
  24. {webrecon_cli-0.2.1 → webrecon_cli-0.2.2}/webrecon/context.py +0 -0
  25. {webrecon_cli-0.2.1 → webrecon_cli-0.2.2}/webrecon/data/subdomains-small.txt +0 -0
  26. {webrecon_cli-0.2.1 → webrecon_cli-0.2.2}/webrecon/models.py +0 -0
  27. {webrecon_cli-0.2.1 → webrecon_cli-0.2.2}/webrecon/modules/__init__.py +0 -0
  28. {webrecon_cli-0.2.1 → webrecon_cli-0.2.2}/webrecon/modules/dns_enum.py +0 -0
  29. {webrecon_cli-0.2.1 → webrecon_cli-0.2.2}/webrecon/modules/http_probe.py +0 -0
  30. {webrecon_cli-0.2.1 → webrecon_cli-0.2.2}/webrecon/modules/port_scan.py +0 -0
  31. {webrecon_cli-0.2.1 → webrecon_cli-0.2.2}/webrecon/modules/security_headers.py +0 -0
  32. {webrecon_cli-0.2.1 → webrecon_cli-0.2.2}/webrecon/modules/tech_detect.py +0 -0
  33. {webrecon_cli-0.2.1 → webrecon_cli-0.2.2}/webrecon/modules/tls_info.py +0 -0
  34. {webrecon_cli-0.2.1 → webrecon_cli-0.2.2}/webrecon/py.typed +0 -0
  35. {webrecon_cli-0.2.1 → webrecon_cli-0.2.2}/webrecon/ratelimit.py +0 -0
  36. {webrecon_cli-0.2.1 → webrecon_cli-0.2.2}/webrecon/scanner.py +0 -0
  37. {webrecon_cli-0.2.1 → webrecon_cli-0.2.2}/webrecon/targets.py +0 -0
  38. {webrecon_cli-0.2.1 → webrecon_cli-0.2.2}/webrecon_cli.egg-info/SOURCES.txt +0 -0
  39. {webrecon_cli-0.2.1 → webrecon_cli-0.2.2}/webrecon_cli.egg-info/dependency_links.txt +0 -0
  40. {webrecon_cli-0.2.1 → webrecon_cli-0.2.2}/webrecon_cli.egg-info/entry_points.txt +0 -0
  41. {webrecon_cli-0.2.1 → webrecon_cli-0.2.2}/webrecon_cli.egg-info/requires.txt +0 -0
  42. {webrecon_cli-0.2.1 → webrecon_cli-0.2.2}/webrecon_cli.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: webrecon-cli
3
- Version: 0.2.1
3
+ Version: 0.2.2
4
4
  Summary: A small web reconnaissance scanner: DNS, subdomains, HTTP fingerprinting, TLS and ports.
5
5
  License-Expression: MIT
6
6
  Project-URL: Homepage, https://github.com/Just-Ipavon/web-recon
@@ -114,9 +114,12 @@ A small subdomain wordlist ships inside the package and is used by default;
114
114
  # Default scan: DNS, subdomains, HTTP and TLS (asks you to confirm authorization)
115
115
  webrecon example.com
116
116
 
117
- # Everything, non-interactively, with JSON + HTML reports and a live JSONL log
118
- webrecon example.com -m all --i-have-authorization \
119
- -o report.json --html report.html --jsonl results.jsonl
117
+ # Everything, non-interactively, with JSON + HTML reports in reports/
118
+ # (reports/example.com.json and reports/example.com.html) and a live JSONL log
119
+ webrecon example.com -m all --i-have-authorization -o --html --jsonl results.jsonl
120
+
121
+ # Reports in a file of your choice
122
+ webrecon example.com -o scan.json --html scan.html
120
123
 
121
124
  # 10 requests per second across all modules, 5 at a time, at most 10 minutes
122
125
  webrecon example.com -r 10 -c 5 --max-time 600
@@ -169,8 +172,8 @@ time and the scope in the report.
169
172
  | `--proxy URL` | HTTP(S) proxy for HTTP probes and crt.sh; DNS, TLS and port scans still connect directly. `HTTP(S)_PROXY` variables are ignored |
170
173
  | `--user-agent` | User-Agent for HTTP requests |
171
174
  | `--no-redact` | Keep `Set-Cookie` and `Authorization` values in reports |
172
- | `-o, --output` | Write a JSON report |
173
- | `--html` | Write a self-contained HTML report |
175
+ | `-o, --output [PATH]` | Write a JSON report. Without `PATH`: `reports/<target>.json`, one per target. A `PATH` ending in `/` (or an existing directory) gets one file per target; any other `PATH` is a single file with every target |
176
+ | `--html [PATH]` | Write a self-contained HTML report, with the same rules (`reports/<target>.html`) |
174
177
  | `--jsonl` | Append each result to a JSONL file as soon as it is found |
175
178
  | `--json` | Print the JSON report to stdout |
176
179
  | `--force` | Overwrite existing report files |
@@ -209,7 +212,7 @@ The HTML report is a single self-contained file — no external stylesheets,
209
212
  scripts or fonts — so it can be archived or attached to an engagement report
210
213
  and still render years later:
211
214
 
212
- ![HTML report for example.com, showing DNS records, subdomains, HTTP results, TLS certificates and open ports](https://raw.githubusercontent.com/Just-Ipavon/web-recon/main/assets/reporthtml.png)
215
+ ![HTML report for example.com, showing scope and authorization, DNS records, HTTP results, security-header findings and the TLS certificate](https://raw.githubusercontent.com/Just-Ipavon/web-recon/main/assets/reporthtml.png)
213
216
 
214
217
  ## Design notes
215
218
 
@@ -78,9 +78,12 @@ A small subdomain wordlist ships inside the package and is used by default;
78
78
  # Default scan: DNS, subdomains, HTTP and TLS (asks you to confirm authorization)
79
79
  webrecon example.com
80
80
 
81
- # Everything, non-interactively, with JSON + HTML reports and a live JSONL log
82
- webrecon example.com -m all --i-have-authorization \
83
- -o report.json --html report.html --jsonl results.jsonl
81
+ # Everything, non-interactively, with JSON + HTML reports in reports/
82
+ # (reports/example.com.json and reports/example.com.html) and a live JSONL log
83
+ webrecon example.com -m all --i-have-authorization -o --html --jsonl results.jsonl
84
+
85
+ # Reports in a file of your choice
86
+ webrecon example.com -o scan.json --html scan.html
84
87
 
85
88
  # 10 requests per second across all modules, 5 at a time, at most 10 minutes
86
89
  webrecon example.com -r 10 -c 5 --max-time 600
@@ -133,8 +136,8 @@ time and the scope in the report.
133
136
  | `--proxy URL` | HTTP(S) proxy for HTTP probes and crt.sh; DNS, TLS and port scans still connect directly. `HTTP(S)_PROXY` variables are ignored |
134
137
  | `--user-agent` | User-Agent for HTTP requests |
135
138
  | `--no-redact` | Keep `Set-Cookie` and `Authorization` values in reports |
136
- | `-o, --output` | Write a JSON report |
137
- | `--html` | Write a self-contained HTML report |
139
+ | `-o, --output [PATH]` | Write a JSON report. Without `PATH`: `reports/<target>.json`, one per target. A `PATH` ending in `/` (or an existing directory) gets one file per target; any other `PATH` is a single file with every target |
140
+ | `--html [PATH]` | Write a self-contained HTML report, with the same rules (`reports/<target>.html`) |
138
141
  | `--jsonl` | Append each result to a JSONL file as soon as it is found |
139
142
  | `--json` | Print the JSON report to stdout |
140
143
  | `--force` | Overwrite existing report files |
@@ -173,7 +176,7 @@ The HTML report is a single self-contained file — no external stylesheets,
173
176
  scripts or fonts — so it can be archived or attached to an engagement report
174
177
  and still render years later:
175
178
 
176
- ![HTML report for example.com, showing DNS records, subdomains, HTTP results, TLS certificates and open ports](https://raw.githubusercontent.com/Just-Ipavon/web-recon/main/assets/reporthtml.png)
179
+ ![HTML report for example.com, showing scope and authorization, DNS records, HTTP results, security-header findings and the TLS certificate](https://raw.githubusercontent.com/Just-Ipavon/web-recon/main/assets/reporthtml.png)
177
180
 
178
181
  ## Design notes
179
182
 
@@ -177,3 +177,53 @@ class TestFailingHostMixedWithHealthyOne:
177
177
  first, second = json.loads(capsys.readouterr().out)
178
178
  assert first["http"][0]["reachable"] is False and first["http"][0]["error"]
179
179
  assert second["http"][0]["title"] == "ok"
180
+
181
+
182
+ class TestReportLocation:
183
+ def test_bare_flags_write_one_file_per_target_under_reports(
184
+ self, http_server, tmp_path, monkeypatch, capsys
185
+ ):
186
+ a = http_server({"/": response(200, "<title>a</title>")})
187
+ b = http_server({"/": response(200, "<title>b</title>")})
188
+ monkeypatch.chdir(tmp_path)
189
+ code = cli.main(
190
+ [f"http://127.0.0.1:{a.port}", f"http://127.0.0.1:{b.port}", "-m", "http",
191
+ *LOCAL, "-q", "-o", "--html"]
192
+ )
193
+ assert code == 0
194
+ reports = tmp_path / "reports"
195
+ for server, title in ((a, "a"), (b, "b")):
196
+ data = json.loads((reports / f"127.0.0.1_{server.port}.json").read_text())
197
+ assert data["http"][0]["title"] == title
198
+ assert (reports / f"127.0.0.1_{server.port}.html").exists()
199
+ assert stat.S_IMODE(os.stat(reports).st_mode) == 0o700
200
+
201
+ def test_a_trailing_slash_means_a_directory(self, http_server, tmp_path, capsys):
202
+ server = http_server({"/": response(200, "<title>x</title>")})
203
+ out = tmp_path / "out"
204
+ code = cli.main(
205
+ [f"http://127.0.0.1:{server.port}", "-m", "http", *LOCAL, "-q", "-o", f"{out}/"]
206
+ )
207
+ assert code == 0
208
+ assert (out / f"127.0.0.1_{server.port}.json").exists()
209
+
210
+ def test_an_existing_per_target_file_needs_force(self, tmp_path, monkeypatch, capsys):
211
+ monkeypatch.chdir(tmp_path)
212
+ (tmp_path / "reports").mkdir()
213
+ (tmp_path / "reports" / "example.com.json").write_text("{}")
214
+ with pytest.raises(SystemExit) as exc:
215
+ cli.main(["example.com", "-m", "dns", "-o"])
216
+ assert exc.value.code == 2
217
+
218
+ @pytest.mark.parametrize(
219
+ "raw,expected",
220
+ [
221
+ ("example.com", "example.com.json"),
222
+ ("https://example.com:8443", "example.com_8443.json"),
223
+ ("2001:db8::1", "2001_db8__1.json"),
224
+ ],
225
+ )
226
+ def test_file_names(self, raw, expected):
227
+ from webrecon.targets import parse_target
228
+
229
+ assert cli.report_filename(parse_target(raw), "json") == expected
@@ -2,6 +2,6 @@
2
2
 
3
3
  # Single source of truth for the version: pyproject.toml reads this attribute
4
4
  # at build time (``[tool.setuptools.dynamic]``) and config.USER_AGENT embeds it.
5
- __version__ = "0.2.1"
5
+ __version__ = "0.2.2"
6
6
 
7
7
  __all__ = ["__version__"]
@@ -34,6 +34,9 @@ EXIT_NOTHING_REACHABLE = 3
34
34
  EXIT_INTERRUPTED = 130
35
35
 
36
36
  MAX_PORT = 65535
37
+
38
+ # Where -o and --html write when given no path: one file per target.
39
+ DEFAULT_REPORT_DIR = "reports/"
37
40
  _DIGITS = re.compile(r"^[0-9]{1,5}$")
38
41
  _NUMBER = re.compile(r"^-?[0-9]+(?:\.[0-9]+)?$")
39
42
 
@@ -241,8 +244,15 @@ def build_parser() -> argparse.ArgumentParser:
241
244
  )
242
245
 
243
246
  output = parser.add_argument_group("output")
244
- output.add_argument("-o", "--output", type=Path, help="write a JSON report to this path")
245
- output.add_argument("--html", type=Path, help="write an HTML report to this path")
247
+ output.add_argument(
248
+ "-o", "--output", nargs="?", const=DEFAULT_REPORT_DIR, metavar="PATH",
249
+ help="write a JSON report: to PATH, or one file per target inside PATH when it is a "
250
+ "directory or ends with '/'; without PATH, to reports/<target>.json",
251
+ )
252
+ output.add_argument(
253
+ "--html", nargs="?", const=DEFAULT_REPORT_DIR, metavar="PATH",
254
+ help="write an HTML report, with the same rules as -o (reports/<target>.html)",
255
+ )
246
256
  output.add_argument(
247
257
  "--jsonl", type=Path, help="append each result to this JSONL file as it is found"
248
258
  )
@@ -289,6 +299,48 @@ def _check_output(parser: argparse.ArgumentParser, path: Path | None, force: boo
289
299
  parser.error(f"{path} already exists; use --force to overwrite it")
290
300
 
291
301
 
302
+ def report_filename(target: Target, extension: str) -> str:
303
+ """File name for one target's report: ``example.com.json``, ``192.0.2.1_8443.html``."""
304
+ name = target.host.replace(":", "_") # IPv6 literals
305
+ if target.port:
306
+ name += f"_{target.port}"
307
+ return f"{name}.{extension}"
308
+
309
+
310
+ # Each entry: where to write, and the indexes of the targets whose reports go there.
311
+ OutputPlan = list[tuple[Path, list[int]]]
312
+
313
+
314
+ def plan_output(
315
+ parser: argparse.ArgumentParser,
316
+ value: str | None,
317
+ targets: list[Target],
318
+ extension: str,
319
+ force: bool,
320
+ ) -> OutputPlan:
321
+ """Decide the report files for -o or --html, failing before any scan starts.
322
+
323
+ A path that is an existing directory or ends with ``/`` (including the
324
+ default ``reports/``) gets one file per target; any other path is a single
325
+ file holding every target's report.
326
+ """
327
+ if value is None:
328
+ return []
329
+ path = Path(value)
330
+ if value.endswith(("/", "\\")) or path.is_dir():
331
+ if path.exists() and not path.is_dir():
332
+ parser.error(f"{path} is not a directory")
333
+ plan: OutputPlan = []
334
+ for index, target in enumerate(targets):
335
+ file = path / report_filename(target, extension)
336
+ if file.exists() and not force:
337
+ parser.error(f"{file} already exists; use --force to overwrite it")
338
+ plan.append((file, [index]))
339
+ return plan
340
+ _check_output(parser, path, force)
341
+ return [(path, list(range(len(targets))))]
342
+
343
+
292
344
  def _confirm(
293
345
  console: Console, targets: list[Target], scope_entries: list[str], modules: set[str],
294
346
  passive: bool,
@@ -366,8 +418,9 @@ def main(argv: list[str] | None = None) -> int:
366
418
  wordlist = bundled_wordlist()
367
419
 
368
420
  # ---- outputs
369
- for path in (args.output, args.html, args.jsonl):
370
- _check_output(parser, path, args.force)
421
+ json_plan = plan_output(parser, args.output, targets, "json", args.force)
422
+ html_plan = plan_output(parser, args.html, targets, "html", args.force)
423
+ _check_output(parser, args.jsonl, args.force)
371
424
 
372
425
  # ---- options that would silently do nothing
373
426
  if args.ports is not None and "ports" not in modules:
@@ -465,14 +518,18 @@ def main(argv: list[str] | None = None) -> int:
465
518
  payload = reports[0] if len(reports) == 1 else reports
466
519
  sys.stdout.write(report_module.to_json(payload) + "\n")
467
520
 
468
- single: ScanReport | list[ScanReport] = reports[0] if len(reports) == 1 else reports
469
521
  try:
470
- if args.output:
471
- report_module.write_json(single, args.output, args.force)
472
- console.print(f"[green]JSON report written to[/green] {args.output}")
473
- if args.html:
474
- report_module.write_html(single, args.html, args.force)
475
- console.print(f"[green]HTML report written to[/green] {args.html}")
522
+ for kind, plan, write in (
523
+ ("JSON", json_plan, report_module.write_json),
524
+ ("HTML", html_plan, report_module.write_html),
525
+ ):
526
+ for path, indexes in plan:
527
+ selected = [reports[i] for i in indexes if i < len(reports)]
528
+ if not selected:
529
+ continue # interrupted before this target was scanned
530
+ path.parent.mkdir(mode=0o700, parents=True, exist_ok=True)
531
+ write(selected[0] if len(selected) == 1 else selected, path, args.force)
532
+ console.print(f"[green]{kind} report written to[/green] {path}")
476
533
  except OSError as exc:
477
534
  console.print(f"[red]could not write report:[/red] {exc}")
478
535
  return EXIT_ERROR
@@ -400,7 +400,8 @@ def to_html(reports: Reports) -> str:
400
400
  th, td {{ text-align: left; padding: .4rem .6rem;
401
401
  border-bottom: 1px solid rgba(128,128,128,.3); vertical-align: top; }}
402
402
  th {{ font-weight: 600; white-space: nowrap; }}
403
- td {{ word-break: break-word; }}
403
+ td {{ overflow-wrap: anywhere; }}
404
+ td:first-child {{ white-space: nowrap; }}
404
405
  hr {{ margin: 3rem 0; border: 0; border-top: 1px solid rgba(128,128,128,.4); }}
405
406
  </style></head>
406
407
  <body>
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: webrecon-cli
3
- Version: 0.2.1
3
+ Version: 0.2.2
4
4
  Summary: A small web reconnaissance scanner: DNS, subdomains, HTTP fingerprinting, TLS and ports.
5
5
  License-Expression: MIT
6
6
  Project-URL: Homepage, https://github.com/Just-Ipavon/web-recon
@@ -114,9 +114,12 @@ A small subdomain wordlist ships inside the package and is used by default;
114
114
  # Default scan: DNS, subdomains, HTTP and TLS (asks you to confirm authorization)
115
115
  webrecon example.com
116
116
 
117
- # Everything, non-interactively, with JSON + HTML reports and a live JSONL log
118
- webrecon example.com -m all --i-have-authorization \
119
- -o report.json --html report.html --jsonl results.jsonl
117
+ # Everything, non-interactively, with JSON + HTML reports in reports/
118
+ # (reports/example.com.json and reports/example.com.html) and a live JSONL log
119
+ webrecon example.com -m all --i-have-authorization -o --html --jsonl results.jsonl
120
+
121
+ # Reports in a file of your choice
122
+ webrecon example.com -o scan.json --html scan.html
120
123
 
121
124
  # 10 requests per second across all modules, 5 at a time, at most 10 minutes
122
125
  webrecon example.com -r 10 -c 5 --max-time 600
@@ -169,8 +172,8 @@ time and the scope in the report.
169
172
  | `--proxy URL` | HTTP(S) proxy for HTTP probes and crt.sh; DNS, TLS and port scans still connect directly. `HTTP(S)_PROXY` variables are ignored |
170
173
  | `--user-agent` | User-Agent for HTTP requests |
171
174
  | `--no-redact` | Keep `Set-Cookie` and `Authorization` values in reports |
172
- | `-o, --output` | Write a JSON report |
173
- | `--html` | Write a self-contained HTML report |
175
+ | `-o, --output [PATH]` | Write a JSON report. Without `PATH`: `reports/<target>.json`, one per target. A `PATH` ending in `/` (or an existing directory) gets one file per target; any other `PATH` is a single file with every target |
176
+ | `--html [PATH]` | Write a self-contained HTML report, with the same rules (`reports/<target>.html`) |
174
177
  | `--jsonl` | Append each result to a JSONL file as soon as it is found |
175
178
  | `--json` | Print the JSON report to stdout |
176
179
  | `--force` | Overwrite existing report files |
@@ -209,7 +212,7 @@ The HTML report is a single self-contained file — no external stylesheets,
209
212
  scripts or fonts — so it can be archived or attached to an engagement report
210
213
  and still render years later:
211
214
 
212
- ![HTML report for example.com, showing DNS records, subdomains, HTTP results, TLS certificates and open ports](https://raw.githubusercontent.com/Just-Ipavon/web-recon/main/assets/reporthtml.png)
215
+ ![HTML report for example.com, showing scope and authorization, DNS records, HTTP results, security-header findings and the TLS certificate](https://raw.githubusercontent.com/Just-Ipavon/web-recon/main/assets/reporthtml.png)
213
216
 
214
217
  ## Design notes
215
218
 
File without changes
File without changes