def log(self): """all request log into mongodb""" #reqHash = hashlib.md5(self.url.split('?')[0].strip()).hexdigest() #reqHash = hashlib.md5(self.url.strip()).hexdigest() table = MongoTool().conn.request.log res = table.find_one({"hash":self.hash}) if res == None: row = self.__dict__ row['hash'] = self.hash row['time'] = int(time.time()) row['check'] = 0 row['data'] = row['data'].decode("unicode_escape") table.insert(row) print "\033[1;31m%s\033[0m" % "Log Request "+row['url']
def log(self): """all request log into mongodb""" #reqHash = hashlib.md5(self.url.split('?')[0].strip()).hexdigest() #reqHash = hashlib.md5(self.url.strip()).hexdigest() table = MongoTool().conn.request.log res = table.find_one({"hash": self.hash}) if res == None: row = self.__dict__ row['hash'] = self.hash row['time'] = int(time.time()) row['check'] = 0 row['data'] = row['data'].decode("unicode_escape") table.insert(row) print "\033[1;31m%s\033[0m" % "Log Request " + row['url']
d = soup.find(attrs={"name": "description"})['content'].encode( 'utf8', 'ignore') except: d = "" return headers, t, d, k if __name__ == '__main__': #url = "http://210.14.138.1" if len(sys.argv) == 3: target = sys.argv[1] port = sys.argv[2] if port == 443: protocal = "https" else: protocal = "http" url = protocal + "://" + target + ":" + str(port) (h, t, d, k) = btdk(url) row = { "ip": target, "port": port, "headers": dict(h), "title": t, "keywords": d, "desc": k } table = MongoTool().conn.request.banner print table.insert(row) #print table.find_one({"a":2})
try: d = soup.find(attrs={"name":"description"})['content'].encode('utf8','ignore') except: d = "" return headers,t,d,k if __name__ == '__main__': #url = "http://210.14.138.1" if len(sys.argv) == 3: target = sys.argv[1] port = sys.argv[2] if port == 443: protocal = "https" else: protocal = "http" url = protocal+"://"+target+":"+str(port) (h,t,d,k) = btdk(url) row = { "ip" : target, "port" : port, "headers" : dict(h), "title" : t, "keywords" : d, "desc" : k } table = MongoTool().conn.request.banner print table.insert(row) #print table.find_one({"a":2})