使用shc简单加密后的脚本文件恢复
时间:2014-02-26 04:04:45
收藏:0
阅读:1466
现学现用,写了个解密shc加密脚本的脚本:
#!/bin/sh ############################################################## # Used to unzip script files generated by shc # # Created by cuterhei at 2014-02-25 # ############################################################## function uncomp_shc() { skip=0 skl_f="none" while read skip_line do skipstrlist=$(echo $skip_line|tr "=" "\n") for xs in $skipstrlist; do let "skip += 1" if [ "$xs" = "skip" ]; then skl_f="find" elif [ "$skl_f" = "find" ]; then skip="$xs" skl_f="succ" break elif [ $skip -eq 2 ]; then skl_f="failed" break fi done if [ "$skl_f" = "succ" -o "$skl_f" = "failed" ]; then break fi done < "$1" if [ "$skl_f" = "succ" ]; then if tail -n +"$skip" "$1" | gzip -cd > "$2"; then echo "Unzip $1 to $2 with skip=$skip successfully." else echo "Unzip $1 with skip=$skip failed." fi else echo "Skip flag not found in file $1" fi } if [ "$#" = "0" ]; then echo " Used to unzip script file generated by shc." echo " Usage:" echo " 1. shcd inputfile " echo " 2. shcd inputfile outputfile " echo " 3. shcd -all " elif [ -f $1 ]; then if [ "$#" = "2" ]; then uncomp_shc "$1" "$2" else uncomp_shc "$1" "$1.bat" fi elif [ "$1" = "-all" ]; then for file in ./* do if [ -f $file ]; then uncomp_shc $file "$file.bat" fi done else echo "File $1 is not exist." fi exit
原文:http://blog.csdn.net/cuterhei/article/details/19926425
评论(0)