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

Function check_tshark_availability

tg_get_ip.py:29–54  ·  view source on GitHub ↗

Check Tshark install.

()

Source from the content-addressed store, hash-verified

27 return None
28
29def check_tshark_availability():
30 """Check Tshark install."""
31 wireshark_path = None
32 if platform.system() == "Windows":
33 wireshark_path = get_wireshark_install_path_from_registry()
34 elif platform.system() == "Darwin":
35 wireshark_path = "/Applications/Wireshark.app/Contents/MacOS"
36 elif platform.system() == "Linux":
37 wireshark_path = os.popen('which wireshark').read().strip()
38 tshark_path = os.popen('which tshark').read().strip()
39 if os.path.isfile(wireshark_path):
40 wireshark_path = os.path.dirname(wireshark_path)
41 elif os.path.isfile(tshark_path):
42 wireshark_path = os.path.dirname(tshark_path)
43
44 if not wireshark_path:
45 os_type = platform.system()
46 if os_type == "Linux":
47 print("Install tshark first: sudo apt update && apt install tshark")
48 elif os_type == "Darwin": # macOS
49 print("Install Wireshark first: https://www.wireshark.org/download.html")
50 else:
51 print("Please install tshark.")
52 sys.exit(1)
53 else:
54 print("[+] tshark is available.")
55
56# Telegram AS list of excluded IP ranges
57EXCLUDED_NETWORKS = ['91.108.13.0/24', '149.154.160.0/21', '149.154.160.0/22',

Callers 1

mainFunction · 0.85

Tested by

no test coverage detected