Query

net_query_ip

Query the public/external IP address of this host using a reflection service. For the local IP address, use net_query_ip instead.

Arguments

  • $1 (string): Optional: '-6' for IPv6 (default: IPv4)

Exit codes

  • 0: Success
  • 1: curl failed

Output on stdout

  • The public IP address

net_query_ipinfo

Look up geo and network metadata for an IP address or hostname using ipinfo.io. Requires IPINFO_TOKEN to be set in the environment.

Example

net_query_ipinfo 8.8.8.8
net_query_ipinfo --brief 8.8.8.8

Arguments

  • $1 (string): Optional: '-b' or '--brief' for country code only
  • $2 (string): IP address or hostname to look up (default: caller's public IP)

Exit codes

  • 0: Success
  • 1: IPINFO_TOKEN not set

Output on stdout

  • JSON metadata, or 'IP: COUNTRY' in brief mode

net_query_http_code

Return the HTTP status code for a URL.

Arguments

  • $1 (string): URL to query

Exit codes

  • 0: curl succeeded
  • 1: curl failed

Output on stdout

  • HTTP status code (e.g. 200, 404)

net_query_as_numbers

Fetch AS numbers for a given search term from bgpview.io.

Arguments

  • $1 (string): Search term (e.g. organisation name or IP)

Exit codes

  • 0: Always

Output on stdout

  • AS numbers, one per line

net_query_asn_attr

Pull ASN info from riswhois.ripe.net for one or more AS numbers.

Arguments

  • ... (string): One or more AS numbers

Exit codes

  • 0: Always

Output on stdout

  • whois output with blank/comment lines stripped

net_parse_url

Parse a URL into its component parts. With one argument, prints all components as key: value lines. With a second argument, prints only the requested field. Default ports are inferred for http, https, mysql, redis if not explicitly set.

Example

net_parse_url 'https://user:pw@host.com:8080/path' host   # => host.com
net_parse_url 'https://example.com/foo' port               # => 443

Arguments

  • $1 (string): URL to parse (e.g. "https://user:pw@example.com:8080/some/path")
  • $2 (string): Optional field: proto user pass host port path

Exit codes

  • 0: Success
  • 1: Unknown field selector
  • 2: Missing argument

Output on stdout

  • Requested field value, or all fields as key: value lines