GithubHelp home page GithubHelp logo

purplebooth / whatismyip Goto Github PK

View Code? Open in Web Editor NEW
4.0 3.0 0.0 303 KB

Work out what your external IP is

License: Creative Commons Zero v1.0 Universal

Jinja 5.09% Rust 84.34% Just 10.57%
what-is-my-ip cli

whatismyip's Introduction

What is my ip

Work out what your external ip is. This is done by querying the o-o.myaddr.l.google.com TXT record on the Google DNS servers (ns1.google.com, ns2.google.com, ns3.google.com, or ns4.google.com).

You can do the same thing yourself running using the dig tool:

dig TXT +short o-o.myaddr.l.google.com @ns1.google.com

I made this tool as a convenient way to do the same thing, including making multiple requests via only IPv4 and IPv6, so you can see both your IPv4 and IPv6 addresses.

Usage

whatismyip --help | sed 's/\.exe//'
Work out what your external ip is

Usage: whatismyip [OPTIONS]

Options:
  -4, --only-4   Only print IPv4 addresses
  -6, --only-6   Only print IPv6 addresses
  -r, --reverse  Print the reverse DNS entries for the IP addresses
  -h, --help     Print help
  -V, --version  Print version

When you run it you should get an IP back

whatismyip
207.105.7.192

It returns IPs and only IPs

whatismyip | grep -E '([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})|(([a-f0-9:]+:+)+[a-f0-9]+)'
207.105.7.192

If you have an IPv4 address and an IPv6 address it'll list both

whatismyip
207.105.7.192
2001:0db8:85a3:0000:0000:8a2e:0370:7334

And if you have only an IPv6 address it'll list that

whatismyip
2001:0db8:85a3:0000:0000:8a2e:0370:7334

You can also force only v6 IPs

whatismyip -6
2001:0db8:85a3:0000:0000:8a2e:0370:7334

Or v4s

whatismyip -4
207.105.7.192

You can also reverse those IPs, which is handy for checking VPNs and similar where you want to identify your gateway exit point

whatismyip -r
207.105.7.192 (5898c708dfaf.dip0.t-ipconnect.de.)
2001:0db8:85a3:0000:0000:8a2e:0370:7334 (c06aa6b6af6c4ad5b46473d8d70bc068.dip0.t-ipconnect.de.)

Installing

See the releases page we build for linux and mac (all x86_64), alternatively use brew

brew install PurpleBooth/repo/whatismyip

whatismyip's People

Contributors

dependabot[bot] avatar mergify[bot] avatar purplebooth avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

whatismyip's Issues

Add local ip address(es)

Would be interesting to add something like a -local argument.

That way this tool can be used for both external and internal addresses and there would be no need to use something else.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.