Perform HTTP/HTTPS validation on discovered open ports Args: port_scan_results: Results from port scanning max_threads: Maximum number of threads timeout: Request timeout detailed_ssl: If True, extract detailed SSL certificate info (slower)
(port_scan_results, max_threads, timeout, detailed_ssl=False)
| 2825 | |
| 2826 | |
| 2827 | def perform_http_validation(port_scan_results, max_threads, timeout, detailed_ssl=False): |
| 2828 | """Perform HTTP/HTTPS validation on discovered open ports |
| 2829 | |
| 2830 | Args: |
| 2831 | port_scan_results: Results from port scanning |
| 2832 | max_threads: Maximum number of threads |
| 2833 | timeout: Request timeout |
| 2834 | detailed_ssl: If True, extract detailed SSL certificate info (slower) |
| 2835 | """ |
| 2836 | from validators.http_validator import HTTPValidator |
| 2837 | |
| 2838 | if not port_scan_results: |
| 2839 | return {} |
| 2840 | |
| 2841 | # Use detailed_ssl parameter to control SSL analysis depth |
| 2842 | validator = HTTPValidator(timeout=timeout, max_threads=max_threads, detailed_ssl=detailed_ssl) |
| 2843 | |
| 2844 | # Collect all IP:port combinations that need HTTP validation |
| 2845 | targets = [] |
| 2846 | for computer_name, computer_ports in port_scan_results.items(): |
| 2847 | for ip, ports in computer_ports.items(): |
| 2848 | for port in ports: |
| 2849 | targets.append(f"{ip}:{port}") |
| 2850 | |
| 2851 | if not targets: |
| 2852 | return {} |
| 2853 | |
| 2854 | logger.info("HTTP/HTTPS validation requested...") |
| 2855 | logger.info(f"Starting HTTP/HTTPS validation for {len(targets)} IP:port combinations...") |
| 2856 | logger.info(f"Threads: {max_threads}, Timeout: {timeout}s") |
| 2857 | ssl_mode = "Detailed SSL analysis" if detailed_ssl else "Basic SSL info only" |
| 2858 | logger.info(f"SSL Mode: {ssl_mode}") |
| 2859 | |
| 2860 | # Convert targets to (ip, port) tuples for the validator |
| 2861 | ip_port_list = [] |
| 2862 | for target in targets: |
| 2863 | ip, port = target.split(':') |
| 2864 | ip_port_list.append((ip, int(port))) |
| 2865 | |
| 2866 | # Use the optimized threaded/multiprocessing validation |
| 2867 | results = validator.validate_http_ports_threaded(ip_port_list) |
| 2868 | |
| 2869 | return results |
| 2870 | |
| 2871 | def perform_smb_validation(port_scan_results, max_threads, timeout, username="", password="", domain="", ntlm_hash="", kerberos_ticket=""): |
| 2872 | """Perform SMB validation on discovered SMB ports |
no test coverage detected