Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions Domains/cli/MiniProjects/IPShield/README.md
Original file line number Diff line number Diff line change
@@ -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
52 changes: 52 additions & 0 deletions Domains/cli/MiniProjects/IPShield/ip_shield.py
Original file line number Diff line number Diff line change
@@ -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()
Loading