🌍 IPCap
============
📖 Table of Contents
🚀 Installation
To install ipcap, use the following Cargo command:
📖 Download the dataset
Download the city database from the repository using this command:
This will download the data/geo_ip_city.dat from the repository and put it under ~/ipcap/geo_ip_city.dat.
If, for some reason, you decide to change this file location, just set this environment variable to help the CLI read this file. To set the environment variable before running your Rust program, you can do something like:
Replace /your/custom/path/geo_ip_city.dat with the desired file path. If the environment variable is not set, the program will use the default path (/home/username/ipcap/geo_ip_city.dat).
[!NOTE] The dataset was shamelessly taken from the fedora website at https://src.fedoraproject.org/repo/pkgs/GeoIP-GeoLite-data/GeoLiteCity.dat.gz.
About the dataset
The last 600 bytes of this dataset:
can be interpreted as follows:
| (
&
)
The forth byte from the end of the file, '2', indicates the database type as the GeoLite City database CITY_EDITION_REV1. This dataset provides geolocation information, featuring diverse locations, numeric codes, and associated details. Place names, such as "Shek Kip Mei" and "Chiang Mai," and numeric codes, postal codes, contribute to the dataset's geographical context. Additionally, metadata elements like "GEO-533LITE" and a copyright statement suggest a connection to the MaxMind geolocation database. The dataset aims to offer insights into the geographical distribution of locations and is potentially valuable for geospatial analysis, like this project.
✨ Features
- IP address lookup without internet access.
- Zero API calls for decoding IP addresses.
- Dataset download and customizable file path.
⌨ Usage as CLI
Perform IP lookup:
💻 Usage as Dep
[]
= "0.1.2"
use GeoIpReader;
use File;
🎨 Options
| Option | Default Value | Description |
|---|---|---|
--target |
"" |
Set the IP address to lookup with the --target option. |
🤝 Contributing
Contributions and feedback are welcome! If you'd like to contribute, report an issue, or suggest an enhancement, please engage with the project on GitHub. Your contributions help improve this CLI for the community.
📄 License
This project is licensed under the MIT License.