cloudxtreme / sshpt Goto Github PK
View Code? Open in Web Editor NEWAutomatically exported from code.google.com/p/sshpt
Automatically exported from code.google.com/p/sshpt
sshpt -- SSH Power Tool Copyright (C) 2011 Dan McDougall. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License (GPL) version 3 as published by the Free Software Foundation. A copy of the GNU GPLv3 should have been distributed with this sofware. If a copy was not provided it may be downloaded at the following URL: http://www.gnu.org/licenses/gpl-3.0.txt *******************************************************************************` Detailed information on sshpt as well as the latest version can be found at the following URL: http://code.google.com/p/sshpt/ No installation is necessary to use sshpt but Python 2.5+ is required as well as the following Python modules: Paramiko - Pythonic SSH implementation URL: http://www.lag.net/paramiko/ pycrypto - Python Cryptography Toolkit URL: http://www.amk.ca/python/code/crypto.html If you want to use sshpt as a module in your Python program a setup.py has been provided: sudo python setup.py install
Just find out this tool today, and I really enjoy it.
I'm new to google code, not sure where to sign up for the project.
I like to know how to join this project.
Original issue reported on code.google.com by [email protected]
on 8 Oct 2014 at 6:49
What steps will reproduce the problem?
1. I create a script with 2 commands:
$ cat script.sh
#!/usr/bin/ksh
pwd
uname -a
2. I try send to machines (2 machines in my machine's file):
$ ./sshpt.py -u myuser -P mypass -f maqs -c script.sh -x
"slx00010299","SUCCESS","2010-07-13 17:43:19.596311","sshpt: sftp.put script.sh
slx00010299:/tmp/","0: Failure
1: "
"slx00010300","SUCCESS","2010-07-13 17:43:20.594740","sshpt: sftp.put script.sh
slx00010300:/tmp/","0: Failure
1: "
What is the expected output? What do you see instead?
I don't know. I never have seen the correct output.
What version of the product are you using? On what operating system?
Ubuntu 9.04
Linux bypper 2.6.28-19-generic #61-Ubuntu SMP Wed May 26 23:35:15 UTC 2010 i686
GNU/Linux
Python 2.6.2
Please provide any additional information below.
If I run a remote command in the same machines, no problem:
$ ./sshpt.py -u myuser -P mypass -f maqs "uname -a"
"slx00010299","SUCCESS","2010-07-13 17:42:43.601907","uname -a","Linux
SLX00010299 2.6.5-7.308-bigsmp #1 SMP Mon Dec 10 11:36:40 UTC 2007 i686 i686
i386 GNU/Linux"
"slx00010300","SUCCESS","2010-07-13 17:42:44.720475","uname -a","Linux
SLX00010300 2.6.5-7.308-bigsmp #1 SMP Mon Dec 10 11:36:40 UTC 2007 i686 i686
i386 GNU/Linux"
The script isn't in /tmp from remote machine.
Original issue reported on code.google.com by [email protected]
on 13 Jul 2010 at 3:56
What steps will reproduce the problem?
1. sshpt from sol 8.0 to sol8 / sol9 /sol10
2.
3.
What is the expected output? What do you see instead?
It should run the command remotely, but it hungs and says egg broken.
What version of the product are you using? On what operating system?
sshpt.py runs on sun 8.0 -> clients are sol 8/9/10 and redhat linux 5.6 , SUSE
linux
Please provide any additional information below.
Original issue reported on code.google.com by [email protected]
on 29 Oct 2011 at 12:10
What steps will reproduce the problem?
1. Run old version of sshpt
What is the expected output? What do you see instead?
I expect to find the new features I added, but they are not
there.
What version of the product are you using? On what operating system?
v1.20 on Linux
Please provide any additional information below.
The attached patch includes the following changes:
1. correct misspelled variable name, which led to a bug where quotes
were not doubled when they needed to be.
2. Added ssh config usage (option -F). This allows sshpt to use host
names and ports specified in the ssh configuration file.
By default, ~/.ssh/config is used, but another file can be
specified if desired.
With this change, the names in the hostfile can be ssh config host
names and sshpt will use the HostName and Port from the
config file if they exist. Since the real hostname we connect to
could differ from the specified name in the hosts file,
I had to make a few changes to ensure that the user specified names
would show up in the output.
I did make sure to maintain the same interfaces so any existing
libraries will continue to work.
3. Added 'use-agent' option (-A) to allow user to specify whether to
use an ssh agent. Without this option, a password based connection
would try all loaded ssh keys first, wasting time and potentially
losing the connection if the remote host has been configured
to reject connections after a few failures. This is kind of a
negative option; I added it so I could turn off agent usage by
default, while
leaving the option to turn it back on if desired.
4. I updated the handler for the hosts file so one can optionally
specify a username and password, in addition to the host entry. An
entry can now be one of
host
host:username:password
host:username
host::password
Any unspecified value will be pulled from the auth file, which is
still required. That is a minor annoyance when all usernames and
passwords are
specified in the hosts file but I can get around it by specifying a
'fake' auth file.
5. Various small fixes and minor improvements.
Please let me know if you have any questions or comments.
Thanks for writing sshpt; it really fit the bill for what I was doing!
-Gyepi
Original issue reported on code.google.com by [email protected]
on 24 Aug 2012 at 1:35
Attachments:
What steps will reproduce the problem?
1. Create auth file with line username:password as documented
2. sshpt -f hosts -a auth "uptime"
3. Atribute error on line 453 Version 1.1.2
What is the expected output? What do you see instead?
No error
What version of the product are you using? On what operating system?
1.1.2
Please provide any additional information below:
following line should be like this
credentials = open(options.authfile).readline()
Also follwing fragements, when username and password acquired from auth
file, it should not ask usrname and password again.
if options.authfile is not None:
credentials = open(options.authfile).readline()
username, password = credentials.split(":")
# Get the username and password to use when checking hosts
if options.username == None:
username = raw_input('Username: ')
if options.password == None:
password = getpass.getpass('Password: ')
Original issue reported on code.google.com by [email protected]
on 27 Mar 2010 at 2:18
What steps will reproduce the problem?
1. Run the command %pip install sshpt
What is the expected output? What do you see instead?
sshpt is installed successfully.
What version of the product are you using? On what operating system?
python 2.6.6. Linux
Please provide any additional information below.
I get the following error. This is dependent on python 3.1. Please make it
backward compatible and it is just due to the author section in setup.py.
File "<string>", line 16, in <module>
File "/tmp/pip-build-root/sshpt/setup.py", line 17, in <module>
author = "{},{}".format(sshpt.__author__, sshpt.__second_author__),
ValueError: zero length field name in format
Original issue reported on code.google.com by [email protected]
on 9 Aug 2015 at 3:45
I just briefly looked at the source code and at line 60 there is:
srting = re.sub(r'(")', '""', string)
so, the string is misspelled. It doesn't affect though, because
the substitution is done in place and the assignment is not needed.
Original issue reported on code.google.com by [email protected]
on 7 Jan 2011 at 12:05
Fix the typo in normalizeString() that breaks CSV RFC 4180 compliance.
Original issue reported on code.google.com by [email protected]
on 19 Oct 2011 at 4:53
Attachments:
When trying to install sshpt on a system without setuptools it fails for
obvious reasons.
Here's a patch that fixes it, while still using setuptools where available:
--- setup.py.o 2012-03-28 15:55:34.000000000 +0100
+++ setup.py 2012-03-28 16:17:16.000000000 +0100
@@ -1,9 +1,15 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
-from setuptools import setup, find_packages
import sys, os
+try:
+ from setuptools import setup, find_packages
+ pkgs_provided = find_packages(exclude=['ez_setup', 'examples', 'tests'])
+except ImportError:
+ from distutils.core import setup
+ pkgs_provided = []
+
version = '1.2.0'
setup(name = 'sshpt',
@@ -24,7 +30,7 @@
author = 'Dan McDougall',
author_email = '[email protected]',
url = 'http://code.google.com/p/sshpt/',
- packages=find_packages(exclude=['ez_setup', 'examples', 'tests']),
+ packages = pkgs_provided
install_requires=[
"paramiko>=1.7.0",
],
Original issue reported on code.google.com by e.yunak
on 28 Mar 2012 at 3:17
What steps will reproduce the problem?
1. Use the "copy and run this script" functions in sshpt.
2. Have more than 200 or so hosts
3. Watch for the traceback
What is the expected output? What do you see instead?
The expected behavior is to complete all the hosts in the host list.
What version of the product are you using? On what operating system? I'm on
freebsd 9.1 using sshpt version 1.2.0
Please provide any additional information below.
Here is the traceback:
Exception in thread OutputThread:
Traceback (most recent call last):
File "/usr/local/lib/python2.7/threading.py", line 551, in __bootstrap_inner
self.run()
File "./sshpt.py", line 123, in run
self.writeOut(queueObj)
File "./sshpt.py", line 106, in writeOut
elif len(queueObj['command_output']) > 1: # Only prepend 'index: ' if we were passed more than one command
TypeError: object of type 'SSHException' has no len()
Original issue reported on code.google.com by [email protected]
on 15 Jul 2013 at 8:33
What steps will reproduce the problem?
1. run sshpt with a provided username against a host that requires no password
(key-based authentication)
What is the expected output?
sshpt connects and executes desired commands without prompting for a password
What do you see instead?
password prompt
What version of the product are you using? On what operating system?
[N840F7LKS53SU2K:35033355] : </home/35033355>
$ sshpt --version
1.2.0
[N840F7LKS53SU2K:35033355] : </home/35033355>
$
Please provide any additional information below.
user keys and configuration housed under ~/.ssh. public keys have been
installed to target system, but sshpt requests password, indicating that the
software is ignoring key-based authentication
Original issue reported on code.google.com by kmhuntly
on 17 Sep 2014 at 7:26
The attached patch file does the following:
- Adds a remote command error reporting column (last column)
- Make remote 'sudo' commands use an interactive shell which allocates
a pseudo-tty. This deals with cases where 'sudo' requires a tty
e.g. "sudo: sorry, you must have a tty to run sudo"
Apply patch using 'patch -p0 < sshpt.py-gp.patch'
Tested on CentOS/RHEL 5.x and RHEL 4.5
Original issue reported on code.google.com by [email protected]
on 14 May 2012 at 8:23
Attachments:
What steps will reproduce the problem?
1. I'm running this command
./sshpt.py -f ../servers -a ../user -s " yum --disablerepo=* --enablerepo=remi
update php -y"
What is the expected output? What do you see instead?
I expected that PHP version is upgraded to the latest version. But no.
For exmaple, I have php-5.3.15-1.el5.remi.x86_64 and the latest version is
php-5.3.17-1.el5.remi.x86_64
Yum command is not running correctly in my servers.
"Yum update " local with success.
What version of the product are you using? On what operating system?
$ ./sshpt.py --version
1.2.0
Ubuntu 12.04.1 LTS
Please provide any additional information below.
I have patched sshpt.py with patch provided in issue 10. But this not solve the
problem.
Original issue reported on code.google.com by [email protected]
on 21 Sep 2012 at 5:26
What steps will reproduce the problem?
1. Run the script with multiple commands
2. Host file includes 500 hosts or more
3. One or more hosts reboots
What is the expected output? What do you see instead?
The script should finish successfully and get back to the prompt.
Instead, if one or more hosts gets rebooted during the runtime, the script just
hangs and I need to use CTRL + C to exit it.
What version of the product are you using? On what operating system?
sshpt 1.2.0
CentOS 6.2, SUSE 12.3
Please provide any additional information below.
I'm running multiple commands for grabbing machine details, such as lspci,
dmidecode, ifconfig etc. (around 15 commands)
The I output it to a csv file.
Thanks for the awesome script!
Original issue reported on code.google.com by [email protected]
on 3 Oct 2013 at 7:38
What steps will reproduce the problem?
1. ./sshpt.py -f hosts "sudo /sbin/shutdown -r now"
2. ./sshpt.py -f hosts "sudo reboot"
3.
What is the expected output? What do you see instead?
The system should reboot. The System does not reboot
What version of the product are you using? On what operating system?
1.1.3 on RHEL 5
Please provide any additional information below.
/var/log/messages shows following:
Jul 8 11:16:05 l01 sudo: foo : no tty present and no askpass program specified
; TTY=unknown ; PWD=/home/foo ; USER=root ; COMMAND=shutdown -r now
Alternatively if I do following command it works
"ssh -t hostname "sudo /sbin/shutdown -r now""
Original issue reported on code.google.com by [email protected]
on 8 Jul 2011 at 6:28
When running the sshpt.py, I keep getting the error below.
I am running this on CentOS 5.5 which has python 2.4 and paramiko 1.7.6 (see
rpm listing below).
[machine]# ./sshpt.py -t 1 -f hostlist.txt "date"
Password:
Queue instance has no attribute 'task_done'
"10.10.10.1","SUCCESS","2010-11-13 07:48:42.643668","date","Sat Nov 13 07:48:25
EST 2010"
Exception in thread OutputThread:
Traceback (most recent call last):
File "/usr/lib64/python2.4/threading.py", line 442, in __bootstrap
self.run()
File "./sshpt.py", line 122, in run
self.output_queue.task_done()
AttributeError: Queue instance has no attribute 'task_done'
caught KeyboardInterrupt, exiting...
[machine]# rpm -aq | grep "python-"
python-sqlite-1.1.7-1.2.1
python-2.4.3-27.el5
python-elementtree-1.2.6-5
audit-libs-python-1.7.17-3.el5
python-crypto-2.0.1-4.el5.2
python-urlgrabber-3.1.0-5.el5
python-paramiko-1.7.6-1.el5
Original issue reported on code.google.com by [email protected]
on 13 Nov 2010 at 5:52
What steps will reproduce the problem?
1. In a list of many servers, it stop and throw errors on system.
2. But it never gives the system name , so very difficult on which system it
got stuck.
3.
What is the expected output? What do you see instead?
It should show the server name before running the query .
What version of the product are you using? On what operating system?
Solaris 8 and 10/ Redhat linux 4 and 5 / suse Linux 10 and 11
Please provide any additional information below.
Already given
Original issue reported on code.google.com by [email protected]
on 18 Apr 2012 at 3:17
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.