Skip to main content

unmaskip

IP lookup with proxy, VPN, Tor and hosting detection, powered by checkip.me.

  • Geolocation, ASN, ISP, connection type (Residential / Business / Wireless / Hosting)
  • Detects proxy, VPN, Tor, hosting/datacenter, compromised hosts and scrapers
  • Risk score from 0 to 100
  • No API key, zero dependencies, fully typed
  • Built-in cache and automatic retry on rate limits
  • Command-line tool included

Install

pip install unmaskip

Requires Python 3.9+.

Quick start

import unmaskip

info = unmaskip.lookup("8.8.8.8")
print(info.country, info.city, info.isp)   # United States Mountain View Google LLC
print(info.type)                           # Business
print(info.risk)                           # 0-100

if info.is_vpn or info.is_proxy or info.is_tor:
    print("Masked connection")

# One-liners
unmaskip.is_vpn("1.2.3.4")
unmaskip.is_proxy("1.2.3.4")
unmaskip.is_tor("1.2.3.4")
unmaskip.is_hosting("1.2.3.4")
unmaskip.risk("1.2.3.4")

# Your own IP
unmaskip.my_ip()
unmaskip.lookup()

Example: block anonymous sign-ups

import unmaskip

def is_suspicious(ip: str) -> bool:
    info = unmaskip.lookup(ip)
    return info.is_masked or info.is_hosting or (info.risk or 0) >= 80

The IPInfo object

Field Type Description
ip str The IP address
hostname str | None Reverse DNS
asn, isp, organisation str | None Network owner
type str | None Residential, Business, Wireless or Hosting
range str | None Network range (CIDR)
continent, country, country_code, region, region_code, city, postal_code str | None Location
latitude, longitude float | None Coordinates
timezone, currency str | None
proxy, vpn, tor, hosting bool Detections
compromised, scraper, anonymous bool Detections
risk int | None Risk score, 0 (clean) to 100 (very risky)
operator str | None VPN/proxy operator, when known
raw dict Full JSON response

Helpers: is_proxy, is_vpn, is_tor, is_hosting, is_anonymous, and is_masked (proxy or VPN or Tor). to_dict() returns a plain dict.

Client options

from unmaskip import Client

client = Client(
    timeout=10.0,         # seconds per request
    cache_ttl=3600,       # cache results for 1 hour (0 disables the cache)
    cache_size=1024,      # max cached IPs
    max_retries=2,        # retries on HTTP 429
    max_retry_wait=60,    # never sleep longer than this; raise instead
)
info = client.lookup("1.1.1.1")

The module-level functions (unmaskip.lookup, unmaskip.is_vpn, ...) share one default client, so their results are cached too.

Rate limits

The free API allows 120 lookups of other IPs per hour per client; looking up your own IP is unlimited and cached IPs do not count. When the limit is hit, unmaskip waits for Retry-After and retries. If the wait is too long, it raises unmaskip.RateLimitError, whose retry_after attribute tells you how long to wait.

Errors

All errors inherit from unmaskip.UnmaskIPError:

Exception When
InvalidIPError Not a valid IPv4/IPv6 address (raised before any request)
PrivateIPError Private or reserved address such as 10.0.0.1 or 127.0.0.1
RateLimitError HTTP 429 and the retry budget is used up
NetworkError DNS failure, timeout, connection refused, ...
APIError Any other unexpected response

InvalidIPError and PrivateIPError are also ValueErrors.

Command line

unmaskip                       # your own IP
unmaskip 8.8.8.8 1.1.1.1       # several IPs
unmaskip 8.8.8.8 --json        # raw JSON
unmaskip 8.8.8.8 -f vpn        # one field: true / false
unmaskip 8.8.8.8 -f country    # United States
unmaskip 1.2.3.4 --strict      # exit code 3 if proxy / VPN / Tor / hosting
$ unmaskip 8.8.8.8
IP            8.8.8.8
Hostname      dns.google
ASN           AS15169
ISP           Google LLC
Organisation  Level 3
Type          Business
Range         8.8.8.0/24
Location      Mountain View, California, United States
Timezone      America/Los_Angeles
Proxy         no
VPN           no
Tor           no
Hosting       no
Anonymous     yes
Compromised   no
Scraper       no
Risk          100/100

Exit codes: 0 success, 1 lookup error, 2 bad arguments, 3 flagged IP (with --strict).

python -m unmaskip works too.

Privacy

unmaskip sends the IP addresses you look up to the checkip.me API over HTTPS, together with a User-Agent header (unmaskip/<version>). Nothing else is collected or sent. Results are cached only in your process memory.

License

MIT

Metadata

Release files for unmaskip 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for unmaskip 0.1.0
File Size Uploaded
unmaskip-0.1.0.tar.gz 13.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for unmaskip 0.1.0
File Interpreter ABI Platform
unmaskip-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 26.4 kB

Release files / unmaskip-0.1.0.tar.gz

Download URL unmaskip-0.1.0.tar.gz
Size 13.4 kB
Tags Source
SHA-256 checksum
How to use checksums
8660974839a448350ce4f098e76aa3f8a1b4b119b21842badbdbd9fb9e03c379
BLAKE2b-256 checksum
How to use checksums
878035a0e511764946fc40e04e0755d08cbcadb1570e858bc4f4f8f0dca36d03
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release files / unmaskip-0.1.0-py3-none-any.whl

Download URL unmaskip-0.1.0-py3-none-any.whl
Size 12.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
68c1bab564e0b2e4fe7025d0c6a90237ab7d53d335cdd0b3c7c107459c795557
BLAKE2b-256 checksum
How to use checksums
61652a09804c878713a33fadbe25f645dd8f1f116ffcfecf2b36ea5ac26f5afd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release history Release notifications | RSS feed

0.3.0

2 release files

0.2.0

2 release files

0.1.1

2 release files

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page