Created
January 16, 2019 20:49
-
-
Save BruceGitHub/ee67706069f0702d2b6aac803f4e2607 to your computer and use it in GitHub Desktop.
Extract zip with password nested file name
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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