pyModbusTCP-cli 0.4.0a1__py3-none-any.whl

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.
@@ -0,0 +1,110 @@
1
+ Metadata-Version: 2.5
2
+ Name: pyModbusTCP-cli
3
+ Version: 0.4.0a1
4
+ Summary: Command line tools for pyModbusTCP: Modbus/TCP server, client and Modbus TCP/RTU gateways
5
+ Project-URL: Source, https://github.com/sourceperl/pyModbusTCP
6
+ Project-URL: Issues, https://github.com/sourceperl/pyModbusTCP/issues
7
+ Author: Loïc Lefebvre
8
+ License-Expression: MIT
9
+ License-File: LICENSE
10
+ Classifier: Development Status :: 3 - Alpha
11
+ Classifier: Environment :: Console
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Operating System :: OS Independent
14
+ Classifier: Programming Language :: Python :: 3 :: Only
15
+ Classifier: Topic :: System :: Networking
16
+ Requires-Python: >=3.10
17
+ Requires-Dist: pymodbustcp[serial]==0.4.0a1
18
+ Description-Content-Type: text/markdown
19
+
20
+ # pyModbusTCP-cli
21
+
22
+ Command line tools built on [pyModbusTCP](https://github.com/sourceperl/pyModbusTCP):
23
+
24
+ | Command | Role |
25
+ |------------------|----------------------------------------------------------------------------|
26
+ | `mbtcp-server` | Modbus/TCP server (test a client, a SCADA, a gateway...) |
27
+ | `mbtcp-client` | Modbus/TCP client: read and write requests from the command line |
28
+ | `mbtcp-tcp2rtu` | gateway: Modbus/TCP clients -> Modbus/RTU slaves on a serial line |
29
+ | `mbtcp-rtu2tcp` | gateway: a Modbus/RTU master on a serial line -> a Modbus/TCP server |
30
+
31
+ The code of the tools is in the pyModbusTCP library (module `pyModbusTCP.tools`). This package contains no code:
32
+ it only adds the commands to the PATH, with pyserial for the gateways. So a plain `pip install pyModbusTCP` puts no
33
+ command in the PATH and installs no dependency.
34
+
35
+ ## Install
36
+
37
+ ```bash
38
+ # as isolated command line tools (recommended)
39
+ pipx install pyModbusTCP-cli
40
+
41
+ # or in a virtual environment, with the library
42
+ pip install "pyModbusTCP[tools]==0.4.0a1"
43
+ ```
44
+
45
+ **Alpha**: pyModbusTCP-cli is new with pyModbusTCP 0.4.0, only pre-releases exist for now. The commands, their
46
+ options and their output may still change before the final release. Without a version or `--pre`,
47
+ `pip install "pyModbusTCP[tools]"` installs the stable pyModbusTCP 0.3.1, without the tools.
48
+
49
+ Without this package, the tools can still be run from the library alone:
50
+
51
+ ```bash
52
+ python -m pyModbusTCP.tools server --help
53
+ python -m pyModbusTCP.tools client --help
54
+ pip install "pyModbusTCP[serial]==0.4.0a1" # pyserial, only needed by the gateways
55
+ python -m pyModbusTCP.tools tcp2rtu --help
56
+ python -m pyModbusTCP.tools rtu2tcp --help
57
+ ```
58
+
59
+ ## Examples
60
+
61
+ ```bash
62
+ # server on localhost:5020, log the writes of the clients
63
+ mbtcp-server --log-changes
64
+
65
+ # read 4 holding registers from address 0, write some values
66
+ mbtcp-client -p 5020 read-holding 0 -n 4
67
+ mbtcp-client -p 5020 write-registers 0 100 200 0x1234
68
+ mbtcp-client -p 5020 write-coil 10 on
69
+
70
+ # TCP clients of the 192.168.1.0/24 network can read (only) the RTU slaves of /dev/ttyUSB0
71
+ mbtcp-tcp2rtu -H 0.0.0.0 -A 192.168.1.0/24 --read-only -b 19200 --parity E /dev/ttyUSB0
72
+
73
+ # a RTU master on /dev/ttyUSB0 reads the Modbus/TCP server 192.168.1.10 (gateway is RTU slave 30)
74
+ mbtcp-rtu2tcp -a 30 -H 192.168.1.10 /dev/ttyUSB0
75
+ ```
76
+
77
+ Run any command with `--help` for all its options.
78
+
79
+ ## Security
80
+
81
+ Modbus/TCP has no authentication and no encryption: any host that can reach a server can read and write its data.
82
+ The server and the TCP to RTU gateway are designed to be safe by default:
83
+
84
+ - they listen on `localhost` and on port 5020 by default: use `-H` with the address of the network interface that
85
+ needs it (`0.0.0.0` only if every network of the host is trusted);
86
+ - `-A/--allow` restricts the clients to some IP addresses or networks, `--read-only` refuses every write;
87
+ - the TCP to RTU gateway refuses broadcast requests (unit id 0) unless `--allow-broadcast` is set.
88
+
89
+ Port 502 (the standard Modbus/TCP port) is a privileged port on Unix systems. **Never run these commands as root (or
90
+ with sudo) to listen on it.** Give the `CAP_NET_BIND_SERVICE` capability to the Python interpreter of a virtual
91
+ environment dedicated to the tools instead:
92
+
93
+ ```bash
94
+ python3 -m venv --copies ~/mbtcp-venv # --copies: real interpreter files, not links to the system one
95
+ ~/mbtcp-venv/bin/pip install pyModbusTCP-cli
96
+ sudo setcap 'cap_net_bind_service=+ep' ~/mbtcp-venv/bin/python3
97
+ ~/mbtcp-venv/bin/mbtcp-server -H 192.168.1.10 -p 502
98
+ ```
99
+
100
+ The commands of this virtual environment run its `bin/python3`, the file with the capability. This does not work
101
+ with pipx, whose environments use links to the system interpreter (`setcap` refuses them). See "Listen on the standard
102
+ Modbus port 502 without root" in the [examples README](https://github.com/sourceperl/pyModbusTCP/tree/master/examples)
103
+ for the details and the precautions.
104
+
105
+ See also the [security policy](https://github.com/sourceperl/pyModbusTCP/blob/master/SECURITY.md) of pyModbusTCP.
106
+
107
+ ## Versions
108
+
109
+ pyModbusTCP-cli has the version of pyModbusTCP and requires exactly this release of the library (where its code
110
+ is).
@@ -0,0 +1,5 @@
1
+ pymodbustcp_cli-0.4.0a1.dist-info/METADATA,sha256=i78KZqGmcFE32DH4E3A0cIeL2YtvdTkyZLO2_47E2Tg,5018
2
+ pymodbustcp_cli-0.4.0a1.dist-info/WHEEL,sha256=W3fkpkm7-wf9vBI5Z-7s0eWkeM-spu78I8Neb98DeEg,87
3
+ pymodbustcp_cli-0.4.0a1.dist-info/entry_points.txt,sha256=mui54qZCX_q1fqQAy91019E49Ygr0udexBRFOsRQJMk,226
4
+ pymodbustcp_cli-0.4.0a1.dist-info/licenses/LICENSE,sha256=Q-TwRxZ_Hhz-lD3EK2MX1_4yE70R2LsYsWlVkA5ehwc,1077
5
+ pymodbustcp_cli-0.4.0a1.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.32.4
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,5 @@
1
+ [console_scripts]
2
+ mbtcp-client = pyModbusTCP.tools._entry:run_client
3
+ mbtcp-rtu2tcp = pyModbusTCP.tools._entry:run_rtu2tcp
4
+ mbtcp-server = pyModbusTCP.tools._entry:run_server
5
+ mbtcp-tcp2rtu = pyModbusTCP.tools._entry:run_tcp2rtu
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2014 l.lefebvre
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.