ipub is a lightweight command-line interface (CLI) tool written in Python to check your public IPv4 or IPv6 address and retrieve geolocation details (ISP, City, Country, Timezone).
The output is strictly JSON, making it perfect for parsing in scripts, automation, or logging.
- ⚡ Fast: Uses
curland lightweight Python standard libraries. - 📡 Dual Stack: Support for both
-v4(IPv4) and-v6(IPv6). - 📍 Geolocation: Fetches detailed info via
ip-api.com. - 🤖 Automation Ready: Outputs clean JSON.
- 🧾 Clean Terminal Output: Properly formatted JSON with newline.
Make sure the following are installed:
- Python 3.x
- curl
Check installation:
python3 --version
curl --versionIf not installed:
sudo apt update
sudo apt install python3 curl -ysudo pacman -S python curlbrew install python curlInstall ipub system-wide so it can be used anywhere.
git clone https://github.com/bud1mu/ipub.git
cd ipubchmod +x ipubsudo mv ipub /usr/local/bin/ipub
/usr/local/binis preferred over/usr/binfor manually installed tools.
ipub -v4If it prints JSON output, installation was successful ✅
ipub -v4 # Prefer IPv4
ipub -v6 # Prefer IPv6{
"status": "ok",
"ipv4": "203.0.113.10",
"ipv6": null,
"location": {
"country": "Indonesia",
"region": "Jakarta",
"city": "Jakarta",
"lat": -6.2,
"lon": 106.8,
"timezone": "Asia/Jakarta"
},
"isp": {
"isp": "Example ISP",
"org": "Example Org",
"as": "AS12345 Example ASN"
}
}