Bash Script help required

Posted by Sunil J on Ask Ubuntu See other posts from Ask Ubuntu or by Sunil J
Published on 2012-09-17T20:17:26Z Indexed on 2012/09/17 21:52 UTC
Read the original article Hit count: 351

Filed under:

I am trying to get this bash script that i found on a forum to work.

Copied it to text editor. Saved it as script.sh

chmod 700 and tried to run it.

rootdir="/usr/share/malware"
day=`date +%Y%m%d`

url=`echo "wget -qO - http://lists.clean-mx.com/pipermail/viruswatch/$day/thread.html |\
awk '/\[Virus/'|tail -n 1|sed 's:\": :g' |\
awk '{print \"http://lists.clean-mx.com/pipermail/viruswatch/$day/\"$3}'"|sh`

filename=`wget -qO - http://lists.clean-mx.com/pipermail/viruswatch/$day/thread.html |\
awk '/\[Virus/'|tail -n 1|sed 's:": :g' |awk '{print $3}'`

links -dump $url$filename | awk '/Up/'|grep "TR\|exe" | awk '{print $2,$8,$10,$11,$12"\n"}' > $rootdir/>$filename

dirname=`wget -qO - http://lists.clean-mx.com/pipermail/viruswatch/$day/thread.html |\
awk '/\[Virus/'|tail -n 1|sed 's:": :g' |awk '{print $3}'|sed 's:.html::g'`

rm -rf $rootdir/$dirname
mkdir $rootdir/$dirname

cd $rootdir

grep "exe$" $filename |awk '{print "wget \""$5"\""}' | sh 
ls *.exe | xargs md5 >> checksums
mv *.exe $dirname

rm -r $rootdir/*exe*
mv checksums $rootdir/$dirname
mv $filename $rootdir/$dirname

I get the following message..

script.sh: line 11: /usr/share/malware/: Is a directory

script.sh: line 11: links: command not found

© Ask Ubuntu or respective owner

Related posts about bash