MCPcopy Create free account
hub / github.com/achillean/shodan-python / myip

Function myip

shodan/__main__.py:442–455  ·  view source on GitHub ↗

Print your external IP address

(ipv6)

Source from the content-addressed store, hash-verified

440@main.command()
441@click.option('--ipv6', '-6', is_flag=True, default=False, help='Try to use IPv6 instead of IPv4')
442def myip(ipv6):
443 """Print your external IP address"""
444 key = get_api_key()
445
446 api = shodan.Shodan(key)
447
448 # Use the IPv6-enabled domain if requested
449 if ipv6:
450 api.base_url = 'https://apiv6.shodan.io'
451
452 try:
453 click.echo(api.tools.myip())
454 except shodan.APIError as e:
455 raise click.ClickException(e.value)
456
457
458@main.command()

Callers

nothing calls this directly

Calls 2

get_api_keyFunction · 0.90
myipMethod · 0.80

Tested by

no test coverage detected