def http_type(self): http_type = self.data["http_type"] p_id = get_md5(self.host + self.path + "http_type" + self.method) p_state = self.get_Ostate(http_type) p_type = "http_type" p_name = "" return (p_id, p_state, p_type, p_name)
def content_length(self): content_length = self.data["content_length"] p_id = get_md5(self.host + self.path + "content_length" + self.method) p_state = self.get_Ostate(content_length) p_type = "content_length" p_name = "" return (p_id, p_state, p_type, p_name)
def ex_json(post_data): post_data = json.loads(post_data) for p_name, p_value in post_data.items(): p_id = get_md5(self.host + self.path + decode(p_name) + self.method) p_state = self.get_Ostate(str(p_value)) p_type = "post" yield (p_id, p_state, p_type, p_name)
def uri_p_name(self): p_name = "" for p in self.payload.split("&"): p_name += p.split("=")[0] p_state = self.get_Ostate(p_name) p_type = "uri_pname" p_id = get_md5(self.host + self.path + self.method + p_type) p_name = "" return (p_id, p_state, p_type, p_name)
def ex_urlencoded(post_data): for p in post_data.split("&"): p_list = p.split("=") p_name = p_list[0] if len(p_list) > 1: p_value = reduce(operator.add, p_list[1:]) p_id = get_md5(self.host + self.path + decode(p_name) + self.method) p_state = self.get_Ostate(p_value) p_type = "post" yield (p_id, p_state, p_type, p_name)
def url(self): for p in self.payload.split("&"): p_list = p.split("=") p_name = p_list[0] if len(p_list) > 1: p_value = reduce(operator.add, p_list[1:]) p_id = get_md5(self.host + self.path + decode(p_name) + self.method) p_state = self.get_Ostate(p_value) p_type = "uri" yield (p_id, p_state, p_type, p_name)
def cookie_p_name(self): cookie = urllib.parse.unquote( str(self.data["cookie"].encode("utf-8"), encoding="utf-8")) p_name = "" for p in cookie.split("; "): if p.strip(): p_name += p.split("=")[0] p_type = "cookie_pname" p_id = get_md5(self.host + self.path + self.method + p_type) p_state = self.get_Ostate(p_name) p_name = "" return (p_id, p_state, p_type, p_name)
def cookie(self): cookies = urllib.parse.unquote( str(self.data["cookie"].encode("utf-8"), encoding="utf-8")) for p in cookies.split("; "): if p.strip(): p_list = p.split("=") p_name = p_list[0] if len(p_list) > 1: p_value = reduce(operator.add, p_list[1:]) p_id = get_md5(self.host + self.path + decode(p_name) + self.method) p_state = self.get_Ostate(p_value) p_type = "cookie" yield (p_id, p_state, p_type, p_name)
def ex_xml(post_data): tree = ElementTree.fromstring(post_data) elements = [] p_names = [] def get_item(tree, parent_tag=""): if tree.getchildren(): if parent_tag: parent_tag += "/" + tree.tag else: parent_tag = tree.tag for t in tree.getchildren(): get_item(t, parent_tag) else: elements.append(tree.text) p_names.append(parent_tag + "/" + tree.tag) get_item(tree) for (p_name, p_value) in zip(p_names, elements): p_state = self.get_Ostate(p_value) p_type = "post" p_id = get_md5(self.host + self.path + decode(p_name) + self.method) yield (p_id, p_state, p_type, p_name)
def post_p_name(self, p_names): p_state = self.get_Ostate(p_names) p_type = "post_pname" p_name = "" p_id = get_md5(self.host + self.path + self.method + p_type) return (p_id, p_state, p_type, p_name)
def path_p(self): p_id = get_md5(self.host + self.method + self.path) p_state = self.get_Ostate(self.path) p_type = "uri_path" p_name = "" return (p_id, p_state, p_type, p_name)