capsight 0.2.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.
- capsight-0.2.0/.github/workflows/ci.yml +22 -0
- capsight-0.2.0/.github/workflows/release.yml +35 -0
- capsight-0.2.0/.gitignore +234 -0
- capsight-0.2.0/.streamlit/config.toml +13 -0
- capsight-0.2.0/CHANGELOG.md +29 -0
- capsight-0.2.0/LICENSE +21 -0
- capsight-0.2.0/PKG-INFO +261 -0
- capsight-0.2.0/README.md +240 -0
- capsight-0.2.0/docs/PLAN.md +91 -0
- capsight-0.2.0/docs/ROADMAP.md +74 -0
- capsight-0.2.0/docs/VALIDATION.md +132 -0
- capsight-0.2.0/docs/img/demo.svg +36 -0
- capsight-0.2.0/packages.txt +1 -0
- capsight-0.2.0/pyproject.toml +47 -0
- capsight-0.2.0/requirements.txt +1 -0
- capsight-0.2.0/samples/public/SOURCES.md +7 -0
- capsight-0.2.0/samples/synthetic/attach-user-unknown.pcap +0 -0
- capsight-0.2.0/samples/synthetic/ipv4v6-rejected.pcap +0 -0
- capsight-0.2.0/samples/synthetic/radius-accept-then-reject.pcap +0 -0
- capsight-0.2.0/samples/synthetic/wrong-apn.pcap +0 -0
- capsight-0.2.0/scripts/make_demo_captures.py +86 -0
- capsight-0.2.0/scripts/make_demo_svg.py +87 -0
- capsight-0.2.0/src/capsight/__init__.py +3 -0
- capsight-0.2.0/src/capsight/cli.py +171 -0
- capsight-0.2.0/src/capsight/codes.py +257 -0
- capsight-0.2.0/src/capsight/codes_5g.py +258 -0
- capsight-0.2.0/src/capsight/correlate.py +268 -0
- capsight-0.2.0/src/capsight/decode.py +167 -0
- capsight-0.2.0/src/capsight/engine.py +145 -0
- capsight-0.2.0/src/capsight/fields.py +80 -0
- capsight-0.2.0/src/capsight/identity.py +66 -0
- capsight-0.2.0/src/capsight/model.py +50 -0
- capsight-0.2.0/src/capsight/redact.py +79 -0
- capsight-0.2.0/src/capsight/rules.py +522 -0
- capsight-0.2.0/src/capsight/rules_5g.py +322 -0
- capsight-0.2.0/src/capsight/summary.py +116 -0
- capsight-0.2.0/src/capsight/timeline.py +238 -0
- capsight-0.2.0/src/capsight/web.py +116 -0
- capsight-0.2.0/tests/conftest.py +82 -0
- capsight-0.2.0/tests/pcapgen.py +246 -0
- capsight-0.2.0/tests/test_5g.py +221 -0
- capsight-0.2.0/tests/test_cli.py +34 -0
- capsight-0.2.0/tests/test_decode.py +55 -0
- capsight-0.2.0/tests/test_decode_memory.py +59 -0
- capsight-0.2.0/tests/test_operator_patterns.py +131 -0
- capsight-0.2.0/tests/test_redact.py +76 -0
- capsight-0.2.0/tests/test_rules_e2e.py +62 -0
- capsight-0.2.0/tests/test_rules_unit.py +90 -0
- capsight-0.2.0/tests/test_streaming.py +41 -0
- capsight-0.2.0/tests/test_summary.py +89 -0
- capsight-0.2.0/tests/test_timeline.py +148 -0
- capsight-0.2.0/tests/test_web.py +44 -0
- capsight-0.2.0/uv.lock +1528 -0
- capsight-0.2.0/web/.streamlit/config.toml +13 -0
- capsight-0.2.0/web/Dockerfile +19 -0
- capsight-0.2.0/web/README.md +13 -0
- capsight-0.2.0/web/requirements.txt +1 -0
- capsight-0.2.0/web/streamlit_app.py +363 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
name: ci
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
test:
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
steps:
|
|
12
|
+
- uses: actions/checkout@v4
|
|
13
|
+
- name: Install tshark
|
|
14
|
+
run: |
|
|
15
|
+
sudo apt-get update
|
|
16
|
+
echo "wireshark-common wireshark-common/install-setuid boolean false" | sudo debconf-set-selections
|
|
17
|
+
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y tshark
|
|
18
|
+
- uses: astral-sh/setup-uv@v6
|
|
19
|
+
- run: uv sync
|
|
20
|
+
- run: uv run ruff check .
|
|
21
|
+
- run: uv run ruff format --check .
|
|
22
|
+
- run: uv run pytest -q
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
name: release
|
|
2
|
+
|
|
3
|
+
# Publishes to PyPI when a GitHub Release is published.
|
|
4
|
+
# Uses PyPI trusted publishing (no API token stored in the repo). One-time setup on PyPI:
|
|
5
|
+
# Account -> Publishing -> Add a pending publisher:
|
|
6
|
+
# project: capsight, owner: Kx96xx, repo: capsight, workflow: release.yml, environment: pypi
|
|
7
|
+
|
|
8
|
+
on:
|
|
9
|
+
release:
|
|
10
|
+
types: [published]
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
build:
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
steps:
|
|
16
|
+
- uses: actions/checkout@v4
|
|
17
|
+
- uses: astral-sh/setup-uv@v6
|
|
18
|
+
- run: uv build
|
|
19
|
+
- uses: actions/upload-artifact@v4
|
|
20
|
+
with:
|
|
21
|
+
name: dist
|
|
22
|
+
path: dist/
|
|
23
|
+
|
|
24
|
+
publish:
|
|
25
|
+
needs: build
|
|
26
|
+
runs-on: ubuntu-latest
|
|
27
|
+
environment: pypi
|
|
28
|
+
permissions:
|
|
29
|
+
id-token: write
|
|
30
|
+
steps:
|
|
31
|
+
- uses: actions/download-artifact@v4
|
|
32
|
+
with:
|
|
33
|
+
name: dist
|
|
34
|
+
path: dist/
|
|
35
|
+
- uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[codz]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
lib/
|
|
18
|
+
lib64/
|
|
19
|
+
parts/
|
|
20
|
+
sdist/
|
|
21
|
+
var/
|
|
22
|
+
wheels/
|
|
23
|
+
share/python-wheels/
|
|
24
|
+
*.egg-info/
|
|
25
|
+
.installed.cfg
|
|
26
|
+
*.egg
|
|
27
|
+
MANIFEST
|
|
28
|
+
|
|
29
|
+
# PyInstaller
|
|
30
|
+
# Usually these files are written by a python script from a template
|
|
31
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
32
|
+
*.manifest
|
|
33
|
+
*.spec
|
|
34
|
+
|
|
35
|
+
# Installer logs
|
|
36
|
+
pip-log.txt
|
|
37
|
+
pip-delete-this-directory.txt
|
|
38
|
+
|
|
39
|
+
# Unit test / coverage reports
|
|
40
|
+
htmlcov/
|
|
41
|
+
.tox/
|
|
42
|
+
.nox/
|
|
43
|
+
.coverage
|
|
44
|
+
.coverage.*
|
|
45
|
+
.cache
|
|
46
|
+
nosetests.xml
|
|
47
|
+
coverage.xml
|
|
48
|
+
*.cover
|
|
49
|
+
*.py.cover
|
|
50
|
+
*.lcov
|
|
51
|
+
.hypothesis/
|
|
52
|
+
.pytest_cache/
|
|
53
|
+
cover/
|
|
54
|
+
|
|
55
|
+
# Translations
|
|
56
|
+
*.mo
|
|
57
|
+
*.pot
|
|
58
|
+
|
|
59
|
+
# Django stuff:
|
|
60
|
+
*.log
|
|
61
|
+
local_settings.py
|
|
62
|
+
db.sqlite3
|
|
63
|
+
db.sqlite3-journal
|
|
64
|
+
db.sqlite3-wal
|
|
65
|
+
db.sqlite3-shm
|
|
66
|
+
|
|
67
|
+
# Flask stuff:
|
|
68
|
+
instance/
|
|
69
|
+
.webassets-cache
|
|
70
|
+
|
|
71
|
+
# Scrapy stuff:
|
|
72
|
+
.scrapy
|
|
73
|
+
|
|
74
|
+
# Sphinx documentation
|
|
75
|
+
docs/_build/
|
|
76
|
+
|
|
77
|
+
# PyBuilder
|
|
78
|
+
.pybuilder/
|
|
79
|
+
target/
|
|
80
|
+
|
|
81
|
+
# Jupyter Notebook
|
|
82
|
+
.ipynb_checkpoints
|
|
83
|
+
|
|
84
|
+
# IPython
|
|
85
|
+
profile_default/
|
|
86
|
+
ipython_config.py
|
|
87
|
+
|
|
88
|
+
# pyenv
|
|
89
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
90
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
91
|
+
# .python-version
|
|
92
|
+
|
|
93
|
+
# pipenv
|
|
94
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
95
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
96
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
97
|
+
# install all needed dependencies.
|
|
98
|
+
# Pipfile.lock
|
|
99
|
+
|
|
100
|
+
# uv
|
|
101
|
+
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
|
|
102
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
103
|
+
# commonly ignored for libraries.
|
|
104
|
+
# uv.lock
|
|
105
|
+
|
|
106
|
+
# poetry
|
|
107
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
108
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
109
|
+
# commonly ignored for libraries.
|
|
110
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
111
|
+
# poetry.lock
|
|
112
|
+
# poetry.toml
|
|
113
|
+
|
|
114
|
+
# pdm
|
|
115
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
116
|
+
# pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
|
|
117
|
+
# https://pdm-project.org/en/latest/usage/project/#working-with-version-control
|
|
118
|
+
# pdm.lock
|
|
119
|
+
# pdm.toml
|
|
120
|
+
.pdm-python
|
|
121
|
+
.pdm-build/
|
|
122
|
+
|
|
123
|
+
# pixi
|
|
124
|
+
# Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
|
|
125
|
+
# pixi.lock
|
|
126
|
+
# Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
|
|
127
|
+
# in the .venv directory. It is recommended not to include this directory in version control.
|
|
128
|
+
.pixi/*
|
|
129
|
+
!.pixi/config.toml
|
|
130
|
+
|
|
131
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
132
|
+
__pypackages__/
|
|
133
|
+
|
|
134
|
+
# Celery stuff
|
|
135
|
+
celerybeat-schedule*
|
|
136
|
+
celerybeat.pid
|
|
137
|
+
|
|
138
|
+
# Redis
|
|
139
|
+
*.rdb
|
|
140
|
+
*.aof
|
|
141
|
+
*.pid
|
|
142
|
+
|
|
143
|
+
# RabbitMQ
|
|
144
|
+
mnesia/
|
|
145
|
+
rabbitmq/
|
|
146
|
+
rabbitmq-data/
|
|
147
|
+
|
|
148
|
+
# ActiveMQ
|
|
149
|
+
activemq-data/
|
|
150
|
+
|
|
151
|
+
# SageMath parsed files
|
|
152
|
+
*.sage.py
|
|
153
|
+
|
|
154
|
+
# Environments
|
|
155
|
+
.env
|
|
156
|
+
.envrc
|
|
157
|
+
.venv
|
|
158
|
+
env/
|
|
159
|
+
venv/
|
|
160
|
+
ENV/
|
|
161
|
+
env.bak/
|
|
162
|
+
venv.bak/
|
|
163
|
+
|
|
164
|
+
# Conda environments
|
|
165
|
+
conda-meta/
|
|
166
|
+
|
|
167
|
+
# Spyder project settings
|
|
168
|
+
.spyderproject
|
|
169
|
+
.spyproject
|
|
170
|
+
|
|
171
|
+
# Rope project settings
|
|
172
|
+
.ropeproject
|
|
173
|
+
|
|
174
|
+
# mkdocs/Zensical documentation
|
|
175
|
+
/site
|
|
176
|
+
|
|
177
|
+
# mypy
|
|
178
|
+
.mypy_cache/
|
|
179
|
+
.dmypy.json
|
|
180
|
+
dmypy.json
|
|
181
|
+
|
|
182
|
+
# Pyre type checker
|
|
183
|
+
.pyre/
|
|
184
|
+
|
|
185
|
+
# pytype static type analyzer
|
|
186
|
+
.pytype/
|
|
187
|
+
|
|
188
|
+
# Cython debug symbols
|
|
189
|
+
cython_debug/
|
|
190
|
+
|
|
191
|
+
# PyCharm
|
|
192
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
193
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
194
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
195
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
196
|
+
# .idea/
|
|
197
|
+
|
|
198
|
+
# Abstra
|
|
199
|
+
# Abstra is an AI-powered process automation framework.
|
|
200
|
+
# Ignore directories containing user credentials, local state, and settings.
|
|
201
|
+
# Learn more at https://abstra.io/docs
|
|
202
|
+
.abstra/
|
|
203
|
+
|
|
204
|
+
# Visual Studio Code
|
|
205
|
+
# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore that
|
|
206
|
+
# can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
|
|
207
|
+
# and can be added to the global gitignore or merged into this file. However, if you prefer, you
|
|
208
|
+
# could uncomment the following to ignore the entire vscode folder
|
|
209
|
+
# .vscode/
|
|
210
|
+
# Temporary file for partial code execution
|
|
211
|
+
tempCodeRunnerFile.py
|
|
212
|
+
|
|
213
|
+
# Ruff stuff:
|
|
214
|
+
.ruff_cache/
|
|
215
|
+
|
|
216
|
+
# PyPI configuration file
|
|
217
|
+
.pypirc
|
|
218
|
+
|
|
219
|
+
# Marimo
|
|
220
|
+
marimo/_static/
|
|
221
|
+
marimo/_lsp/
|
|
222
|
+
__marimo__/
|
|
223
|
+
|
|
224
|
+
# Streamlit
|
|
225
|
+
.streamlit/secrets.toml
|
|
226
|
+
|
|
227
|
+
# captures and secrets never committed
|
|
228
|
+
*.pcap
|
|
229
|
+
*.pcapng
|
|
230
|
+
*.cap
|
|
231
|
+
!samples/public/**
|
|
232
|
+
!samples/synthetic/**
|
|
233
|
+
.env
|
|
234
|
+
*.key
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 0.2.0
|
|
4
|
+
|
|
5
|
+
First release on PyPI. Usable on real captures.
|
|
6
|
+
|
|
7
|
+
- `--imsi X`: one subscriber's attach, authentication, session and data steps in order, and
|
|
8
|
+
where it stopped.
|
|
9
|
+
- Large captures: streaming analysis; a 1.1 GB capture runs in about 780 MB of memory.
|
|
10
|
+
Same findings as 0.1 on 476 real and 17 public captures.
|
|
11
|
+
- `--summary`: top problems with counts, first/last time and subscribers affected, the most
|
|
12
|
+
affected subscribers, and problems over time.
|
|
13
|
+
- `--redact` / `--redact-all`: mask IMSI, MSISDN, IP addresses, hosts/realms and the capture
|
|
14
|
+
file name in text and JSON output.
|
|
15
|
+
- Hosted demo redesigned (finding cards, demo captures, redact switch, report downloads).
|
|
16
|
+
|
|
17
|
+
## 0.1.0
|
|
18
|
+
|
|
19
|
+
First release.
|
|
20
|
+
|
|
21
|
+
- 4G: Diameter S6a/base result codes, GTPv2-C rejects (cause source, RADIUS Access-Accept
|
|
22
|
+
before cause 92, PDN-type split, retransmission folding), EPS NAS EMM/ESM rejects,
|
|
23
|
+
authentication MAC vs sync failure.
|
|
24
|
+
- 5G SA: NGAP unsuccessful outcomes, 5GMM/5GSM rejects, PDU session refused by the AMF with
|
|
25
|
+
the DNN, PFCP rejects and timeouts, one-way GTP-U user plane with N6 NAT hint.
|
|
26
|
+
- Unanswered requests, with one-directional capture detection.
|
|
27
|
+
- Subscriber linking via S1AP / NGAP UE IDs; SUPI only from a null-scheme SUCI.
|
|
28
|
+
- CLI with text/JSON output and `--fail-on` exit codes; optional web demo (`capsight[web]`).
|
|
29
|
+
- Validated on 5 public LTE captures (5/5) and 12 public 5G SA captures (12/12).
|
capsight-0.2.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Kx96xx
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
capsight-0.2.0/PKG-INFO
ADDED
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: capsight
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: Drop in a 4G/5G packet capture, get a plain-English diagnosis of why a device couldn't attach, register or get data.
|
|
5
|
+
Project-URL: Homepage, https://github.com/Kx96xx/capsight
|
|
6
|
+
Project-URL: Issues, https://github.com/Kx96xx/capsight/issues
|
|
7
|
+
Author: Kx96xx
|
|
8
|
+
License-Expression: MIT
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Keywords: 5g,diameter,gtp,lte,ngap,pcap,pfcp,telecom,tshark,wireshark
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: Environment :: Console
|
|
13
|
+
Classifier: Intended Audience :: Telecommunications Industry
|
|
14
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Topic :: System :: Networking :: Monitoring
|
|
17
|
+
Requires-Python: >=3.11
|
|
18
|
+
Provides-Extra: web
|
|
19
|
+
Requires-Dist: gradio>=4; extra == 'web'
|
|
20
|
+
Description-Content-Type: text/markdown
|
|
21
|
+
|
|
22
|
+
# capsight
|
|
23
|
+
|
|
24
|
+
**Drop in a 4G/5G packet capture, get a plain-English diagnosis of why a device couldn't attach, register or get data.**
|
|
25
|
+
|
|
26
|
+
> Status: early development, v0.2. 4G core (Diameter S6a, GTPv2-C, EPS NAS, RADIUS) and 5G SA (NGAP, 5G NAS, PFCP, GTP-U) work today. See [docs/PLAN.md](https://github.com/Kx96xx/capsight/blob/main/docs/PLAN.md).
|
|
27
|
+
|
|
28
|
+
**Try it in the browser:** [capsight-dewfuba7pvrbayxcmnamqb.streamlit.app](https://capsight-dewfuba7pvrbayxcmnamqb.streamlit.app/) (pick a demo capture or upload your own; the app sleeps when idle and takes ~30 s to wake).
|
|
29
|
+
|
|
30
|
+

|
|
31
|
+
|
|
32
|
+
Debugging a mobile core usually means scrolling through thousands of Diameter, GTP and NAS packets in Wireshark and looking up result codes and cause values by hand. capsight does that part: it pairs requests with answers, matches known failure patterns and tells you what broke, for whom, where in the capture, and what to check next.
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
## Who it is for
|
|
36
|
+
|
|
37
|
+
- **Core / NOC engineers**: a customer says "my device won't connect". Grab a capture, run capsight, get the reject and the subscriber in seconds instead of reading packets.
|
|
38
|
+
- **Private LTE/5G and lab builders** (Open5GS, free5GC, srsRAN): find out why your phone won't attach to the network you just set up.
|
|
39
|
+
- **Students and people learning telecom**: see what a failure means in plain words, with the packet numbers to open in Wireshark.
|
|
40
|
+
- **Automation**: run it in a script or CI job on captures from a test lab and fail the build if a reject appears.
|
|
41
|
+
|
|
42
|
+
## Install
|
|
43
|
+
|
|
44
|
+
You need Python 3.11+ and `tshark` (comes with Wireshark).
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
# tshark
|
|
48
|
+
brew install wireshark # macOS
|
|
49
|
+
sudo apt install tshark # Debian/Ubuntu
|
|
50
|
+
|
|
51
|
+
# capsight
|
|
52
|
+
pip install capsight # from PyPI (after the first release)
|
|
53
|
+
|
|
54
|
+
# or from source
|
|
55
|
+
git clone https://github.com/Kx96xx/capsight.git
|
|
56
|
+
cd capsight
|
|
57
|
+
uv sync
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Quick start
|
|
61
|
+
|
|
62
|
+
Generate a few demo captures (synthetic, safe to share) and analyze them:
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
uv run python scripts/make_demo_captures.py
|
|
66
|
+
uv run capsight analyze samples/synthetic/attach-user-unknown.pcap
|
|
67
|
+
uv run capsight analyze samples/synthetic/radius-accept-then-reject.pcap
|
|
68
|
+
uv run capsight analyze samples/synthetic/ipv4v6-rejected.pcap
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## How to use it
|
|
72
|
+
|
|
73
|
+
### 1. Get a capture
|
|
74
|
+
|
|
75
|
+
capsight reads `.pcap` / `.pcapng` files. Capture on the interface that carries the signalling you care about:
|
|
76
|
+
|
|
77
|
+
| Problem | Capture where | Filter example |
|
|
78
|
+
|---|---|---|
|
|
79
|
+
| 4G: device won't attach | MME (S1-MME + S6a) | `sctp or port 3868` |
|
|
80
|
+
| 4G: attached but no data | MME/SGW/PGW GTP-C | `udp port 2123` |
|
|
81
|
+
| 4G: session rejected by AAA | PGW + RADIUS | `udp port 2123 or udp port 1812 or udp port 1813` |
|
|
82
|
+
| 5G: gNB or phone won't register | AMF (N2) | `sctp port 38412` |
|
|
83
|
+
| 5G: registered but no PDU session | AMF + SMF/UPF (N2, N4) | `sctp port 38412 or udp port 8805` |
|
|
84
|
+
| 5G: session up but no internet | UPF (N3 + N6) | `udp port 2152 or icmp` |
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
tshark -i any -f "sctp or port 3868 or udp port 2123" -w attach.pcapng
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
Reproduce the problem (power-cycle the device, toggle airplane mode), then stop the capture.
|
|
91
|
+
|
|
92
|
+
### 2. Analyze
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
capsight analyze attach.pcapng
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
Each finding has:
|
|
99
|
+
|
|
100
|
+
- **Severity**: `FAILURE` (it broke), `WARNING` (degraded or partially working), `INFO` (looks odd but is normal, e.g. a first-attach SQN resync)
|
|
101
|
+
- **WHY**: the exact code or cause and what it means
|
|
102
|
+
- **WHO**: the subscriber(s) affected (IMSI)
|
|
103
|
+
- **WHERE**: packet numbers. Open the capture in Wireshark and jump there with `Ctrl+G`
|
|
104
|
+
- **FIX**: what to check next
|
|
105
|
+
|
|
106
|
+
Repeated failures are grouped into one finding with a count. Retransmissions of the same request are counted once, so a retransmission storm does not look like a thousand failures.
|
|
107
|
+
|
|
108
|
+
### 3. Options
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
capsight analyze FILE [--format text|json] [--timeout SECONDS] [--fail-on failure|warning|never]
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
| Option | What it does |
|
|
115
|
+
|---|---|
|
|
116
|
+
| `--format json` | machine-readable output, for scripts and dashboards |
|
|
117
|
+
| `--timeout 5` | seconds without an answer before a request counts as unanswered (default 5) |
|
|
118
|
+
| `--fail-on failure` | exit code 1 if any failure is found (use in CI or scripts) |
|
|
119
|
+
|
|
120
|
+
Exit codes: `0` ok, `1` findings at the `--fail-on` level, `2` the capture could not be read.
|
|
121
|
+
|
|
122
|
+
### Follow one subscriber
|
|
123
|
+
|
|
124
|
+
When a capture has many devices, `--imsi` shows one subscriber's steps in order and where
|
|
125
|
+
they stopped, plus only the findings about that subscriber:
|
|
126
|
+
|
|
127
|
+
```
|
|
128
|
+
$ capsight analyze attach.pcap --imsi 001010000000001
|
|
129
|
+
|
|
130
|
+
subscriber 001010000000001
|
|
131
|
+
+ 0.000s #7 nas Attach Request ok
|
|
132
|
+
+ 0.001s #8,#9 diameter AIR -> AIA FAILED DIAMETER_ERROR_USER_UNKNOWN (5001)
|
|
133
|
+
+ 0.004s #10 nas Attach Reject FAILED EMM cause #8 (...)
|
|
134
|
+
stopped at: AIR -> AIA (packet #9), DIAMETER_ERROR_USER_UNKNOWN (5001)
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
If the IMSI is not in the capture, capsight lists the subscribers it did find. The IMSI can
|
|
138
|
+
be written as `001010000000001` or `imsi-001010000000001`. In 5G the subscriber is known only
|
|
139
|
+
when the SUCI is not concealed.
|
|
140
|
+
|
|
141
|
+
### Busy captures: --summary
|
|
142
|
+
|
|
143
|
+
On a capture with thousands of failures, `--summary` gives the shape of the problem in one
|
|
144
|
+
screen: top problems by occurrences (with first/last time and how many subscribers),
|
|
145
|
+
the most affected subscribers, and problems over time:
|
|
146
|
+
|
|
147
|
+
```
|
|
148
|
+
$ capsight analyze hss-5min.pcapng --summary
|
|
149
|
+
|
|
150
|
+
summary 11 problems, 32,185 occurrences, 7,553 subscribers affected
|
|
151
|
+
|
|
152
|
+
TOP PROBLEMS
|
|
153
|
+
1. FAILURE 28,384x AIR rejected: DIAMETER_ERROR_USER_UNKNOWN.
|
|
154
|
+
16:25:00 - 16:34:59 UTC, 6,496 subscribers
|
|
155
|
+
2. FAILURE 3,327x AIR rejected: DIAMETER_ERROR_UNKNOWN_EPS_SUBSCRIPTION.
|
|
156
|
+
...
|
|
157
|
+
MOST AFFECTED SUBSCRIBERS
|
|
158
|
+
001010000000001 57x AIR rejected: DIAMETER_ERROR_USER_UNKNOWN.
|
|
159
|
+
...
|
|
160
|
+
OVER TIME (UTC, per 1 min)
|
|
161
|
+
16:25 ######################################## 5,976
|
|
162
|
+
16:30 #### 559
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
Time buckets grow with the capture (1 minute up to a day) so the chart stays under 25 rows.
|
|
166
|
+
`--format json --summary` adds the same data under `summary`. Without `--summary`, capsight
|
|
167
|
+
suggests it once a capture has 100+ problem occurrences.
|
|
168
|
+
|
|
169
|
+
### Sharing output: --redact
|
|
170
|
+
|
|
171
|
+
`--redact` masks what should not leave your network before you paste output into a ticket
|
|
172
|
+
or chat. It works with every other option (`--summary`, `--imsi`, `--format json`):
|
|
173
|
+
|
|
174
|
+
- subscriber numbers (IMSI, MSISDN) become `00101-sub1`, `00101-sub2`, ... The first 5
|
|
175
|
+
digits (the home network) are kept because they are often the diagnosis; `--redact-all`
|
|
176
|
+
hides them too
|
|
177
|
+
- IP addresses become `ip1`, `ip2`, ...; host names and Diameter realms become `host1.invalid`
|
|
178
|
+
- the capture's file name becomes `capture.pcap`
|
|
179
|
+
|
|
180
|
+
The same value always gets the same placeholder within a run, so "these 40 failures are the
|
|
181
|
+
same subscriber" still shows. The last line says how many values were masked.
|
|
182
|
+
|
|
183
|
+
### 4. Web demo
|
|
184
|
+
|
|
185
|
+
A small upload page, for people who would rather not use a terminal:
|
|
186
|
+
|
|
187
|
+
```bash
|
|
188
|
+
pip install "capsight[web]"
|
|
189
|
+
capsight-web # http://127.0.0.1:7860
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
Uploads are analyzed in a temporary folder and deleted right after. The [hosted demo](https://capsight-dewfuba7pvrbayxcmnamqb.streamlit.app/) runs
|
|
193
|
+
`web/streamlit_app.py` on Streamlit Community Cloud; `web/Dockerfile` builds the Gradio page
|
|
194
|
+
as a container for self-hosting.
|
|
195
|
+
|
|
196
|
+
### 5. Use it in scripts / CI
|
|
197
|
+
|
|
198
|
+
```bash
|
|
199
|
+
for f in captures/*.pcapng; do
|
|
200
|
+
capsight analyze "$f" --fail-on failure > "${f%.pcapng}.txt" || echo "FAILED: $f"
|
|
201
|
+
done
|
|
202
|
+
|
|
203
|
+
capsight analyze attach.pcapng --format json | jq '.findings[] | {severity, verdict, count}'
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
## What it detects today
|
|
207
|
+
|
|
208
|
+
**Diameter (S6a and base protocol)**
|
|
209
|
+
- Failure Result-Code / Experimental-Result-Code: user unknown, roaming not allowed, RAT not allowed, unknown EPS subscription, auth data unavailable, unable to deliver, too busy, ...
|
|
210
|
+
- Requests that never got an answer
|
|
211
|
+
|
|
212
|
+
**GTPv2-C**
|
|
213
|
+
- Rejections with the cause and the APN: missing or unknown APN, APN access denied, IP pool exhausted, context not found, system failure, ...
|
|
214
|
+
- Whether the cause came from the responder or a node further down the path
|
|
215
|
+
- **User authentication failed right after RADIUS Access-Accept**: credentials were fine, the gateway refused on policy
|
|
216
|
+
- **PDN type split**: IPv4v6 rejected while IPv4 works for the same subscriber
|
|
217
|
+
- Requests with no response, and retransmission folding
|
|
218
|
+
|
|
219
|
+
**NAS (EPS)**
|
|
220
|
+
- Attach / TAU / Service Reject with EMM cause, linked to the subscriber even when the reject carries no IMSI
|
|
221
|
+
- Authentication failure: MAC failure (SIM and HSS keys differ) vs sync failure (and whether it recovered)
|
|
222
|
+
- PDN Connectivity Reject, and whether it happened during attach (failure) or for an extra APN after a working attach (warning)
|
|
223
|
+
|
|
224
|
+
**5G SA**
|
|
225
|
+
- NGAP failures with the cause, e.g. NG Setup rejected for an unknown PLMN or tracking area
|
|
226
|
+
- Registration / Service / Security Mode Reject with 5GMM cause (no slices available, PLMN not allowed, ...)
|
|
227
|
+
- 5G-AKA authentication failure: MAC failure (keys mismatch) vs sync failure, and whether the network then rejected
|
|
228
|
+
- PDU session request refused by the AMF (e.g. 5GMM #91, DNN not subscribed), naming the DNN
|
|
229
|
+
- PDU Session Establishment Reject from the SMF with 5GSM cause and DNN
|
|
230
|
+
- PFCP rejects between SMF and UPF (rule creation failure, no association, no resources, ...) and unanswered PFCP requests
|
|
231
|
+
- One-way user plane: uplink enters the GTP-U tunnel and nothing comes back, with a NAT hint when a private UE address leaks onto N6
|
|
232
|
+
- SUPI shown when the SUCI is not concealed; never guessed when it is
|
|
233
|
+
|
|
234
|
+
Checked against real public captures, 4G and 5G: [docs/VALIDATION.md](https://github.com/Kx96xx/capsight/blob/main/docs/VALIDATION.md).
|
|
235
|
+
|
|
236
|
+
## How it works
|
|
237
|
+
|
|
238
|
+
1. **Decode**: `tshark` turns the capture into structured fields. capsight never writes its own dissectors.
|
|
239
|
+
2. **Correlate**: requests are paired with answers (Diameter hop-by-hop + end-to-end ID, GTPv2 and PFCP sequence numbers), and NAS messages are linked to a subscriber through the S1AP / NGAP UE ID.
|
|
240
|
+
3. **Diagnose**: deterministic rules match known failure patterns. Every verdict cites packet numbers. Nothing is guessed.
|
|
241
|
+
|
|
242
|
+
## Privacy
|
|
243
|
+
|
|
244
|
+
Captures contain subscriber identities. capsight runs entirely on your machine, sends nothing anywhere, and stores nothing. Do not commit real captures: the repo's `.gitignore` blocks `*.pcap` / `*.pcapng` outside `samples/`. Use `--redact` before sharing output.
|
|
245
|
+
|
|
246
|
+
## Roadmap
|
|
247
|
+
|
|
248
|
+
v0.2 real-capture usability (released), v0.3 operator coverage (roaming, Gx/Gy, MAP), v0.4 voice and SMS, v0.5 diagrams/HTML/MCP, v1.0 stable. Details and exit tests: [docs/ROADMAP.md](https://github.com/Kx96xx/capsight/blob/main/docs/ROADMAP.md).
|
|
249
|
+
|
|
250
|
+
## Contributing
|
|
251
|
+
|
|
252
|
+
Public captures that show a failure are the most useful contribution. Open an issue with a link (never attach captures with real subscriber data).
|
|
253
|
+
|
|
254
|
+
```bash
|
|
255
|
+
uv run pytest # tests generate their own captures; tshark required
|
|
256
|
+
uv run ruff check .
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
## License
|
|
260
|
+
|
|
261
|
+
MIT
|