Skip to content
deltaaa00Public

About

Open-source IP Look up tool

Topics

Resources

Security policy

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

45 Commits

Folders and files

Repository files navigation

banner

License Python Version Stars Last Commit pypi version downloads build status

iprad - modular Python-based CLI utility designed for IP Lookup. Built with scalability in mind, it separates core logic into distinct modules for easier maintenance and expansion.

❗️IP Type

iprad supports IPv4, IPv6, and domain names such as google.com. Domain lookups prefer IPv4 and fall back to IPv6 for IPv6-only hosts. IPv6 addresses are normalized before lookup and caching.

💻 Architecture

  • Modular Design: Core functionality is encapsulated within the iprad/core package.
  • Package Management: Uses pyproject.toml for modern dependency management and entry point configuration.
  • Data Persistence: Includes a local .cache directory for caching results.

🚀 Installation

Project uses pyproject.toml, you can install it as a package directly from the source.

Standard installation

iprad can be installed with pip

Windows

pip install iprad

Linux/macOS

pip3 install iprad

Also you can install it via git clone

git clone https://github.com/deltaaa00/iprad.git
cd iprad
pip install .

For Developers (Editable Mode)

If you plan to modify the code and want changes to take effect immediately:

git clone https://github.com/deltaaa00/iprad.git
cd iprad
pip install -e .

API Keys 🔑

Some modules use API Keys. For example AbuseIPDB need it. Go to iprad directory (can be user folder). And run this:

cp .env.example .env

Then, open it in your text editor and replace YOUR_KEY with your API KEY for module.

ABUSEIPDB_API_KEY="YOUR KEY" <-- replace this

Examples 💾

Let`s try

iprad check 1.1.1.1

And you`ll get this example_output iprad has some modules, that require sudo mode, for opening raw socket, for example:

sudo iprad check 1.1.1.1 -pt

Also, you can check own IP with this command:

iprad check myip

-pt Enables ping and traceroute module. Here is output:

output_pt

If you don't want to use API Keys you can run with --nokeys

iprad check 1.1.1.1 --nokeys

Cache 🧹

iprad has cache function. If you want to clean cache run this:

iprad cache rm

You will get this message

Cache removed successfully

Also you can check cache size via this command:

iprad cache info

You will get this message similar to this:

Cache Size:  0.07MB

Request retries and timeouts

Lookup requests retry transient connection/read failures and HTTP 429, 500, 502, 503, and 504 responses. The default is two retries after the initial attempt, with exponential backoff. Other HTTP errors (such as 401 and 403) are not retried. Each attempt has a 10-second connect/read timeout; this is not a total command deadline.

iprad check 1.1.1.1 --nokeys --retries 3 --timeout 5
iprad check 2606:4700:4700::1111 --nokeys

Use --retries 0 to disable retries. These options apply to the check command's API requests, including public address discovery with myip.

Cache controls

Results are cached for 48 hours by default. Expired entries are fetched again. --refresh bypasses existing entries and saves successful fresh results; --cache-ttl HOURS changes the lifetime for that invocation. A TTL of zero always fetches fresh data. A failed refresh reports the failure rather than displaying old data. Existing iprad cache info and iprad cache rm commands still apply.

iprad check 1.1.1.1 --nokeys --refresh
iprad check 1.1.1.1 --nokeys --cache-ttl 6

IPv6 ping and traceroute are available with -pt where raw ICMP permissions and connectivity allow them.

Development checks

python -m unittest discover -s tests -v
python -m build

The tests use mocked API responses and a local HTTP server; no API key or external network access is required.

About

Open-source IP Look up tool

Topics

Resources

Security policy

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages