|
14 | 14 | from .triage import run_triage_tui |
15 | 15 | from .plugin_system import get_plugin_manager, PluginSecurity |
16 | 16 | import requests |
| 17 | +from urllib.parse import urlparse |
17 | 18 |
|
18 | 19 | # Import the Rust core from its new location |
19 | 20 | try: |
@@ -268,7 +269,7 @@ def cli(): |
268 | 269 | __/> / \ |
269 | 270 | """ |
270 | 271 | click.echo(click.style(banner)) |
271 | | - click.echo("Version: 0.1.6\n") |
| 272 | + click.echo("Version: 0.1.7\n") |
272 | 273 | click.echo("Made with <3 by github.com/ParzivalHack\n") |
273 | 274 | note = get_startup_note() |
274 | 275 | click.echo(click.style(f"{note}\n", fg="bright_black", italic=True)) |
@@ -362,6 +363,16 @@ def run_scan_command( |
362 | 363 |
|
363 | 364 | # Repo scan |
364 | 365 | if params["repo_url"]: |
| 366 | + try: |
| 367 | + _parsed = urlparse(params["repo_url"]) |
| 368 | + _hostname = _parsed.hostname or "" |
| 369 | + except Exception: |
| 370 | + _hostname = "" |
| 371 | + |
| 372 | + if _hostname not in ("github.com", "gitlab.com"): |
| 373 | + raise click.BadParameter( |
| 374 | + "URL must be a public GitHub or GitLab repository. " |
| 375 | + ) |
365 | 376 | with tempfile.TemporaryDirectory() as temp_dir: |
366 | 377 | click.echo(f"[*] Cloning '{params['repo_url']}' into temporary directory...") |
367 | 378 | subprocess.run( |
@@ -435,8 +446,16 @@ def run_scan_command( |
435 | 446 |
|
436 | 447 | if repo_url: |
437 | 448 | # Handle Git URL cloning |
438 | | - if not ("github.com" in repo_url or "gitlab.com" in repo_url): |
439 | | - raise click.BadParameter("URL must be a public GitHub or GitLab repository.") |
| 449 | + try: |
| 450 | + _parsed = urlparse(repo_url) |
| 451 | + _hostname = _parsed.hostname or "" |
| 452 | + except Exception: |
| 453 | + _hostname = "" |
| 454 | + |
| 455 | + if _hostname not in ("github.com", "gitlab.com"): |
| 456 | + raise click.BadParameter( |
| 457 | + "URL must be a public GitHub or GitLab repository. " |
| 458 | + ) |
440 | 459 |
|
441 | 460 | with tempfile.TemporaryDirectory() as temp_dir: |
442 | 461 | click.echo(f"[*] Cloning '{repo_url}' into temporary directory...") |
|
0 commit comments