• [^] # Re: bash & zsh power

    Posté par (site web personnel, Mastodon) . En réponse à la dépêche Linux au poignet. Évalué à 2.

    Ben moi j'en suis là, et ça marche pas trop mal:

    #!/bin/bash
    #
    LIMIT=100000
    a=1
    b=1

    if [ -z 1ドル ]; then
    echo "Ex: 0ドル www.truc.fr/truc"
    echo ""
    echo "Récupère 100000x l'URL en se faisant passer pour différents browsers"
    exit 1
    fi

    # Afin de faire des stats 'plausibles', mais... bon...
    # 50% Windows, 30% Linux, 20% MacOS
    # 50% IE, 30% Mozilla, 10% Netscape, 10% lynx
    BRO1="Mozilla/4.0 (compatible; MSIE 4.01; Windows NT)"
    BRO2="Mozilla/4.0 (compatible; MSIE 5.5; Windows 95)"
    BRO3="Mozilla/4.0 (compatible; MSIE 5.0; Windows 98; DigExt)"
    BRO4="Mozilla/4.0 (compatible; MSIE 6.0; Windows 98; Win 9x 4.90)"
    BRO5="Mozilla/5.0 (Windows; U; Windows NT 5.0; rv:0.9.5) Gecko/2001"
    BRO6="Mozilla/5.0 (X11; GNU/Linux 2.4.12 i686; 0.9.5) Gecko/2001"
    BRO7="Mozilla/4.78 [fr] (X11; U; Linux 2.4.7 i686; Nav)"
    BRO8="Lynx/2.8.4dev.16 libwww-FM/2.14 SSL-MM/1.4.1 OpenSSL/0.9.6"
    BRO9="Mozilla/5.0 (Macintosh; U; PPC; en-US; rv:0.9.4) Gecko/20010913"
    BRO10="Mozilla/4.0 (compatible; MSIE 5.0b1; Mac_PowerPC)"

    while [ "$a" -le $LIMIT ]
    do
    if [ "$b" -eq 11 ]; then b=1 ; fi
    if [ "$b" -eq 1 ]; then BRO=$BRO1 ; fi
    if [ "$b" -eq 2 ]; then BRO=$BRO2 ; fi
    if [ "$b" -eq 3 ]; then BRO=$BRO3 ; fi
    if [ "$b" -eq 4 ]; then BRO=$BRO4 ; fi
    if [ "$b" -eq 5 ]; then BRO=$BRO5 ; fi
    if [ "$b" -eq 6 ]; then BRO=$BRO6 ; fi
    if [ "$b" -eq 7 ]; then BRO=$BRO7 ; fi
    if [ "$b" -eq 8 ]; then BRO=$BRO8 ; fi
    if [ "$b" -eq 9 ]; then BRO=$BRO9 ; fi
    if [ "$b" -eq 10 ]; then BRO=$BRO10 ; fi

    UA="-useragent="$BRO
    eval "lynx '$UA' -dump 1ドル >/dev/null 2>/dev/null"
    sleep 0
    let "a+=1"
    let "b+=1"
    done

    echo "Fini, djeu!"
    echo "Fait $LIMIT requêtes à 1ドル ;-)"

    La gelée de coings est une chose à ne pas avaler de travers.