Skip to content

Instantly share code, notes, and snippets.

@lub
Created April 27, 2016 18:53
Show Gist options
  • Save lub/47a9136bda6f673fad6885cea6092c3c to your computer and use it in GitHub Desktop.
Save lub/47a9136bda6f673fad6885cea6092c3c to your computer and use it in GitHub Desktop.
#!/bin/bash
file='ips.txt'
max=`curl -s 'https://en.greatfire.org/search/ip-addresses' | grep 'page=' | grep 'last' | sed 's/.*\([0-9]\{3,4\}\).*/\1/'`
for i in $(seq 0 $max); do
echo 'Starting Download '$i
curl -s 'https://en.greatfire.org/search/ip-addresses?page='$i | grep 'td class="first"' | sed 's/.*\([0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\).*/\1/' >> $file &
done
while killall -0 curl; do
current=`echo $(ps -x | grep curl | wc -l)-1 | bc`
echo 'Downloads still running. '$current' remaining'
sleep 5
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment