예제 #1
0
 def post(self):
     conf_all = config.load()
     for i in self.request.body.split("&"):
         para = secure.clear(urllib.unquote(i.split("=", 1)[0]))
         value = secure.clear(urllib.unquote(i.split("=", 1)[1]))
         if para in conf_all.keys():
             conf_all[para] = value
     config.update(conf_all)
     return self.render("config.html", config=config.load())
예제 #2
0
 def post(self):
     scan_methods = []
     conf_all = common.conf
     for i in self.request.body.decode().split("&"):
         para = secure.clear(urllib.unquote(i.split("=", 1)[0]))
         value = secure.clear(urllib.unquote(i.split("=", 1)[1]))
         if para in conf_all.keys():
             conf_all[para] = value
         elif "scan_methods" in para:
             scan_methods.append(para[para.rindex("_") + 1:].upper())
     conf_all["scan_methods"] = ",".join(scan_methods)
     update_config(conf_all, CHECK_CONF_FILE)
     return self.write(out.alert("Success!", "/config"))
예제 #3
0
 def post(self):
     account = secure.clear(self.get_argument("account"))
     password = secure.clear(self.get_argument("password"))
     if account == common.conf['account'] and password == common.conf[
             'password']:
         cookie = session.new(self.request.remote_ip)
         self.set_cookie("token",
                         cookie,
                         expires_days=int(
                             common.conf["session_expires_time"]))
         session.update(cookie)
         self.set_header("Location", "/")
         self.set_status(302)
         return
     else:
         location = "/login"
         content = "Something wrong with you account or password!"
         return self.render("302.html", location=location, content=content)
예제 #4
0
 def get(self):
     stat = secure.clear(self.get_argument("stat"))
     config_all = config.load()
     config_all['scan_stat'] = stat
     config.update(config_all)
     if stat.lower() == "true":
         thread = threading.Thread(target=scan.scan_start, args=())
         thread.setDaemon(True)
         thread.start()
     return self.write(out.jump("/scan_config"))
예제 #5
0
 def post(self):
     proxy_type = self.get_argument("type")
     if proxy_type == "mix_proxy":
         conf = config.load()
         conf["mix_addr"] = secure.clear(self.get_argument("mix_addr"))
         conf["mix_port"] = secure.clear(self.get_argument("mix_port"))
         config.update(conf)
     elif proxy_type == "scapy":
         conf = config.load()
         conf['scapy_out'] = secure.clear(self.get_argument('scapy_out'))
         conf['scapy_network_card'] = self.get_argument(
             'scapy_network_card')
         config.update(conf)
     elif proxy_type == "tornado":
         conf = config.load()
         conf['tornado_address'] = secure.clear(
             self.get_argument('tornado_address'))
         conf['tornado_port'] = secure.clear(
             self.get_argument('tornado_port'))
         config.update(conf)
     return self.write(out.jump("/proxy?type=" + proxy_type))
예제 #6
0
    def get(self):
        stat = secure.clear(self.get_argument("stat"))
        if stat == "False":
            common.scanner_status = False
            logger.success("Stop the scanner.")
        else:
            common.scanner_status = True
            # start scanning
            logger.success("Start the scanner.")
            thread = threading.Thread(target=create_scanner, args=())
            thread.setDaemon(True)
            thread.start()
            logger.success("Start the scanner.")

        return self.write(out.jump("/scan_config"))
예제 #7
0
 def get(self):
     proxy_type = self.get_argument("type")
     conf = {}
     if proxy_type == "mix_proxy":
         conf['mix_addr'] = config.load()['mix_addr']
         conf['mix_port'] = config.load()['mix_port']
         stat = config.load()['mix_stat']
         try:
             start_stat = self.get_argument("stat")
             start_conf = config.load()
             start_conf['mix_stat'] = start_stat
             config.update(start_conf)
             if start_stat.lower() == "true":
                 thread = threading.Thread(target=mix_proxy.main)
                 thread.setDaemon(True)
                 thread.start()
             else:
                 secure.kill(config.load()['mix_addr'],
                             int(config.load()['mix_port']), "GE")
             return self.write(out.jump("/proxy?type=" + proxy_type))
         except:
             pass
     elif proxy_type == "scapy":
         conf['scapy_out'] = config.load()['scapy_out']
         conf['scapy_network_card'] = config.load()['scapy_network_card']
         stat = config.load()['scapy_stat']
         try:
             start_stat = secure.clear(self.get_argument("stat"))
             start_conf = config.load()
             start_conf['scapy_stat'] = start_stat
             config.update(start_conf)
             if start_stat.lower() == "true":
                 thread = threading.Thread(target=pyscapy.main)
                 thread.setDaemon(True)
                 thread.start()
             return self.write(out.jump("/proxy?type=" + proxy_type))
         except:
             pass
     elif proxy_type == "tornado":
         conf['tornado_address'] = config.load()['tornado_address']
         conf['tornado_port'] = config.load()['tornado_port']
         stat = config.load()['tornado_stat']
         try:
             start_stat = secure.clear(self.get_argument("stat"))
             start_conf = config.load()
             start_conf['tornado_stat'] = start_stat
             config.update(start_conf)
             if start_stat.lower() == "true" and config.load(
             )['tornado_run_stat'] == 'false':
                 thread = threading.Thread(target=proxy_io.main)
                 thread.setDaemon(True)
                 thread.start()
                 start_conf = config.load()
                 start_conf['tornado_run_stat'] = 'true'
                 config.update(start_conf)
             return self.write(out.jump("/proxy?type=" + proxy_type))
         except:
             pass
     else:
         return self.write(out.jump("/"))
     return self.render("proxy.html",
                        proxy_type=proxy_type,
                        conf=conf,
                        stat=stat)