udplisten 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.
- udplisten-0.1.0/LICENSE +21 -0
- udplisten-0.1.0/PKG-INFO +89 -0
- udplisten-0.1.0/README.md +60 -0
- udplisten-0.1.0/pyproject.toml +43 -0
- udplisten-0.1.0/setup.cfg +4 -0
- udplisten-0.1.0/src/udplisten/__init__.py +6 -0
- udplisten-0.1.0/src/udplisten/cli.py +42 -0
- udplisten-0.1.0/src/udplisten.egg-info/PKG-INFO +89 -0
- udplisten-0.1.0/src/udplisten.egg-info/SOURCES.txt +10 -0
- udplisten-0.1.0/src/udplisten.egg-info/dependency_links.txt +1 -0
- udplisten-0.1.0/src/udplisten.egg-info/entry_points.txt +2 -0
- udplisten-0.1.0/src/udplisten.egg-info/top_level.txt +1 -0
udplisten-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Tobias Glaubach
|
|
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.
|
udplisten-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: udplisten
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A simple CLI tool that listens for UDP broadcast messages
|
|
5
|
+
Author: Tobias Glaubach
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/tglaubach/udplisten
|
|
8
|
+
Project-URL: Repository, https://github.com/tglaubach/udplisten
|
|
9
|
+
Project-URL: Issues, https://github.com/tglaubach/udplisten/issues
|
|
10
|
+
Project-URL: Changelog, https://github.com/tglaubach/udplisten/releases
|
|
11
|
+
Keywords: udp,broadcast,network,discovery,listener
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Environment :: Console
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: Intended Audience :: System Administrators
|
|
16
|
+
Classifier: Operating System :: OS Independent
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
24
|
+
Classifier: Topic :: System :: Networking
|
|
25
|
+
Requires-Python: >=3.8
|
|
26
|
+
Description-Content-Type: text/markdown
|
|
27
|
+
License-File: LICENSE
|
|
28
|
+
Dynamic: license-file
|
|
29
|
+
|
|
30
|
+
# udplisten
|
|
31
|
+
|
|
32
|
+
A tiny CLI tool that listens for UDP broadcast messages and prints them to
|
|
33
|
+
stdout. Useful for debugging UDP-based service discovery (e.g. devices or
|
|
34
|
+
services that announce themselves on the local network).
|
|
35
|
+
|
|
36
|
+
## Installation
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
pip install udplisten
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Usage
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
udplisten --port 1234
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
`--port` is optional and defaults to `1239`.
|
|
49
|
+
|
|
50
|
+
Every received datagram is printed together with the sender address:
|
|
51
|
+
|
|
52
|
+
```text
|
|
53
|
+
Listening for UDP broadcasts on port 1234...
|
|
54
|
+
Received:
|
|
55
|
+
b'hello from the network'
|
|
56
|
+
from ('192.168.1.42', 53512)
|
|
57
|
+
==============
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Test broadcast
|
|
61
|
+
|
|
62
|
+
From another machine on the same network:
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
echo -n "hello" | socat - UDP-DATAGRAM:255.255.255.255:1234,broadcast
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
or with Python:
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
python -c "import socket; s=socket.socket(socket.AF_INET, socket.SOCK_DGRAM); s.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1); s.sendto(b'hello', ('255.255.255.255', 1234))"
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## Releasing
|
|
75
|
+
|
|
76
|
+
This repository uses GitHub Actions to build and publish to PyPI via
|
|
77
|
+
[Trusted Publishing](https://docs.pypi.org/trusted-publishers/).
|
|
78
|
+
|
|
79
|
+
1. Configure a Trusted Publisher for this project on PyPI
|
|
80
|
+
(PyPI project settings -> Publishing, owner `tglaubach`, repository
|
|
81
|
+
`udplisten`, workflow `release.yml`).
|
|
82
|
+
2. Create a GitHub release with a tag like `v0.1.0` (or run the
|
|
83
|
+
*Release* workflow manually with `workflow_dispatch`).
|
|
84
|
+
|
|
85
|
+
The workflow builds sdist and wheel and uploads them to PyPI.
|
|
86
|
+
|
|
87
|
+
## License
|
|
88
|
+
|
|
89
|
+
MIT
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# udplisten
|
|
2
|
+
|
|
3
|
+
A tiny CLI tool that listens for UDP broadcast messages and prints them to
|
|
4
|
+
stdout. Useful for debugging UDP-based service discovery (e.g. devices or
|
|
5
|
+
services that announce themselves on the local network).
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
pip install udplisten
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
udplisten --port 1234
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
`--port` is optional and defaults to `1239`.
|
|
20
|
+
|
|
21
|
+
Every received datagram is printed together with the sender address:
|
|
22
|
+
|
|
23
|
+
```text
|
|
24
|
+
Listening for UDP broadcasts on port 1234...
|
|
25
|
+
Received:
|
|
26
|
+
b'hello from the network'
|
|
27
|
+
from ('192.168.1.42', 53512)
|
|
28
|
+
==============
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Test broadcast
|
|
32
|
+
|
|
33
|
+
From another machine on the same network:
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
echo -n "hello" | socat - UDP-DATAGRAM:255.255.255.255:1234,broadcast
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
or with Python:
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
python -c "import socket; s=socket.socket(socket.AF_INET, socket.SOCK_DGRAM); s.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1); s.sendto(b'hello', ('255.255.255.255', 1234))"
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Releasing
|
|
46
|
+
|
|
47
|
+
This repository uses GitHub Actions to build and publish to PyPI via
|
|
48
|
+
[Trusted Publishing](https://docs.pypi.org/trusted-publishers/).
|
|
49
|
+
|
|
50
|
+
1. Configure a Trusted Publisher for this project on PyPI
|
|
51
|
+
(PyPI project settings -> Publishing, owner `tglaubach`, repository
|
|
52
|
+
`udplisten`, workflow `release.yml`).
|
|
53
|
+
2. Create a GitHub release with a tag like `v0.1.0` (or run the
|
|
54
|
+
*Release* workflow manually with `workflow_dispatch`).
|
|
55
|
+
|
|
56
|
+
The workflow builds sdist and wheel and uploads them to PyPI.
|
|
57
|
+
|
|
58
|
+
## License
|
|
59
|
+
|
|
60
|
+
MIT
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=64"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "udplisten"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "A simple CLI tool that listens for UDP broadcast messages"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.8"
|
|
11
|
+
license = "MIT"
|
|
12
|
+
license-files = ["LICENSE"]
|
|
13
|
+
authors = [
|
|
14
|
+
{ name = "Tobias Glaubach" },
|
|
15
|
+
]
|
|
16
|
+
keywords = ["udp", "broadcast", "network", "discovery", "listener"]
|
|
17
|
+
classifiers = [
|
|
18
|
+
"Development Status :: 4 - Beta",
|
|
19
|
+
"Environment :: Console",
|
|
20
|
+
"Intended Audience :: Developers",
|
|
21
|
+
"Intended Audience :: System Administrators",
|
|
22
|
+
"Operating System :: OS Independent",
|
|
23
|
+
"Programming Language :: Python :: 3",
|
|
24
|
+
"Programming Language :: Python :: 3.8",
|
|
25
|
+
"Programming Language :: Python :: 3.9",
|
|
26
|
+
"Programming Language :: Python :: 3.10",
|
|
27
|
+
"Programming Language :: Python :: 3.11",
|
|
28
|
+
"Programming Language :: Python :: 3.12",
|
|
29
|
+
"Programming Language :: Python :: 3.13",
|
|
30
|
+
"Topic :: System :: Networking",
|
|
31
|
+
]
|
|
32
|
+
|
|
33
|
+
[project.urls]
|
|
34
|
+
Homepage = "https://github.com/tglaubach/udplisten"
|
|
35
|
+
Repository = "https://github.com/tglaubach/udplisten"
|
|
36
|
+
Issues = "https://github.com/tglaubach/udplisten/issues"
|
|
37
|
+
Changelog = "https://github.com/tglaubach/udplisten/releases"
|
|
38
|
+
|
|
39
|
+
[project.scripts]
|
|
40
|
+
udplisten = "udplisten.cli:main"
|
|
41
|
+
|
|
42
|
+
[tool.setuptools.packages.find]
|
|
43
|
+
where = ["src"]
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import argparse
|
|
2
|
+
import socket
|
|
3
|
+
|
|
4
|
+
DEFAULT_PORT = 1239
|
|
5
|
+
BUFFER_SIZE = 1024
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def parse_args(argv=None):
|
|
9
|
+
parser = argparse.ArgumentParser(
|
|
10
|
+
prog="udplisten",
|
|
11
|
+
description="UDP broadcast discovery listener",
|
|
12
|
+
)
|
|
13
|
+
parser.add_argument(
|
|
14
|
+
"--port",
|
|
15
|
+
type=int,
|
|
16
|
+
default=DEFAULT_PORT,
|
|
17
|
+
help=f"UDP port to listen on (default: {DEFAULT_PORT})",
|
|
18
|
+
)
|
|
19
|
+
return parser.parse_args(argv)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def main(argv=None):
|
|
23
|
+
args = parse_args(argv)
|
|
24
|
+
|
|
25
|
+
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
|
|
26
|
+
sock.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1)
|
|
27
|
+
sock.bind(("", args.port))
|
|
28
|
+
|
|
29
|
+
print(f"Listening for UDP broadcasts on port {args.port}...", flush=True)
|
|
30
|
+
|
|
31
|
+
try:
|
|
32
|
+
while True:
|
|
33
|
+
data, addr = sock.recvfrom(BUFFER_SIZE)
|
|
34
|
+
print(f"Received:\n{data}\nfrom {addr}\n==============", flush=True)
|
|
35
|
+
except KeyboardInterrupt:
|
|
36
|
+
print("\nShutting down.")
|
|
37
|
+
finally:
|
|
38
|
+
sock.close()
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
if __name__ == "__main__":
|
|
42
|
+
main()
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: udplisten
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A simple CLI tool that listens for UDP broadcast messages
|
|
5
|
+
Author: Tobias Glaubach
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/tglaubach/udplisten
|
|
8
|
+
Project-URL: Repository, https://github.com/tglaubach/udplisten
|
|
9
|
+
Project-URL: Issues, https://github.com/tglaubach/udplisten/issues
|
|
10
|
+
Project-URL: Changelog, https://github.com/tglaubach/udplisten/releases
|
|
11
|
+
Keywords: udp,broadcast,network,discovery,listener
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Environment :: Console
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: Intended Audience :: System Administrators
|
|
16
|
+
Classifier: Operating System :: OS Independent
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
24
|
+
Classifier: Topic :: System :: Networking
|
|
25
|
+
Requires-Python: >=3.8
|
|
26
|
+
Description-Content-Type: text/markdown
|
|
27
|
+
License-File: LICENSE
|
|
28
|
+
Dynamic: license-file
|
|
29
|
+
|
|
30
|
+
# udplisten
|
|
31
|
+
|
|
32
|
+
A tiny CLI tool that listens for UDP broadcast messages and prints them to
|
|
33
|
+
stdout. Useful for debugging UDP-based service discovery (e.g. devices or
|
|
34
|
+
services that announce themselves on the local network).
|
|
35
|
+
|
|
36
|
+
## Installation
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
pip install udplisten
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Usage
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
udplisten --port 1234
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
`--port` is optional and defaults to `1239`.
|
|
49
|
+
|
|
50
|
+
Every received datagram is printed together with the sender address:
|
|
51
|
+
|
|
52
|
+
```text
|
|
53
|
+
Listening for UDP broadcasts on port 1234...
|
|
54
|
+
Received:
|
|
55
|
+
b'hello from the network'
|
|
56
|
+
from ('192.168.1.42', 53512)
|
|
57
|
+
==============
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Test broadcast
|
|
61
|
+
|
|
62
|
+
From another machine on the same network:
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
echo -n "hello" | socat - UDP-DATAGRAM:255.255.255.255:1234,broadcast
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
or with Python:
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
python -c "import socket; s=socket.socket(socket.AF_INET, socket.SOCK_DGRAM); s.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1); s.sendto(b'hello', ('255.255.255.255', 1234))"
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## Releasing
|
|
75
|
+
|
|
76
|
+
This repository uses GitHub Actions to build and publish to PyPI via
|
|
77
|
+
[Trusted Publishing](https://docs.pypi.org/trusted-publishers/).
|
|
78
|
+
|
|
79
|
+
1. Configure a Trusted Publisher for this project on PyPI
|
|
80
|
+
(PyPI project settings -> Publishing, owner `tglaubach`, repository
|
|
81
|
+
`udplisten`, workflow `release.yml`).
|
|
82
|
+
2. Create a GitHub release with a tag like `v0.1.0` (or run the
|
|
83
|
+
*Release* workflow manually with `workflow_dispatch`).
|
|
84
|
+
|
|
85
|
+
The workflow builds sdist and wheel and uploads them to PyPI.
|
|
86
|
+
|
|
87
|
+
## License
|
|
88
|
+
|
|
89
|
+
MIT
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
pyproject.toml
|
|
4
|
+
src/udplisten/__init__.py
|
|
5
|
+
src/udplisten/cli.py
|
|
6
|
+
src/udplisten.egg-info/PKG-INFO
|
|
7
|
+
src/udplisten.egg-info/SOURCES.txt
|
|
8
|
+
src/udplisten.egg-info/dependency_links.txt
|
|
9
|
+
src/udplisten.egg-info/entry_points.txt
|
|
10
|
+
src/udplisten.egg-info/top_level.txt
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
udplisten
|