• # Exemple maison

    Posté par . En réponse au message exécution de script via une page web. Évalué à 2. Dernière modification le 03 juillet 2017 à 19:24.

    Exemple 1
    Un exemple où on exécute une commande et affiche le résultat (dans le cas présent on télécharge une page via tor et on l'affiche) :

    <?php
    $URL="https://x53nxts56jccs2hi.onion/";
    print_r( exec("echo `torsocks wget -qO- ".$URL." --no-check-certificate`"));
    ?>

    source : https://www.0rion.netlib.re/forum4/viewtopic.php?f=9&t=105#p161

    Exemple 2
    Un autre exemple où on lance un script externe depuis PHP afin de vérifier si un site est en ligne

    test.php

    <?php
    $URL="https://x53nxts56jccs2hi.onion/";
    print_r (exec('./test.sh '.$URL.' 2>&1'));
    ?>

    qui exécute test.sh

    #!/usr/bin/env bash
    URL=1ドル
    torsocks wget -q --spider $URL --no-check-certificate >/dev/null 2>/dev/null
    if [ $? -eq 0 ]; then
     echo "[+] $URL is online"
    else
     echo "[-] $URL is offline"
    fi

    source : https://www.0rion.netlib.re/forum4/viewtopic.php?f=9&t=105#p160

    Donation Bitcoin : 1N8QGrhJGWdZNQNSspm3rSGjtXaXv9Ngat