ssh-handler 1.2.0__tar.gz → 1.4.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.2.0 → ssh_handler-1.4.0}/PKG-INFO +62 -6
  2. ssh_handler-1.2.0/ssh_handler.egg-info/PKG-INFO → ssh_handler-1.4.0/README.md +536 -506
  3. {ssh_handler-1.2.0 → ssh_handler-1.4.0}/pyproject.toml +1 -1
  4. {ssh_handler-1.2.0 → ssh_handler-1.4.0}/ssh_handler/__init__.py +1 -1
  5. {ssh_handler-1.2.0 → ssh_handler-1.4.0}/ssh_handler/core.py +77 -0
  6. ssh_handler-1.2.0/README.md → ssh_handler-1.4.0/ssh_handler.egg-info/PKG-INFO +562 -480
  7. {ssh_handler-1.2.0 → ssh_handler-1.4.0}/LICENSE +0 -0
  8. {ssh_handler-1.2.0 → ssh_handler-1.4.0}/setup.cfg +0 -0
  9. {ssh_handler-1.2.0 → ssh_handler-1.4.0}/ssh_handler/__main__.py +0 -0
  10. {ssh_handler-1.2.0 → ssh_handler-1.4.0}/ssh_handler/cli.py +0 -0
  11. {ssh_handler-1.2.0 → ssh_handler-1.4.0}/ssh_handler/config.py +0 -0
  12. {ssh_handler-1.2.0 → ssh_handler-1.4.0}/ssh_handler/credentials.py +0 -0
  13. {ssh_handler-1.2.0 → ssh_handler-1.4.0}/ssh_handler/exceptions.py +0 -0
  14. {ssh_handler-1.2.0 → ssh_handler-1.4.0}/ssh_handler/ftp.py +0 -0
  15. {ssh_handler-1.2.0 → ssh_handler-1.4.0}/ssh_handler/openssh/OpenSSH-ARM64.zip +0 -0
  16. {ssh_handler-1.2.0 → ssh_handler-1.4.0}/ssh_handler/openssh/OpenSSH-Win32.zip +0 -0
  17. {ssh_handler-1.2.0 → ssh_handler-1.4.0}/ssh_handler/openssh/OpenSSH-Win64.zip +0 -0
  18. {ssh_handler-1.2.0 → ssh_handler-1.4.0}/ssh_handler/pool.py +0 -0
  19. {ssh_handler-1.2.0 → ssh_handler-1.4.0}/ssh_handler/pyqt_worker.py +0 -0
  20. {ssh_handler-1.2.0 → ssh_handler-1.4.0}/ssh_handler/results.py +0 -0
  21. {ssh_handler-1.2.0 → ssh_handler-1.4.0}/ssh_handler/serial_handler.py +0 -0
  22. {ssh_handler-1.2.0 → ssh_handler-1.4.0}/ssh_handler/setup_openssh_server.ps1 +0 -0
  23. {ssh_handler-1.2.0 → ssh_handler-1.4.0}/ssh_handler/winrm_bootstrap.py +0 -0
  24. {ssh_handler-1.2.0 → ssh_handler-1.4.0}/ssh_handler.egg-info/SOURCES.txt +0 -0
  25. {ssh_handler-1.2.0 → ssh_handler-1.4.0}/ssh_handler.egg-info/dependency_links.txt +0 -0
  26. {ssh_handler-1.2.0 → ssh_handler-1.4.0}/ssh_handler.egg-info/entry_points.txt +0 -0
  27. {ssh_handler-1.2.0 → ssh_handler-1.4.0}/ssh_handler.egg-info/requires.txt +0 -0
  28. {ssh_handler-1.2.0 → ssh_handler-1.4.0}/ssh_handler.egg-info/top_level.txt +0 -0
  29. {ssh_handler-1.2.0 → ssh_handler-1.4.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.2.0
3
+ Version: 1.4.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
@@ -295,11 +295,67 @@ To stop a stream from another thread (e.g. a GUI Stop button), pass a
295
295
  Same streaming + match + save model for device serial consoles (included by
296
296
  default — no extra install).
297
297
 
298
- > **Important where the COM port physically is.** `pyserial` opens a *local*
299
- > port, so this runs on the machine the device is **plugged into**. If the device
300
- > is on your laptop, run it on your laptop. If it's on the remote/RDP machine,
301
- > either run the script there, or — on Linux targets — stream the device file
302
- > over SSH instead: `ssh.stream("cat /dev/ttyUSB0", match=..., save_to=...)`.
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 / SSH (port on a *remote* machine)
308
+ `pyserial` only opens a *local* port, so when the serial port is on a remote
309
+ machine, stream it **over SSH** with `serial_stream()` — same live match + save.
310
+ It auto-detects the OS from the device name: `COM*` → Windows (PowerShell
311
+ SerialPort reader), `/dev/tty*` → Linux (`stty` + `cat`).
312
+
313
+ **Windows COM port on the remote machine** (connect SSH straight to that machine
314
+ — it has sshd from `ssh-handler-setup`):
315
+
316
+ ```python
317
+ cfg = SSHConfig(host="10.232.9.22", domain="CORP", username="myuser",
318
+ password="pw", host_key_policy="ignore")
319
+ with SSHHandler(cfg, quiet=True) as ssh:
320
+ ssh.serial_write("COM5", "version", baudrate=115200) # write a line
321
+ ssh.serial_stream("COM5", baudrate=115200, # read it live
322
+ on_line=print, match=r"login:|ERROR",
323
+ save_to="com5.log", timeout=120)
324
+ ```
325
+
326
+ **Linux device file on a target reached through the jump:**
327
+
328
+ ```python
329
+ target = SSHConfig(host="10.120.1.91", username="root", password="pw",
330
+ jump_host=rdp_box, host_key_policy="ignore")
331
+ with SSHHandler(target, quiet=True) as ssh:
332
+ ssh.serial_stream("/dev/ttyUSB0", baudrate=115200,
333
+ on_line=print, match=r"login:", save_to="ttyusb0.log")
334
+ ```
335
+
336
+ > Note: on Windows a COM port can't be shared — don't run `serial_write` while a
337
+ > `serial_stream` on the same port is open (`serial_write` opens/writes/closes).
338
+ > If the port is on **your own laptop**, use the local `SerialHandler("COM5")`
339
+ > above instead — no SSH needed.
340
+
341
+ ## File transfer (SFTP / SCP / FTP) via RDP
342
+
343
+ **SFTP and SCP already work through the jump host** — no special setup. Once you
344
+ pass `jump_host=`, every transfer runs over that tunnel (laptop → RDP → target):
345
+
346
+ ```python
347
+ with SSHHandler(target, quiet=True) as ssh: # target has jump_host=rdp_box
348
+ ssh.push("firmware.bin", "/tmp/firmware.bin") # SFTP, through the jump
349
+ ssh.pull("/var/log/messages", "messages.log") # SFTP, through the jump
350
+ ssh.scp_push("img.tar", "/tmp/img.tar") # SCP, through the jump
351
+ print(ssh.read_text("/etc/os-release"))
352
+ ```
353
+
354
+ **FTP via RDP:** FTP is a separate protocol (its data channel can't ride an SSH
355
+ tunnel cleanly), so prefer **SFTP through the jump** as shown above — it does the
356
+ same job better and is already routed via RDP. If you specifically need a real
357
+ FTP *server* on the target, run `FTPHandler` on the RDP machine itself (where it
358
+ can reach that server directly).
303
359
 
304
360
  ```python
305
361
  from ssh_handler import SerialHandler, list_serial_ports