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

Function BigFileMd5

osxauditor.py:344–355  ·  view source on GitHub ↗

Return the md5 hash of a big file

(FilePath)

Source from the content-addressed store, hash-verified

342 PrintAndLog(Hash + u' '+ LOCAL_HASHES_DB[Hash], 'WARNING')
343
344def BigFileMd5(FilePath):
345 ''' Return the md5 hash of a big file '''
346
347 Md5 = hashlib.md5()
348 try:
349 with open(FilePath, 'rb') as f:
350 for Chunk in iter(partial(f.read, 1048576), ''):
351 Md5.update(Chunk)
352 return Md5.hexdigest()
353 except:
354 PrintAndLog(u'Cannot hash ' + FilePath.decode('utf-8'), 'ERROR')
355 return False
356
357def UniversalReadPlist(PlistPath):
358 ''' Try to read a plist depending of the plateform and the available libs. Good luck Jim... '''

Callers 4

ParseStartupItemsFunction · 0.85
ParseLaunchAgentsFunction · 0.85
HashDirFunction · 0.85
ParsePackagesDirFunction · 0.85

Calls 1

PrintAndLogFunction · 0.85

Tested by

no test coverage detected