Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/day0ng/w-sw-ssh
This is a simple tool to execute multiple commands on network device, such as router and switch, and it supports Cisco Catalyst, Cisco Nexus, Huawei and H3C.
https://github.com/day0ng/w-sw-ssh
Last synced: 6 days ago
JSON representation
This is a simple tool to execute multiple commands on network device, such as router and switch, and it supports Cisco Catalyst, Cisco Nexus, Huawei and H3C.
- Host: GitHub
- URL: https://github.com/day0ng/w-sw-ssh
- Owner: day0ng
- Created: 2015-11-27T11:48:36.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2022-10-17T11:57:22.000Z (about 2 years ago)
- Last Synced: 2024-08-01T19:51:48.150Z (3 months ago)
- Language: Python
- Homepage:
- Size: 16.6 KB
- Stars: 24
- Watchers: 6
- Forks: 12
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# w-sw-ssh
This is a simple tool to execute multiple commands on network device, such as router and switch, and it supports Cisco Catalyst, Cisco Nexus, Huawei and H3C.Author
==============
Wang Dayong (Email: [email protected], http://weibo.com/wandering997)Depends
==============
pexpect (https://pypi.python.org/pypi/pexpect/)Help
==============[root@TEST w-sw-ssh]# w-sw-ssh.py
Usage: w-sw-ssh.py
--uid SSH username
--pwd SSH password
-p Get password from user input
--host ip[:port] list of remote ssh server, default port is 22
--host_file Filename of ip[:port] list
--cmd Command list to execute on remote ssh server
--cmd_prefix Prefix of command list files. For example:
test.cmd.cisco
test.cmd.cisco_nexus
test.cmd.h3c
test.cmd.huawei
'test' is the prefix (--cmd_prefix).--cmd_interval Time to wait after a command being executed, default is 0.5s.
And some devices would get error if execute command too fast.--save Save config on device automatically after user cmd being executed.
--log_dir Log command output to // instead of stdout.
Example:
/var/log/test/$(date "+%Y")/$(date "+%Y%m%d")/--thread The maximum threads could be spread each time, default is 1000.
--timeout Time to wait for command executing, default is 10 seconds.
Try to set higher value in case of seeing 'pexpect timed out' error.--l2_sw Check the layer-2 switch only infomation, such as uplink, gateway etc.
Caution:
--host has higher priority than --host_file
--cmd has higher priority than --cmd_prefixExample:
w-sw-ssh.py --uid npc -p --host 192.168.161.10 --cmd "disp users"
w-sw-ssh.py --uid npc -p --host_file ~/ip.test --cmd_prefix ~/cmd.test[root@TEST w-sw-ssh]#