MCPcopy
hub / github.com/jipegit/OSXAuditor / HashDir

Function HashDir

osxauditor.py:533–549  ·  view source on GitHub ↗

Hash a direrctory and add the hashes

(Title, Path)

Source from the content-addressed store, hash-verified

531 PrintAndLog(CustomListItem['Name'].decode('utf-8') + u' - ' + binascii.hexlify(CustomListItem['Alias']).decode('hex').decode('utf-8', 'ignore'), 'INFO')
532
533def HashDir(Title, Path):
534 ''' Hash a direrctory and add the hashes'''
535 PrintAndLog(Title.decode('utf-8'), 'SUBSECTION')
536
537 NbFiles = 0
538 for Root, Dirs, Files in os.walk(Path):
539 for File in Files:
540 FilePath = os.path.join(Root, File)
541 Md5 = BigFileMd5(FilePath)
542 if Md5:
543 if Md5 not in HASHES:
544 HASHES.append(Md5)
545 PrintAndLog(Md5 +' '+ FilePath.decode('utf-8') + u' - ' + time.ctime(os.path.getmtime(FilePath)) + u' - ' + time.ctime(os.path.getctime(FilePath)) + u'\n', 'INFO')
546 NbFiles += 1
547
548 if NbFiles == 0:
549 PrintAndLog(Path.decode('utf-8') + u' is empty', 'INFO')
550
551def ParseDownloads():
552 ''' Hash all users\' downloaded files '''

Callers 1

ParseDownloadsFunction · 0.85

Calls 2

PrintAndLogFunction · 0.85
BigFileMd5Function · 0.85

Tested by

no test coverage detected