Photon Observer
Tools for working with the Photon protocol.
Example:
import pyshark
import io
from photon_observer import PhotonLayer, FragmentBuffer, CommandType, ReliableMessage
def on_message(message: ReliableMessage):
pass
def main():
capture = pyshark.LiveCapture("wlp4s0", bpf_filter="udp")
buf = FragmentBuffer()
for p in capture.sniff_continuously():
payload = bytes.fromhex(p.udp.payload.replace(":", ''))
layer = PhotonLayer.unpack(io.BytesIO(payload))
for cmd in layer.commands:
if cmd.type == CommandType.SendReliableType:
msg = cmd.reliable_message()
on_message(msg)
elif cmd.type == CommandType.SendUnreliableType:
_cmd = cmd.unreliable_type()
msg = _cmd.reliable_message()
on_message(msg)
elif cmd.type == CommandType.SendReliableFragmentType:
msg = cmd.reliable_fragment()
result = buf.offer(msg)
if result is not None:
msg = result.reliable_message()
on_message(msg)
else:
continue
PS
Additional thanks to @hmadison for his photon_spectator package
License
This project is licensed under MIT. Contributions to this project are accepted under the same license.
Metadata
Release files for photon-observer 0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| photon_observer-0.1.tar.gz | 8.1 kB | Without provenance | Details for photon_observer-0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| photon_observer-0.1-py3-none-any.whl | Python 3 | none | any | Details for photon_observer-0.1-py3-none-any.whl |
Total release size: 15.4 kB
Release files / photon_observer-0.1.tar.gz
| Download URL | photon_observer-0.1.tar.gz |
|---|---|
| Size | 8.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
12f7bf3f893d061c2e829a559303bc5e88bc58edc4965543a8bf7a165517c34f
|
|
BLAKE2b-256 checksum How to use checksums |
af7503dd869a46cb14ff547e27e80bfeb4c90ef26612687ce0314b41d8e14179
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/4.0.1 CPython/3.11.4
|
Release files / photon_observer-0.1-py3-none-any.whl
| Download URL | photon_observer-0.1-py3-none-any.whl |
|---|---|
| Size | 7.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
92381bffa31410d0bdfa974c07e466f139cf3a4f254a38d6197d17107533e8f4
|
|
BLAKE2b-256 checksum How to use checksums |
9cdfc522a62206fe5f0e8acb8b88be4e7e9db92a05852689f4859b0f3ee83747
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/4.0.1 CPython/3.11.4
|
Security for photon-observer 0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.