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

Function LocalLookup

osxauditor.py:323–342  ·  view source on GitHub ↗

Perform of lookup in a local database

(HashDBPath)

Source from the content-addressed store, hash-verified

321 PrintAndLog(u'Got a weird answer from Virustotal\n', 'ERROR')
322
323def LocalLookup(HashDBPath):
324 ''' Perform of lookup in a local database '''
325
326 global LOCAL_HASHES_DB
327
328 PrintAndLog(u'Local hashes DB lookup', 'SECTION')
329 PrintAndLog(u'Got %s hashes to verify' % len(HASHES), 'DEBUG')
330
331 with open(HashDBPath, 'r') as f:
332 Data = f.readlines()
333 for Line in Data:
334 if Line[0] != '#':
335 Line = Line.split(' ')
336 LOCAL_HASHES_DB[Line[0]] = Line[1]
337
338 PrintAndLog(str(len(LOCAL_HASHES_DB)) + u' hashes loaded from the local hashes database', 'DEBUG')
339
340 for Hash in HASHES:
341 if Hash in LOCAL_HASHES_DB:
342 PrintAndLog(Hash + u' '+ LOCAL_HASHES_DB[Hash], 'WARNING')
343
344def BigFileMd5(FilePath):
345 ''' Return the md5 hash of a big file '''

Callers 1

MainFunction · 0.85

Calls 1

PrintAndLogFunction · 0.85

Tested by

no test coverage detected