def exportTol2t(cache): """ Export the cache in CSV log2timeline compliant format """ output = [] output.append(["date", "time", "timezone", "MACB", "source", "sourcetype", "type", "user", "host", "short", "desc", "version", "filename", "inode", "notes", "format", "extra"]) for entry in cache: date = entry.creationTime.date().strftime("%m/%d/%Y") time = entry.creationTime.time() # TODO get timezone timezone = 0 short = entry.keyToStr() descr = "Hash: 0x%08x" % entry.hash descr += " Usage Counter: %d" % entry.usageCounter if entry.httpHeader != None: if entry.httpHeader.headers.has_key('content-type'): descr += " MIME: %s" % entry.httpHeader.headers['content-type'] output.append([date, time, timezone, "MACB", "WEBCACHE", "Chrome Cache", "Cache Entry", "-", "-", short, descr, "2", "-", "-", "-", "-", "-", ]) csvOutput.csvOutput(output)
def __init__(self,filename): prefix,ext = filename.split('.') if ext == 'txt': self.handler = open(filename,mode) elif ext == 'pdf': self.handler = pdfOutput(filename) elif ext == 'png': self.handler = pngOutput(filename) elif ext == 'csv': self.handler = csvOutput(filename) else: print('current does not support file format %s'%(ext))