From 88753e17d10754eae39ae48d2492bf09097d25f4 Mon Sep 17 00:00:00 2001 From: pulkittillion Date: Fri, 31 Oct 2025 18:47:47 +0530 Subject: [PATCH] Add: CLI - IP Shield IP Intelligence Tool --- Domains/cli/MiniProjects/IPShield/README.md | 21 ++++++++ .../cli/MiniProjects/IPShield/ip_shield.py | 52 +++++++++++++++++++ 2 files changed, 73 insertions(+) create mode 100644 Domains/cli/MiniProjects/IPShield/README.md create mode 100644 Domains/cli/MiniProjects/IPShield/ip_shield.py diff --git a/Domains/cli/MiniProjects/IPShield/README.md b/Domains/cli/MiniProjects/IPShield/README.md new file mode 100644 index 00000000..7ba01320 --- /dev/null +++ b/Domains/cli/MiniProjects/IPShield/README.md @@ -0,0 +1,21 @@ +# IP Shield: Real-Time IP Intelligence Tool + +A terminal-based cybersecurity utility that reveals your public IP address and detailed geolocation/network information—perfect for verifying your digital footprint, checking VPN leaks, or learning about IP tracking. + +## 🔍 Real-Life Use Cases +- **Remote Workers**: Confirm your IP matches your expected location. +- **Privacy Enthusiasts**: Verify if your VPN is masking your real IP. +- **Developers**: Debug location-based services or API restrictions. +- **Students**: Learn how IP geolocation works in real time. + +## Features +- Fetches your real public IP (bypasses localhost) +- Retrieves country, city, ISP, timezone, coordinates, and more +- Clean, secure-themed terminal display +- Zero dependencies (pure Python) + +## How to Run +1. Ensure Python 3 is installed. +2. Navigate to the project folder: + ```bash + cd Domains/CLI/MiniProjects/IPShield \ No newline at end of file diff --git a/Domains/cli/MiniProjects/IPShield/ip_shield.py b/Domains/cli/MiniProjects/IPShield/ip_shield.py new file mode 100644 index 00000000..e4fdbae0 --- /dev/null +++ b/Domains/cli/MiniProjects/IPShield/ip_shield.py @@ -0,0 +1,52 @@ +import urllib.request +import json + +def get_public_ip(): + """Get public IP using ipify.org""" + try: + with urllib.request.urlopen("https://api.ipify.org/?format=json") as response: + data = json.loads(response.read().decode()) + return data["ip"] + except Exception: + return None + +def get_ip_info(ip): + """Get detailed info using ip-api.com""" + try: + url = f"http://ip-api.com/json/{ip}" + with urllib.request.urlopen(url) as response: + return json.loads(response.read().decode()) + except Exception: + return None + +def display_info(info): + """Display IP intelligence in a shield-style box.""" + if not info or info.get("status") != "success": + print("\033[91m❌ Failed to retrieve IP information.\033[0m") + return + + print("\n" + "\033[1;94m🛡️ IP SHIELD: Digital Identity Report 🛡️\033[0m") + print("=" * 50) + print(f"🌐 Public IP : {info.get('query', 'N/A')}") + print(f"📍 Location : {info.get('city', 'N/A')}, {info.get('regionName', 'N/A')}, {info.get('country', 'N/A')}") + print(f"📮 Postal Code : {info.get('zip', 'N/A')}") + print(f"🧭 Coordinates : {info.get('lat', 'N/A')}, {info.get('lon', 'N/A')}") + print(f"🕒 Timezone : {info.get('timezone', 'N/A')}") + print(f"🏢 ISP : {info.get('isp', 'N/A')}") + print(f"🧾 Org : {info.get('org', 'N/A')}") + print(f"📶 ASN : {info.get('as', 'N/A')}") + print("=" * 50 + "\n") + +def main(): + print("\033[1;92m🔍 Fetching your public IP and geolocation...\033[0m") + + ip = get_public_ip() + if not ip: + print("\033[91m❌ Could not detect your public IP.\033[0m") + return + + info = get_ip_info(ip) + display_info(info) + +if __name__ == "__main__": + main() \ No newline at end of file