commit da2dbe75c11e5d3a2e692e4f7986288213be6864 Author: jxr8142 Date: Wed Sep 27 10:39:00 2017 -0400 Initial creation of python script that runs a SSH connection diff --git a/src/ssh_manager.py b/src/ssh_manager.py new file mode 100644 index 0000000..8d0b7fb --- /dev/null +++ b/src/ssh_manager.py @@ -0,0 +1,37 @@ +""" +Jeffery Russell +9-26-17 +""" + +import subprocess +import collections + +INPUT_FILE = "/home/jeff/scripts/servers.txt" +Computer = collections.namedtuple("Computer", ('host', 'menue_id')) + +def main(): + + + cmp = [] + count = 1 + with open(INPUT_FILE) as file: + for line in file: + cmp.append(Computer(line, count)) + count += 1 + + print("SSH manager V 0.1") + for c in cmp: + print(str(c.menue_id) + ")", c.host) + print() + i = input("Enter number of computer to connect to or enter to exit:") + + for c in cmp: + if i != '' and int(i) == c.menue_id: + subprocess.call(["ssh", c.host.strip(' \t\n\r')]) + #subprocess.Popen("ssh " + c.host.strip(' \t\n\r')) + +""" +Makes sure that this other programs don't run the program +""" +if __name__ == '__main__': + main() \ No newline at end of file