diff --git a/modules/ip_address.py b/modules/ip_address.py new file mode 100644 index 0000000..fa5eb7b --- /dev/null +++ b/modules/ip_address.py @@ -0,0 +1,11 @@ +import socket + +def get_ip(): + try: + s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) + s.connect(("8.8.8.8", 80)) + ip = s.getsockname()[0] + s.close() + except Exception: + ip = "No Connection" + return f"IP: {ip}"