This commit is contained in:
rasmus 2020-12-22 01:34:18 +02:00
parent 3c05587f1a
commit 3e5b77ee8d
1 changed files with 13 additions and 6 deletions

19
main.py
View File

@ -1,7 +1,8 @@
# External deps
import paramiko
import logging
from time import sleep
import paramiko # for ssh
import logging # for possible debugging
from time import sleep # for sleep()
import os # for CLI arguments
# Local deps
import listServers, relativeUsage
@ -10,10 +11,16 @@ import listServers, relativeUsage
#logging.basicConfig()
#logging.getLogger("paramiko").setLevel(logging.DEBUG)
"""
ENV VARIABLES AVAILABLE:
- hostname
- sshkeylocation (optional)
- sshuser (optional)
"""
# Creds
hostname = '172.23.224.40'
sshuser = 'Administrator'
sshkeylocation = '/home/jc/.ssh/id_rsa'
hostname = str(os.environ['hostname'])
sshuser = str(os.getenv('sshuser', 'Administrator'))
sshkeylocation = str(os.path.abspath( os.getenv('sshkeypath', '~/.ssh/id_rsa') ))
paramiko.transport.Transport._preferred_keys += ('ssh-dss',) # Allow the insecurities
ssh = paramiko.SSHClient() # Alias