Example #1
0
 def upgrade(self, target):
     # target sample: ['ip', 'port', 'username', 'password', 'upgrade_method', 'firmware']
     upgrade_thread = UpgradeFactory(target[0], target[1], target[2],
                                     target[3], target[4], target[5])
     upgrade_thread.produce()
Example #2
0
if u_debug:
    # add the plugins path to sys.path to load plugins
    sys.path.append('upgrade/plugins')
    for arg in xrange(6):
        try:
            print args[arg]
        except Exception:
            print 'arg should include ip, port, username, password, plugin, firmware'
            sys.exit(-1)
    if not os.path.exists(args[5]):
        print 'can not find the firmware file, please check the path'
        sys.exit(-1)

    firmware_path = os.path.abspath(args[5])
    test_upgrader = UpgradeFactory(addr=args[0], port=args[1],
                                   username=args[2], password=args[3],
                                   plugin=args[4], firmware=firmware_path, debug=True)
    ret = test_upgrader.produce()
    sys.exit(0)

try:
    file(data_in_path)
except Exception:
    print 'no such ip address file'
    sys.exit(0)

if crawl_flag:
    sys.path.append('./crawler/plugins')
    work_manager = WorkManager(data_in_path, data_out_path, threads_num, 'crawl')
    work_manager.wait_all()
    sys.exit(0)
Example #3
0
 def upgrade(self, target):
     # target sample: ['ip', 'port', 'username', 'password', 'upgrade_method', 'firmware']
     upgrade_thread = UpgradeFactory(target[0], target[1], target[2], target[3], target[4], target[5])
     upgrade_thread.produce()
Example #4
0
    sys.path.append('upgrade/plugins')
    for arg in xrange(6):
        try:
            print args[arg]
        except Exception:
            print 'arg should include ip, port, username, password, plugin, firmware'
            sys.exit(-1)
    if not os.path.exists(args[5]):
        print 'can not find the firmware file, please check the path'
        sys.exit(-1)

    firmware_path = os.path.abspath(args[5])
    test_upgrader = UpgradeFactory(addr=args[0],
                                   port=args[1],
                                   username=args[2],
                                   password=args[3],
                                   plugin=args[4],
                                   firmware=firmware_path,
                                   debug=True)
    ret = test_upgrader.produce()
    sys.exit(0)

try:
    file(data_in_path)
except Exception:
    print 'no such ip address file'
    sys.exit(0)

if crawl_flag:
    sys.path.append('./crawler/plugins')
    work_manager = WorkManager(data_in_path, data_out_path, threads_num,