mirror of https://github.com/n1nj4sec/pupy.git
Merge branch 'unstable' of https://github.com/n1nj4sec/pupy into unstable
This commit is contained in:
commit
df96009a7b
|
@ -80,7 +80,8 @@ class SSHell(PupyModule):
|
|||
host = uri.hostname
|
||||
port = args.port or uri.port or 22
|
||||
user = args.user or uri.username
|
||||
passwords = (args.passwords or tuple([uri.password]),
|
||||
u_pwd = [uri.password] if uri.password else []
|
||||
passwords = (args.passwords or tuple(u_pwd),
|
||||
tuple(args.key_passwords))
|
||||
program = ' '.join(args.program) or None
|
||||
|
||||
|
|
|
@ -188,7 +188,7 @@ class SSH(object):
|
|||
yield pair
|
||||
|
||||
for process in process_iter():
|
||||
info = process.as_dict(['username', 'environ'])
|
||||
info = process.as_dict()
|
||||
if 'environ' not in info or info['environ'] is None:
|
||||
continue
|
||||
|
||||
|
@ -332,7 +332,7 @@ class SSH(object):
|
|||
if chown:
|
||||
commands.append('chown {} {}'.format(repr(chown), repr(remote_path)))
|
||||
|
||||
if perm and type(perm) in (str,unicode):
|
||||
if perm and type(perm) in (str, unicode):
|
||||
perm = int(perm, 8)
|
||||
|
||||
commands.append('chmod {} {}'.format(oct(perm), repr(remote_path)))
|
||||
|
@ -792,7 +792,7 @@ def ssh_interactive(term, w, h, wp, hp, host, port, user, passwords, private_key
|
|||
raise ValueError('No valid credentials found to connect to {}:{} user={}'.format(
|
||||
ssh.host, ssh.port, ssh.user or 'any'))
|
||||
|
||||
except gaierror, e:
|
||||
except gaierror as e:
|
||||
raise ValueError('Unable to connect to {}:{} - {}'.format(host, port, e.strerror))
|
||||
|
||||
except NoValidConnectionsError:
|
||||
|
@ -886,7 +886,7 @@ def _ssh_cmd(ssh_cmd, thread_name, arg, hosts, port, user, passwords, private_ke
|
|||
|
||||
continue
|
||||
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
data_cb((3, 'Exception: {}: {}'.format(type(e), str(e))))
|
||||
continue
|
||||
|
||||
|
|
|
@ -7,9 +7,11 @@ from StringIO import StringIO
|
|||
from ..PupyConfig import PupyConfig
|
||||
from ..PupyCredentials import Encryptor
|
||||
|
||||
|
||||
class EncryptionError(Exception):
|
||||
pass
|
||||
|
||||
|
||||
class Credentials(object):
|
||||
def __init__(self, client=None, config=None, password=None):
|
||||
self.config = config or PupyConfig()
|
||||
|
@ -56,7 +58,7 @@ class Credentials(object):
|
|||
try:
|
||||
db = self._load_db()
|
||||
except ValueError:
|
||||
db = {'creds':[]}
|
||||
db = {'creds': []}
|
||||
|
||||
if not cid:
|
||||
if not self.client:
|
||||
|
@ -113,7 +115,8 @@ class Credentials(object):
|
|||
return
|
||||
|
||||
for creds in data:
|
||||
found = False
|
||||
creds = {k.lower(): v for k, v in creds.items()}
|
||||
|
||||
c = {
|
||||
'category': creds['category'],
|
||||
'cid': creds.get('cid', creds.get('uid')),
|
||||
|
|
Loading…
Reference in New Issue