From 2d3ff6dbc119693ed848e4b8bd72250f2218616c Mon Sep 17 00:00:00 2001 From: Kevin Date: Fri, 4 May 2018 11:07:23 -0700 Subject: [PATCH] check for existing hashfile downloads Checks the specified directory for previously-downloaded hash files and only downloads new ones, conserving virusshare's bandwidth. --- analyzers/Virusshare/getHashes.sh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/analyzers/Virusshare/getHashes.sh b/analyzers/Virusshare/getHashes.sh index 96225a408..444f5ce90 100755 --- a/analyzers/Virusshare/getHashes.sh +++ b/analyzers/Virusshare/getHashes.sh @@ -21,9 +21,16 @@ if [ ! -d $1 ]; then fi cd $1 -for u in `curl https://virusshare.com/hashes.4n6 | grep -E "hashes\/VirusShare_[0-9]{5}\.md5" | cut -d\" -f2` +for u in `curl https://virusshare.com/hashes.4n6 | grep -E "VirusShare_[0-9]{5}\.md5" | c\ +ut -d\" -f2 | cut -d\/ -f2` do echo $u - wget https://virusshare.com/$u + if [ -e $1/$u ]; then + echo "File already downloaded" + else + wget https://virusshare.com/hashes/$u + sleep 3 + fi + done | tee -a ../$0.log cd ..