mirror of
https://github.com/dcarrillo/digaws.git
synced 2025-07-05 11:29:27 +00:00
Compare commits
16 Commits
Author | SHA1 | Date | |
---|---|---|---|
b657c4a4d3
|
|||
87618a960d
|
|||
b1f48d5534
|
|||
ca98c678b2 | |||
5b58df2b3a
|
|||
ad80450442
|
|||
61970f6679 | |||
613727ef5a
|
|||
a3517a25ab | |||
204ec8f9ff
|
|||
ef31af865a
|
|||
fda5957a04
|
|||
0b2f98fa4f
|
|||
e6756888e7
|
|||
3e03e532fd
|
|||
ae7bf28702
|
6
.github/workflows/main.yml
vendored
6
.github/workflows/main.yml
vendored
@ -4,16 +4,17 @@ on:
|
|||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
|
tags:
|
||||||
|
- '*'
|
||||||
pull_request:
|
pull_request:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
tests:
|
tests:
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
if: github.event_name == 'pull_request'
|
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-latest, macos-latest, windows-latest]
|
os: [ubuntu-latest, macos-latest, windows-latest]
|
||||||
python-version: [3.7, 3.8, 3.9]
|
python-version: ["3.7", "3.8", "3.9", "3.10"]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
@ -37,6 +38,7 @@ jobs:
|
|||||||
|
|
||||||
build_publish:
|
build_publish:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
needs: tests
|
||||||
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
|
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
|
15
README.md
15
README.md
@ -1,9 +1,12 @@
|
|||||||
# digaws
|
# digaws
|
||||||
|
|
||||||
The digaws lookup tool displays information for a given IP address (v4 o v6) or a CIDR, sourced from the AWS official IP ranges.
|
The digaws lookup tool displays information for a given IP address (both v4 and 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
|
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.
|
a cached version until a new version is published.
|
||||||
|
|
||||||
|
[](https://pypi.org/project/digaws/)
|
||||||
|
[](https://github.com/dcarrillo/digaws/actions)
|
||||||
|
|
||||||
## Requirements
|
## Requirements
|
||||||
|
|
||||||
Python >= 3.7
|
Python >= 3.7
|
||||||
@ -12,8 +15,16 @@ Tests are verified on Linux, macos and Windows.
|
|||||||
|
|
||||||
## Install
|
## Install
|
||||||
|
|
||||||
|
### Using [pipx](https://pypa.github.io/pipx/#install-pipx) (this is the preferred way)
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
pip install digaws
|
pipx install digaws
|
||||||
|
```
|
||||||
|
|
||||||
|
### Using pip
|
||||||
|
|
||||||
|
```bash
|
||||||
|
pip install digaws --user
|
||||||
```
|
```
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
__version__ = '1.0.2'
|
__version__ = '1.0.5'
|
||||||
__description__ = 'Look up canonical information for AWS IP addresses and networks'
|
__description__ = 'Look up canonical information for AWS IP addresses and networks'
|
||||||
|
@ -127,8 +127,7 @@ class DigAWSPrettyPrinter:
|
|||||||
item_dict.update({'network_border_group': prefix['network_border_group']})
|
item_dict.update({'network_border_group': prefix['network_border_group']})
|
||||||
data.append(item_dict)
|
data.append(item_dict)
|
||||||
|
|
||||||
if data:
|
print(json.dumps(data, indent=2))
|
||||||
print(json.dumps(data, indent=2))
|
|
||||||
|
|
||||||
|
|
||||||
class DigAWS():
|
class DigAWS():
|
||||||
@ -182,7 +181,7 @@ class DigAWS():
|
|||||||
data = [prefix for prefix in self.ipv6_prefixes
|
data = [prefix for prefix in self.ipv6_prefixes
|
||||||
if addr.subnet_of(prefix['ipv6_prefix'])]
|
if addr.subnet_of(prefix['ipv6_prefix'])]
|
||||||
except (ipaddress.AddressValueError, ValueError):
|
except (ipaddress.AddressValueError, ValueError):
|
||||||
raise(ValueError(f'Wrong IP or CIDR format: {address}'))
|
raise ValueError(f'Wrong IP or CIDR format: {address}')
|
||||||
|
|
||||||
return data
|
return data
|
||||||
|
|
||||||
|
@ -1,10 +1,12 @@
|
|||||||
import nox
|
import nox
|
||||||
|
|
||||||
|
|
||||||
nox.options.sessions = ['lint', 'typing', 'tests']
|
nox.options.sessions = ['lint', 'typing', 'tests']
|
||||||
locations = ['noxfile.py', 'setup.py', 'digaws/', 'tests/']
|
locations = ['noxfile.py', 'setup.py', 'digaws/', 'tests/']
|
||||||
|
|
||||||
lint_common_args = ['--max-line-length', '120']
|
lint_common_args = ['--max-line-length', '120']
|
||||||
mypy_args = ['--ignore-missing-imports']
|
mypy_args = ['--ignore-missing-imports', '--install-types', '--non-interactive']
|
||||||
|
|
||||||
pytest_args = ['--cov=digaws', '--cov-report=', 'tests/']
|
pytest_args = ['--cov=digaws', '--cov-report=', 'tests/']
|
||||||
coverage_args = ['report', '--show-missing', '--fail-under=80']
|
coverage_args = ['report', '--show-missing', '--fail-under=80']
|
||||||
|
|
||||||
|
2
setup.py
2
setup.py
@ -17,7 +17,7 @@ setup(
|
|||||||
url='http://github.com/dcarrillo/digaws',
|
url='http://github.com/dcarrillo/digaws',
|
||||||
author='Daniel Carrillo',
|
author='Daniel Carrillo',
|
||||||
author_email='daniel.carrillo@gmail.com',
|
author_email='daniel.carrillo@gmail.com',
|
||||||
license='MIT',
|
license='Apache Software License',
|
||||||
packages=['digaws'],
|
packages=['digaws'],
|
||||||
zip_safe=False,
|
zip_safe=False,
|
||||||
classifiers=[
|
classifiers=[
|
||||||
|
@ -84,4 +84,5 @@ def test_get_aws_ip_ranges_invalid_status(mocker, fs, create_cache_dir) -> None:
|
|||||||
|
|
||||||
with pytest.raises(digaws.UnexpectedRequestException) as e:
|
with pytest.raises(digaws.UnexpectedRequestException) as e:
|
||||||
digaws.get_aws_ip_ranges()
|
digaws.get_aws_ip_ranges()
|
||||||
assert e.startswith('Unexpected response from')
|
|
||||||
|
assert e.match('^Unexpected response from')
|
||||||
|
Reference in New Issue
Block a user