-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsimple.py
More file actions
32 lines (22 loc) · 766 Bytes
/
simple.py
File metadata and controls
32 lines (22 loc) · 766 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
from getpass import getpass
import click
import logging
from paramiko import SSHClient, PasswordRequiredException
from core.backends.remote_client import RemoteClient
logging.basicConfig()
def handlePass():
password = getpass("Enter password: ")
main(password)
def main(password=None):
"""
"""
print 'Hello World'
remote = RemoteClient('voms.cat.cbpf.br', 'maany', '/Users/mayanksharma/.ssh/id_rsa', remote_path='/')
if password is not None:
remote = RemoteClient('voms.cat.cbpf.br', 'maany', '/Users/mayanksharma/.ssh/id_rsa', password=password, remote_path='/')
remote.execute_commands(['ls /'])
if __name__ == "__main__":
try:
main()
except PasswordRequiredException as error:
handlePass()