Skip to content
Open
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
53 changes: 21 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ pip install requests beautifulsoup4
1. **Clone the repository**:

```bash
git clone https://github.com/DevURANIUM/IP.git
git clone https://github.com/noarche/IP
cd IP
```

Expand All @@ -52,31 +52,15 @@ pip install requests beautifulsoup4
1. **Run the script**:
Start the script by running:
```bash
python3 ip.py
python3 ip.py 127.0.0.1
```

2. **Choose an option**:
- **Option 1**: Enter `1` to retrieve general IP information from [Check-host.net](https://check-host.net/).
- **Option 2**: Enter `2` to check if the IP is residential using [Proxycheck.io](https://proxycheck.io/).

### Example

1. Run the script:

```bash
python3 ip.py
```

2. Enter the IP address when prompted, and choose between:
- **Option 1**: General IP Info (Check-host.net)
- **Option 2**: Residential Check (Proxycheck.io)

The script will display detailed information about the IP address, including its location, ASN, provider, and whether it is a proxy or VPN.

## Code Overview

- **IP Information Retrieval**: Fetches general IP data from Check-host.net, including location, ASN, and ISP.
- **Residential Check**: Uses Proxycheck.io to determine if the IP is residential, including the provider, ASN, and other details like city, region, and timezone.
- **python ip.py -1 127.0.0.1**: Fetches general IP data from Check-host.net, including location, ASN, and ISP.
- **python ip.py 127.0.0.1**: Uses Proxycheck.io to determine if the IP is residential, including the provider, ASN, and other details like city, region, and timezone.

## Dependencies

Expand All @@ -93,22 +77,27 @@ pip install requests beautifulsoup4

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

## Support & Contributions

If you encounter any issues or have suggestions for improvement, please reach out via:
# ꧁꧂ Buy me a coffee ☕

![qrCode](https://raw.githubusercontent.com/noarche/cd-ripper/main/unrelated-ignore/CryptoQRcodes.png)

**Bitcoin** address `bc1qnpjpacyl9sff6r4kfmn7c227ty9g50suhr0y9j`


**Ethereum** address `0x94FcBab18E4c0b2FAf5050c0c11E056893134266`


**Litecoin** address `ltc1qu7ze2hlnkh440k37nrm4nhpv2dre7fl8xu0egx`



- [Telegram](https://t.me/DevURANIUM)
- [GitHub Issues](https://github.com/DevURANIUM/IP/issues)
-------------------------------------------------------------------

## Donation Links
![noarche's GitHub stats](https://github-readme-stats.vercel.app/api?username=noarche&show_icons=true&theme=transparent)

Support the project through donations:

- **BTC**: `bc1qcclcp574hnznm0nmdzzf0ta7366svjskttqks3`
- **TRON**: `TXJqhhwvkrTdnf5HReZf55hEzZuxjto3R4`
- **USDT-(TRC20)**: `TXJqhhwvkrTdnf5HReZf55hEzZuxjto3R4`
- **TON**: `UQAJH2N0pqpvC9YN841w5NH1dCN9Lakwkpjvoy7vXf-vfqgv`
## Credits

---
This script has been updated and customized to my personal preferance, a fork of the [original by devURANIUM](https://github.com/DevURANIUM/IP)

This file provides an organized and professional overview of the project, similar to the format you requested.
235 changes: 133 additions & 102 deletions ip.py
Original file line number Diff line number Diff line change
@@ -1,81 +1,39 @@

# ###############################

# import requests
# from bs4 import BeautifulSoup

# print(f"""
# \033[34m
# ██╗░░░██╗██████╗░░█████╗░███╗░░██╗██╗██╗░░░██╗███╗░░░███╗
# ██║░░░██║██╔══██╗██╔══██╗████╗░██║██║██║░░░██║████╗░████║
# ██║░░░██║██████╔╝███████║██╔██╗██║██║██║░░░██║██╔████╔██║
# ██║░░░██║██╔══██╗██╔══██║██║╚████║██║██║░░░██║██║╚██╔╝██║
# ╚██████╔╝██║░░██║██║░░██║██║░╚███║██║╚██████╔╝██║░╚═╝░██║
# ░╚═════╝░╚═╝░░╚═╝╚═╝░░╚═╝╚═╝░░╚══╝╚═╝░╚═════╝░╚═╝░░░░░╚═╝

# Dev : DevUranium.t.me
# GitHUB :
# """)

# def get_csrf_token():
# url = "https://check-host.net/ip-info"
# response = requests.get(url)
# response.raise_for_status()
# soup = BeautifulSoup(response.text, 'html.parser')

# csrf_token_input = soup.find('input', {'name': 'csrf_token'})
# if csrf_token_input:
# csrf_token = csrf_token_input['value']
# return csrf_token
# else:
# print("CSRF token not found.")
# return None

# def send_request(ip_address):
# csrf_token = get_csrf_token()
# if csrf_token is not None:
# url = f"https://check-host.net/ip-info?host={ip_address}&csrf_token={csrf_token}"
# response = requests.get(url)
# response.raise_for_status()

# soup = BeautifulSoup(response.text, 'html.parser')
# table = soup.find('table', class_='ipinfo-table')

# data = {}

# for row in table.find_all('tr'):
# columns = row.find_all('td')
# if len(columns) == 2:
# key = columns[0].get_text(strip=True)
# value = columns[1].get_text(strip=True)
# data[key] = value

# for key, value in data.items():
# print(f"{key} : {value}")
# else:
# print("Cannot send request without CSRF token.")

# ip = input("\033[32mIP Enter : \033[0m")

# send_request(ip)

# ###############################


import sys
import requests
from bs4 import BeautifulSoup
import socket

def print_banner():
print(f"""
\033[34m
\033[95m
██╗░░░██╗██████╗░░█████╗░███╗░░██╗██╗██╗░░░██╗███╗░░░███╗
██║░░░██║██╔══██╗██╔══██╗████╗░██║██║██║░░░██║████╗░████║
██║░░░██║██████╔╝███████║██╔██╗██║██║██║░░░██║██╔████╔██║
██║░░░██║██╔══██╗██╔══██║██║╚████║██║██║░░░██║██║╚██╔╝██║
╚██████╔╝██║░░██║██║░░██║██║░╚███║██║╚██████╔╝██║░╚═╝░██║
░╚═════╝░╚═╝░░╚═╝╚═╝░░╚═╝╚═╝░░╚══╝╚═╝░╚═════╝░╚═╝░░░░░╚═╝\033[0m

\033[91m ų℘ɖąɬɛɖ ცყ אσα૨૮ɦε \033[0m
""")

def print_help():
print(f"""
\033[96mUsage:\033[0m
\033[92m python ip.py -1 <IP_OR_DOMAIN>\033[0m : Get detailed IP information.
\033[92m python ip.py -2 <IP_OR_DOMAIN>\033[0m : Check if the IP is residential.
\033[92m python ip.py <IP_OR_DOMAIN>\033[0m : Default to checking if the IP is residential.
\033[92m python ip.py -h\033[0m : Display this help message.
""")

def resolve_to_ip(address):
"""Resolve a domain name to an IP address. If already an IP, return as is."""
try:
ip_address = socket.gethostbyname(address)
return ip_address
except socket.gaierror:
print(f"\033[91mError: Unable to resolve domain '{address}' to an IP address.\033[0m")
return None

def get_csrf_token():
url = "https://check-host.net/ip-info"
response = requests.get(url)
Expand All @@ -87,7 +45,7 @@ def get_csrf_token():
csrf_token = csrf_token_input['value']
return csrf_token
else:
print("CSRF token not found.")
print("\033[91mCSRF token not found.\033[0m")
return None

def get_ip_info(ip_address):
Expand All @@ -110,9 +68,42 @@ def get_ip_info(ip_address):
data[key] = value

for key, value in data.items():
print(f"\033[36m{key} : \033[33m{value}")
print(f"\033[94m{key} : \033[93m{value}\033[0m")
else:
print("Cannot send request without CSRF token.")
print("\033[91mCannot send request without CSRF token.\033[0m")

def get_ip_info_summary(ip_address):
"""Fetch and return a summary of IP info (Host name, IP range, Local time)."""
csrf_token = get_csrf_token()
if csrf_token is not None:
url = f"https://check-host.net/ip-info?host={ip_address}&csrf_token={csrf_token}"
response = requests.get(url)
response.raise_for_status()

soup = BeautifulSoup(response.text, 'html.parser')
table = soup.find('table', class_='ipinfo-table')

data = {}

for row in table.find_all('tr'):
columns = row.find_all('td')
if len(columns) == 2:
key = columns[0].get_text(strip=True)
value = columns[1].get_text(strip=True)
data[key] = value

host_name = data.get('Host name', 'N/A')
ip_range = data.get('IP range', 'N/A')
local_time = data.get('Local time', 'N/A')

return {
'Host name': host_name,
'IP range': ip_range,
'Local time': local_time
}
else:
print("\033[91mCannot send request without CSRF token.\033[0m")
return None

def check_ip_residential(ip_address):
url = f'https://proxycheck.io/v2/{ip_address}?vpn=1&asn=1'
Expand Down Expand Up @@ -140,47 +131,87 @@ def check_ip_residential(ip_address):
proxy = ip_data.get('proxy', "")
IPtype = ip_data.get('type', "")

print(f"IP: {ip_address}")
print(f"Status: {status}")
print(f"ASN: {asn}")
print(f"Provider: {provider}")
print(f"Organisation: {organisation}")
print(f"Continent: {continent}")
print(f"Country: {country}")
print(f"ISO code: {isocode}")
print(f"Region: {region}")
print(f"Region code: {regioncode}")
print(f"Timezone: {timezone}")
print(f"City: {city}")
print(f"Postcode: {postcode}")
print(f"Latitude: {latitude}")
print(f"Longitude: {longitude}")
print(f"Currency: {currency}")
print(f"Currency symbol: {symbol}")
print(f"Proxy: {proxy}")
print(f"IP type: {IPtype}")
return {
"IP": ip_address,
"Status": status,
"ASN": asn,
"Provider": provider,
"Organisation": organisation,
"Continent": continent,
"Country": country,
"ISO code": isocode,
"Region": region,
"Region code": regioncode,
"Timezone": timezone,
"City": city,
"Postcode": postcode,
"Latitude": latitude,
"Longitude": longitude,
"Currency": currency,
"Currency symbol": symbol,
"Proxy": proxy,
"IP type": IPtype
}

except Exception as e:
print(f'Error: {str(e)}')
print(f'\033[91mError: {str(e)}\033[0m')
return {}

def main():
print_banner()
print("Choose an option:")
print("1. IP Info")
print("2. IP Check Residential")

choice = input("Enter number: ")

if choice not in ['1', '2']:
print("\033[31mInvalid choice.\033[0m")
if len(sys.argv) < 2:
print_banner()
print_help()
return

ip = input("Enter IP address: ")
if len(sys.argv) == 2 and not sys.argv[1].startswith('-'):
address = sys.argv[1]
ip_address = resolve_to_ip(address)
if ip_address:
print("\033[97m𝘗𝘳𝘰𝘤𝘦𝘴𝘴𝘪𝘯•._.••`¯\033[0m")
residential_results = []
try:
residential_results = check_ip_residential(ip_address)
except Exception as e:
print(f"\033[91mError during residential check: {str(e)}\033[0m")

print("\033[96m𝘗𝘳𝘰𝘤𝘦𝘴𝘴𝘪𝘯•._.••`¯´´•.¸¸.•`\033[0m")
summary = {}
try:
summary = get_ip_info_summary(ip_address)
except Exception as e:
print(f"\033[91mError during IP info fetch: {str(e)}\033[0m")

print("\n\033[92m𝘗𝘳𝘰𝘤𝘦𝘴𝘴𝘦𝘥•._.••`¯´´•.¸¸.•`´¯`••._.•\033[0m")
if residential_results:
for key, value in residential_results.items():
print(f"\033[94m{key}: \033[93m{value}\033[0m")
if summary:
print(f"\033[94mHost name: \033[93m{summary.get('Host name', 'N/A')}\033[0m")
print(f"\033[94mIP range: \033[93m{summary.get('IP range', 'N/A')}\033[0m")
print(f"\033[94mLocal time: \033[93m{summary.get('Local time', 'N/A')}\033[0m")
return

option = sys.argv[1]

if choice == '1':
get_ip_info(ip)
elif choice == '2':
check_ip_residential(ip)
if option == '-h':
print_help()
elif option in ['-1', '-2']:
if len(sys.argv) < 3:
print("\033[91mError: IP address or domain is required.\033[0m")
return

address = sys.argv[2]
ip_address = resolve_to_ip(address)
if not ip_address:
return

if option == '-1':
get_ip_info(ip_address)
elif option == '-2':
check_ip_residential(ip_address)
else:
print("\033[91mInvalid option.\033[0m")
print_help()

if __name__ == "__main__":
main()
Expand Down