ssh-handler 1.1.0__tar.gz → 1.3.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.
Files changed (29) hide show
  1. {ssh_handler-1.1.0 → ssh_handler-1.3.0}/PKG-INFO +66 -23
  2. ssh_handler-1.1.0/ssh_handler.egg-info/PKG-INFO → ssh_handler-1.3.0/README.md +523 -506
  3. {ssh_handler-1.1.0 → ssh_handler-1.3.0}/pyproject.toml +10 -8
  4. {ssh_handler-1.1.0 → ssh_handler-1.3.0}/ssh_handler/__init__.py +1 -1
  5. {ssh_handler-1.1.0 → ssh_handler-1.3.0}/ssh_handler/core.py +35 -0
  6. ssh_handler-1.1.0/README.md → ssh_handler-1.3.0/ssh_handler.egg-info/PKG-INFO +549 -472
  7. {ssh_handler-1.1.0 → ssh_handler-1.3.0}/ssh_handler.egg-info/requires.txt +4 -16
  8. {ssh_handler-1.1.0 → ssh_handler-1.3.0}/LICENSE +0 -0
  9. {ssh_handler-1.1.0 → ssh_handler-1.3.0}/setup.cfg +0 -0
  10. {ssh_handler-1.1.0 → ssh_handler-1.3.0}/ssh_handler/__main__.py +0 -0
  11. {ssh_handler-1.1.0 → ssh_handler-1.3.0}/ssh_handler/cli.py +0 -0
  12. {ssh_handler-1.1.0 → ssh_handler-1.3.0}/ssh_handler/config.py +0 -0
  13. {ssh_handler-1.1.0 → ssh_handler-1.3.0}/ssh_handler/credentials.py +0 -0
  14. {ssh_handler-1.1.0 → ssh_handler-1.3.0}/ssh_handler/exceptions.py +0 -0
  15. {ssh_handler-1.1.0 → ssh_handler-1.3.0}/ssh_handler/ftp.py +0 -0
  16. {ssh_handler-1.1.0 → ssh_handler-1.3.0}/ssh_handler/openssh/OpenSSH-ARM64.zip +0 -0
  17. {ssh_handler-1.1.0 → ssh_handler-1.3.0}/ssh_handler/openssh/OpenSSH-Win32.zip +0 -0
  18. {ssh_handler-1.1.0 → ssh_handler-1.3.0}/ssh_handler/openssh/OpenSSH-Win64.zip +0 -0
  19. {ssh_handler-1.1.0 → ssh_handler-1.3.0}/ssh_handler/pool.py +0 -0
  20. {ssh_handler-1.1.0 → ssh_handler-1.3.0}/ssh_handler/pyqt_worker.py +0 -0
  21. {ssh_handler-1.1.0 → ssh_handler-1.3.0}/ssh_handler/results.py +0 -0
  22. {ssh_handler-1.1.0 → ssh_handler-1.3.0}/ssh_handler/serial_handler.py +0 -0
  23. {ssh_handler-1.1.0 → ssh_handler-1.3.0}/ssh_handler/setup_openssh_server.ps1 +0 -0
  24. {ssh_handler-1.1.0 → ssh_handler-1.3.0}/ssh_handler/winrm_bootstrap.py +0 -0
  25. {ssh_handler-1.1.0 → ssh_handler-1.3.0}/ssh_handler.egg-info/SOURCES.txt +0 -0
  26. {ssh_handler-1.1.0 → ssh_handler-1.3.0}/ssh_handler.egg-info/dependency_links.txt +0 -0
  27. {ssh_handler-1.1.0 → ssh_handler-1.3.0}/ssh_handler.egg-info/entry_points.txt +0 -0
  28. {ssh_handler-1.1.0 → ssh_handler-1.3.0}/ssh_handler.egg-info/top_level.txt +0 -0
  29. {ssh_handler-1.1.0 → ssh_handler-1.3.0}/tests/test_offline.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ssh-handler
3
- Version: 1.1.0
3
+ Version: 1.3.0
4
4
  Summary: Extensive SSH/SFTP/SCP/FTP handler built on Paramiko, for test automation, CLIs and PyQt5 tools.
5
5
  Author: ssh-handler contributors
6
6
  License-Expression: MIT
@@ -14,22 +14,14 @@ Requires-Python: >=3.8
14
14
  Description-Content-Type: text/markdown
15
15
  License-File: LICENSE
16
16
  Requires-Dist: paramiko>=3.0
17
- Provides-Extra: secure
18
- Requires-Dist: keyring>=23.0; extra == "secure"
19
- Provides-Extra: scp
20
- Requires-Dist: scp>=0.14; extra == "scp"
17
+ Requires-Dist: scp>=0.14
18
+ Requires-Dist: pyserial>=3.5
19
+ Requires-Dist: keyring>=23.0
20
+ Requires-Dist: pywinrm>=0.4.3
21
21
  Provides-Extra: gui
22
22
  Requires-Dist: PyQt5>=5.15; extra == "gui"
23
- Provides-Extra: winrm
24
- Requires-Dist: pywinrm>=0.4.3; extra == "winrm"
25
- Provides-Extra: serial
26
- Requires-Dist: pyserial>=3.5; extra == "serial"
27
23
  Provides-Extra: all
28
- Requires-Dist: keyring>=23.0; extra == "all"
29
- Requires-Dist: scp>=0.14; extra == "all"
30
24
  Requires-Dist: PyQt5>=5.15; extra == "all"
