tftpcrawl - scripts - various script and utils
 (HTM) git clone git://z3bra.org/scripts
 (DIR) Log
 (DIR) Files
 (DIR) Refs
       ---
       tftpcrawl (664B)
       ---
            1 #!/bin/sh
            2 
            3 ENGINES=${ENGINES:-"filemare ftplike"}
            4 
            5 extract_link() {
            6     ENGINE=$1
            7     ARCHIVE=$2
            8     case $1 in
            9         filemare)   URL="http://filemare.com/en/search/${ARCHIVE}"
           10                     SED='s^.*/en/browse/\([^>'\''"]*\).*$ftp://\1p;d'
           11                     ;;
           12         ftplike)    URL="http://ftplike.com/index.aspx?m=EXACT&t=Files&q=${ARCHIVE}"
           13                     SED='s|^.*\(ftp://[^ '\''"><]*\).*$|\1|p;d'
           14                     ;;
           15         *) return 1
           16     esac
           17 
           18     curl -s "$URL" | sed "$SED"
           19 }
           20 
           21 crawl() {
           22     ARCHIVE=$1
           23     for ENGINE in $ENGINES; do
           24         extract_link $ENGINE $ARCHIVE
           25     done | shuf
           26 }
           27 
           28 for ARG in $@; do
           29     crawl $ARG
           30 done
           31