I'm building a ZIP file password-recovery tool which tries every password in a dictionary file to unlock a specified ZIP file. However, when I use a long dictionary file, strange files appear that have the name as words in the dictionary. This tool is built with AppleScript, but uses do shell script
to do the actual cracking. The variable dictionary
is set to the POSIX path of whatever dictionary file the user chose in a choose file
dialog. This is the line that is most likely causing the problem:
do shell script "while read line; do unzip -P \"$line\" /Applications/ZipBuster.app/Contents/Resources/Cracked/current.zip -d /Applications/ZipBuster.app/Contents/Resources/Cracked/recovered; done < " & dictionary
current.zip
is a copy of the ZIP file being cracked. Every line of the dictionary file is fed into unzip -P
. When I use a small dictionary with fewer words, everything works fine. However, with huge dictionaries, files are created in the /Applications/ZipBuster.app/Contents/Resources/Cracked/recovered
directory random words from the dictionary file as names. I have no idea what's going on. Within each created file is encrypted data. The expected behavior is creating a directory with the decrypted data from the ZIP file when the program (hopefully) hits the correct password, otherwise notifying the user that the operation failed. Any help would be appreciated!