def crawler(self, target): # target sample: ['ip', port, 'username', 'passwd'] crawler_thread = CrawlerFactory(target[0], target[1], target[2], target[3]) router_info = crawler_thread.produce() self.data_out(self.data_out_path, router_info)
if (crawl_flag or dns_flag or c_debug or d_debug or u_debug or upgrade_flag) is False: print 'no mode chosen, program will exit' sys.exit(-1) if c_debug: # add the plugins path to sys.path to load plugins sys.path.append('crawler/plugins') for arg in xrange(4): try: print args[arg] except Exception: print 'args should include ip, port, username, password' sys.exit(-1) test_crawl = CrawlerFactory(addr=args[0], port=int(args[1]), username=args[2], password=args[3], debug=True) ret = test_crawl.produce() sys.exit(0) if d_debug: # add the plugins path to sys.path to load plugins sys.path.append('dnsset/plugins') for arg in xrange(7): try: print args[arg] except Exception: print 'arg should include ip, port ,username, password, plugin, dns1, dns2' sys.exit(-1) test_setter = DnsSetFactory(addr=args[0], port=int(args[1]), username=args[2], password=args[3], original_dns=args[6], plugin=args[4], dns=args[5], debug=True) ret = test_setter.produce()
if c_debug: # add the plugins path to sys.path to load plugins sys.path.append('crawler/plugins') for arg in xrange(4): try: print args[arg] except Exception: print 'args should include ip, port, username, password' sys.exit(-1) test_crawl = CrawlerFactory(addr=args[0], port=int(args[1]), username=args[2], password=args[3], debug=True) ret = test_crawl.produce() sys.exit(0) if d_debug: # add the plugins path to sys.path to load plugins sys.path.append('dnsset/plugins') for arg in xrange(7): try: print args[arg] except Exception: print 'arg should include ip, port ,username, password, plugin, dns1, dns2' sys.exit(-1) test_setter = DnsSetFactory(addr=args[0], port=int(args[1]), username=args[2], password=args[3],