From f12f327999c6a7d84670d4b07ee47fb77e9be45d Mon Sep 17 00:00:00 2001 From: Reilly Chase Date: Thu, 27 Jun 2019 14:24:42 -0400 Subject: [PATCH] Create main.py --- main.py | 127 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 127 insertions(+) create mode 100644 main.py diff --git a/main.py b/main.py new file mode 100644 index 0000000..436dea6 --- /dev/null +++ b/main.py @@ -0,0 +1,127 @@ +import threading +from Queue import Queue +import paramiko +url = '' +which_command = raw_input("Which mode? set-inform, info, or set-default [info]: ") +if which_command == "set-inform": + url = raw_input("Enter your set-inform URL [http://p01.hostifi.net:8080/inform]: ") +username_ = raw_input("Enter device username [ubnt]: ") +password_ = raw_input("Enter device password [ubnt]: ") +subnet_ = raw_input("Enter subnet [192.168.1.0]: ") + +if url != '': + url = url +else: + url = "http://p01.hostifi.net:8080/inform" + +if which_command != '': + which_command = which_command +else: + which_command = 'info' + +if username_ != '': + USERNAME = username_ +else: + USERNAME = 'ubnt' + +if password_ != '': + PASSWORD = password_ +else: + PASSWORD = 'ubnt' + +if subnet_ != '': + SUBNET = subnet_ +else: + SUBNET = '192.168.1.0' + +SUBNET = SUBNET[:-1] +PORT = 22 +COMMAND = url + +hostnames = [] +ips = range(1,254) +for i in ips: + hostnames.append(SUBNET + str(i)) + +def info(hostname, output_q): + print "Starting..." + print hostname + try: + client = paramiko.SSHClient() + client.load_system_host_keys() + client.set_missing_host_key_policy(paramiko.AutoAddPolicy()) + + client.connect(hostname, port=PORT, username=USERNAME, password=PASSWORD) + + stdin, stdout, stderr = client.exec_command("mca-cli <