multiSSH3 5.91__py3-none-any.whl → 6.2__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.

Potentially problematic release.


This version of multiSSH3 might be problematic. Click here for more details.

@@ -0,0 +1,6 @@
1
+ multiSSH3.py,sha256=Jwq-X0NMKbnqP_rJhHuvz_OZPgLUrvoTrUbIUIaul0Q,183084
2
+ multissh3-6.2.dist-info/METADATA,sha256=YTqqyXE9i6Nx9IDwB8S9QybB3pdR9RT8sOL3a9n4cs4,44607
3
+ multissh3-6.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
4
+ multissh3-6.2.dist-info/entry_points.txt,sha256=xi2rWWNfmHx6gS8Mmx0rZL2KZz6XWBYP3DWBpWAnnZ0,143
5
+ multissh3-6.2.dist-info/top_level.txt,sha256=tUwttxlnpLkZorSsroIprNo41lYSxjd2ASuL8-EJIJw,10
6
+ multissh3-6.2.dist-info/RECORD,,
@@ -1,379 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: multiSSH3
3
- Version: 5.91
4
- Summary: Run commands on multiple hosts via SSH
5
- Home-page: https://github.com/yufei-pan/multiSSH3
6
- Author: Yufei Pan
7
- Author-email: pan@zopyr.us
8
- License: GPLv3+
9
- Classifier: Programming Language :: Python :: 3
10
- Classifier: License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
11
- Classifier: Operating System :: POSIX :: Linux
12
- Classifier: Operating System :: MacOS
13
- Classifier: Operating System :: Microsoft :: Windows
14
- Requires-Python: >=3.6
15
- Description-Content-Type: text/markdown
16
- Requires-Dist: argparse
17
- Requires-Dist: ipaddress
18
- Dynamic: author
19
- Dynamic: author-email
20
- Dynamic: classifier
21
- Dynamic: description
22
- Dynamic: description-content-type
23
- Dynamic: home-page
24
- Dynamic: license
25
- Dynamic: requires-dist
26
- Dynamic: requires-python
27
- Dynamic: summary
28
-
29
- # multiSSH3
30
- A script that is able to issue commands to multiple hosts while monitoring their progress.
31
- Can be used in bash scripts for automation actions.
32
- Also able to be imported and / or use with Flexec SSH Backend to perform cluster automation actions.
33
-
34
- Install via
35
- ```bash
36
- pip install multiSSH3
37
- ```
38
-
39
- multiSSH3 will be available as
40
- ```bash
41
- mssh
42
- mssh3
43
- multissh
44
- multissh3
45
- multiSSH3
46
- ```
47
-
48
- multissh will read a config file located at ```/etc/multiSSH3.config.json```
49
-
50
- To store / generate a config file with the current command line options, you can use
51
-
52
- ```bash
53
- mssh --store_config_file
54
- ```
55
-
56
- You can modify the json file directly after generation and multissh will read from it for loading defaults.
57
-
58
- ```bash
59
- mssh --ipmi_interface_ip_prefix 192 --store_config_file
60
- ```
61
- will store
62
- ```json
63
- "DEFAULT_IPMI_INTERFACE_IP_PREFIX": "192"
64
- ```
65
- into the json file.
66
-
67
- Note:
68
-
69
- If you want to store password, it will be a plain text password in this config file. This will be better to supply it everytime as a CLI argument but you should really consider setting up priv-pub key setup.
70
-
71
- Also Note:
72
-
73
- On some systems, scp / rsync will require you use a priv-pub key to work
74
-
75
- This option can also be used to store cli options into the config files. For example.
76
-
77
- By defualt reads bash env variables for hostname aliases. Also able to read
78
- ```bash
79
- DEFAULT_ENV_FILE = '/etc/profile.d/hosts.sh'
80
- ```
81
- as hostname aliases.
82
-
83
- multissh3 will resolve hostname grouping by:
84
- ipv4 address expansion > local hostname resolution ( like /etc/hosts ) > currrent terminal environment > env from env_file > remote hostname resolution ( socket.gethostbyname() )
85
-
86
- An example hostname alias file will look like:
87
- ```bash
88
- us_east='100.100.0.1-3,us_east_prod_[1-5]'
89
- us_central=""
90
- us_west="100.101.0.1-2,us_west_prod_[a-c]_[1-3]"
91
- us="$us_east,$us_central,$us_west"
92
- asia="100.90.0-1.1-9"
93
- eu=''
94
- rhel8="$asia,$us_east"
95
- all="$us,$asia,$eu"
96
- ```
97
- ( You can use bash replacements for grouping. )
98
-
99
- For example:
100
- ```bash
101
- export all='192.168.1-2.1-64'
102
- mssh all 'echo hi'
103
- ```
104
-
105
- Note: you probably want to set presistent ssh connections to speed up each connection events.
106
- An example .ssh/config:
107
- ```bash
108
- Host *
109
- StrictHostKeyChecking no
110
- ControlMaster auto
111
- ControlPath /run/user/%i/ssh_sockets_%C
112
- ControlPersist 3600
113
- ```
114
-
115
- It is also able to recognize ip blocks / number blocks / hex blocks / character blocks directly.
116
-
117
- For example:
118
- ```bash
119
- mssh testrig[1-10] lsblk
120
- mssh ww[a-c],10.100.0.* 'cat /etc/fstab' 'sed -i "/lustre/d' /etc/fstab' 'cat /etc/fstab'
121
- ```
122
-
123
- It also supports interactive inputs. ( and able to async boardcast to all supplied hosts )
124
- ```bash
125
- mssh www bash
126
- ```
127
-
128
- By default, it will try to fit everything inside your window.
129
- ```bash
130
- DEFAULT_CURSES_MINIMUM_CHAR_LEN = 40
131
- DEFAULT_CURSES_MINIMUM_LINE_LEN = 1
132
- ```
133
- While leaving minimum 40 characters / 1 line for each host display by default. You can modify this by using -ww and -wh.
134
-
135
-
136
- Use ```mssh --help``` for more info.
137
-
138
- ```bash
139
- usage: mssh [-h] [-u USERNAME] [-p PASSWORD] [-k [KEY]] [-uk] [-ea EXTRAARGS] [-11] [-f FILE] [-fs] [--scp] [-gm] [-t TIMEOUT] [-r REPEAT]
140
- [-i INTERVAL] [--ipmi] [-mpre IPMI_INTERFACE_IP_PREFIX] [-pre INTERFACE_IP_PREFIX] [-q] [-ww WINDOW_WIDTH] [-wh WINDOW_HEIGHT]
141
- [-sw] [-eo] [-no] [--no_env] [--env_file ENV_FILE] [-m MAX_CONNECTIONS] [-j] [--success_hosts] [-g] [-su | -nsu]
142
- [-sh SKIP_HOSTS] [--store_config_file] [--debug] [-ci] [-V]
143
- [hosts] [commands ...]
144
-
145
- Run a command on multiple hosts, Use #HOST# or #HOSTNAME# to replace the host name in the command. Config file: /etc/multiSSH3.config.json
146
-
147
- positional arguments:
148
- hosts Hosts to run the command on, use "," to seperate hosts. (default: all)
149
- commands the command to run on the hosts / the destination of the files #HOST# or #HOSTNAME# will be replaced with the host
150
- name.
151
-
152
- options:
153
- -h, --help show this help message and exit
154
- -u USERNAME, --username USERNAME
155
- The general username to use to connect to the hosts. Will get overwrote by individual username@host if specified.
156
- (default: None)
157
- -p PASSWORD, --password PASSWORD
158
- The password to use to connect to the hosts, (default: )
159
- -k [KEY], --key [KEY], --identity [KEY]
160
- The identity file to use to connect to the hosts. Implies --use_key. Specify a folder for program to search for a
161
- key. Use option without value to use ~/.ssh/ (default: None)
162
- -uk, --use_key Attempt to use public key file to connect to the hosts. (default: False)
163
- -ea EXTRAARGS, --extraargs EXTRAARGS
164
- Extra arguments to pass to the ssh / rsync / scp command. Put in one string for multiple arguments.Use "=" ! Ex.
165
- -ea="--delete" (default: None)
166
- -11, --oneonone Run one corresponding command on each host. (default: False)
167
- -f FILE, --file FILE The file to be copied to the hosts. Use -f multiple times to copy multiple files
168
- -fs, --file_sync Operate in file sync mode, sync path in <COMMANDS> from this machine to <HOSTS>. Treat --file <FILE> and
169
- <COMMANDS> both as source as source and destination will be the same in this mode. (default: False)
170
- --scp Use scp for copying files instead of rsync. Need to use this on windows. (default: False)
171
- -gm, --gather_mode Gather files from the hosts instead of sending files to the hosts. Will send remote files specified in <FILE> to
172
- local path specified in <COMMANDS> (default: False)
173
- -t TIMEOUT, --timeout TIMEOUT
174
- Timeout for each command in seconds (default: 600 (disabled))
175
- -r REPEAT, --repeat REPEAT
176
- Repeat the command for a number of times (default: 1)
177
- -i INTERVAL, --interval INTERVAL
178
- Interval between repeats in seconds (default: 0)
179
- --ipmi Use ipmitool to run the command. (default: False)
180
- -mpre IPMI_INTERFACE_IP_PREFIX, --ipmi_interface_ip_prefix IPMI_INTERFACE_IP_PREFIX
181
- The prefix of the IPMI interfaces (default: )
182
- -pre INTERFACE_IP_PREFIX, --interface_ip_prefix INTERFACE_IP_PREFIX
183
- The prefix of the for the interfaces (default: None)
184
- -q, -nw, --no_watch, --quiet
185
- Quiet mode, no curses watch, only print the output. (default: False)
186
- -ww WINDOW_WIDTH, --window_width WINDOW_WIDTH
187
- The minimum character length of the curses window. (default: 40)
188
- -wh WINDOW_HEIGHT, --window_height WINDOW_HEIGHT
189
- The minimum line height of the curses window. (default: 5)
190
- -sw, --single_window Use a single window for all hosts. (default: False)
191
- -eo, --error_only Only print the error output. (default: False)
192
- -no, --no_output Do not print the output. (default: False)
193
- --no_env Do not load the command line environment variables. (default: False)
194
- --env_file ENV_FILE The file to load the mssh file based environment variables from. ( Still work with --no_env ) (default:
195
- /etc/profile.d/hosts.sh)
196
- -m MAX_CONNECTIONS, --max_connections MAX_CONNECTIONS
197
- Max number of connections to use (default: 4 * cpu_count)
198
- -j, --json Output in json format. (default: False)
199
- --success_hosts Output the hosts that succeeded in summary as wells. (default: False)
200
- -g, --greppable, --table
201
- Output in greppable format. (default: False)
202
- -su, --skip_unreachable
203
- Skip unreachable hosts. Note: Timedout Hosts are considered unreachable. Note: multiple command sequence will
204
- still auto skip unreachable hosts. (default: False)
205
- -nsu, --no_skip_unreachable
206
- Do not skip unreachable hosts. Note: Timedout Hosts are considered unreachable. Note: multiple command sequence
207
- will still auto skip unreachable hosts. (default: True)
208
- -sh SKIP_HOSTS, --skip_hosts SKIP_HOSTS
209
- Skip the hosts in the list. (default: None)
210
- --store_config_file Store / generate the default config file from command line argument and current config at
211
- /etc/multiSSH3.config.json
212
- --debug Print debug information
213
- -ci, --copy_id Copy the ssh id to the hosts
214
- -V, --version show program's version number and exit
215
- ```
216
-
217
- Following document is generated courtesy of Mr.ChatGPT-o1 Preview:
218
-
219
- # multissh
220
-
221
- `multissh` is a powerful Python script that allows you to run commands on multiple hosts concurrently over SSH. It supports various features such as copying files, handling IP address ranges, using IPMI, and more. It's designed to simplify the management of multiple remote systems by automating command execution and file synchronization.
222
-
223
- ## Table of Contents
224
-
225
- - [multiSSH3](#multissh3)
226
- - [multissh](#multissh)
227
- - [Table of Contents](#table-of-contents)
228
- - [Features](#features)
229
- - [Basic Syntax](#basic-syntax)
230
- - [Command-Line Options](#command-line-options)
231
- - [Examples](#examples)
232
- - [Running a Command on Multiple Hosts](#running-a-command-on-multiple-hosts)
233
- - [Copying Files to Multiple Hosts](#copying-files-to-multiple-hosts)
234
- - [Using Hostname Ranges](#using-hostname-ranges)
235
- - [Using IPMI](#using-ipmi)
236
- - [Using Password Authentication](#using-password-authentication)
237
- - [Skipping Unreachable Hosts](#skipping-unreachable-hosts)
238
- - [JSON Output](#json-output)
239
- - [Quiet Mode](#quiet-mode)
240
- - [Environment Variables](#environment-variables)
241
- - [Notes](#notes)
242
- - [License](#license)
243
-
244
- ## Features
245
-
246
- - **Concurrent Execution**: Run commands on multiple hosts concurrently with controlled parallelism.
247
- - **File Transfer**: Copy files or synchronize directories to multiple hosts using `rsync` or `scp`.
248
- - **Hostname Expansion**: Support for hostname ranges and wildcards for easy targeting of multiple hosts.
249
- - **IPMI Support**: Execute IPMI commands on remote hosts.
250
- - **Authentication**: Support for SSH password authentication and key-based authentication.
251
- - **Custom SSH Options**: Pass extra arguments to SSH, `rsync`, or `scp` commands.
252
- - **Skip Unreachable Hosts**: Option to skip hosts that are unreachable.
253
- - **Output Formats**: Supports JSON and greppable output formats.
254
- - **Interactive Mode**: Run interactive commands with curses-based UI for monitoring.
255
- - **Quiet Mode**: Suppress output for cleaner automation scripts.
256
-
257
- ### Basic Syntax
258
-
259
- ```bash
260
- mssh [options] <hosts> <commands>
261
- ```
262
-
263
- - `<hosts>`: Comma-separated list of target hosts. Supports ranges and wildcards.
264
- - `<commands>`: Command(s) to execute on the target hosts.
265
-
266
- ### Command-Line Options
267
-
268
- | Short Option | Long Option | Description |
269
- |--------------|---------------------------|-----------------------------------------------------------------------------------------------------------|
270
- | `-u` | `--username` | Username for SSH connections. |
271
- | `-ea` | `--extraargs` | Extra arguments for SSH/rsync/scp commands. |
272
- | `-p` | `--password` | Password for SSH authentication. Requires `sshpass`. |
273
- | `-11` | `--oneonone` | Run one command per host (commands and hosts lists must have the same length). |
274
- | `-f` | `--file` | File(s) to copy to the hosts. Can be used multiple times. |
275
- | | `--file_sync` | Synchronize directories instead of copying files. |
276
- | | `--scp` | Use `scp` instead of `rsync` for file transfer. |
277
- | `-t` | `--timeout` | Command execution timeout in seconds. |
278
- | `-r` | `--repeat` | Number of times to repeat the command execution. |
279
- | `-i` | `--interval` | Interval between command repetitions in seconds. |
280
- | | `--ipmi` | Use IPMI to execute commands. |
281
- | `-pre` | `--interface_ip_prefix` | IP prefix for interface selection. |
282
- | `-q` | `--quiet` | Suppress output. |
283
- | `-ww` | `--window_width` | Minimum character width for the curses window. |
284
- | `-wh` | `--window_height` | Minimum line height for the curses window. |
285
- | `-sw` | `--single_window` | Use a single window for all hosts in curses mode. |
286
- | `-eo` | `--error_only` | Only display error outputs. |
287
- | `-no` | `--nooutput` | Do not print any output. |
288
- | | `--no_env` | Do not load environment variables from files. |
289
- | | `--env_file` | Specify a custom environment file. |
290
- | `-m` | `--maxconnections` | Maximum number of concurrent SSH connections. |
291
- | `-j` | `--json` | Output results in JSON format. |
292
- | | `--success_hosts` | Also display hosts where commands succeeded. |
293
- | `-g` | `--greppable` | Output results in a greppable format. |
294
- | `-nw` | `--no_watch` | Do not use curses mode; use simple output instead. |
295
- | `-su` | `--skipunreachable` | Skip hosts that are unreachable. |
296
- | `-sh` | `--skiphosts` | Comma-separated list of hosts to skip. |
297
- | `-V` | `--version` | Display the script version and exit. |
298
-
299
- ## Examples
300
-
301
- ### Running a Command on Multiple Hosts
302
-
303
- ```bash
304
- mssh "host1,host2,host3" "uptime"
305
- ```
306
-
307
- This command runs `uptime` on `host1`, `host2`, and `host3`.
308
-
309
- ### Copying Files to Multiple Hosts
310
-
311
- ```bash
312
- mssh -f "/path/to/local/file.txt" "host1,host2,host3" "/remote/path/"
313
- ```
314
-
315
- This command copies `file.txt` to `/remote/path/` on the specified hosts.
316
-
317
- ### Using Hostname Ranges
318
-
319
- ```bash
320
- mssh "host[01-05]" "hostname"
321
- ```
322
-
323
- This expands to `host01`, `host02`, `host03`, `host04`, `host05` and runs `hostname` on each.
324
-
325
- ### Using IPMI
326
-
327
- ```bash
328
- mssh --ipmi "192.168.1.[100-105]" "chassis power status"
329
- ```
330
-
331
- Runs `ipmitool chassis power status` on the specified IPMI interfaces.
332
-
333
- ### Using Password Authentication
334
-
335
- ```bash
336
- mssh -p "yourpassword" "host1,host2" "whoami"
337
- ```
338
-
339
- Uses `sshpass` to provide the password for SSH authentication.
340
-
341
- ### Skipping Unreachable Hosts
342
-
343
- ```bash
344
- mssh -su "host1,host2,host3" "date"
345
- ```
346
-
347
- Skips hosts that are unreachable during execution.
348
-
349
- ### JSON Output
350
-
351
- ```bash
352
- mssh -j "host1,host2" "uname -a"
353
- ```
354
-
355
- Outputs the results in JSON format, suitable for parsing.
356
-
357
- ### Quiet Mode
358
-
359
- ```bash
360
- mssh -q "host1,host2" "ls /nonexistent"
361
- ```
362
-
363
- Suppresses all output, useful for scripts where you only care about exit codes.
364
-
365
- ## Environment Variables
366
-
367
- - The script can load environment variables from a file (default: `/etc/profile.d/hosts.sh`) to resolve hostnames.
368
- - Use the `--env_file` option to specify a custom environment file.
369
- - Use `--no_env` to prevent loading any environment variables from files.
370
-
371
- ## Notes
372
- - **Dependencies**: Requires Python 3, `sshpass` (if using password authentication), and standard Unix utilities like `ssh`, `scp`, and `rsync`.
373
- - **Signal Handling**: Supports graceful termination with `Ctrl+C`.
374
-
375
- ## License
376
-
377
- This script is provided "as is" without any warranty. Use it at your own risk.
378
-
379
- ---
@@ -1,6 +0,0 @@
1
- multiSSH3.py,sha256=9hTPnoRn6yswbQ8QaQIvkgIOwlVohz1o8jFlq_-S5D0,172386
2
- multissh3-5.91.dist-info/METADATA,sha256=kyyw0bHMd-ifFluN0LAlKqhY6udom5D3Q2_AgAuSqqU,18093
3
- multissh3-5.91.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
4
- multissh3-5.91.dist-info/entry_points.txt,sha256=xi2rWWNfmHx6gS8Mmx0rZL2KZz6XWBYP3DWBpWAnnZ0,143
5
- multissh3-5.91.dist-info/top_level.txt,sha256=tUwttxlnpLkZorSsroIprNo41lYSxjd2ASuL8-EJIJw,10
6
- multissh3-5.91.dist-info/RECORD,,