Files
catarrh 38650b4797 Rename project to SIMtrace Analyser (v2.0.0)
- move the analysis server out of simtrace2_pysniff into simtrace_analyser;
  simtrace2_pysniff stays as the simtrace2-sniff replacement capture utility
- new server CLI: simtrace-analyser-server; python -m simtrace_analyser
  (simtrace2-pysniff-server and python -m simtrace2_pysniff.server dropped)
- simtrace2_pysniff lazy-imports hardware symbols, so the server no longer
  pulls PyUSB at startup; the GSMTAP/PCAP codecs work without libusb
- version 2.0.0 everywhere (was 1.22.21); PWA SW cache simtrace-analyser-v54
- frontend: server name, clone URL and i18n strings updated; vendored-parser
  reference otaman -> SIMple
- README/README_RUS reworked product-first (analyser first, utility second)
- DB dir ~/.simtrace-analyser, /api status payload and hosted PWA unchanged
2026-09-19 12:34:16 +03:00

47 lines
1.4 KiB
Python

"""simtrace2-pysniff — Python replacement for simtrace2-sniff.
Capture utility bundled with SIMtrace Analyser. Hardware access (PyUSB) is
imported lazily, so the GSMTAP/PCAP codec modules can be used without libusb.
"""
from simtrace_analyser.version import __version__
__all__ = [
'SniffSession',
'DeviceDisconnected',
'find_sniffer_device',
'parse_message',
'SniffMessage',
'GsmtapSender',
'GsmtapReceiver',
'PcapWriter',
'FileDumper',
'format_message',
'__version__',
]
_LAZY_IMPORTS = {
'SniffSession': ('.device', 'SniffSession'),
'DeviceDisconnected': ('.device', 'DeviceDisconnected'),
'find_sniffer_device': ('.device', 'find_sniffer_device'),
'parse_message': ('.protocol', 'parse_message'),
'SniffMessage': ('.protocol', 'SniffMessage'),
'GsmtapSender': ('.gsmtap', 'GsmtapSender'),
'GsmtapReceiver': ('.gsmtap', 'GsmtapReceiver'),
'PcapWriter': ('.pcap', 'PcapWriter'),
'FileDumper': ('.dump', 'FileDumper'),
'format_message': ('.dump', 'format_message'),
}
def __getattr__(name):
"""Import utility symbols on first use (PEP 562)."""
try:
module_name, attr = _LAZY_IMPORTS[name]
except KeyError:
raise AttributeError(f'module {__name__!r} has no attribute {name!r}') from None
from importlib import import_module
value = getattr(import_module(module_name, __name__), attr)
globals()[name] = value
return value