Approved

This query is one you are recommended to read the full content of the post to use. It is not simply a copy and paste query, like others in the forum. It is valuable in the right situation 

Live Discovery - Need help to get current IP address

Hi, need some help on creating a query that will show me the current IP address the machine is connecting from.

Is there any nice easy way of doing this?

I've tried with: interface_addresses.address Network_IP,

But that returns the IP for all existing interfaces, not just the one that the machine is connected from.

Thanks in advance!

Parents
  • If you're in need of extracting the External IPv4 address that your machine is masquerading behind you can use the following:

    DO NOTE:  You will need to sign up for a FREE API key to use this service, I will not reveal my actual API key.  Put your key where I have said Key_Goes_Here

    SELECT
    json_extract(curl.result,'$.continent_name') continent,
    json_extract(curl.result,'$.country_name') country,
    json_extract(curl.result,'$.region_name') region,
    json_extract(curl.result,'$.city') City,
    json_extract(curl.result,'$.ip') Ext_IP,
    json_extract(curl.result,'$.type') IP_Type
    FROM curl
    WHERE url = 'http:' || '/' || '/' || 'api.ipstack.com/' || (SELECT result FROM curl WHERE url = 'http:' || '/' || '/' || 'ipv4bot.whatismyipaddress.com') || '?access_key=key_goes_here'

Comment
  • If you're in need of extracting the External IPv4 address that your machine is masquerading behind you can use the following:

    DO NOTE:  You will need to sign up for a FREE API key to use this service, I will not reveal my actual API key.  Put your key where I have said Key_Goes_Here

    SELECT
    json_extract(curl.result,'$.continent_name') continent,
    json_extract(curl.result,'$.country_name') country,
    json_extract(curl.result,'$.region_name') region,
    json_extract(curl.result,'$.city') City,
    json_extract(curl.result,'$.ip') Ext_IP,
    json_extract(curl.result,'$.type') IP_Type
    FROM curl
    WHERE url = 'http:' || '/' || '/' || 'api.ipstack.com/' || (SELECT result FROM curl WHERE url = 'http:' || '/' || '/' || 'ipv4bot.whatismyipaddress.com') || '?access_key=key_goes_here'

Children
No Data