| 1124 | # INTERACTIVE MENU |
| 1125 | # ───────────────────────────────────────────── |
| 1126 | def interactive_menu(): |
| 1127 | while True: |
| 1128 | print(ccolor(CYAN + BOLD, "\n Interactive Scan Mode")) |
| 1129 | print(ccolor(DIM, " ---------------------")) |
| 1130 | print(" 1. Balanced device scan (recommended)") |
| 1131 | print(" 2. Cameras / NVR / DVR") |
| 1132 | print(" 3. Media / TV / streaming devices") |
| 1133 | print(" 4. Computers / NAS / servers") |
| 1134 | print(" 5. Printers") |
| 1135 | print(" 6. Enter custom ports") |
| 1136 | print(" 7. Help") |
| 1137 | print(" 0. Exit") |
| 1138 | |
| 1139 | choice = input(ccolor(YELLOW, "\n Select [0-7]: ")).strip() |
| 1140 | if choice == "0": |
| 1141 | sys.exit(0) |
| 1142 | if choice == "1": |
| 1143 | return sorted(PORT_CATEGORIES["balanced"]) |
| 1144 | if choice == "2": |
| 1145 | return sorted(PORT_CATEGORIES["cameras"]) |
| 1146 | if choice == "3": |
| 1147 | return sorted(PORT_CATEGORIES["media"]) |
| 1148 | if choice == "4": |
| 1149 | return sorted(PORT_CATEGORIES["workstation"]) |
| 1150 | if choice == "5": |
| 1151 | return sorted(PORT_CATEGORIES["printer"]) |
| 1152 | if choice == "6": |
| 1153 | value = input(" Enter ports (example: 22,80,443,445): ").strip() |
| 1154 | try: |
| 1155 | ports = [int(item.strip()) for item in value.split(",") if item.strip()] |
| 1156 | if not ports: |
| 1157 | raise ValueError |
| 1158 | return sorted(set(ports)) |
| 1159 | except Exception: |
| 1160 | error("Invalid port list.") |
| 1161 | continue |
| 1162 | if choice == "7": |
| 1163 | print() |
| 1164 | print(" This version first discovers live devices using ARP / neighbor table / nmap host discovery,") |
| 1165 | print(" then it scans only those discovered hosts. This reduces false positives and finds devices") |
| 1166 | print(" even when they do not expose web pages or camera ports.") |
| 1167 | print() |
| 1168 | print(" Important changes:") |
| 1169 | print(" • 80/443/8080 alone no longer cause camera-style false positives") |
| 1170 | print(" • devices are shown as live even when their exact type is still unknown") |
| 1171 | print(" • type identification now uses combined evidence: ports + banners + hostnames + vendors") |
| 1172 | print(" • deep scan is optional and adds mDNS, UPnP, SNMP, NetBIOS clues") |
| 1173 | print() |
| 1174 | input(" Press Enter to return...") |
| 1175 | continue |
| 1176 | warn("Invalid choice.") |
| 1177 | |
| 1178 | |
| 1179 | # ───────────────────────────────────────────── |