Hash a direrctory and add the hashes
(Title, Path)
| 531 | PrintAndLog(CustomListItem['Name'].decode('utf-8') + u' - ' + binascii.hexlify(CustomListItem['Alias']).decode('hex').decode('utf-8', 'ignore'), 'INFO') |
| 532 | |
| 533 | def 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 | |
| 551 | def ParseDownloads(): |
| 552 | ''' Hash all users\' downloaded files ''' |
no test coverage detected