Commit graph

7 commits

Author SHA1 Message Date
Greg T. Wallace
703c26bd27 apcssh: add shell cmd timeout
It was possible for scanner.Scan() to block indefinitely if the UPS never returned the expected prompt regex pattern. This could occur with a UPS using a prompt format I'm not aware of, or if the UPS responds in a non-standard way.

This change ensures that Scan() is aborted after a fixed amount of blocking time and the shell cmd function accordingly returns an error.

Some error messages, comments, and var names are also updated for clarity.
2024-06-19 19:56:17 -04:00
Greg T. Wallace
841a459dca apcssh: minor log and logic clarity 2024-06-19 19:56:16 -04:00
Greg T. Wallace
208827f636 ssh: fix shell regex
* from ssh videos I found on youtube, the @ symbol might not be present in prompt, so make it optional
* fix typo of 0-0 instead of 0-9 (all numbers are possible in the prompt)
2024-06-18 21:30:40 -04:00
Greg T. Wallace
7bf70c4d71 ssh: switch string comps to EqualFold func 2024-06-18 21:30:39 -04:00
Greg T. Wallace
12c613f3b4 apcssh: remove logging
For sanity and consistency, centralize logging in the app with the app's loggers.
2024-06-06 22:52:54 -04:00
Greg T. Wallace
dda11df624 install: add support for native ssl command
The code should auto-select the native ssl method if the ssl command is available on the UPS.

If this fails, install will drop back to the original install method used by this tool (which works on NMC2).
2024-06-06 22:52:54 -04:00
Greg T. Wallace
06c9263bc4 ssh: breakout ups ssh to its own package
This was done for clearer separation of function. A subsequent update will (hopefully) make the SSL command more robust so it works for both NMC2 and NMC3.

The method for sending shell commands was also updated to use an interactive shell instead. This allows capturing responses of the commands which will be needed to deduce if devices are NMC2 or NMC3.
2024-06-06 22:52:54 -04:00