MCPcopy
hub / github.com/n0a/telegram-get-remote-ip / choose_interface

Function choose_interface

tg_get_ip.py:125–138  ·  view source on GitHub ↗

Prompt the user to select a network interface.

()

Source from the content-addressed store, hash-verified

123
124
125def 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
141def extract_stun_xor_mapped_address(interface):

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected