ColumPaget / Hashrat

Hashing tool supporting md5,sha1,sha256,sha512,whirlpool,jh and hmac versions of these. Includes recursive file hashing and other features.
GNU General Public License v3.0
59 stars 9 forks source link

Problem with special characters in the filename/path #16

Closed wgcyb closed 4 years ago

wgcyb commented 4 years ago

Hi. In our media projects use special characters in the file/folder names. For example: [ ] . ' , ^

1) I'm faced with a problem when using the following characters: [ and ]. If the folder name matches the regex template .*\[.+\].*, then the folder is not processed. Maybe this problem also reproduces in other situations with other special characters

2) Is it possible to hash hidden files and folders (files/folders that begins with a dot)? This is necessary for many files that are used and transferred from Windows

I attached zip-file with a simplified example to reproduce the problems At the moment, when executing a command:

cd ./project_root_folder
hashrat -sha512 -t -x ./hashes.sha512 -r . | tee ./hashes.sha512

I get only one file from all files:

40b244112641dd78dd4f93b6c9190dd46e0099194d5a44257b7efad6ef9ff4683da1eda0244448cb343aa688f5d3efd7314dafe580ac0bcbf115aeca9e8dc114  ./sources/qwerty 2019/2.wav

Full tree in example:

project_root_folder
├── .d
│   └── sources
│       ├── qwerty [2019]
│       │   └── 3.wav
│       └── qwerty 2019
│           └── 4.wav
├── hashes.sha512
├── .name.txt
└── sources
    ├── qwerty [2019]
    │   └── 1.wav
    └── qwerty 2019
        └── 2.wav

And, if the checksum file (hashes.sha512) contains all files:

b5ba77af1f7bda735894e746a199acb1d2c836424da2fc46bebb55423dccbff871877a30fab77a31e47b0a29ea0154882e532e9a29b220a8f2958773313bbb2a  ./.name.txt
a321d8b405e3ef2604959847b36d171eebebc4a8941dc70a4784935a4fca5d5813de84dfa049f06549aa61b20848c1633ce81b675286ea8fb53db240d831c568  ./.d/sources/qwerty 2019/4.wav
3bafbf08882a2d10133093a1b8433f50563b93c14acd05b79028eb1d12799027241450980651994501423a66c276ae26c43b739bc65c4e16b10c3af6c202aebb  ./.d/sources/qwerty [2019]/3.wav
40b244112641dd78dd4f93b6c9190dd46e0099194d5a44257b7efad6ef9ff4683da1eda0244448cb343aa688f5d3efd7314dafe580ac0bcbf115aeca9e8dc114  ./sources/qwerty 2019/2.wav
4dff4ea340f0a823f15d3f4f01ab62eae0e5da579ccb851f8db9dfe84c58b2b37b89903a740e1ee172da793a6e79d560e5f7f9bd058a12a280433ed6fa46510a  ./sources/qwerty [2019]/1.wav

When i run:

cat ./hashes.sha512 | hashrat -color -C .. -sha512 -x 'hashes.sha512'

I get:

./sources/qwerty 2019/2.wav: OKAY

test.zip

ColumPaget commented 4 years ago

Thanks for reporting this. I'm not quite sure I understand it, but I suspect it will become obvious once I use your test files. I'll try to look into this this week.

ColumPaget commented 4 years ago

Finally I've found time to deal with these issues. Both should be fixed in v1.11. Ironically the pandemic has given me some free time.

Thanks for reporting these issues. These are the kinds of use cases I'd never have thought of!