🌍 IPCap
============
📖 Table of Contents
🚀 Installation
To install ipcap, use the following Cargo command:
📖 Download the dataset
Download the city databases, v4 and v6 from the repository using this command:
# IPV4 database
# IPV6 database
This will download the data/geo_ip_city_v4.dat and or data/geo_ip_city_v4.dat database(s) from the repository and put it under ~/.local/share/ipcap/.
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:
# IPV4 database
# IPV6 database
Replace /your/custom/path/geo_ip_city_v4.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_v4.dat).
[!NOTE] The default location to find the databases is
~/Library/Application Support/ipcap/on macOS, andC:\Users\Username\AppData\Local\ipcap\on Windows.
[!NOTE] The databases were shamelessly taken from the fedora website at https://src.fedoraproject.org/repo/pkgs/GeoIP-GeoLite-data/.
About the IPV4 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
- Auto detect ipv4 and ipv6.
- IP address lookup without internet access.
- Zero API calls for decoding IP addresses.
- Dataset download and customizable file path.
⌨ Usage as CLI
Perform IPV4 lookup:
Perform IPV6 lookup:
💻 Usage as Dep
[]
= "0.1.7"
use GeoIpReader;
use pretty_print_dict;
use File;
🎨 Options
| Option | Default Value | Description |
|---|---|---|
--target |
"" |
Set the IP address, v4 or v6, 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.