()
| 674 | |
| 675 | |
| 676 | async def _async_main() -> None: |
| 677 | parser = _build_parser() |
| 678 | args = parser.parse_args() |
| 679 | _configure_logging(args.verbose) |
| 680 | |
| 681 | # No subcommand or explicit 'shell' → launch REPL. |
| 682 | # Await directly — run_repl() is a sync wrapper that calls asyncio.run() |
| 683 | # internally, which raises RuntimeError when called from a running event loop. |
| 684 | if args.command in (None, "shell"): |
| 685 | from openosint.repl import OpenOSINTRepl |
| 686 | |
| 687 | repl = OpenOSINTRepl( |
| 688 | api_key=getattr(args, "api_key", None), |
| 689 | provider=getattr(args, "provider", "anthropic"), |
| 690 | ollama_model=getattr(args, "ollama_model", "llama3.2"), |
| 691 | ollama_host=getattr(args, "ollama_host", "http://localhost:11434"), |
| 692 | is_pdf_disabled=getattr(args, "is_pdf_disabled", False), |
| 693 | ) |
| 694 | await repl.run() |
| 695 | return |
| 696 | |
| 697 | is_parallel = getattr(args, "is_parallel", False) |
| 698 | json_output = getattr(args, "json_output", False) |
| 699 | is_pdf_disabled = getattr(args, "is_pdf_disabled", False) |
| 700 | |
| 701 | if args.command == "email": |
| 702 | await _handle_email( |
| 703 | args.target, args.timeout, is_parallel=is_parallel, json_output=json_output |
| 704 | ) |
| 705 | elif args.command == "username": |
| 706 | await _handle_username( |
| 707 | args.target, args.timeout, is_parallel=is_parallel, json_output=json_output |
| 708 | ) |
| 709 | elif args.command == "shodan": |
| 710 | await _handle_shodan(args.query, args.timeout, json_output=json_output) |
| 711 | elif args.command == "virustotal": |
| 712 | await _handle_virustotal(args.target, args.timeout, json_output=json_output) |
| 713 | elif args.command == "censys": |
| 714 | await _handle_censys(args.target, args.timeout, json_output=json_output) |
| 715 | elif args.command == "github": |
| 716 | await _handle_github(args.query, args.timeout, json_output=json_output) |
| 717 | elif args.command == "dns": |
| 718 | await _handle_dns(args.domain, args.timeout, json_output=json_output) |
| 719 | elif args.command == "abuseipdb": |
| 720 | await _handle_abuseipdb(args.ip, args.timeout, json_output=json_output) |
| 721 | elif args.command == "ip2location": |
| 722 | await _handle_ip2location(args.ip, args.timeout, json_output=json_output) |
| 723 | elif args.command == "multi": |
| 724 | await _handle_multi( |
| 725 | args.targets, api_key=getattr(args, "api_key", None), is_pdf_disabled=is_pdf_disabled |
| 726 | ) |
| 727 | elif args.command == "web": |
| 728 | await _handle_web( |
| 729 | host=getattr(args, "host", "0.0.0.0"), |
| 730 | port=getattr(args, "port", 8080), |
| 731 | no_browser=getattr(args, "no_browser", False), |
| 732 | ) |
| 733 | elif args.command == "history": |
no test coverage detected