2014-01-09 17:52:17 +01:00
|
|
|
#!/usr/bin/env bash
|
2014-01-09 21:16:40 +01:00
|
|
|
parallel=50
|
2014-04-04 20:12:50 +02:00
|
|
|
max_bg=400
|
2014-01-09 17:52:17 +01:00
|
|
|
[ ! -e "results" ] && mkdir results
|
2014-04-04 20:12:50 +02:00
|
|
|
|
|
|
|
function wait_for_jobs() {
|
|
|
|
local no_jobs
|
|
|
|
no_jobs=$(jobs | wc -l)
|
|
|
|
|
|
|
|
while [ $no_jobs -gt $1 ]; do
|
|
|
|
sleep 1
|
|
|
|
no_jobs=$(jobs | wc -l)
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
i=0
|
|
|
|
count=$(wc -l top-1m.csv | awk '{print $1}')
|
|
|
|
while [ $i -lt $count ]
|
2014-01-09 17:52:17 +01:00
|
|
|
do
|
2014-01-09 21:16:40 +01:00
|
|
|
echo processings sites $i to $((i + parallel))
|
2014-04-04 20:12:50 +02:00
|
|
|
for t in $(tail -$(($count - $i)) top-1m.csv | head -$parallel |cut -d ',' -f 2)
|
2014-01-09 17:52:17 +01:00
|
|
|
do
|
2014-04-04 20:12:50 +02:00
|
|
|
(tcping -u 10000000 $t 443;
|
|
|
|
if [ $? -gt 0 ];then
|
|
|
|
tcping -u 10000000 www.$t 443;
|
|
|
|
if [ $? -gt 0 ]; then
|
|
|
|
continue;
|
|
|
|
else
|
|
|
|
../cipherscan -json www.$t:443 > results/www.$t
|
|
|
|
continue;
|
|
|
|
fi;
|
|
|
|
fi;../cipherscan -json $t:443 > results/$t )&
|
2014-01-09 17:52:17 +01:00
|
|
|
done
|
2014-01-09 21:16:40 +01:00
|
|
|
i=$(( i + parallel))
|
2014-04-04 20:12:50 +02:00
|
|
|
wait_for_jobs $max_bg
|
2014-01-09 17:52:17 +01:00
|
|
|
done
|
2014-04-04 20:12:50 +02:00
|
|
|
wait
|