def req_scan_ip_handler(self): req = urlparse.urlparse(self.path).query reqs = urlparse.parse_qs(req, keep_blank_values=True) data = "" if reqs['cmd'] == ['get_range']: data = ip_range.load_range_content() elif reqs['cmd'] == ['set_range']: content = self.postvars['ip_range'][0] ip_range.update_range_content(content) ip_range.load_ip_range() data = '{"res":"success"}' elif reqs['cmd'] == ['set_auto_adjust_scan_ip_thread_num']: user_config.user_special.auto_adjust_scan_ip_thread_num = int(self.postvars['auto_adjust_scan_ip_thread_num'][0]) user_config.save() google_ip.auto_adjust_scan_ip_thread_num = user_config.user_special.auto_adjust_scan_ip_thread_num data = '{"res":"success"}' elif reqs['cmd'] == ['set_scan_thread_num']: user_config.user_special.scan_ip_thread_num = int(self.postvars['scan_ip_thread_num'][0]) user_config.save() scan_ip_thread_num = int(self.postvars['scan_ip_thread_num'][0]) google_ip.update_scan_thread_num(scan_ip_thread_num) data = '{"res":"success"}' elif reqs['cmd'] == ['get_scan_ip_log']: data = scan_ip_log.get_log_content() mimetype = 'text/plain' self.send_response(mimetype, data)
def req_scan_ip_handler(self): req = urlparse.urlparse(self.path).query reqs = urlparse.parse_qs(req, keep_blank_values=True) data = "" if reqs['cmd'] == ['get_range']: data = ip_range.load_range_content() elif reqs['cmd'] == ['set_range']: content = self.postvars['ip_range'][0] ip_range.update_range_content(content) ip_range.load_ip_range() data = '{"res":"success"}' elif reqs['cmd'] == ['set_auto_adjust_scan_ip_thread_num']: user_config.user_special.auto_adjust_scan_ip_thread_num = int( self.postvars['auto_adjust_scan_ip_thread_num'][0]) user_config.save() google_ip.auto_adjust_scan_ip_thread_num = user_config.user_special.auto_adjust_scan_ip_thread_num data = '{"res":"success"}' elif reqs['cmd'] == ['set_scan_thread_num']: user_config.user_special.scan_ip_thread_num = int( self.postvars['scan_ip_thread_num'][0]) user_config.save() scan_ip_thread_num = int(self.postvars['scan_ip_thread_num'][0]) google_ip.update_scan_thread_num(scan_ip_thread_num) data = '{"res":"success"}' elif reqs['cmd'] == ['get_scan_ip_log']: data = scan_ip_log.get_log_content() mimetype = 'text/plain' self.send_response(mimetype, data)