https://github.com/d4v1-sudo/ip-geolocation-tool
π₯οΈ β π β πΊοΈ - Python code that utilizes the MaxMind GeoIP2 database to retrieve geolocation information for a given IP address.
https://github.com/d4v1-sudo/ip-geolocation-tool
geoip geoip-location geoip2 geolocation ip-geolocation ip-lookup latitude-and-longitude latitude-longitude maxmind python
Last synced: about 2 months ago
JSON representation
π₯οΈ β π β πΊοΈ - Python code that utilizes the MaxMind GeoIP2 database to retrieve geolocation information for a given IP address.
- Host: GitHub
- URL: https://github.com/d4v1-sudo/ip-geolocation-tool
- Owner: d4v1-sudo
- License: mit
- Created: 2024-02-21T21:01:31.000Z (about 1 year ago)
- Default Branch: master
- Last Pushed: 2024-09-05T01:02:15.000Z (8 months ago)
- Last Synced: 2025-01-13T23:28:55.689Z (3 months ago)
- Topics: geoip, geoip-location, geoip2, geolocation, ip-geolocation, ip-lookup, latitude-and-longitude, latitude-longitude, maxmind, python
- Language: Python
- Homepage: https://dev.maxmind.com/static/pdf/GeoLite2-IP-MetaData-Databases-Comparison-Chart.pdf
- Size: 34.5 MB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## π₯οΈ β π β πΊοΈ - IP Geolocation Tool
This Python script utilizes the MaxMind GeoIP2 database to retrieve geolocation information for a given IP address.
### Requirements
- Python 3.x. [Install here](python.org)
- MaxMind GeoLite2 City and ASN databases (`GeoLite2-City.mmdb`, `GeoLite2-ASN.mmdb`)### Usage
1. Download
- Visit the GitHub repository page at [https://github.com/d4v1-sudo/IP-geolocation-tool](https://github.com/d4v1-sudo/IP-geolocation-tool.git).
- Click the "Code" button and select "Download ZIP" to download the repository as a ZIP file.
- Extract the contents of the ZIP file to your local machine.2. Run the script on terminal (linux) or cmd (windows)
```python3 geo-ip.py```
or
```python3 all.py```
3. Enter the IP address you want to look up when prompted.### Output
The script will provide the following information if the IP address is found:
- IP Address
- AS Number
- AS Name
- ISP
- City
- Region
- Country
- Country Code
- Postal Code
- Timezone
- Latitude
- Longitude
- Google Maps link to the location### Example
```
IP: 8.8.8.8
IP Informations:
IP Address: 8.8.8.8
AS Number: 15169
AS Name: Google LLC
ISP: Google LLC
City: Mountain View
Region: California
Country: United States
Country Code: US
Postal Code: 94043
Timezone: America/Los_Angeles
Latitude: 37.4229
Longitude: -122.085
Google Maps: [Google Maps Link](https://www.google.com/maps/search/?api=1&query=37.4229,-122.085)
```### Note
- If the IP address is not found in the database, the script will display a message indicating that the address was not found.### Dependencies
- [geoip2](https://pypi.org/project/geoip2/) Python library, which can be installed via pip:```
pip install geoip2
```
### Download all MaxMind database for more data:[MaxMind GeoLite2 Database](https://github.com/P3TERX/GeoLite.mmdb)
### Disclaimer
This script relies on third-party data provided by MaxMind. The accuracy of the geolocation information may vary.