Skip to content

Instantly share code, notes, and snippets.

@BruceGitHub
Created January 16, 2019 20:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BruceGitHub/ee67706069f0702d2b6aac803f4e2607 to your computer and use it in GitHub Desktop.
Save BruceGitHub/ee67706069f0702d2b6aac803f4e2607 to your computer and use it in GitHub Desktop.
Extract zip with password nested file name
#!/bin/bash
workpath=$(pwd)
echo $workpath
function goToWorkPath() {
cd $workpath
}
function save() {
goToWorkPath
mkdir copy
cp $1 copy
cd copy
filenameAsHas=$(md5 -q $1)
mv $1 $filenameAsHas
}
function move_temp_dir() {
goToWorkPath
mkdir temp
mv $1 temp
cd temp
mv * $2
}
function prepare_for_restart() {
mv * file.hack
mv file.hack ../
}
mkdir ../tmp
while :
do
find . -name "*.zip" -print | while read filename; do
cd $workpath
echo $filename
filezip=$(unzip -vl $filename | grep Defl | cut -d' ' -f16)
echo $filezip
password=${filezip/.zip/}
password=${password/\.\//}
echo La password: $password
unzip -P $password ./$filename
cp $filename ../tmp
rm $filename
echo "END"
done
#read -n1 -r -p "Press any key to continue..." key
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment