digaws/README.md

124 lines
2.7 KiB
Markdown
Raw Normal View History

2020-12-25 20:32:50 +00:00
# digaws
2020-12-25 20:36:41 +00:00
The digaws lookup tool displays information for a given IP address (v4 o v6) or a CIDR, sourced from the AWS official IP ranges.
In order to save bandwidth and time this tool requests the [AWS IP ranges](https://ip-ranges.amazonaws.com/ip-ranges.json) and keeps
a cached version until a new version is published.
2020-12-26 17:50:48 +00:00
![PyPI version](https://badge.fury.io/py/digaws.svg)
![CI](https://github.com/dcarrillo/digaws/workflows/CI/badge.svg)
2020-12-25 20:55:16 +00:00
## Requirements
Python >= 3.7
Tests are verified on Linux, macos and Windows.
2020-12-25 20:36:41 +00:00
## Install
```bash
pip install digaws
```
## Usage
2020-12-25 20:55:16 +00:00
```text
2020-12-26 12:31:05 +00:00
usage: digaws [-h] [--output <plain|json>] [--output-fields [{prefix,region,service,network_border_group} ...]] [--debug] [--version] <ip address|cidr> [<ip address|cidr> ...]
2020-12-25 20:36:41 +00:00
Look up canonical information for AWS IP addresses and networks
positional arguments:
<ip address|cidr> CIDR or IP (v4 or v6) to look up
optional arguments:
-h, --help show this help message and exit
--output <plain|json>
Formatting style for command output, by default plain
2020-12-26 12:31:05 +00:00
--output-fields [{prefix,region,service,network_border_group} ...]
Print only the given fields
2020-12-25 20:36:41 +00:00
--debug Enable debug
2020-12-26 12:31:05 +00:00
--version show program's version number and exit
2020-12-25 20:36:41 +00:00
```
## Examples
- look up an IPv4 address
2020-12-25 20:55:16 +00:00
```text
2020-12-25 20:36:41 +00:00
~ » digaws 52.218.97.130
Prefix: 52.218.0.0/17
Region: eu-west-1
Service: AMAZON
Network border group: eu-west-1
Prefix: 52.218.0.0/17
Region: eu-west-1
Service: S3
Network border group: eu-west-1
```
- look up an IPv6 address
2020-12-25 20:55:16 +00:00
```text
2020-12-25 20:36:41 +00:00
~ » digaws 2600:1f1e:fff:f810:a29b:cb50:2812:e2dc
IPv6 Prefix: 2600:1f1e::/36
Region: sa-east-1
Service: AMAZON
Network border group: sa-east-1
IPv6 Prefix: 2600:1f1e:fff:f800::/53
Region: sa-east-1
Service: ROUTE53_HEALTHCHECKS
Network border group: sa-east-1
IPv6 Prefix: 2600:1f1e::/36
Region: sa-east-1
Service: EC2
Network border group: sa-east-1
```
- look up several addresses and print output as json
2020-12-25 20:55:16 +00:00
```text
2020-12-25 20:36:41 +00:00
~ » digaws 2600:1f14::/36 13.224.119.88 --output json
[
{
"ipv6_prefix": "2600:1f14::/35",
"region": "us-west-2",
"service": "AMAZON",
"network_border_group": "us-west-2"
},
{
"ipv6_prefix": "2600:1f14::/35",
"region": "us-west-2",
"service": "EC2",
"network_border_group": "us-west-2"
},
{
"ip_prefix": "13.224.0.0/14",
"region": "GLOBAL",
"service": "AMAZON",
"network_border_group": "GLOBAL"
},
{
"ip_prefix": "13.224.0.0/14",
"region": "GLOBAL",
"service": "CLOUDFRONT",
"network_border_group": "GLOBAL"
}
]
```
2020-12-26 12:31:05 +00:00
- Choose output fields
```text
~ » digaws 34.255.166.63 --output-fields service
Service: AMAZON
Service: EC2
```