def submithttp(tmpDir, pcapfile, comment): lastPath = db.lastLine() newPath = str(lastPath) logging.info('Record %s Submitted', newPath) reportDir = os.path.join(reportRoot, newPath) # Set the path if not os.path.exists(reportDir): os.makedirs(reportDir) #Create the Dir Structure shutil.copyfile(os.path.join(tmpDir, pcapfile), os.path.join(reportDir, "http.pcap")) # Copy The Pcap File in retcode = subprocess.call("(cd %s && tcpflow -r %s -AH)"%(os.path.join(MaildbRoot, "store", newPath), "http.pcap"), shell=True)# Extract all the stream in HTTP Format. from core.httpParse import httpParse httpParse().http(newPath, comment) return newPath
def submithttp(tmpDir, pcapfile, comment): lastPath = db.lastLine() newPath = str(lastPath) logging.info('Record %s Submitted', newPath) reportDir = os.path.join(reportRoot, newPath) # Set the path if not os.path.exists(reportDir): os.makedirs(reportDir) #Create the Dir Structure shutil.copyfile(os.path.join(tmpDir, pcapfile), os.path.join(reportDir, "http.pcap")) # Copy The Pcap File in retcode = subprocess.call( "(cd %s && tcpflow -r %s -AH)" % (os.path.join(MaildbRoot, "store", newPath), "http.pcap"), shell=True) # Extract all the stream in HTTP Format. from core.httpParse import httpParse httpParse().http(newPath, comment) return newPath
def submithttp(self, pcapfile, comment): try: # this try means an empty db file wont break it lastPath = db.lastLine() newPath = str(lastPath + 1) # will be used to set the database and match it to a physical location except: newPath = '1' reportDir = os.path.join(reportRoot, newPath) # Set the path log = "##INFO##, HTTP Submitted With ID " + newPath writeLog.logEntry(log) if not os.path.exists(reportDir): os.makedirs(reportDir) #Create the Dir Structure shutil.copyfile(os.path.join(MaildbRoot, "tmp", pcapfile), os.path.join(reportDir, "http.pcap")) # Copy The Pcap File in retcode = subprocess.call("(cd %s && tcpflow -r %s -AH)"%(os.path.join(MaildbRoot, "store", newPath), "http.pcap"), shell=True)# Extract all the stream in HTTP Format. from core.httpParse import httpParse httpParse().http(newPath, comment) return newPath