Print your external IP address
(ipv6)
| 440 | @main.command() |
| 441 | @click.option('--ipv6', '-6', is_flag=True, default=False, help='Try to use IPv6 instead of IPv4') |
| 442 | def 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() |
nothing calls this directly
no test coverage detected