• [^] # Re: ouch (bis)

    Posté par . En réponse au message Extraire username password d'une page html. Évalué à 1. Dernière modification le 30 mars 2019 à 19:07.

    voila mon script
    ```

    !/bin/sh

    *******************************************

    /etc/init.d/openvpn stop > /dev/null 2>&1
    rm -r -f /etc/openvpn; mkdir /etc/openvpn
    wget -q -O- --trust-server-names "https://ia600702.us.archive.org/26/items/dreamosat /cfg.itconf" > /etc/openvpn/cfg.conf
    DTMP=`mktemp -d`
    CLT='/etc/openvpn/client.conf'
    cd $DTMP
    vph="https://freevpnme.b-cdn.net/FreeVPN.me-OpenVPN- Bundle.zip"
    wget -q -O 'vpn.zip' $vph
    find . -type f -name "vpn.zip" -exec unzip {} + > /dev/null 2>&1
    for i in */; do find "$i" -type f -exec mv {} "$i" \; && rm -r "$i"*/; done
    cd FreeVPN.me-OpenVPN-Bundle
    OVPN=`find . -maxdepth 1 -name "*it-UDP-443*" -print`
    echo $OVPN
    mv $OVPN client.conf
    sed -i 's/auth-user-pass/auth-user-pass cfg.itconf/g' client.conf
    cp -f client.conf $CLT

    echo "Current IP: wget -qO- http://ipecho.net /plain;echo"
    /etc/init.d/openvpn start > /dev/null 2>&1
    sleep 8
    echo "New IP : wget -qO- http://ipecho.net /plain;echo"
    rm -r -f $DTMP
    exit 0
    ```mais comme le password change souvent j'ai besoin d'extraire l'username et le password de la page html du site et le mettre dans un fichie cfg dans etc/openvpn