DEV Community

Check your IP, ASN, and VPN/proxy leaks from the terminal with curl (no signup, no key)

The basics

IP + location + network, human-readable:

curl hackmyip.com

Just the raw IP (pipe-friendly):

curl hackmyip.com/ip
# 203.0.113.45

Because /ip returns nothing but the address, it drops straight into scripts:

IP=$(curl -s hackmyip.com/ip)
echo "running from $IP"

JSON when you need to parse it

curl hackmyip.com/json
{
  "ip": "203.0.113.45",
  "city": "Amsterdam",
  "country": "NL",
  "asn": "AS64500",
  "org": "Example Telecom B.V."
}

Pipe it into jq like anything else:

curl -s hackmyip.com/json | jq -r .asn

The useful one: is my VPN actually working?

This is the endpoint I reach for most. It tells you whether your current IP looks like a normal residential connection or a datacenter / VPN / proxy:

curl hackmyip.com/proxy
proxy: yes
type: datacenter/hosting
network: AS212238 Datacamp Limited
signal: IP is on a known datacenter/hosting ASN

Why this is handy: turn your VPN on, then run curl hackmyip.com/proxy. If it still shows your real residential ISP and ASN, your VPN is not actually routing that traffic (a leak). If it shows a datacenter ASN like above, the VPN is doing its job. It is a one-second sanity check you can even drop into a script before doing anything sensitive.

The rest of the toolkit

  • curl hackmyip.com/asn - your ASN + ISP
  • curl hackmyip.com/headers - the request headers the server sees
  • curl hackmyip.com/ua - your User-Agent
  • curl hackmyip.com/rdns - reverse DNS (PTR) of your IP
  • curl hackmyip.com/help - the full menu

All of it is free, keyless, and runs on Cloudflare's edge, so it is fast from anywhere. If you would rather hit a full JSON API (DNS, WHOIS, blacklist, breach checks, and more), the no-key API is documented at https://hackmyip.com/api-docs.

What do you use for this in your scripts? Curious whether people are still hardcoding ifconfig.me or have a sharper trick.

Comments

No comments yet. Start the discussion.