glv2 / bruteforce-salted-openssl

Try to find the password of a file that was encrypted with the 'openssl' command.
Other
217 stars 52 forks source link

Magic match using regex #30

Open ricosolana opened 7 months ago

ricosolana commented 7 months ago

Magic using regex

This pull changes how matching is normally performed against the starting "magic" bytes.

The previous method of matching uses string comparison (strncmp), requiring an exact string to be present starting from the first position.

In cases where the file type is unknown and is likely to be in binary format, this check fails.

Test case

sample.png:

Lets create an encrypted file:

To find the password of this unknown media file:

Tried / Total passwords: 2 / 5 Tried passwords per second: inf Last tried password: supersecret Total space searched: 40.000000% ETA: Tue 30 Apr 2024 03:07:53 PM EDT

Password candidate: supersecret



There might be a better alternative for matching binary data, but regex seems to work for now.