22 lines
683 B
Python
Executable file
22 lines
683 B
Python
Executable file
#!/usr/bin/python3
|
|
|
|
import os
|
|
from protonvpn_cli import utils as pvpn_utils
|
|
|
|
|
|
IP_ADDR = pvpn_utils.get_ip_info()[0]
|
|
|
|
if not pvpn_utils.is_connected():
|
|
OUTPUT = os.environ['LABEL_OFF']
|
|
OUTPUT += " {}".format(IP_ADDR)
|
|
|
|
else:
|
|
CONNECTED_SERVER = pvpn_utils.get_config_value("metadata", "connected_server")
|
|
SERVERS = pvpn_utils.get_servers()
|
|
COUNTRY_CODE = pvpn_utils.get_server_value(CONNECTED_SERVER, "ExitCountry", SERVERS)
|
|
COUNTRY = pvpn_utils.get_country_name(COUNTRY_CODE)
|
|
CITY = pvpn_utils.get_server_value(CONNECTED_SERVER, "City", SERVERS)
|
|
OUTPUT = os.environ['LABEL_ON']
|
|
OUTPUT += " {} - {}, {}".format(IP_ADDR, CITY, COUNTRY)
|
|
|
|
print(OUTPUT)
|