#!/usr/bin/env bash # # +===============================================+ # || A Simple ZIP Password Cracker || # || Developed By : http:\\www.sec-articles.net || # +===============================================+ # declare -r TRUE=0 declare -r FALSE=1 flag=$FALSE counter=0 # Declaring char_sets chars_1=`echo {a..z}` chars_2=`echo {A..Z}` chars_3=`echo {0..9}` chars_4="~ ! @ \$ % ^ - _ = + { } [ ] : , . / ?" # cracking function function cracker() { pass=$1 echo "trying Password $pass" counter=$(($counter + 1)) unzip -P $pass -o $file_name [ $? -eq 0 ] && clear && Banner && echo "Password Found : $pass" && echo "Password tried : $counter"&& return $TRUE || return $FALSE } # word_List generator function word_gen() { args=$1 [ ${#args} -ge $length ] && cracker $1 && echo "Password Cracked" && flag=$TRUE && exit if [ ${#args} -lt $length ]; then for c in $chars; do word_gen $1$c done fi } function is_num() { [ "$1" -eq "$1" ] > /dev/null 2>&1 return $? } function Show_message() { echo "+===============================================+" echo "| A Simple ZIP Password Cracker |" echo "| Developed By : http:\\\\www.sec-articles.net |" echo "+===============================================+" echo " ./s_zipcrack [Mode b/d] {[Lenght_of_Passowrd] [Type_Password] [location]} {[location]}" echo"" echo " For brute_force Mode :- " echo " ./s_zipcrack -b [Lenght_of_Passowrd] [Type_Password] [zip_file_location]" echo " Length_of_Password - integer value" echo " Type_of_Password - \"A\" Upper_case A-Z" echo " - \"a\" Lower_case a-z" echo " - \"n\" numeric 0-9" echo " - \"c\" Special_chars !.?" echo " zip_file_Location - Full Path of Zip File" echo " Example : ./s_zipcrack -b 4 n /home/user/Desktop/secure.zip" echo "" echo " For Dictonary Mode : - " echo " ./s_zipcrack -d [Password_dictonary_file] [zip_file_Location]" echo " Password_dictonary_file - Full Path of Password dictonary file " echo " zip_file_Location - Full Path of Zip file" } function Banner() { echo "+===============================================+" echo "| A Simple ZIP Password Cracker |" echo "| Developed By : http:\\\\www.sec-articles.net |" echo "+===============================================+" echo "" } function brute_force() { # Handling Arguments if [ "$1" = "" ] then Show_message exit fi if is_num $1 then length=$1 else length=2 fi for args in "$@"; do case $args in a) chars="$chars $chars_1" ;; A) chars="$chars $chars_2" ;; n) chars="$chars $chars_3" ;; c) chars="$chars $chars_4" ;; esac; done if [ "$chars" = "" ] then chars="$chars_1" fi for arg in "$@"; do if [ -a $arg ] then file_name=$arg break fi done if [ "$file_name" = "" ] then Banner echo "Could not find \"$3\"" echo "please check the file location & try Again." exit fi #calling word_gen function for w in $chars; do word_gen $w done } function dictonary() { if [ "$1" = "" ] then Banner echo "please give the password_list." exit 1 elif [ "$2" = "" ] then Banner echo "please give the zip file location." exit 1 fi if [ -a $1 ] then pass_list=$1 else Banner echo "could not find \"$1\"" echo "please check the file location & try Again." exit 1 fi if [ -a $2 ] then file_name=$2 else Banner echo "could not find \"$2\"" echo "please check the file location & try Again." exit 1 fi # reading passwords & calling to cracker function length=`cat $pass_list | wc -l` for ((i=0;i<=$length;i++)) do passwd=`sed -n "$i"p $pass_list` cracker $passwd && echo "Password Cracked" && flag=$TRUE && exit done } # Main if [ "$1" = "b" ] then brute_force $2 $3 $4 elif [ "$1" = "d" ] then dictonary $2 $3 elif [ "$1" = "" ] then Show_message exit else Banner echo "Error in Arguments..!?" echo "please choose the correct mode. b/d [brute_force/dictonary_attack]" exit fi if [ $flag -eq $FALSE ] then clear Banner echo "Could not Found Password ?? " echo "Password tried : $counter" echo "please Try Again with other Keywords." fi