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())
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.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.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": thread = threading.Thread(target=proxy_io.main) thread.start() 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)
def post(self): account = secure.clear(self.get_argument("account")) password = secure.clear(self.get_argument("password")) if account == config.load()['account'] and password == config.load( )['password']: cookie = session.new("self.request.remote_ip") self.set_cookie("ysrc_token", cookie, expires_days=int( config.load()["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)
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.start() return self.write(out.jump("/scan_config"))
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))