Perform of lookup in a local database
(HashDBPath)
| 321 | PrintAndLog(u'Got a weird answer from Virustotal\n', 'ERROR') |
| 322 | |
| 323 | def 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 | |
| 344 | def BigFileMd5(FilePath): |
| 345 | ''' Return the md5 hash of a big file ''' |