31
- Requires-Dist: pywinrm>=0.4.3; extra == "all"
32
- Requires-Dist: pyserial>=3.5; extra == "all"
33
25
  Dynamic: license-file
34
26
 
35
27
  # ssh-handler
@@ -89,15 +81,17 @@ behind one object that:
89
81
  ## Install
90
82
 
91
83
  ```bash
92
- pip install ssh-handler # core (paramiko only)
93
- pip install "ssh-handler[secure]" # + keyring (OS credential vault)
94
- pip install "ssh-handler[scp]" # + scp (SCP-protocol transfers)
95
- pip install "ssh-handler[gui]" # + PyQt5 (the GUI worker)
96
- pip install "ssh-handler[all]" # everything
84
+ pip install ssh-handler # everything: SSH, SFTP, SCP, FTP, serial,
85
+ # credential vault, WinRM bootstrap
86
+ pip install "ssh-handler[gui]" # also installs PyQt5 for the GUI worker
97
87
  ```
98
88
 
99
- `scp`, `keyring`, and `PyQt5` are optional the core works without them, and
100
- those features raise a clear, actionable message if you use them without the extra.
89
+ **Batteries included.** A plain `pip install ssh-handler` pulls in `paramiko`,
90
+ `scp`, `pyserial`, `keyring`, and `pywinrm`, so SSH, SFTP/SCP/FTP transfers,
91
+ serial/COM ports, confidential credential storage, and the WinRM bootstrap all
92
+ work out of the box. Only **PyQt5** is optional (`[gui]`), because it's a large
93
+ GUI toolkit you only need when building a GUI — forcing it would bloat headless
94
+ and CI installs.
101
95
 
102
96
  ## Quick start
103
97
 
@@ -137,7 +131,7 @@ with SSHHandler(SSHConfig(host="10.0.0.5", username="root", password="pw")) as s
137
131
  with **live regex matching**, a per-line/per-match callback, and **tee to a
138
132
  local file**, all built in.
139
133
 
140
- **Serial / COM ports** (`SerialHandler`, needs the `serial` extra)
134
+ **Serial / COM ports** (`SerialHandler`, included by default)
141
135
  - `list_serial_ports()`, `open`/`close`, `write` / `write_line`.
142
136
  - `iter_lines()` and `stream(...)` — same live streaming + match + save-to-file
143
137
  model as SSH, for device consoles.
@@ -298,8 +292,57 @@ To stop a stream from another thread (e.g. a GUI Stop button), pass a
298
292
 
299
293
  ## Serial / COM ports
300
294
 
301
- Same streaming + match + save model for device serial consoles (needs
302
- `pip install "ssh-handler[serial]"`).
295
+ Same streaming + match + save model for device serial consoles (included by
296
+ default — no extra install).
297
+
298
+ ### Local serial (device plugged into the machine running the code)
299
+ ```python
300
+ from ssh_handler import SerialHandler, list_serial_ports
301
+ print(list_serial_ports())
302
+ with SerialHandler("COM5", baudrate=115200, quiet=True) as ser:
303
+ ser.write_line("version")
304
+ ser.stream(on_line=print, match=r"login:", stop_on_match=True, save_to="console.log")
305
+ ```
306
+
307
+ ### Serial via RDP / jump host (device on the remote target)
308
+ `pyserial` only opens a *local* port, so when the serial cable is on the remote
309
+ box (reached through your RDP jump), stream it **over SSH** with `serial_stream()`
310
+ — same live match + save, routed through the jump:
311
+
312
+ ```python
313
+ rdp_box = SSHConfig(host="10.232.9.22", domain="CORP", username="myuser", password="pw")
314
+ target = SSHConfig(host="10.120.1.91", username="root", password="pw",
315
+ jump_host=rdp_box, host_key_policy="ignore")
316
+
317
+ with SSHHandler(target, quiet=True) as ssh:
318
+ ssh.serial_write("/dev/ttyUSB0", "version") # write to the device
319
+ ssh.serial_stream("/dev/ttyUSB0", baudrate=115200, # read it live
320
+ on_line=print, match=r"login:|ERROR",
321
+ save_to="device_console.log", timeout=120)
322
+ ```
323
+
324
+ `serial_stream()` sets the line speed with `stty` then streams the device — for
325
+ **Linux targets**. (Windows COM ports on the remote side need a remote helper;
326
+ ask if you need that.)
327
+
328
+ ## File transfer (SFTP / SCP / FTP) via RDP
329
+
330
+ **SFTP and SCP already work through the jump host** — no special setup. Once you
331
+ pass `jump_host=`, every transfer runs over that tunnel (laptop → RDP → target):
332
+
333
+ ```python
334
+ with SSHHandler(target, quiet=True) as ssh: # target has jump_host=rdp_box
335
+ ssh.push("firmware.bin", "/tmp/firmware.bin") # SFTP, through the jump
336
+ ssh.pull("/var/log/messages", "messages.log") # SFTP, through the jump
337
+ ssh.scp_push("img.tar", "/tmp/img.tar") # SCP, through the jump
338
+ print(ssh.read_text("/etc/os-release"))
339
+ ```
340
+
341
+ **FTP via RDP:** FTP is a separate protocol (its data channel can't ride an SSH
342
+ tunnel cleanly), so prefer **SFTP through the jump** as shown above — it does the
343
+ same job better and is already routed via RDP. If you specifically need a real
344
+ FTP *server* on the target, run `FTPHandler` on the RDP machine itself (where it
345
+ can reach that server directly).
303
346
 
304
347
  ```python
305
348
  from ssh_handler import SerialHandler, list_serial_ports