Urgent.News

What's breaking now, across thousands of outlets.

Tech

Get your public IP, VPN/proxy status and risk score with one curl command

Most "what's my IP" sites are built for browsers. Call them from a script and you get a full HTML page back, or you're asked to sign up for an API key just to read one line of text. I run checkip.me , a free IP lookup service, and I wanted it to work well from a terminal. So this post is partly a how-to and partly a plug. Everything below works without an account or a key. Just the IP curl…

The article provides instructions on how to obtain your public IP address, VPN/proxy status and risk score using a single curl command. It highlights that most "what's my IP" websites are designed for browsers and provide a full HTML page as output, often requiring an API key to access even a single line of text. In contrast, checkip.me offers a free IP lookup service that works seamlessly from a terminal without the need for an account or key.

The article demonstrates various use cases for this IP lookup service via curl commands. When you simply type "curl checkip.me 203.0.113.42" in your terminal, you will receive plain text output containing key details about your IP address, such as ASN (Autonomous System Number), ISP, country, city, timezone, VPN/proxy/Tor status, and hosting information.

If you require only one specific value, you can append the field name to the path, which returns the corresponding information as plain text, eliminating the need for additional processing.

The article also shares a practical example of using this tool to update a DNS provider's API whenever your IP changes, ensuring that your DNS records reflect your current IP address. The script demonstrates how to fetch your IP address using curl, compare it with the last recorded address, and update the DNS settings accordingly. It emphasizes the importance of handling potential HTTP errors, limiting the execution time, and leveraging locking mechanisms to prevent race conditions during script execution.

Additionally, the article discusses potential use cases for fetching IP details of other IPs, including locking SSH access to your current IP address using Terraform. It provides a code snippet that demonstrates how to pass your current IP address to Terraform during an apply operation, ensuring secure SSH connections exclusively for your IP. The article cautions against relying on VPN, proxy or Tor flags for security-sensitive applications, as they are only indicative and not foolproof.

Furthermore, the article explains the limitations and potential inaccuracies associated with IP geolocation data, which is used to determine the country and city associated with your IP address. It emphasizes that while the country information is generally accurate, the city information may be approximate, similar to other free IP geolocation services.

The article concludes by encouraging readers to explore checkip.me's API documentation at checkip.me/api, expressing interest in suggestions for additional fields and endpoints that could enhance the service's functionality.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

Sandboxing with minimal effort

  • Inko introduces sandboxing feature with minimal effort
  • Uses Landlock, Seatbelt, Capsicum, pledge/unveil for cross-platform support
  • API enables easy sandboxing of Inko applications with simple code

More from Wednesday 23 September →