Prompt the user to select a network interface.
()
| 123 | |
| 124 | |
| 125 | def choose_interface(): |
| 126 | """Prompt the user to select a network interface.""" |
| 127 | interfaces = netifaces.interfaces() |
| 128 | print("[+] Available interfaces:") |
| 129 | for idx, iface in enumerate(interfaces, 1): |
| 130 | print(f"{idx}. {iface}") |
| 131 | try: |
| 132 | ip_address = netifaces.ifaddresses(iface)[netifaces.AF_INET][0]['addr'] |
| 133 | print(f"[+] Selected interface: {iface} IP address: {ip_address}") |
| 134 | except KeyError: |
| 135 | print("[!] Unable to retrieve IP address for the selected interface.") |
| 136 | |
| 137 | choice = int(input("[+] Enter the number of the interface you want to use: ")) |
| 138 | return interfaces[choice - 1] |
| 139 | |
| 140 | |
| 141 | def extract_stun_xor_mapped_address(interface): |