ipsak 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- ipsak-0.1.0/.github/workflows/ci.yml +61 -0
- ipsak-0.1.0/.github/workflows/release.yml +60 -0
- ipsak-0.1.0/.gitignore +9 -0
- ipsak-0.1.0/LICENSE +116 -0
- ipsak-0.1.0/PKG-INFO +190 -0
- ipsak-0.1.0/README.md +151 -0
- ipsak-0.1.0/pyproject.toml +85 -0
- ipsak-0.1.0/src/ipsak/__init__.py +3 -0
- ipsak-0.1.0/src/ipsak/__main__.py +15 -0
- ipsak-0.1.0/src/ipsak/cli.py +343 -0
- ipsak-0.1.0/src/ipsak/display.py +601 -0
- ipsak-0.1.0/src/ipsak/lookups/__init__.py +131 -0
- ipsak-0.1.0/src/ipsak/lookups/asn.py +63 -0
- ipsak-0.1.0/src/ipsak/lookups/bogon.py +62 -0
- ipsak-0.1.0/src/ipsak/lookups/dns.py +49 -0
- ipsak-0.1.0/src/ipsak/lookups/geo.py +33 -0
- ipsak-0.1.0/src/ipsak/lookups/myip.py +115 -0
- ipsak-0.1.0/src/ipsak/lookups/reputation.py +57 -0
- ipsak-0.1.0/src/ipsak/lookups/rpki.py +40 -0
- ipsak-0.1.0/src/ipsak/lookups/subnet.py +38 -0
- ipsak-0.1.0/src/ipsak/lookups/trace.py +327 -0
- ipsak-0.1.0/src/ipsak/lookups/trace_engine.py +299 -0
- ipsak-0.1.0/src/ipsak/lookups/whois.py +85 -0
- ipsak-0.1.0/src/ipsak/models.py +153 -0
- ipsak-0.1.0/src/ipsak/resolve.py +72 -0
- ipsak-0.1.0/uv.lock +407 -0
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main]
|
|
8
|
+
|
|
9
|
+
permissions:
|
|
10
|
+
contents: read
|
|
11
|
+
|
|
12
|
+
concurrency:
|
|
13
|
+
group: ci-${{ github.ref }}
|
|
14
|
+
cancel-in-progress: true
|
|
15
|
+
|
|
16
|
+
jobs:
|
|
17
|
+
lint:
|
|
18
|
+
name: Lint
|
|
19
|
+
runs-on: ubuntu-latest
|
|
20
|
+
steps:
|
|
21
|
+
- name: Check out repository
|
|
22
|
+
uses: actions/checkout@v4
|
|
23
|
+
|
|
24
|
+
- name: Install uv
|
|
25
|
+
uses: astral-sh/setup-uv@v5
|
|
26
|
+
with:
|
|
27
|
+
python-version: "3.12"
|
|
28
|
+
|
|
29
|
+
- name: Install dependencies
|
|
30
|
+
run: uv sync
|
|
31
|
+
|
|
32
|
+
- name: Ruff format check
|
|
33
|
+
run: uv run ruff format --check .
|
|
34
|
+
|
|
35
|
+
- name: Ruff lint
|
|
36
|
+
run: uv run ruff check .
|
|
37
|
+
|
|
38
|
+
build:
|
|
39
|
+
name: Build (Python ${{ matrix.python-version }})
|
|
40
|
+
runs-on: ubuntu-latest
|
|
41
|
+
strategy:
|
|
42
|
+
fail-fast: false
|
|
43
|
+
matrix:
|
|
44
|
+
python-version: ["3.11", "3.12", "3.13"]
|
|
45
|
+
steps:
|
|
46
|
+
- name: Check out repository
|
|
47
|
+
uses: actions/checkout@v4
|
|
48
|
+
|
|
49
|
+
- name: Install uv
|
|
50
|
+
uses: astral-sh/setup-uv@v5
|
|
51
|
+
with:
|
|
52
|
+
python-version: ${{ matrix.python-version }}
|
|
53
|
+
|
|
54
|
+
- name: Install package
|
|
55
|
+
run: uv sync
|
|
56
|
+
|
|
57
|
+
- name: CLI smoke test
|
|
58
|
+
run: uv run ipsak --version
|
|
59
|
+
|
|
60
|
+
- name: Build sdist and wheel
|
|
61
|
+
run: uv build
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
name: Publish to PyPI
|
|
2
|
+
|
|
3
|
+
# Publishes `ipsak` to PyPI whenever a GitHub release is published.
|
|
4
|
+
# Uses PyPI trusted publishing (OIDC) — no API token required. Configure once at:
|
|
5
|
+
# https://pypi.org/manage/project/ipsak/settings/publishing/
|
|
6
|
+
# with:
|
|
7
|
+
# - Owner: linsomniac
|
|
8
|
+
# - Repository: ipsak
|
|
9
|
+
# - Workflow name: release.yml
|
|
10
|
+
# - Environment: pypi
|
|
11
|
+
|
|
12
|
+
on:
|
|
13
|
+
release:
|
|
14
|
+
types: [published]
|
|
15
|
+
workflow_dispatch:
|
|
16
|
+
|
|
17
|
+
permissions:
|
|
18
|
+
contents: read
|
|
19
|
+
|
|
20
|
+
jobs:
|
|
21
|
+
build:
|
|
22
|
+
name: Build distribution
|
|
23
|
+
runs-on: ubuntu-latest
|
|
24
|
+
steps:
|
|
25
|
+
- name: Check out repository
|
|
26
|
+
uses: actions/checkout@v4
|
|
27
|
+
|
|
28
|
+
- name: Install uv
|
|
29
|
+
uses: astral-sh/setup-uv@v5
|
|
30
|
+
with:
|
|
31
|
+
python-version: "3.12"
|
|
32
|
+
|
|
33
|
+
- name: Build sdist and wheel
|
|
34
|
+
run: uv build
|
|
35
|
+
|
|
36
|
+
- name: Upload distributions
|
|
37
|
+
uses: actions/upload-artifact@v4
|
|
38
|
+
with:
|
|
39
|
+
name: dist
|
|
40
|
+
path: dist/
|
|
41
|
+
if-no-files-found: error
|
|
42
|
+
|
|
43
|
+
publish:
|
|
44
|
+
name: Publish to PyPI
|
|
45
|
+
needs: build
|
|
46
|
+
runs-on: ubuntu-latest
|
|
47
|
+
environment:
|
|
48
|
+
name: pypi
|
|
49
|
+
url: https://pypi.org/p/ipsak
|
|
50
|
+
permissions:
|
|
51
|
+
id-token: write # required for trusted publishing
|
|
52
|
+
steps:
|
|
53
|
+
- name: Download distributions
|
|
54
|
+
uses: actions/download-artifact@v4
|
|
55
|
+
with:
|
|
56
|
+
name: dist
|
|
57
|
+
path: dist/
|
|
58
|
+
|
|
59
|
+
- name: Publish to PyPI
|
|
60
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
ipsak-0.1.0/.gitignore
ADDED
ipsak-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
CC0 1.0 Universal
|
|
2
|
+
|
|
3
|
+
Statement of Purpose
|
|
4
|
+
|
|
5
|
+
The laws of most jurisdictions throughout the world automatically confer
|
|
6
|
+
exclusive Copyright and Related Rights (defined below) upon the creator and
|
|
7
|
+
subsequent owner(s) (each and all, an "owner") of an original work of
|
|
8
|
+
authorship and/or a database (each, a "Work").
|
|
9
|
+
|
|
10
|
+
Certain owners wish to permanently relinquish those rights to a Work for the
|
|
11
|
+
purpose of contributing to a commons of creative, cultural and scientific
|
|
12
|
+
works ("Commons") that the public can reliably and without fear of later
|
|
13
|
+
claims of infringement build upon, modify, incorporate in other works, reuse
|
|
14
|
+
and redistribute as freely as possible in any form whatsoever and for any
|
|
15
|
+
purposes, including without limitation commercial purposes. These owners may
|
|
16
|
+
contribute to the Commons to promote the ideal of a free culture and the
|
|
17
|
+
further production of creative, cultural and scientific works, or to gain
|
|
18
|
+
reputation or greater distribution for their Work in part through the use and
|
|
19
|
+
efforts of others.
|
|
20
|
+
|
|
21
|
+
For these and/or other purposes and motivations, and without any expectation
|
|
22
|
+
of additional consideration or compensation, the person associating CC0 with a
|
|
23
|
+
Work (the "Affirmer"), to the extent that he or she is an owner of Copyright
|
|
24
|
+
and Related Rights in the Work, voluntarily elects to apply CC0 to the Work
|
|
25
|
+
and publicly distribute the Work under its terms, with knowledge of his or her
|
|
26
|
+
Copyright and Related Rights in the Work and the meaning and intended legal
|
|
27
|
+
effect of CC0 on those rights.
|
|
28
|
+
|
|
29
|
+
1. Copyright and Related Rights. A Work made available under CC0 may be
|
|
30
|
+
protected by copyright and related or neighboring rights ("Copyright and
|
|
31
|
+
Related Rights"). Copyright and Related Rights include, but are not limited
|
|
32
|
+
to, the following:
|
|
33
|
+
|
|
34
|
+
i. the right to reproduce, adapt, distribute, perform, display, communicate,
|
|
35
|
+
and translate a Work;
|
|
36
|
+
|
|
37
|
+
ii. moral rights retained by the original author(s) and/or performer(s);
|
|
38
|
+
|
|
39
|
+
iii. publicity and privacy rights pertaining to a person's image or likeness
|
|
40
|
+
depicted in a Work;
|
|
41
|
+
|
|
42
|
+
iv. rights protecting against unfair competition in regards to a Work,
|
|
43
|
+
subject to the limitations in paragraph 4(a), below;
|
|
44
|
+
|
|
45
|
+
v. rights protecting the extraction, dissemination, use and reuse of data in
|
|
46
|
+
a Work;
|
|
47
|
+
|
|
48
|
+
vi. database rights (such as those arising under Directive 96/9/EC of the
|
|
49
|
+
European Parliament and of the Council of 11 March 1996 on the legal
|
|
50
|
+
protection of databases, and under any national implementation thereof,
|
|
51
|
+
including any amended or successor version of such directive); and
|
|
52
|
+
|
|
53
|
+
vii. other similar, equivalent or corresponding rights throughout the world
|
|
54
|
+
based on applicable law or treaty, and any national implementations thereof.
|
|
55
|
+
|
|
56
|
+
2. Waiver. To the greatest extent permitted by, but not in contravention of,
|
|
57
|
+
applicable law, Affirmer hereby overtly, fully, permanently, irrevocably and
|
|
58
|
+
unconditionally waives, abandons, and surrenders all of Affirmer's Copyright
|
|
59
|
+
and Related Rights and associated claims and causes of action, whether now
|
|
60
|
+
known or unknown (including existing as well as future claims and causes of
|
|
61
|
+
action), in the Work (i) in all territories worldwide, (ii) for the maximum
|
|
62
|
+
duration provided by applicable law or treaty (including future time
|
|
63
|
+
extensions), (iii) in any current or future medium and for any number of
|
|
64
|
+
copies, and (iv) for any purpose whatsoever, including without limitation
|
|
65
|
+
commercial, advertising or promotional purposes (the "Waiver"). Affirmer makes
|
|
66
|
+
the Waiver for the benefit of each member of the public at large and to the
|
|
67
|
+
detriment of Affirmer's heirs and successors, fully intending that such Waiver
|
|
68
|
+
shall not be subject to revocation, rescission, cancellation, termination, or
|
|
69
|
+
any other legal or equitable action to disrupt the quiet enjoyment of the Work
|
|
70
|
+
by the public as contemplated by Affirmer's express Statement of Purpose.
|
|
71
|
+
|
|
72
|
+
3. Public License Fallback. Should any part of the Waiver for any reason be
|
|
73
|
+
judged legally invalid or ineffective under applicable law, then the Waiver
|
|
74
|
+
shall be preserved to the maximum extent permitted taking into account
|
|
75
|
+
Affirmer's express Statement of Purpose. In addition, to the extent the Waiver
|
|
76
|
+
is so judged Affirmer hereby grants to each affected person a royalty-free,
|
|
77
|
+
non transferable, non sublicensable, non exclusive, irrevocable and
|
|
78
|
+
unconditional license to exercise Affirmer's Copyright and Related Rights in
|
|
79
|
+
the Work (i) in all territories worldwide, (ii) for the maximum duration
|
|
80
|
+
provided by applicable law or treaty (including future time extensions), (iii)
|
|
81
|
+
in any current or future medium and for any number of copies, and (iv) for any
|
|
82
|
+
purpose whatsoever, including without limitation commercial, advertising or
|
|
83
|
+
promotional purposes (the "License"). The License shall be deemed effective as
|
|
84
|
+
of the date CC0 was applied by Affirmer to the Work. Should any part of the
|
|
85
|
+
License for any reason be judged legally invalid or ineffective under
|
|
86
|
+
applicable law, such partial invalidity or ineffectiveness shall not invalidate
|
|
87
|
+
the remainder of the License, and in such case Affirmer hereby affirms that he
|
|
88
|
+
or she will not (i) exercise any of his or her remaining Copyright and Related
|
|
89
|
+
Rights in the Work or (ii) assert any associated claims and causes of action
|
|
90
|
+
with respect to the Work, in either case contrary to Affirmer's express
|
|
91
|
+
Statement of Purpose.
|
|
92
|
+
|
|
93
|
+
4. Limitations and Disclaimers.
|
|
94
|
+
|
|
95
|
+
a. No trademark or patent rights held by Affirmer are waived, abandoned,
|
|
96
|
+
surrendered, licensed or otherwise affected by this document.
|
|
97
|
+
|
|
98
|
+
b. Affirmer offers the Work as-is and makes no representations or warranties
|
|
99
|
+
of any kind concerning the Work, express, implied, statutory or otherwise,
|
|
100
|
+
including without limitation warranties of title, merchantability, fitness
|
|
101
|
+
for a particular purpose, non infringement, or the absence of latent or
|
|
102
|
+
other defects, accuracy, or the present or absence of errors, whether or not
|
|
103
|
+
discoverable, all to the greatest extent permissible under applicable law.
|
|
104
|
+
|
|
105
|
+
c. Affirmer disclaims responsibility for clearing rights of other persons
|
|
106
|
+
that may apply to the Work or any use thereof, including without limitation
|
|
107
|
+
any person's Copyright and Related Rights in the Work. Further, Affirmer
|
|
108
|
+
disclaims responsibility for obtaining any necessary consents, permissions or
|
|
109
|
+
other rights required for any use of the Work.
|
|
110
|
+
|
|
111
|
+
d. Affirmer understands and acknowledges that Creative Commons is not a
|
|
112
|
+
party to this document and has no duty or obligation with respect to this CC0
|
|
113
|
+
or use of the Work.
|
|
114
|
+
|
|
115
|
+
For more information, please see
|
|
116
|
+
<http://creativecommons.org/publicdomain/zero/1.0/>
|
ipsak-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: ipsak
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: The IP Swiss Army Knife — fast IP, CIDR, and domain information queries for network operations
|
|
5
|
+
Project-URL: Homepage, https://github.com/linsomniac/ipsak
|
|
6
|
+
Project-URL: Repository, https://github.com/linsomniac/ipsak
|
|
7
|
+
Project-URL: Issues, https://github.com/linsomniac/ipsak/issues
|
|
8
|
+
Project-URL: Changelog, https://github.com/linsomniac/ipsak/releases
|
|
9
|
+
Author: Sean Reifschneider
|
|
10
|
+
License-Expression: CC0-1.0
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Keywords: asn,cidr,dns,dnsbl,geolocation,ip,networking,rpki,traceroute,whois
|
|
13
|
+
Classifier: Development Status :: 4 - Beta
|
|
14
|
+
Classifier: Environment :: Console
|
|
15
|
+
Classifier: Intended Audience :: Information Technology
|
|
16
|
+
Classifier: Intended Audience :: System Administrators
|
|
17
|
+
Classifier: Intended Audience :: Telecommunications Industry
|
|
18
|
+
Classifier: Operating System :: MacOS :: MacOS X
|
|
19
|
+
Classifier: Operating System :: POSIX
|
|
20
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
21
|
+
Classifier: Programming Language :: Python
|
|
22
|
+
Classifier: Programming Language :: Python :: 3
|
|
23
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
24
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
25
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
26
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
27
|
+
Classifier: Topic :: Internet
|
|
28
|
+
Classifier: Topic :: System :: Networking
|
|
29
|
+
Classifier: Topic :: System :: Networking :: Monitoring
|
|
30
|
+
Classifier: Topic :: System :: Systems Administration
|
|
31
|
+
Classifier: Topic :: Utilities
|
|
32
|
+
Requires-Python: >=3.11
|
|
33
|
+
Requires-Dist: dnspython>=2.6
|
|
34
|
+
Requires-Dist: httpx>=0.27
|
|
35
|
+
Requires-Dist: ipwhois>=1.3
|
|
36
|
+
Requires-Dist: rich>=13.0
|
|
37
|
+
Requires-Dist: typer>=0.12
|
|
38
|
+
Description-Content-Type: text/markdown
|
|
39
|
+
|
|
40
|
+
# ipsak
|
|
41
|
+
|
|
42
|
+
The IP Swiss Army Knife -- fast IP, CIDR, and domain information queries for network operations.
|
|
43
|
+
|
|
44
|
+
One command gives you ASN, geolocation, WHOIS, DNS, RPKI validation, DNSBL reputation, subnet math, and traceroute -- all in parallel.
|
|
45
|
+
|
|
46
|
+
## Quickstart
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
uvx ipsak 8.8.8.8
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Demo
|
|
53
|
+
|
|
54
|
+
```
|
|
55
|
+
$ ipsak 8.8.8.8
|
|
56
|
+
|
|
57
|
+
8.8.8.8 · dns.google · AS15169 GOOGLE - Google LLC, US · Ashburn, US · Public
|
|
58
|
+
|
|
59
|
+
Network Location
|
|
60
|
+
ASN AS15169 Country United States (US)
|
|
61
|
+
Org GOOGLE - Google LLC, US Region Virginia
|
|
62
|
+
Prefix 8.8.8.0/24 City Ashburn
|
|
63
|
+
RIR ARIN ISP Google LLC
|
|
64
|
+
RPKI ✓ Valid Org Google Public DNS
|
|
65
|
+
WHOIS TZ America/New_York
|
|
66
|
+
Range 8.8.8.0 - 8.8.8.255 Coords 39.0300, -77.5000
|
|
67
|
+
Name GOGL
|
|
68
|
+
Org Google LLC Reputation
|
|
69
|
+
Abuse network-abuse@google.com DNSBL Clean (6 lists checked)
|
|
70
|
+
Country US
|
|
71
|
+
Created 2023-12-28
|
|
72
|
+
Updated 2023-12-28
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
```
|
|
76
|
+
$ ipsak dns google.com
|
|
77
|
+
|
|
78
|
+
google.com DNS
|
|
79
|
+
A 142.251.35.142
|
|
80
|
+
AAAA 2607:f8b0:400f:801::200e
|
|
81
|
+
MX 10 smtp.google.com.
|
|
82
|
+
NS ns1.google.com.
|
|
83
|
+
ns4.google.com.
|
|
84
|
+
ns2.google.com.
|
|
85
|
+
ns3.google.com.
|
|
86
|
+
TXT "v=spf1 include:_spf.google.com ~all"
|
|
87
|
+
...
|
|
88
|
+
SOA ns1.google.com. dns-admin.google.com. ...
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
```
|
|
92
|
+
$ ipsak calc 10.0.0.0/24
|
|
93
|
+
|
|
94
|
+
10.0.0.0/24 Subnet
|
|
95
|
+
Network 10.0.0.0
|
|
96
|
+
Broadcast 10.0.0.255
|
|
97
|
+
Netmask 255.255.255.0
|
|
98
|
+
Wildcard 0.0.0.255
|
|
99
|
+
Prefix /24
|
|
100
|
+
First Host 10.0.0.1
|
|
101
|
+
Last Host 10.0.0.254
|
|
102
|
+
Addresses 256
|
|
103
|
+
Usable 254
|
|
104
|
+
IP Version IPv4
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
## Install
|
|
108
|
+
|
|
109
|
+
Requires Python 3.11+.
|
|
110
|
+
|
|
111
|
+
### Run without installing
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
uvx ipsak 8.8.8.8
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
### Install with uv
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
uv tool install ipsak
|
|
121
|
+
ipsak 8.8.8.8
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
### Install with pipx or pip
|
|
125
|
+
|
|
126
|
+
```bash
|
|
127
|
+
pipx install ipsak
|
|
128
|
+
# or
|
|
129
|
+
pip install ipsak
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
### Install from source
|
|
133
|
+
|
|
134
|
+
```bash
|
|
135
|
+
git clone https://github.com/linsomniac/ipsak.git
|
|
136
|
+
cd ipsak
|
|
137
|
+
uv tool install .
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
## Usage
|
|
141
|
+
|
|
142
|
+
```
|
|
143
|
+
ipsak <target> # Full info (ASN, geo, WHOIS, DNS, RPKI, reputation)
|
|
144
|
+
ipsak dns <domain|ip> # DNS records or reverse DNS
|
|
145
|
+
ipsak whois <target> # WHOIS/RDAP lookup
|
|
146
|
+
ipsak calc <cidr> # Subnet calculator
|
|
147
|
+
ipsak trace <target> # Traceroute (fast parallel ICMP; needs root for raw sockets)
|
|
148
|
+
ipsak myip # Show public and local IP addresses
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
The target can be an IPv4/IPv6 address, a CIDR block, or a domain name. When no subcommand is given, `ipsak` defaults to `info`.
|
|
152
|
+
|
|
153
|
+
### Options
|
|
154
|
+
|
|
155
|
+
| Flag | Description |
|
|
156
|
+
|------|-------------|
|
|
157
|
+
| `--json` / `-j` | Output as JSON |
|
|
158
|
+
| `--trace` / `-t` | Include traceroute in info output |
|
|
159
|
+
| `--timeout` / `-T` | Lookup timeout in seconds (default: 10) |
|
|
160
|
+
| `--version` / `-V` | Show version |
|
|
161
|
+
|
|
162
|
+
### Traceroute
|
|
163
|
+
|
|
164
|
+
`ipsak trace` uses a fast parallel raw-ICMP engine when it has the privileges to
|
|
165
|
+
open raw sockets (root, `sudo`, or `CAP_NET_RAW`). If it doesn't, it falls back
|
|
166
|
+
to the system `traceroute` or `tracepath` binary.
|
|
167
|
+
|
|
168
|
+
```bash
|
|
169
|
+
sudo ipsak trace 8.8.8.8
|
|
170
|
+
# or grant the capability once:
|
|
171
|
+
sudo setcap cap_net_raw+ep "$(readlink -f "$(which ipsak)")"
|
|
172
|
+
ipsak trace 8.8.8.8
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
## What it queries
|
|
176
|
+
|
|
177
|
+
All lookups run concurrently for fast results:
|
|
178
|
+
|
|
179
|
+
- **ASN** -- Team Cymru DNS mapping
|
|
180
|
+
- **Geolocation** -- ip-api.com
|
|
181
|
+
- **WHOIS/RDAP** -- via ipwhois library
|
|
182
|
+
- **DNS** -- forward (A, AAAA, CNAME, MX, NS, TXT, SOA) and reverse (PTR)
|
|
183
|
+
- **RPKI** -- Cloudflare RPKI validator
|
|
184
|
+
- **Reputation** -- DNSBL checks (Spamhaus, Barracuda, SORBS, etc.)
|
|
185
|
+
- **Bogon detection** -- RFC 1918, RFC 5737, loopback, link-local, etc.
|
|
186
|
+
- **Subnet calculator** -- network/broadcast/host range math
|
|
187
|
+
|
|
188
|
+
## License
|
|
189
|
+
|
|
190
|
+
CC0 1.0 Universal -- public domain. See [LICENSE](LICENSE).
|
ipsak-0.1.0/README.md
ADDED
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
# ipsak
|
|
2
|
+
|
|
3
|
+
The IP Swiss Army Knife -- fast IP, CIDR, and domain information queries for network operations.
|
|
4
|
+
|
|
5
|
+
One command gives you ASN, geolocation, WHOIS, DNS, RPKI validation, DNSBL reputation, subnet math, and traceroute -- all in parallel.
|
|
6
|
+
|
|
7
|
+
## Quickstart
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
uvx ipsak 8.8.8.8
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Demo
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
$ ipsak 8.8.8.8
|
|
17
|
+
|
|
18
|
+
8.8.8.8 · dns.google · AS15169 GOOGLE - Google LLC, US · Ashburn, US · Public
|
|
19
|
+
|
|
20
|
+
Network Location
|
|
21
|
+
ASN AS15169 Country United States (US)
|
|
22
|
+
Org GOOGLE - Google LLC, US Region Virginia
|
|
23
|
+
Prefix 8.8.8.0/24 City Ashburn
|
|
24
|
+
RIR ARIN ISP Google LLC
|
|
25
|
+
RPKI ✓ Valid Org Google Public DNS
|
|
26
|
+
WHOIS TZ America/New_York
|
|
27
|
+
Range 8.8.8.0 - 8.8.8.255 Coords 39.0300, -77.5000
|
|
28
|
+
Name GOGL
|
|
29
|
+
Org Google LLC Reputation
|
|
30
|
+
Abuse network-abuse@google.com DNSBL Clean (6 lists checked)
|
|
31
|
+
Country US
|
|
32
|
+
Created 2023-12-28
|
|
33
|
+
Updated 2023-12-28
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
```
|
|
37
|
+
$ ipsak dns google.com
|
|
38
|
+
|
|
39
|
+
google.com DNS
|
|
40
|
+
A 142.251.35.142
|
|
41
|
+
AAAA 2607:f8b0:400f:801::200e
|
|
42
|
+
MX 10 smtp.google.com.
|
|
43
|
+
NS ns1.google.com.
|
|
44
|
+
ns4.google.com.
|
|
45
|
+
ns2.google.com.
|
|
46
|
+
ns3.google.com.
|
|
47
|
+
TXT "v=spf1 include:_spf.google.com ~all"
|
|
48
|
+
...
|
|
49
|
+
SOA ns1.google.com. dns-admin.google.com. ...
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
```
|
|
53
|
+
$ ipsak calc 10.0.0.0/24
|
|
54
|
+
|
|
55
|
+
10.0.0.0/24 Subnet
|
|
56
|
+
Network 10.0.0.0
|
|
57
|
+
Broadcast 10.0.0.255
|
|
58
|
+
Netmask 255.255.255.0
|
|
59
|
+
Wildcard 0.0.0.255
|
|
60
|
+
Prefix /24
|
|
61
|
+
First Host 10.0.0.1
|
|
62
|
+
Last Host 10.0.0.254
|
|
63
|
+
Addresses 256
|
|
64
|
+
Usable 254
|
|
65
|
+
IP Version IPv4
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Install
|
|
69
|
+
|
|
70
|
+
Requires Python 3.11+.
|
|
71
|
+
|
|
72
|
+
### Run without installing
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
uvx ipsak 8.8.8.8
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### Install with uv
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
uv tool install ipsak
|
|
82
|
+
ipsak 8.8.8.8
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### Install with pipx or pip
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
pipx install ipsak
|
|
89
|
+
# or
|
|
90
|
+
pip install ipsak
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### Install from source
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
git clone https://github.com/linsomniac/ipsak.git
|
|
97
|
+
cd ipsak
|
|
98
|
+
uv tool install .
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
## Usage
|
|
102
|
+
|
|
103
|
+
```
|
|
104
|
+
ipsak <target> # Full info (ASN, geo, WHOIS, DNS, RPKI, reputation)
|
|
105
|
+
ipsak dns <domain|ip> # DNS records or reverse DNS
|
|
106
|
+
ipsak whois <target> # WHOIS/RDAP lookup
|
|
107
|
+
ipsak calc <cidr> # Subnet calculator
|
|
108
|
+
ipsak trace <target> # Traceroute (fast parallel ICMP; needs root for raw sockets)
|
|
109
|
+
ipsak myip # Show public and local IP addresses
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
The target can be an IPv4/IPv6 address, a CIDR block, or a domain name. When no subcommand is given, `ipsak` defaults to `info`.
|
|
113
|
+
|
|
114
|
+
### Options
|
|
115
|
+
|
|
116
|
+
| Flag | Description |
|
|
117
|
+
|------|-------------|
|
|
118
|
+
| `--json` / `-j` | Output as JSON |
|
|
119
|
+
| `--trace` / `-t` | Include traceroute in info output |
|
|
120
|
+
| `--timeout` / `-T` | Lookup timeout in seconds (default: 10) |
|
|
121
|
+
| `--version` / `-V` | Show version |
|
|
122
|
+
|
|
123
|
+
### Traceroute
|
|
124
|
+
|
|
125
|
+
`ipsak trace` uses a fast parallel raw-ICMP engine when it has the privileges to
|
|
126
|
+
open raw sockets (root, `sudo`, or `CAP_NET_RAW`). If it doesn't, it falls back
|
|
127
|
+
to the system `traceroute` or `tracepath` binary.
|
|
128
|
+
|
|
129
|
+
```bash
|
|
130
|
+
sudo ipsak trace 8.8.8.8
|
|
131
|
+
# or grant the capability once:
|
|
132
|
+
sudo setcap cap_net_raw+ep "$(readlink -f "$(which ipsak)")"
|
|
133
|
+
ipsak trace 8.8.8.8
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
## What it queries
|
|
137
|
+
|
|
138
|
+
All lookups run concurrently for fast results:
|
|
139
|
+
|
|
140
|
+
- **ASN** -- Team Cymru DNS mapping
|
|
141
|
+
- **Geolocation** -- ip-api.com
|
|
142
|
+
- **WHOIS/RDAP** -- via ipwhois library
|
|
143
|
+
- **DNS** -- forward (A, AAAA, CNAME, MX, NS, TXT, SOA) and reverse (PTR)
|
|
144
|
+
- **RPKI** -- Cloudflare RPKI validator
|
|
145
|
+
- **Reputation** -- DNSBL checks (Spamhaus, Barracuda, SORBS, etc.)
|
|
146
|
+
- **Bogon detection** -- RFC 1918, RFC 5737, loopback, link-local, etc.
|
|
147
|
+
- **Subnet calculator** -- network/broadcast/host range math
|
|
148
|
+
|
|
149
|
+
## License
|
|
150
|
+
|
|
151
|
+
CC0 1.0 Universal -- public domain. See [LICENSE](LICENSE).
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "ipsak"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
description = "The IP Swiss Army Knife — fast IP, CIDR, and domain information queries for network operations"
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
license = "CC0-1.0"
|
|
7
|
+
license-files = ["LICENSE"]
|
|
8
|
+
requires-python = ">=3.11"
|
|
9
|
+
authors = [
|
|
10
|
+
{ name = "Sean Reifschneider" },
|
|
11
|
+
]
|
|
12
|
+
keywords = [
|
|
13
|
+
"ip",
|
|
14
|
+
"cidr",
|
|
15
|
+
"whois",
|
|
16
|
+
"dns",
|
|
17
|
+
"asn",
|
|
18
|
+
"geolocation",
|
|
19
|
+
"rpki",
|
|
20
|
+
"dnsbl",
|
|
21
|
+
"traceroute",
|
|
22
|
+
"networking",
|
|
23
|
+
]
|
|
24
|
+
classifiers = [
|
|
25
|
+
"Development Status :: 4 - Beta",
|
|
26
|
+
"Environment :: Console",
|
|
27
|
+
"Intended Audience :: System Administrators",
|
|
28
|
+
"Intended Audience :: Information Technology",
|
|
29
|
+
"Intended Audience :: Telecommunications Industry",
|
|
30
|
+
"Operating System :: POSIX",
|
|
31
|
+
"Operating System :: POSIX :: Linux",
|
|
32
|
+
"Operating System :: MacOS :: MacOS X",
|
|
33
|
+
"Programming Language :: Python",
|
|
34
|
+
"Programming Language :: Python :: 3",
|
|
35
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
36
|
+
"Programming Language :: Python :: 3.11",
|
|
37
|
+
"Programming Language :: Python :: 3.12",
|
|
38
|
+
"Programming Language :: Python :: 3.13",
|
|
39
|
+
"Topic :: Internet",
|
|
40
|
+
"Topic :: System :: Networking",
|
|
41
|
+
"Topic :: System :: Networking :: Monitoring",
|
|
42
|
+
"Topic :: System :: Systems Administration",
|
|
43
|
+
"Topic :: Utilities",
|
|
44
|
+
]
|
|
45
|
+
dependencies = [
|
|
46
|
+
"dnspython>=2.6",
|
|
47
|
+
"ipwhois>=1.3",
|
|
48
|
+
"httpx>=0.27",
|
|
49
|
+
"typer>=0.12",
|
|
50
|
+
"rich>=13.0",
|
|
51
|
+
]
|
|
52
|
+
|
|
53
|
+
# AIDEV-NOTE: Traceroute now uses raw ICMP sockets directly (no icmplib needed).
|
|
54
|
+
# Requires root or CAP_NET_RAW for the fast parallel engine; falls back to
|
|
55
|
+
# system traceroute/tracepath when unprivileged.
|
|
56
|
+
|
|
57
|
+
[project.urls]
|
|
58
|
+
Homepage = "https://github.com/linsomniac/ipsak"
|
|
59
|
+
Repository = "https://github.com/linsomniac/ipsak"
|
|
60
|
+
Issues = "https://github.com/linsomniac/ipsak/issues"
|
|
61
|
+
Changelog = "https://github.com/linsomniac/ipsak/releases"
|
|
62
|
+
|
|
63
|
+
[project.scripts]
|
|
64
|
+
ipsak = "ipsak.cli:app"
|
|
65
|
+
|
|
66
|
+
[build-system]
|
|
67
|
+
requires = ["hatchling"]
|
|
68
|
+
build-backend = "hatchling.build"
|
|
69
|
+
|
|
70
|
+
[tool.hatch.build.targets.wheel]
|
|
71
|
+
packages = ["src/ipsak"]
|
|
72
|
+
|
|
73
|
+
[dependency-groups]
|
|
74
|
+
dev = [
|
|
75
|
+
"mypy>=1.10",
|
|
76
|
+
"ruff>=0.6",
|
|
77
|
+
]
|
|
78
|
+
|
|
79
|
+
[tool.ruff]
|
|
80
|
+
line-length = 100
|
|
81
|
+
|
|
82
|
+
[tool.mypy]
|
|
83
|
+
python_version = "3.11"
|
|
84
|
+
warn_return_any = true
|
|
85
|
+
warn_unused_configs = true
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# /// script
|
|
2
|
+
# requires-python = ">=3.11"
|
|
3
|
+
# dependencies = [
|
|
4
|
+
# "dnspython>=2.6",
|
|
5
|
+
# "ipwhois>=1.3",
|
|
6
|
+
# "httpx>=0.27",
|
|
7
|
+
# "typer>=0.12",
|
|
8
|
+
# "rich>=13.0",
|
|
9
|
+
# ]
|
|
10
|
+
# ///
|
|
11
|
+
"""Allow running as `python -m ipsak` or `uv run src/ipsak/__main__.py`."""
|
|
12
|
+
|
|
13
|
+
from ipsak.cli import app
|
|
14
|
+
|
|
15
|
+
app()
|