IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Matériel Discussion :

Redémarrer un routeur ADSL avec un script


Sujet :

Matériel

  1. #1
    Candidat au Club
    Inscrit en
    Octobre 2013
    Messages
    9
    Détails du profil
    Informations forums :
    Inscription : Octobre 2013
    Messages : 9
    Points : 2
    Points
    2
    Par défaut Redémarrer un routeur ADSL avec un script
    Hello World !

    J'essaye désespérément de redémarrer un routeur ADSL avec un script, mais sans succès !

    Alors pour commencer par le début, notre FAI réinitialise la connexion ADSL toutes les 12 heures ce qui peut poser problème lorsque celui-ci redémarre en pleine journée pendant la production donc, la solution c'est de le forcer à redémarrer avec un script la nuit où très tôt le matin.
    Sinon, je n'ai pas de souci pour redémarrer les routeurs Netgear ou LinkSYS par contre notre FAI n'a rien trouvé de mieux que de nous obliger à acheter une pseudo BOX si l'on veut utiliser leur système gratuit de téléphone IP. Donc, le premier model est un Thomson TG797v2 et le nouveau model un Technicolor TG789vn v3.


    Pour le premier model (Thomson TG797v2), il est possible de la cracker et d'activer le telnet, mais bon c'est dommage d'en arriver là. J'aimerais pouvoir le faire en URL avec curl ou autre chose mais tout ce que j'ai essayé ne fonctionne pas.


    Lien de la page où il y a le bouton "redémarrer ma box":
    Code du bouton lorsque je vais dessus avec la souris:
    javascript:execTask('RESTART')
    Lien de la page après avoir cliquer sur le bouton "redémarrer ma box":
    Code source de la page d'avant où il y a le bouton finale qui lance le redémarrage de la box:
    <input type='button' name='18' value='Oui, redémarrer ma BOX' onClick='submitForm(document.Restart,0,0,"","",0,"")' >
    Une fois le bouton appuyé, l'URL change dans la barre d'adresse en:


    Pour le second model (Technicolor TG789vn v3), il n'est pas possible à ma connaissance d'activer le telnet où le ssh. Il existe une bidouille que je n'ai pas testé, mais il faut ouvrir la bête et je trouve ça encore moins géniale.
    Sinon, pour la procédure de redémarrage elle est identique au model précédent.


    Donc, est-ce qu'il est possible de reconstituer une URL avec les éléments ci-dessus pour redémarrer la box où est-ce qu'il existe une autre solution sans passer par telnet/ssh ?

    Par avance merci de votre aide ...

  2. #2
    Responsable 2D/3D/Jeux


    Avatar de LittleWhite
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Mai 2008
    Messages
    26 860
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Ingénieur développement logiciels

    Informations forums :
    Inscription : Mai 2008
    Messages : 26 860
    Points : 219 062
    Points
    219 062
    Billets dans le blog
    120
    Par défaut
    Bonjour,

    Avec curl, ou même, wget il est possible de faire des requêtes HTTP et donc, d'appeler les URL que vous donnez sans navigateur (dans un script).

    Je vous conseille donc de vous pencher sur les manpages : wget , curl
    Vous souhaitez participer à la rubrique 2D/3D/Jeux ? Contactez-moi

    Ma page sur DVP
    Mon Portfolio

    Qui connaît l'erreur, connaît la solution.

  3. #3
    Candidat au Club
    Inscrit en
    Octobre 2013
    Messages
    9
    Détails du profil
    Informations forums :
    Inscription : Octobre 2013
    Messages : 9
    Points : 2
    Points
    2
    Par défaut
    Tout d'abord, merci d'avoir pris du temps pour me répondre
    Citation Envoyé par LittleWhite Voir le message
    Avec curl, ou même, wget il est possible de faire des requêtes HTTP et donc, d'appeler les URL que vous donnez sans navigateur (dans un script)
    J'utilise curl, lynx et wget pour redémarrer les routeurs Netgear ou Lynksys, mais le problème c'est que les URL que je donne ci-dessus ne peuvent être utilisé tel quel pour redémarrer la box parce que ça ne fait rien ... je pense que c'est à cause du bouton final dans la page web qui envoie la commande onClick='submitForm(document.Restart,0,0,"","",0,"")'

    Je ne sais pas comment créer l'URL dans mon script qui simulerait le onClick. Il est surement possible que je m'égard complètement sur la façon de procéder.

    Sur Windows, il m'est arrivé de faire des tâches redondantes que j'ai résolu en simulant le déplacement de la souris vers un point de l’écran, de cliquer à un endroit bien précis, par le biais d'un soft qui avait son propre langage qui était utilisable en ligne de commande et intégrable dans un batch ... est-ce qu'il existe une solution sous linux pour éventuellement faire quelque chose d’équivalent ?

  4. #4
    Responsable 2D/3D/Jeux


    Avatar de LittleWhite
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Mai 2008
    Messages
    26 860
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Ingénieur développement logiciels

    Informations forums :
    Inscription : Mai 2008
    Messages : 26 860
    Points : 219 062
    Points
    219 062
    Billets dans le blog
    120
    Par défaut
    Je pense que le curl ne fonctionne pas car vous n'avez pas le cookie de connexion.

    Le document.Restart recharge la page avec simplement de nouveaux paramètres, qu'il y ai un clic ou pas à vrai dire.
    Vous souhaitez participer à la rubrique 2D/3D/Jeux ? Contactez-moi

    Ma page sur DVP
    Mon Portfolio

    Qui connaît l'erreur, connaît la solution.

  5. #5
    Membre confirmé
    Profil pro
    Inscrit en
    Février 2005
    Messages
    390
    Détails du profil
    Informations personnelles :
    Localisation : France, Vaucluse (Provence Alpes Côte d'Azur)

    Informations forums :
    Inscription : Février 2005
    Messages : 390
    Points : 465
    Points
    465
    Par défaut
    Bonjour.

    Et une solution "materielle" ne conviendrais pas, genre programmateur de prise murale 5.90€
    La connaissance s'accroit lorsqu'on la partage.

  6. #6
    Candidat au Club
    Inscrit en
    Octobre 2013
    Messages
    9
    Détails du profil
    Informations forums :
    Inscription : Octobre 2013
    Messages : 9
    Points : 2
    Points
    2
    Par défaut
    Salut, désolé pour le retour tardif LittleWhite... beaucoup de travail en ce moment et pour couronner le tout, au moment ou je vais poster, le site était en maintenance

    Citation Envoyé par overider Voir le message
    Bonjour.
    Et une solution "materielle" ne conviendrais pas, genre programmateur de prise murale
    Pas idiot du tout overider, d’ailleurs je me demande pourquoi je n'y ai pas pensé moi même mais bon, ça reste une solution qui n'est pas très professionnel. Merci quand même pour l'idée

    Sinon,
    J'ai testé un script avec expect dans lequel j'utilise telnet pour redémarrer la box (TG797v3) et ça fonctionne nickel sauf que pour le deuxième modèle (TG789vn v3) il est impossible d'activer le telnet et je ne pense pas que le FAI l'activera pour moi !


    LittleWhite, mon curl fonctionne ... je pense que c'est moi qui ne sait pas l'utiliser avec les cookies. Voici un des nombreux bout de code que j'ai essayé !
    curl -s --user $login:$passwd \
    --location \
    --cookie cookies.txt \
    --cookie-jar cookies.txt \
    --data "restart=1&reboot_action=reboot" \
    --output "http://192.168.1.254/rebooting.lp?be=0&l0=1&l1=0&tid=RESTART" \
    "http://192.168.1.254/login.lp"
    Peut importe ce que j'essaye, il me semble que je ne vais pas plus loin que la page de login. D'ailleurs,Le fichier cookies.txt donne le même résultat malgré tout ce que j’ai essayé. Est-ce que les deux FALSE sont normale ?

    # Netscape HTTP Cookie File
    # http://curl.haxx.se/docs/http-cookies.html
    # This file was generated by libcurl! Edit at your own risk.

    192.168.1.254 FALSE / FALSE 0 xAuth_SESSION_ID ec5c31480846ce1b561288f2332954fe
    Les options qui suit "--data" que j'ai rajouté dans le script curl viennent du source code de la page web "http://192.168.1.254/rebooting.lp?be...=0&tid=RESTART" et qui sont en rouge dans le bout de code ci-dessous
    <table cellspacing='0' cellpadding='0'>
    <tr><td class='icon' valign='top' width='100px'><img src='/images/warn__xl.gif' alt='Avertissement !'></td>
    <td class='data' valign='top'><table cellspacing='0' cellpadding='0'><tr><td align='left'><span class='itemtitle'>Avertissement: Redémarrage du système</span></td><td align='right'></td></tr>
    <tr><td colspan='2'><p>Vous êtes sur le point de redémarrer votre BOX. Toutes les connexions actives seront déconnectées.</p>
    <p>Désirez-vous continuer?</p>
    <form name='Restart' method='post' action='/rebooting.lp'>
    <input type="hidden" name="rn" value="-2129074453">
    <input type='hidden' name='restart' value='1'>
    <input type='hidden' name='reboot_action' value='reboot'>
    <table width='100%' class='datatable' cellspacing='0' cellpadding='0'>
    <tr><td></td><td width='30px'></td><td width='220px'></td><td width='50px'></td></tr>
    <br><input type='button' name='18' value='Oui, redémarrer ma BOX' onClick='submitForm(document.Restart,0,0,"","",0,"")' >
    <input type='button' name='20' value='Non' onClick='GoAndRemember("/cgi/b/info/","")' >
    </table>
    Il n'y a que la valeur de "rn" qui change à chaque actualisation de la page et je me demande si ce n'est pas ça qui m’empêche de redémarrer la BOX avec l'URL.


    voila, je continue de chercher et je vous tiens au courant des résultats des mes tests

  7. #7
    Candidat au Club
    Inscrit en
    Octobre 2013
    Messages
    9
    Détails du profil
    Informations forums :
    Inscription : Octobre 2013
    Messages : 9
    Points : 2
    Points
    2
    Par défaut
    Bon, je pense avoir réussi à faire fonctionner curl avec les cookies, mais au final je n'arrive toujours pas à redémarrer mon routeur car, j'ai un code HTTP 302 qui me renvoie sur la page de login.

    curl --cookie cookies.txt \
    --cookie-jar cookies.txt \
    --user-agent Mozilla/4.0 \
    --user $login:$passwd \
    "http://192.168.1.254/rebooting.lp?be=0&l0=1&l1=0&tid=RESTART" -v
    ce bout de code me donne le résultat suivant:

    * About to connect() to 192.168.1.254 port 80 (#0)
    * Trying 192.168.1.254...
    * connected
    * Connected to 192.168.1.254 (192.168.1.254) port 80 (#0)
    * Server auth using Basic with user '$login'
    > GET /rebooting.lp?be=0&l0=1&l1=0&tid=RESTART HTTP/1.1
    > Authorization: Basic bWFuYTptYW5h
    > User-Agent: Mozilla/4.0
    > Host: 192.168.1.254
    > Accept: */*
    > Cookie: xAuth_SESSION_ID=25c3823fcbd492cfdc9b4cedad99c066
    >
    * additional stuff not fine transfer.c:1037: 0 0
    * HTTP 1.1 or later with persistent connection, pipelining supported
    < HTTP/1.1 302 Moved Temporarily
    < Date: Fri, 31 Dec 1999 16:09:45 GMT
    < Server: Mbedthis-Appweb/2.4.2
    < ETag: ""700-982dadb8""
    < Content-length: 0
    < Connection: keep-alive
    < Keep-Alive: timeout=60, max=2000
    < Location: http://192.168.1.254/login.lp
    * Replaced cookie xAuth_SESSION_ID="25c3823fcbd492cfdc9b4cedad99c066" for domain 192.168.1.254, path /, expire 0
    < Set-Cookie: xAuth_SESSION_ID=25c3823fcbd492cfdc9b4cedad99c066; path=/;
    < Cache-control: no-cache="set-cookie"
    <
    * Connection #0 to host 192.168.1.254 left intact
    * Closing connection #0
    Donc, je me connecte bien sur la bonne URL puis j'ai un code 302 qui me renvoie temporairement sur la page login.lp (voir en rouge)


    J'ai essayé avec Wget mais, c'est la même chose :
    wget --save-cookies cookies.txt \
    --keep-session-cookies \
    --post-data="username=$login&password=$password" \
    --base="http://192.168.1.254/login.lp" \
    "http://192.168.1.254/rebooting.lp?be=0&l0=1&l1=0&tid=RESTART" \
    --output-file="log"
    ce bout de code me donne le résultat suivant:

    --2013-10-18 13:41:32-- http://192.168.1.254/rebooting.lp?be=0&l0=1&l1=0&tid=RESTART
    Connexion vers 192.168.1.254:80... connecté.
    requête HTTP transmise, en attente de la réponse... 302 Moved Temporarily
    Emplacement: http://192.168.1.254/login.lp [suivant]
    --2013-10-18 13:41:32-- http://192.168.1.254/login.lp
    Réutilisation de la connexion existante vers 192.168.1.254:80.
    requête HTTP transmise, en attente de la réponse... 200 OK
    Longueur: 10853 (11K) [text/html]
    Sauvegarde en : «rebooting.lp?be=0&l0=1&l1=0&tid=RESTART.1»

    0K .......... 100% 1,09M=0,009s

    2013-10-18 13:41:33 (1,09 MB/s) - «rebooting.lp?be=0&l0=1&l1=0&tid=RESTART.1» sauvegardé [10853/10853]

    NB: j'ai essayé de faire une attaque brute force HTTP sur le routeur pour avoir le mot de passe du compte Administrator et me permettre peut-être d'avoir accès à plus d'option comme la possibilité de sauvegarder la configuration du routeur pour activer le telnet mais, ça ne marche pas non plus !

    Voila, je suis toujours à la recherche de comment redémarrer mon routeur
    Merci d'avance pour vos idées !!!

  8. #8
    Candidat au Club
    Inscrit en
    Octobre 2013
    Messages
    9
    Détails du profil
    Informations forums :
    Inscription : Octobre 2013
    Messages : 9
    Points : 2
    Points
    2
    Par défaut
    Voici toutes les étapes que j'ai lorsque je suis sur le page RESTART et que je clique sur le bouton pour redémarrer la BOX

    GET http://192.168.1.254/restart.lp?be=0...=0&tid=RESTART
    Cookie: xAuth_SESSION_ID=4fb96ab01530b78211aa40ee7bb341f9
    Referer: http://192.168.1.254/cgi/b/ST/?be=0&l0=1&l1=-1
    200 OK
    Content-Type: text/html

    GET http://192.168.1.254/styles.css
    Cookie: xAuth_SESSION_ID=4fb96ab01530b78211aa40ee7bb341f9
    Referer: http://192.168.1.254/restart.lp?be=0...=0&tid=RESTART
    200 OK
    Content-Type: text/css

    GET http://192.168.1.254/util.js
    Cookie: xAuth_SESSION_ID=4fb96ab01530b78211aa40ee7bb341f9
    Referer: http://192.168.1.254/restart.lp?be=0...=0&tid=RESTART
    200 OK
    Content-Type: text/javascript

    GET http://192.168.1.254/b_menu.js
    Cookie: xAuth_SESSION_ID=4fb96ab01530b78211aa40ee7bb341f9
    Referer: http://192.168.1.254/restart.lp?be=0...=0&tid=RESTART
    200 OK
    Content-Type: text/javascript
    [Fri Oct 18 14:37:54 2013] (6938) PROCESS: Too many child process, serving the connection

    ========= Voici les URL après avoir cliqué sur le bouton redemarré

    POST http://192.168.1.254/rebooting.lp?be...=0&tid=RESTART
    Cookie: xAuth_SESSION_ID=4fb96ab01530b78211aa40ee7bb341f9
    Referer: http://192.168.1.254/restart.lp?be=0...=0&tid=RESTART
    rn => -451311653
    restart => 1
    reboot_action => reboot
    200 OK
    Content-Type: text/html

    GET http://192.168.1.254/styles.css
    Cookie: xAuth_SESSION_ID=4fb96ab01530b78211aa40ee7bb341f9
    Referer: http://192.168.1.254/rebooting.lp?be...=0&tid=RESTART
    200 OK
    Content-Type: text/css

    GET http://192.168.1.254/util.js
    Cookie: xAuth_SESSION_ID=4fb96ab01530b78211aa40ee7bb341f9
    Referer: http://192.168.1.254/rebooting.lp?be...=0&tid=RESTART
    200 OK
    Content-Type: text/javascript

    GET http://192.168.1.254/b_menu.js
    Cookie: xAuth_SESSION_ID=4fb96ab01530b78211aa40ee7bb341f9
    Referer: http://192.168.1.254/rebooting.lp?be...=0&tid=RESTART
    200 OK
    Content-Type: text/javascript

    ========== Ici j'ai une barre de progression du redémarrage qui est en cours

    POST http://192.168.1.254/rebooting_action.lp
    Cookie: xAuth_SESSION_ID=4fb96ab01530b78211aa40ee7bb341f9
    Referer: http://192.168.1.254/rebooting.lp?be...=0&tid=RESTART
    next => reboot
    rn => -795072638
    200 OK
    Content-Type: text/html

    =========== A partir de là j'ai perdu le reseau

    [Fri Oct 18 14:39:50 2013] (6973) ERROR: Getting request failed: Client closed
    [Fri Oct 18 14:39:50 2013] (6971) ERROR: Getting request failed: Client closed
    C'est le header/flag RN que je n'arrive pas à mettre dans ma ligne de commande curl puisqu'il change tout le temps mais, j'ai un autre problème c'est que lorsque je fais mon curl sur la page login.lp, ça m'affiche bien le code html de la page par contre pour les autres page ... impossible d'avoir le code qui s'affiche sûrement parce que le cookies ne suffit pas

  9. #9
    Membre émérite
    Inscrit en
    Avril 2010
    Messages
    1 495
    Détails du profil
    Informations forums :
    Inscription : Avril 2010
    Messages : 1 495
    Points : 2 274
    Points
    2 274
    Par défaut
    salut tout le monde

    Citation Envoyé par Sigmoonator Voir le message
    impossible d'avoir le code qui s'affiche sûrement parce que le cookies ne suffit pas
    non c'est parce que t'as pas assez de mana et points de vie

    Plaisanterie à part, le mieux c'est que tu donnes le code sources de la page en question.
    Le fait que tu sois renvoyé vers la page d'authentification c'est parce que la session a expiré.
    Sinon, un test simple, lance ton navigateur, connecte-toi à ta box, recopie et valide (entrée) ton url avec le "RESTART" depuis la barre d'adresse de ton navigateur, et vois si c'est suffisant pour rebooter ton modem.

    Je lirai ta réponse au plus tard lundi si c'est pas résolu avant.

  10. #10
    Expert éminent

    Profil pro
    Inscrit en
    Janvier 2011
    Messages
    1 946
    Détails du profil
    Informations personnelles :
    Localisation : France, Haute Garonne (Midi Pyrénées)

    Informations forums :
    Inscription : Janvier 2011
    Messages : 1 946
    Points : 6 276
    Points
    6 276
    Par défaut
    Salut,

    Personnellement je ferai ça en 2 temps.

    1 - Login + récupération du cookie
    2 - Requête en utilisant le cookie

    Ce qui devrait se traduire par :

    1 -
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    curl -s --user $login:$passwd \
    --cookie-jar cookies.txt \
    -L "http://192.168.1.254/login.lp"
    2 -
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    curl -b cookies.txt \
    -d "be=0&l0=1&l1=0&tid=RESTART" \
    -L "http://192.168.1.254/rebooting.lp" -v
    $ man woman
    Il n'y a pas de page de manuel pour woman.

  11. #11
    Candidat au Club
    Inscrit en
    Octobre 2013
    Messages
    9
    Détails du profil
    Informations forums :
    Inscription : Octobre 2013
    Messages : 9
    Points : 2
    Points
    2
    Par défaut
    Tout d'abord merci de votre aide
    Citation Envoyé par minnesota Voir le message
    Sinon, un test simple, lance ton navigateur, connecte-toi à ta box, recopie et valide (entrée) ton url avec le "RESTART" depuis la barre d'adresse de ton navigateur, et vois si c'est suffisant pour rebooter ton modem.
    minnesota vous pensez bien que j'ai commencé par ça


    Citation Envoyé par zipe31 Voir le message
    Personnellement je ferai ça en 2 temps.

    1 - Login + récupération du cookie
    2 - Requête en utilisant le cookie
    zipe31, ça ne fonctionne pas non plus j'ai toujours le code HTTP 302 et les deux curl m'affichent le code source html de la page login.lp. Sinon voici le résultat du curl dans ma console en ayant pris soin d'envoyer le code html dans un fichier txt
    * About to connect() to 192.168.1.254 port 80 (#0)
    * Trying 192.168.1.254...
    % Total % Received % Xferd Average Speed Time Time Time Current
    Dload Upload Total Spent Left Speed
    0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0* connected
    * Connected to 192.168.1.254 (192.168.1.254) port 80 (#0)
    > POST /rebooting.lp HTTP/1.1
    > User-Agent: curl/7.27.0
    > Host: 192.168.1.254
    > Accept: */*
    > Cookie: xAuth_SESSION_ID=27ee7fbe702a02282becd7774adf5859
    > Content-Length: 26
    > Content-Type: application/x-www-form-urlencoded
    >
    } [data not shown]
    * upload completely sent off: 26 out of 26 bytes
    * additional stuff not fine transfer.c:1037: 0 0
    * HTTP 1.1 or later with persistent connection, pipelining supported
    < HTTP/1.1 302 Moved Temporarily
    < Date: Fri, 31 Dec 1999 14:18:55 GMT
    < Server: Mbedthis-Appweb/2.4.2
    < ETag: ""700-982dadb8""
    < Content-length: 0
    < Connection: keep-alive
    < Keep-Alive: timeout=60, max=2000
    < Location: http://192.168.1.254/login.lp
    * Replaced cookie xAuth_SESSION_ID="27ee7fbe702a02282becd7774adf5859" for domain 192.168.1.254, path /, expire 0
    < Set-Cookie: xAuth_SESSION_ID=27ee7fbe702a02282becd7774adf5859; path=/;
    < Cache-control: no-cache="set-cookie"
    <
    100 26 0 0 100 26 0 2578 --:--:-- --:--:-- --:--:-- 3250
    * Connection #0 to host 192.168.1.254 left intact
    * Issue another request to this URL: 'http://192.168.1.254/login.lp'
    * Violate RFC 2616/10.3.3 and switch from POST to GET
    * Re-using existing connection! (#0) with host (nil)
    * Connected to (nil) (192.168.1.254) port 80 (#0)
    > GET /login.lp HTTP/1.1
    > User-Agent: curl/7.27.0
    > Host: 192.168.1.254
    > Accept: */*
    > Cookie: xAuth_SESSION_ID=27ee7fbe702a02282becd7774adf5859
    >
    * additional stuff not fine transfer.c:1037: 0 0
    * HTTP 1.1 or later with persistent connection, pipelining supported
    < HTTP/1.1 200 OK
    < Date: Fri, 31 Dec 1999 14:18:55 GMT
    < Server: Mbedthis-Appweb/2.4.2
    < Cache-Control: no-cache
    < Content-type: text/html
    < ETag: ""3b3b-89371f20""
    < Content-length: 10852
    < Connection: keep-alive
    < Keep-Alive: timeout=60, max=1999
    <
    { [data not shown]
    100 10852 100 10852 0 0 55549 0 --:--:-- --:--:-- --:--:-- 55549
    * Connection #0 to host (nil) left intact
    * Closing connection #0
    Je suis toujours dans une impasse ...

  12. #12
    Membre émérite
    Inscrit en
    Avril 2010
    Messages
    1 495
    Détails du profil
    Informations forums :
    Inscription : Avril 2010
    Messages : 1 495
    Points : 2 274
    Points
    2 274
    Par défaut
    mais ça répond pas aux questions...
    n'oublie pas qu'on n'a pas ton modem, donc si tu ne fais aucun retour sur ce qui t'est demandé, difficile de t'aider

  13. #13
    Expert éminent

    Profil pro
    Inscrit en
    Janvier 2011
    Messages
    1 946
    Détails du profil
    Informations personnelles :
    Localisation : France, Haute Garonne (Midi Pyrénées)

    Informations forums :
    Inscription : Janvier 2011
    Messages : 1 946
    Points : 6 276
    Points
    6 276
    Par défaut
    Re-

    Il faudrait savoir à quoi ressemble ton code pour l'authentification ainsi que la page affichée après t'être authentifié...

    Peux-tu essayer juste pour l'authentification comme ça alors :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    curl -s -d "username=$login&password=$password" \
    --cookie-jar cookies.txt \
    -L "http://192.168.1.254/login.lp" |  w3m -dump -T text/html
    $ man woman
    Il n'y a pas de page de manuel pour woman.

  14. #14
    Candidat au Club
    Inscrit en
    Octobre 2013
    Messages
    9
    Détails du profil
    Informations forums :
    Inscription : Octobre 2013
    Messages : 9
    Points : 2
    Points
    2
    Par défaut
    Citation Envoyé par minnesota Voir le message
    mais ça répond pas aux questions...
    n'oublie pas qu'on n'a pas ton modem, donc si tu ne fais aucun retour sur ce qui t'est demandé, difficile de t'aider
    minnesota elle était pourtant claire ma réponse car, c'est la première chose que j'ai pensé faire et ça ne fonctionne pas !
    Vous pensez bien que si c’était aussi simple, je ne me serais pas embêté à poster sur le forum
    Sinon, pour détailler, je m'authentifie, je vais sur la page RESTART,je met l'URL de la page RESTART, ça recharge la page et si je met l'URL de la page REBOOT ça me fait un Access error 500: Internal server error

    Citation Envoyé par zipe31 Voir le message
    Re-
    Peux-tu essayer juste pour l'authentification comme ça alors :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    curl -s -d "username=$login&password=$password" \
    --cookie-jar cookies.txt \
    -L "http://192.168.1.254/login.lp" |  w3m -dump -T text/html
    zipe31, avec ce bout de code, je ne passe pas l'authentification et ça me donne ça
    THOMSON - BOX

    To view the Web interface of your device, JavaScript must be supported and
    enabled on your browser!

    Please enable scripting and refresh your browser.


    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
    Authentification Authentification
    ! Entrez votre nom d'utilisateur ainsi que votre mot de passe pour
    accéder à votre BOX.

    _
    Nom [ ]
    d'utilisateur:
    _
    Mot de passe: [ ]
    _
    [OK] [Annuler]

    Sinon, voila le code source de la page d'authentification
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
    284
    285
    286
    287
    288
    289
    290
    291
    292
    293
    294
    295
    296
    297
    298
    299
    300
    301
    302
    303
    304
    305
    306
    307
    308
    309
    310
    311
    312
    313
    314
    315
    316
    317
    318
    319
    320
    321
    322
    323
    324
    325
    326
    327
     
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
      <title>BOX - Authentification</title>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
      <link rel="stylesheet" type="text/css" href="/styles.css">
    </head>
    <body height="100%" style="margin:0px;">
      <noscript>
        <h1>THOMSON - BOX</h1>
        <h4>To view the Web interface of your device, JavaScript must be supported and enabled on your browser! <br><br>Please enable scripting and refresh your browser.</h4>
      </noscript>
     
    <script type="text/javascript">
    //<![CDATA[
    function disable_fields(theForm)
    {
      var len = theForm.elements.length;
      for (var i = 0; i < len; i++) {
        // Don't disable "hidden" fields
        if(theForm.elements[i].type.toLowerCase()!="hidden")
          theForm.elements[i].disabled = 1;
      }
    }
     
    function setLanguage(langCode)
    {
      document.langSelect.elements[0].value = langCode;
      document.langSelect.submit();
      disable_fields(document.langSelect);
    }
     
    function noenter(e) {
      var keycode;
     
      if (window.event)
        keycode = window.event.keyCode;
      else if (e)
        keycode = e.which;
      else 
        return true;
     
      if (keycode == 13)
        return false;
      else
        return true;
    }
     
    var hex_chr = "0123456789abcdef";
    function rhex(num)
    {
      str = "";
      for(j = 0; j <= 3; j++)
        str += hex_chr.charAt((num >> (j * 8 + 4)) & 0x0F) +
               hex_chr.charAt((num >> (j * 8)) & 0x0F);
      return str;
    }
     
    /*
     * Convert a string to a sequence of 16-word blocks, stored as an array.
     * Append padding bits and the length, as described in the MD5 standard.
     */
    function str2blks_MD5(str)
    {
      nblk = ((str.length + 8) >> 6) + 1;
      blks = new Array(nblk * 16);
      for(i = 0; i < nblk * 16; i++) blks[i] = 0;
      for(i = 0; i < str.length; i++)
        blks[i >> 2] |= str.charCodeAt(i) << ((i % 4) * 8);
      blks[i >> 2] |= 0x80 << ((i % 4) * 8);
      blks[nblk * 16 - 2] = str.length * 8; 
      return blks;
    }
     
    /*
     * Add integers, wrapping at 2^32. This uses 16-bit operations internally
     * to work around bugs in some JS interpreters.
     */
    function add(x, y)
    {
      var lsw = (x & 0xFFFF) + (y & 0xFFFF);
      var msw = (x >> 16) + (y >> 16) + (lsw >> 16);
      return (msw << 16) | (lsw & 0xFFFF);
    }
     
    /*
     * Bitwise rotate a 32-bit number to the left
     */
    function rol(num, cnt)
    {
      return (num << cnt) | (num >>> (32 - cnt));
    }
     
    /*
     * These functions implement the basic operation for each round of the
     * algorithm.
     */
    function cmn(q, a, b, x, s, t)
    {
      return add(rol(add(add(a, q), add(x, t)), s), b);
    }
    function ff(a, b, c, d, x, s, t)
    {
      return cmn((b & c) | ((~b) & d), a, b, x, s, t);
    }
    function gg(a, b, c, d, x, s, t)
    {
      return cmn((b & d) | (c & (~d)), a, b, x, s, t);
    }
    function hh(a, b, c, d, x, s, t)
    {
      return cmn(b ^ c ^ d, a, b, x, s, t);
    }
    function ii(a, b, c, d, x, s, t)
    {
      return cmn(c ^ (b | (~d)), a, b, x, s, t);
    }
     
    /*
     * Take a string and return the hex representation of its MD5.
     */
    function MD5(str)
    {
      x = str2blks_MD5(str);
      var a =  1732584193;
      var b = -271733879;
      var c = -1732584194;
      var d =  271733878;
     
      for(i = 0; i < x.length; i += 16)
      {
        var olda = a;
        var oldb = b;
        var oldc = c;
        var oldd = d;
     
        a = ff(a, b, c, d, x[i+ 0], 7 , -680876936);
        d = ff(d, a, b, c, x[i+ 1], 12, -389564586);
        c = ff(c, d, a, b, x[i+ 2], 17,  606105819);
        b = ff(b, c, d, a, x[i+ 3], 22, -1044525330);
        a = ff(a, b, c, d, x[i+ 4], 7 , -176418897);
        d = ff(d, a, b, c, x[i+ 5], 12,  1200080426);
        c = ff(c, d, a, b, x[i+ 6], 17, -1473231341);
        b = ff(b, c, d, a, x[i+ 7], 22, -45705983);
        a = ff(a, b, c, d, x[i+ 8], 7 ,  1770035416);
        d = ff(d, a, b, c, x[i+ 9], 12, -1958414417);
        c = ff(c, d, a, b, x[i+10], 17, -42063);
        b = ff(b, c, d, a, x[i+11], 22, -1990404162);
        a = ff(a, b, c, d, x[i+12], 7 ,  1804603682);
        d = ff(d, a, b, c, x[i+13], 12, -40341101);
        c = ff(c, d, a, b, x[i+14], 17, -1502002290);
        b = ff(b, c, d, a, x[i+15], 22,  1236535329);
     
        a = gg(a, b, c, d, x[i+ 1], 5 , -165796510);
        d = gg(d, a, b, c, x[i+ 6], 9 , -1069501632);
        c = gg(c, d, a, b, x[i+11], 14,  643717713);
        b = gg(b, c, d, a, x[i+ 0], 20, -373897302);
        a = gg(a, b, c, d, x[i+ 5], 5 , -701558691);
        d = gg(d, a, b, c, x[i+10], 9 ,  38016083);
        c = gg(c, d, a, b, x[i+15], 14, -660478335);
        b = gg(b, c, d, a, x[i+ 4], 20, -405537848);
        a = gg(a, b, c, d, x[i+ 9], 5 ,  568446438);
        d = gg(d, a, b, c, x[i+14], 9 , -1019803690);
        c = gg(c, d, a, b, x[i+ 3], 14, -187363961);
        b = gg(b, c, d, a, x[i+ 8], 20,  1163531501);
        a = gg(a, b, c, d, x[i+13], 5 , -1444681467);
        d = gg(d, a, b, c, x[i+ 2], 9 , -51403784);
        c = gg(c, d, a, b, x[i+ 7], 14,  1735328473);
        b = gg(b, c, d, a, x[i+12], 20, -1926607734);
     
        a = hh(a, b, c, d, x[i+ 5], 4 , -378558);
        d = hh(d, a, b, c, x[i+ 8], 11, -2022574463);
        c = hh(c, d, a, b, x[i+11], 16,  1839030562);
        b = hh(b, c, d, a, x[i+14], 23, -35309556);  
        a = hh(a, b, c, d, x[i+ 1], 4 , -1530992060);
        d = hh(d, a, b, c, x[i+ 4], 11,  1272893353);
        c = hh(c, d, a, b, x[i+ 7], 16, -155497632); 
        b = hh(b, c, d, a, x[i+10], 23, -1094730640);
        a = hh(a, b, c, d, x[i+13], 4 ,  681279174); 
        d = hh(d, a, b, c, x[i+ 0], 11, -358537222); 
        c = hh(c, d, a, b, x[i+ 3], 16, -722521979); 
        b = hh(b, c, d, a, x[i+ 6], 23,  76029189);  
        a = hh(a, b, c, d, x[i+ 9], 4 , -640364487); 
        d = hh(d, a, b, c, x[i+12], 11, -421815835); 
        c = hh(c, d, a, b, x[i+15], 16,  530742520); 
        b = hh(b, c, d, a, x[i+ 2], 23, -995338651); 
     
        a = ii(a, b, c, d, x[i+ 0], 6 , -198630844);
        d = ii(d, a, b, c, x[i+ 7], 10,  1126891415);
        c = ii(c, d, a, b, x[i+14], 15, -1416354905);
        b = ii(b, c, d, a, x[i+ 5], 21, -57434055);  
        a = ii(a, b, c, d, x[i+12], 6 ,  1700485571);
        d = ii(d, a, b, c, x[i+ 3], 10, -1894986606);
        c = ii(c, d, a, b, x[i+10], 15, -1051523);   
        b = ii(b, c, d, a, x[i+ 1], 21, -2054922799);
        a = ii(a, b, c, d, x[i+ 8], 6 ,  1873313359);
        d = ii(d, a, b, c, x[i+15], 10, -30611744);  
        c = ii(c, d, a, b, x[i+ 6], 15, -1560198380);
        b = ii(b, c, d, a, x[i+13], 21,  1309151649);
        a = ii(a, b, c, d, x[i+ 4], 6 , -145523070); 
        d = ii(d, a, b, c, x[i+11], 10, -1120210379);
        c = ii(c, d, a, b, x[i+ 2], 15,  718787259); 
        b = ii(b, c, d, a, x[i+ 9], 21, -343485551); 
     
        a = add(a, olda);
        b = add(b, oldb);
        c = add(c, oldc);
        d = add(d, oldd);
      }
      return rhex(a) + rhex(b) + rhex(c) + rhex(d);
    }
     
    var realm = "Thomson Gateway";
    var nonce = "926:194754:676a63fe9cbe5a2240b82855861eb331";
    var qop = "auth";
    var uri = "/login.lp";
     
    function submitAuthentication()
    {
      var user = document.getElementById("user").value;
      var pwd  = document.getElementById("password").value;
      document.getElementById("password").disabled = true;
      var HA1 = MD5(user + ":" + realm + ":" + pwd);
      var HA2 = MD5("GET" + ":" + uri);
      document.getElementById("hidepw").value = MD5(HA1 + ":" + nonce + 
                              ":" + "00000001" + ":" + "xyz" + ":" + qop + ":" + HA2);
      document.authform.submit();
      disable_fields(document.authform);
    }
    //]]>
    </script>
     
      <table cellspacing="0" cellpadding="0" border="0" style="margin-top:10px;" height="100%">
        <tr>
          <td colspan="2">
            <table cellspacing="0" cellpadding="0" border="0" width="100%">
              <tr>
              	<td height="69" width="605" style="background:url(/images/banner_left.gif) no-repeat top left;">	              
    					<p class="displaySettings" id="displaySettings">
    						 <span class="langSelect" id="langSelect">
    						 	<form name="langSelect" action="" method="post"><input type="hidden" name="6" value="en">
                                <input type="hidden" name="rn" value="1860813421">
     
    							</form>
    						</span>            
    					</p>  
    				</span>
    				<script type="text/javascript">
     
    				</script>
                </td>           
              </tr>
            </table>
          </td>
        </tr>
        <tr>
          <td valign="top" style="padding: 25px 30px 0px  15px;"></td>
          <td valign="top">
            <table cellpadding="0" cellspacing="0" border="0" style="margin-top:15px;margin-right:15px;">
              <tr>
                <td>
                  <table width="700" cellspacing="0" cellpadding="0" border="0">
                    <tr>
                      <td>
    <div class='contentcontainer'>
    <hr>
    <div class='contentitem'>
    <table cellspacing='0' cellpadding='0'>
      <tr><td class='icon' valign='top' width='100px'><img src='/images/user__xl.gif' alt='Authentification !'></td>
      <td class='data' valign='top'><table cellspacing='0' cellpadding='0'><tr><td align='left'><span class='itemtitle'>Authentification</span></td><td align='right'></td></tr>
      <tr><td colspan='2'>
        <p>Entrez votre nom d'utilisateur ainsi que votre mot de passe pour accéder à votre BOX.</p>
     
     
        <form method="post" action="login.lp" name="authform" id="authform">
        <input type="hidden" name="rn" value="985656483">
        <input type="hidden" name="hidepw" id="hidepw" value=""/>
     
        <table width='100%' cellspacing='0' cellpadding='0'>
          <tr><td width="40" valign="top"></td>
          <td valign="top">
            <table width='100%' class="datatable" cellspacing='0' cellpadding='0'>
              <tr><td></td><td width='30px'></td><td width='220px'></td><td width='50px'></td></tr>
              <tr><td colspan='4' height='7'><img src='/images/spacer.gif' alt='' border='0' height='7' width='1'></td></tr>
              <tr>
                <td width='120px'>Nom d'utilisateur:</td>
                <td colspan='3'><input type="text" name="user" id="user" style="width: 250px;" onkeypress="return noenter(event)" maxlength="63" /></td>
              </tr>
              <tr><td colspan='4' height='7'><img src='/images/spacer.gif' alt='' border='0' height='7' width='1'></td></tr>
              <tr>
                <td width='120px'>Mot de passe:</td>
                <td colspan='3'><input type="password" name="password" id="password" maxlength="63" style="width: 250px;" onkeypress="return noenter(event)" /></td></td>
              </tr>
              <tr><td colspan='4' height='7'><img src='/images/spacer.gif' alt='' border='0' height='7' width='1'></td></tr>
              <tr>
                <td colspan="4" align="right">
                  <input name="ok" type="button" value="OK" onclick='submitAuthentication()' />
                  <input name="cancel" type="button" value="Annuler" onclick='location.href="/";' />
                </td>
              </tr>
            </table>
          </td></tr>
        </table>
        </form>
        </td></tr></table>
    </td></tr></table>
    </div>
     
    <script type="text/javascript">
    //<![CDATA[
    document.authform.user.focus();
    //]]>
    </script>
     
    </div>
                      </td>
                    </tr>
                  </table>
                </td>
              </tr>
            </table>
          </td>
        </tr>
      </table>
    </body>
    </html>
    et voici le code source de la page après authentification
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
      <title>BOX - Accueil</title>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
      <script type="text/javascript">var g_navitem = -1;</script>
      <script type="text/javascript"> var g_focus = -1;</script>
      <script type='text/javascript' src='/util.js'></script>
      <link rel="stylesheet" type="text/css" href="/styles.css">
    </head>
    <body onLoad="setFocus();" height="100%" style="margin:0px;">
      <noscript>
        <h1>THOMSON - BOX</h1>
        <h4>Pour pouvoir afficher l'interface Web du BOX, votre navigateur doit supporter JavaScript, et doit l'avoir activé! <br><br>Veuillez activer Javascript et actualiser votre navigateur.</h4>
      </noscript>
      <table cellspacing="0" cellpadding="0" border="0" style="margin-top:10px;" height="100%">
        <tr>
          <td colspan="2">
            <table cellspacing="0" cellpadding="0" border="0" class="banner" width="100%">
              <tr>
              	<td height="69" width="605" style="background:url(/images/banner_left.gif) no-repeat top left;">            
    	              <span class="displaySettings" id="displaySettings">
    	              	<script type="text/javascript">             			              		
    	              		if (0==1) {	              			
    							document.write('Display level'+':&nbsp;');
    							if (g_state[BE] ==0) {								
    								document.write('<strong>'+'Basic'+'</strong>'+'&nbsp;');
    								document.write('<a href="javascript:switchmode(1)">'+'Expert'+'</a>');
    							} else {
    								document.write('<a href="javascript:switchmode(0)">'+'Basic'+'</a>'+'&nbsp;');
    								document.write('<strong>'+'Expert'+'</strong>');							
    							}
    						}
    					</script>          
    				</span>
    				<!--<script type="text/javascript">
    					if (g_state[NM] ==0) {
    						if (document.getElementById('langSelect').innerHTML.search("setLanguage")==-1)
    							document.getElementById('langSelect').style.visibility = "hidden";
    					} else {
    						document.getElementById('displaySettings').style.visibility = "hidden";
    					}
    	              </script>	
    	              <script type="text/javascript">					
    					<!--if ((g_state[NM] ==1) || ((document.getElementById('langSelect').innerHTML.search("setLanguage")==-1) && (0==0)) ) {
    						<!--document.getElementById('displaySettings').style.visibility = "hidden";
    					} else {
    						if (document.getElementById('langSelect').innerHTML.search("setLanguage")==-1)
    								document.getElementById('langSelect').style.visibility = "hidden";						
    					}
    	              </script>-->	
                </td>
                <td class="login">
    				<script type="text/javascript">
    					var username = new String('mana');
    					var loginText = 'Connecté en tant que'+':&nbsp;';
    					if (username.length > 0 && 1 && g_state[NM] ==0)
    						document.write(loginText+'<a href="javascript:openWndCentered(\'/cgi/b/users/usrpage/?nm=1\', \'userpage\', 795, 560, \'yes\', \'yes\')">'+username+'</a>');
    				</script>
                </td>            
              </tr> 
            </table>
          </td>
        </tr>
        <tr>
          <td valign="top" style="padding: 25px 30px 0px  15px;">
            <script type="text/javascript">writeMenu();</script>
          </td>
          <td valign="top">
            <table cellpadding="0" cellspacing="0" border="0" style="margin-top:15px;margin-right:15px;">
              <script type="text/javascript">writeNavBar();</script>
              <tr>
                <td>
                  <table width="700" cellspacing="0" cellpadding="0" border="0">
                    <tr>
                      <td>
                       <script type="text/javascript">new pm('error', 'Votre connexion DSL est inactive. Vérifiez que votre BOX est connecté correctement à votre ligne téléphonique. Si le problème persiste, reportez-vous à la documentation.');</script>
    <script type="text/javascript">pm_write_messages();</script>
     
     
    <div class='contentcontainer'>
    <hr>
    <div class='contentitem'>
    <table cellspacing='0' cellpadding='0'>
    <tr><td class='icon' valign='top' width='100px'><a href="javascript:GoAndRemember('/cgi/b/ST/','')"><img src='/images/stxx__xl.gif' alt='BOX'></a></td>
    <td class='data' valign='top'><table cellspacing='0' cellpadding='0'><tr><td align='left'><span class='itemtitle'>BOX</span></td><td align='right'></td></tr>
    <tr><td colspan='2'><table cellspacing='0' cellpadding='0'>
    <tr><td height='5' colspan='5'><img src='/images/spacer.gif' width='1' height='5' border='0' alt=''></td></tr>
    <tr><td width='40' valign='top'><img src='/images/bull__md.gif' alt=''></td> <td class='homeline' width='150'><a href="javascript:GoAndRemember('/cgi/b/info/', '' )">Informations</a></td><td width='20'></td><td class='homeline' colspan='2' width='250'></td></tr>
    <tr><td height='5' colspan='5'><img src='/images/spacer.gif' width='1' height='5' border='0' alt=''></td></tr>
    <tr><td width='40' valign='top'></td> <td class='homeline' width='150'>Nom du produit:</td><td width='20'></td><td class='homeline' colspan='2' width='250'>TG797n v2</td></tr>
    <tr><td height='5' colspan='5'><img src='/images/spacer.gif' width='1' height='5' border='0' alt=''></td></tr>
    <tr><td width='40' valign='top'></td> <td class='homeline' width='150'>Version du logiciel:</td><td width='20'></td><td class='homeline' colspan='2' width='250'>8.4.2.Q</td></tr>
    </table></td></tr></table></td></tr></table></div>
    <hr>
    <div class='contentitem'>
    <table cellspacing='0' cellpadding='0'>
    <tr><td class='icon' valign='top' width='100px'><a href="javascript:GoAndRemember('/cgi/b/bb/','')"><img src='/images/bbc_rdxl.gif' alt='Erreur connexion large bande'></a></td>
    <td class='data' valign='top'><table cellspacing='0' cellpadding='0'><tr><td align='left'><span class='itemtitle'>Connexions Réseaux</span></td><td align='right'></td></tr>
    <tr><td colspan='2'><table cellspacing='0' cellpadding='0'>
    <form name='PPPConn0' action='/' method='post'>
    <input type='hidden' name='0' value=''>
    <input type='hidden' name='1' value=''>
    <input type='hidden' name='2' value='2893808915'>
    <tr><td height='5' colspan='5'><img src='/images/spacer.gif' width='1' height='5' border='0' alt=''></td></tr>
    <tr><td width='40' valign='top'><img src='/images/bull__md.gif' alt=''></td> <td class='homeline' width='150'><a href="javascript:GoAndRemember('/cgi/b/is/_pppoe_/ov/', 'name=Internet' )">Internet</a>:</td><td width='20'></td><td class='homeline' width='150'>Déconnecté</td><td width='150' align='right'><input type='button' name='12' value='Connecter' onClick='submitForm(document.PPPConn0,12,0,"Internet","",0,"")' >
    </td></tr>
    <input type='hidden' name='5' value="1">
    </form>
    <tr><td height='5' colspan='5'><img src='/images/spacer.gif' width='1' height='5' border='0' alt=''></td></tr>
    <tr><td width='40' valign='top'><img src='/images/bull__md.gif' alt=''></td> <td class='homeline' width='150'><a href="javascript:GoAndRemember('/cgi/b/is/_ethoa_/ov/', 'name=ip_voice' )">ip_voice</a>:</td><td width='20'></td><td class='homeline' colspan='2' width='250'>Déconnecté</td></tr>
    </table></td></tr></table></td></tr></table></div>
    <hr>
    <div class='contentitem'>
    <table cellspacing='0' cellpadding='0'>
    <tr><td class='icon' valign='top' width='100px'><a href="javascript:GoAndRemember('/cgi/b/toolbox/','')"><img src='/images/tbox__xl.gif' alt='Boîte à outils'></a></td>
    <td class='data' valign='top'><table cellspacing='0' cellpadding='0'><tr><td align='left'><span class='itemtitle'>Boîte à outils</span></td><td align='right'></td></tr>
    <tr><td colspan='2'><table cellspacing='0' cellpadding='0'>
    <tr><td height='5' colspan='5'><img src='/images/spacer.gif' width='1' height='5' border='0' alt=''></td></tr>
    <tr><td width='40' valign='top'><img src='/images/bull__md.gif' alt=''></td> <td class='homeline' width='150'><a href="javascript:GoAndRemember('/remote_admin.lp', '' )">Assistance à distance</a>:</td><td width='20'></td><td class='homeline' colspan='2' width='250'>Désactivé</td></tr>
    <tr><td height='5' colspan='5'><img src='/images/spacer.gif' width='1' height='5' border='0' alt=''></td></tr>
    <tr><td width='40' valign='top'><img src='/images/bull__md.gif' alt=''></td> <td class='homeline' width='150'><a href="javascript:GoAndRemember('/cgi/b/games/ov/', '' )">Partage du jeu et de l’application</a></td><td width='20'></td><td class='homeline' colspan='2' width='250'></td></tr>
    <tr><td height='5' colspan='5'><img src='/images/spacer.gif' width='1' height='5' border='0' alt=''></td></tr>
    <tr><td width='40' valign='top'><img src='/images/bull__md.gif' alt=''></td> <td class='homeline' width='150'><a href="javascript:GoAndRemember('/cgi/b/secpol/ov/', '' )">Pare-feu</a>:</td><td width='20'></td><td class='homeline' colspan='2' width='250'>Standard</td></tr>
    <tr><td height='5' colspan='5'><img src='/images/spacer.gif' width='1' height='5' border='0' alt=''></td></tr>
    <tr><td width='40' valign='top'><img src='/images/bull__md.gif' alt=''></td> <td class='homeline' width='150'><a href="javascript:GoAndRemember('/cgi/b/sfltr/ov/', '' )">Contrôle parental</a></td><td width='20'></td><td class='homeline' colspan='2' width='250'></td></tr>
    <tr><td height='5' colspan='5'><img src='/images/spacer.gif' width='1' height='5' border='0' alt=''></td></tr>
    <tr><td width='40' valign='top'><img src='/images/bull__md.gif' alt=''></td> <td class='homeline' width='150'><a href="javascript:GoAndRemember('/cgi/b/_voip_/ov/', '' )">Téléphonie</a>:</td><td width='20'></td><td class='homeline' colspan='2' width='250'>Activé</td></tr>
    <tr><td height='5' colspan='5'><img src='/images/spacer.gif' width='1' height='5' border='0' alt=''></td></tr>
    <tr><td width='40' valign='top'><img src='/images/bull__md.gif' alt=''></td> <td class='homeline' width='150'><a href="javascript:GoAndRemember('/cgi/b/_voip_/pb/', '' )">Carnet d'adresses</a>:</td><td width='20'></td><td class='homeline' colspan='2' width='250'>Activé</td></tr>
    </table></td></tr></table></td></tr></table></div>
    <hr>
    <div class='contentitem'>
    <table cellspacing='0' cellpadding='0'>
    <tr><td class='icon' valign='top' width='100px'><a href="javascript:GoAndRemember('/cgi/b/lan/','')"><img src='/images/hnw___xl.gif' alt='Réseau domestique'></a></td>
    <td class='data' valign='top'><table cellspacing='0' cellpadding='0'><tr><td align='left'><span class='itemtitle'>Réseau domestique</span></td><td align='right'></td></tr>
    <tr><td colspan='2'><table cellspacing='0' cellpadding='0'>
    <tr><td height='5' colspan='5'><img src='/images/spacer.gif' width='1' height='5' border='0' alt=''></td></tr>
    <tr><td width='40' valign='top'><img src='/images/iwla__la.gif' alt='Interface WLAN'></td> <td class='homeline' width='150'><a href="javascript:GoAndRemember('/cgi/b/_wli_/ov/', 'name=WLAN: BOX1BA67F' )">Wireless</a>:</td><td width='20'></td><td class='homeline' colspan='2' width='250'><a href="javascript:GoAndRemember('/cgi/b/_dev_/ov/', 'name=iPhone&key=3c:d0:f8:dc:86:df' )">iPhone</a></td></tr>
    <tr><td height='5' colspan='5'><img src='/images/spacer.gif' width='1' height='5' border='0' alt=''></td></tr>
    <tr><td width='40' valign='top'><img src='/images/ieth__la.gif' alt='Interface Ethernet'></td> <td class='homeline' width='150'>Ethernet:</td><td width='20'></td><td class='homeline' colspan='2' width='250'><a href="javascript:GoAndRemember('/cgi/b/_dev_/ov/', 'name=linux&key=00:17:a4:cf:d1:2e' )">linux</a></td></tr>
    <tr><td height='5' colspan='5'><img src='/images/spacer.gif' width='1' height='5' border='0' alt=''></td></tr>
    <tr><td width='40' valign='top'><img src='/images/ipho__la.gif' alt='Interface téléphonique'></td> <td class='homeline' width='150'><a href="javascript:GoAndRemember('/cgi/b/_voip_/ov/', '' )">Téléphonie</a>:</td><td width='20'></td><td class='homeline' colspan='2' width='250'>Téléphone</td></tr>
    <tr><td height='5' colspan='5'><img src='/images/spacer.gif' width='1' height='5' border='0' alt=''></td></tr>
    <tr><td width='40' valign='top'></td> <td class='homeline' width='150'></td><td width='20'></td><td class='homeline' colspan='2' width='250'>Dect 1</td></tr>
    <tr><td height='5' colspan='5'><img src='/images/spacer.gif' width='1' height='5' border='0' alt=''></td></tr>
    <tr><td width='40' valign='top'></td> <td class='homeline' width='150'></td><td width='20'></td><td class='homeline' colspan='2' width='250'>Dect 2</td></tr>
    <tr><td height='5' colspan='5'><img src='/images/spacer.gif' width='1' height='5' border='0' alt=''></td></tr>
    <tr><td width='40' valign='top'></td> <td class='homeline' width='150'></td><td width='20'></td><td class='homeline' colspan='2' width='250'>Dect 3</td></tr>
    <tr><td height='5' colspan='5'><img src='/images/spacer.gif' width='1' height='5' border='0' alt=''></td></tr>
    <tr><td width='40' valign='top'></td> <td class='homeline' width='150'></td><td width='20'></td><td class='homeline' colspan='2' width='250'>Dect 4</td></tr>
    <tr><td height='5' colspan='5'><img src='/images/spacer.gif' width='1' height='5' border='0' alt=''></td></tr>
    <tr><td width='40' valign='top'></td> <td class='homeline' width='150'></td><td width='20'></td><td class='homeline' colspan='2' width='250'>Dect 5</td></tr>
    </table></td></tr></table></td></tr></table></div>
    <script type='text/javascript'>generateTasks()</script>
    </div>
                      </td>
                    </tr>
                  </table>
                </td>
              </tr>
            </table>
          </td>
        </tr>
      </table>
    </body>
    </html>

    Merci encore pour votre aide

  15. #15
    Expert éminent

    Profil pro
    Inscrit en
    Janvier 2011
    Messages
    1 946
    Détails du profil
    Informations personnelles :
    Localisation : France, Haute Garonne (Midi Pyrénées)

    Informations forums :
    Inscription : Janvier 2011
    Messages : 1 946
    Points : 6 276
    Points
    6 276
    Par défaut
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
        <form method="post" action="login.lp" name="authform" id="authform">
        <input type="hidden" name="rn" value="985656483">
        <input type="hidden" name="hidepw" id="hidepw" value=""/>
    Effectivement, il semblerait qu'il faille la valeur de "rn" comme tu l'avais dit plus haut

    Essaie d'installer une extension comme Tamper Data pour voir à quoi ressemble la partie data à passer à cURL...
    $ man woman
    Il n'y a pas de page de manuel pour woman.

  16. #16
    Candidat au Club
    Inscrit en
    Octobre 2013
    Messages
    9
    Détails du profil
    Informations forums :
    Inscription : Octobre 2013
    Messages : 9
    Points : 2
    Points
    2
    Par défaut
    Citation Envoyé par zipe31 Voir le message
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
        <form method="post" action="login.lp" name="authform" id="authform">
        <input type="hidden" name="rn" value="985656483">
        <input type="hidden" name="hidepw" id="hidepw" value=""/>
    Salut zipe31, ce qui me gène un peut c'est que la valeur rn n'est pas la même d'une page à l'autre et elle change à chaque actualisation de la page.

    Citation Envoyé par zipe31 Voir le message
    Essaie d'installer une extension comme Tamper Data pour voir à quoi ressemble la partie data à passer à cURL...
    Je ne connaissais pas cette extension, merci. Sinon, voici le résultat ... bien évidement j'ai enlevé tout ce qui n'avait pas d’intérêt à mon sens
    ============ Page <http://192.168.1.254/login.lp> + authentification
    12:50:18.877[154ms][total 154ms] État: 302[Moved Temporarily]
    POST http://192.168.1.254/login.lp Indicateurs chargement[LOAD_DOCUMENT_URI LOAD_INITIAL_DOCUMENT_URI ] Taille contenu[0] Type Mime[application/x-unknown-content-type]
    En-têtes requête:
    Host[192.168.1.254]
    User-Agent[Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:21.0) Gecko/20100101 Firefox/21.0]
    Accept[text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8]
    Accept-Language[fr,fr-fr;q=0.8,en-US;q=0.5,en;q=0.3]
    Accept-Encoding[gzip, deflate]
    Referer[http://192.168.1.254/login.lp]
    Cookie[xAuth_SESSION_ID=319b52881542605f447131cbd0cf523a]
    Connection[keep-alive]
    Données POST:
    rn[-749426011]
    hidepw[4802be13eb20f4ba6996b1c8024bc510]
    user[$login]
    En-têtes réponse:
    Date[Fri, 31 Dec 1999 14:02:34 GMT]
    Server[Mbedthis-Appweb/2.4.2]
    Cache-Control[no-cache="set-cookie"]
    Etag[""3b3b-89371f20""]
    Content-Length[0]
    Connection[keep-alive]
    Keep-Alive[timeout=60, max=1999]
    Location[http://192.168.1.254/]
    Set-Cookie[xAuth_SESSION_ID=319b52881542605f447131cbd0cf523a; path=/;]

    ============= Page après l'authentification réussi
    12:50:19.050[2629ms][total 3711ms] État: 200[OK]
    GET http://192.168.1.254/ Indicateurs chargement[LOAD_DOCUMENT_URI LOAD_REPLACE LOAD_INITIAL_DOCUMENT_URI ] Taille contenu[13456] Type Mime[text/html]
    En-têtes requête:
    Host[192.168.1.254]
    User-Agent[Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:21.0) Gecko/20100101 Firefox/21.0]
    Accept[text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8]
    Accept-Language[fr,fr-fr;q=0.8,en-US;q=0.5,en;q=0.3]
    Accept-Encoding[gzip, deflate]
    Referer[http://192.168.1.254/login.lp]
    Cookie[xAuth_SESSION_ID=319b52881542605f447131cbd0cf523a]
    Connection[keep-alive]
    En-têtes réponse:
    Date[Fri, 31 Dec 1999 14:02:36 GMT]
    Server[Mbedthis-Appweb/2.4.2]
    Cache-Control[no-cache]
    Content-Type[text/html]
    Content-Length[13456]
    Connection[keep-alive]
    Keep-Alive[timeout=60, max=1998]

    ============= Page intermédiaire pour atteindre le bouton <redémarrer la box>
    12:54:05.661[505ms][total 1564ms] État: 200[OK]
    GET http://192.168.1.254/restart.lp?be=0...=0&tid=RESTART Indicateurs chargement[LOAD_DOCUMENT_URI LOAD_INITIAL_DOCUMENT_URI ] Taille contenu[4331] Type Mime[text/html]
    En-têtes requête:
    Host[192.168.1.254]
    User-Agent[Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:21.0) Gecko/20100101 Firefox/21.0]
    Accept[text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8]
    Accept-Language[fr,fr-fr;q=0.8,en-US;q=0.5,en;q=0.3]
    Accept-Encoding[gzip, deflate]
    Referer[http://192.168.1.254/cgi/b/ST/?be=0&l0=1&l1=-1]
    Cookie[xAuth_SESSION_ID=319b52881542605f447131cbd0cf523a]
    Connection[keep-alive]
    If-None-Match[""5b1-fc36c0e0""]
    En-têtes réponse:
    Date[Fri, 31 Dec 1999 14:06:21 GMT]
    Server[Mbedthis-Appweb/2.4.2]
    Cache-Control[no-cache]
    Content-Type[text/html]
    Etag[""5b1-fc36c0e0""]
    Content-Length[4331]
    Connection[keep-alive]
    Keep-Alive[timeout=60, max=1994]


    ============== Page sur laquelle se trouve le bouton <redémarrer la box> + activation du bouton
    12:54:45.885[309ms][total 1462ms] État: 200[OK]
    POST http://192.168.1.254/rebooting.lp?be...=0&tid=RESTART Indicateurs chargement[LOAD_DOCUMENT_URI LOAD_INITIAL_DOCUMENT_URI ] Taille contenu[5661] Type Mime[text/html]
    En-têtes requête:
    Host[192.168.1.254]
    User-Agent[Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:21.0) Gecko/20100101 Firefox/21.0]
    Accept[text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8]
    Accept-Language[fr,fr-fr;q=0.8,en-US;q=0.5,en;q=0.3]
    Accept-Encoding[gzip, deflate]
    Referer[http://192.168.1.254/restart.lp?be=0...0&tid=RESTART]
    Cookie[xAuth_SESSION_ID=319b52881542605f447131cbd0cf523a]
    Connection[keep-alive]
    Données POST:
    rn[912821356]
    restart[1]
    reboot_action[reboot]
    En-têtes réponse:
    Date[Fri, 31 Dec 1999 14:07:01 GMT]
    Server[Mbedthis-Appweb/2.4.2]
    Cache-Control[no-cache]
    Content-Type[text/html]
    Etag[""700-982dadb8""]
    Content-Length[5661]
    Connection[keep-alive]
    Keep-Alive[timeout=60, max=1987]

    ============== Page après avoir cliquer sur le bouton redémarré > redémarrage en cours
    12:54:47.093[404ms][total 404ms] État: 200[OK]
    POST http://192.168.1.254/rebooting_action.lp Indicateurs chargement[LOAD_BYPASS_CACHE LOAD_BACKGROUND ] Taille contenu[1] Type Mime[text/html]
    En-têtes requête:
    Host[192.168.1.254]
    User-Agent[Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:21.0) Gecko/20100101 Firefox/21.0]
    Accept[text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8]
    Accept-Language[fr,fr-fr;q=0.8,en-US;q=0.5,en;q=0.3]
    Accept-Encoding[gzip, deflate]
    Content-Type[application/x-www-form-urlencoded; charset=UTF-8]
    Referer[http://192.168.1.254/rebooting.lp?be...0&tid=RESTART]
    Content-Length[26]
    Cookie[xAuth_SESSION_ID=319b52881542605f447131cbd0cf523a]
    Connection[keep-alive]
    Pragma[no-cache]
    Cache-Control[no-cache]
    Données POST:
    next[reboot]
    rn[-1984413773]
    En-têtes réponse:
    Date[Fri, 31 Dec 1999 14:07:02 GMT]
    Server[Mbedthis-Appweb/2.4.2]
    Cache-Control[no-cache]
    Content-Type[text/html]
    Etag[""6b7-d1195280""]
    Content-Length[1]
    Connection[keep-alive]
    Keep-Alive[timeout=60, max=1981]

    ============== Ensuite retour à la page login, authentification + nouveau cookie
    PS: ça fait deux jours que j'ai repris toutes les documentations que j'avais afin d'apprendre un maximum de chose sur les script bash, les expressions régulières ... j’espère qu'au final, j'arriverais à récupérer la valeur rn pour l'utiliser dans le curl

  17. #17
    Futur Membre du Club
    Homme Profil pro
    Inscrit en
    Novembre 2013
    Messages
    7
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Royaume-Uni

    Informations professionnelles :
    Secteur : High Tech - Multimédia et Internet

    Informations forums :
    Inscription : Novembre 2013
    Messages : 7
    Points : 9
    Points
    9
    Par défaut
    Bonsoir.
    Je regrette par se que mon franacaise n'est pas trez bonne.
    mai je'etais travailer avec le Technicolor TG582n et mon problem est exactemant comme cette ici.

    Je regrette mais je prefer continuer ecrire en Angletaire.

    @Sigmoonator I signed up to this forum just so that you could see what I have done.

    I have written Bash scripts to scrape the value of 'rn' and use node.js to execute the embedded javascript code to calculate the MD5 hash parameter 'hidepw' using the recovered value 'nonce'

    I made a tar file, but can't see a way to add an attachment here. :-(

    I tried to POST back to the router with the cookie and parameters set but I still have not succeeded in getting the router to return anything useful yet.

  18. #18
    Futur Membre du Club
    Homme Profil pro
    Inscrit en
    Novembre 2013
    Messages
    7
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Royaume-Uni

    Informations professionnelles :
    Secteur : High Tech - Multimédia et Internet

    Informations forums :
    Inscription : Novembre 2013
    Messages : 7
    Points : 9
    Points
    9
    Par défaut TG582n_login.sh
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    #! /usr/bin/sh
    # 
    ## This script designed to scrape data from the web interface of ADSL modem 
    ## branded as 'Technicolor TG582n' supplied by JohnLewisBroadband
    ## whish resells a Plusnet service.
    ## Hardware appears to be made by Thompson - chipset Broadcom
    ## csr 2013_11_16
     
    ## raw command line for testing 
    #curl --proxy 192.168.4.118:8118 --user admin:xxxxxx --cookie-jar cookies.txt -L "http://192.168.1.254/login.lp" | w3m -dump > TG582n_login.lp_w3m-dump
     
    CURL='/usr/bin/curl'
    W3M='/usr/bin/w3m'
    ECHO='/usr/bin/echo'
     
    # First task is to capture a session cookie.
     
    #PAGE_TEXT=$($CURL -s --proxy 192.168.4.118:8118 --user admin:xxxxxx --cookie-jar .cookies.txt -L 'http://192.168.1.254/login.lp' > .TG582n_login.lp
    #CURL_STATUS=$?
     
    ## Unfortunately all formatting seems to have been lost. :-( 
    #$ECHO $PAGE_TEXT | w3m -dump
     
    $CURL -s --proxy 192.168.4.118:8118 --user admin:xxxxxx --cookie-jar .cookies.txt -L 'http://192.168.1.254/login.lp' > .TG582n_login.lp 
     
    exit $?

  19. #19
    Futur Membre du Club
    Homme Profil pro
    Inscrit en
    Novembre 2013
    Messages
    7
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Royaume-Uni

    Informations professionnelles :
    Secteur : High Tech - Multimédia et Internet

    Informations forums :
    Inscription : Novembre 2013
    Messages : 7
    Points : 9
    Points
    9
    Par défaut TG582n_doLogin.sh
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    #! /usr/bin/sh
    # 
    ## This script designed to scrape data from the web interface of ADSL modem 
    ## branded as 'Technicolor TG582n' supplied by JohnLewisBroadband
    ## whish resells a Plusnet service.
    ## Hardware appears to be made by Thompson - chipset Broadcom
    ## csr 2013_11_16
     
    ECHO='/usr/bin/echo' 
    #GREP='/usr/bin/grep'
    #AWK='/usr/bin/awk' 
    #CUT='/usr/bin/cut' 
    NODE='/usr/bin/node'
    CURL='/usr/bin/curl'
     
    SCRIPT_DIR='/home/colin/scripts/TG582n'
     
    GET_LOGIN_CREDENTIALS="$SCRIPT_DIR/TG582n_login.sh"
     
    LOGIN_FILE="$SCRIPT_DIR/.TG582n_login.lp"
    COOKIE_FILE="$SCRIPT_DIR/.cookies.txt"
    GET_COOKIE_SCRIPT="$SCRIPT_DIR/TG582n_getAuthCookie.sh"
    GET_RN_VALUE_SCRIPT="$SCRIPT_DIR/TG582n_getRNValue.sh"
    GET_NONCE_SCRIPT="$SCRIPT_DIR/TG582n_getNonce.sh"
    MD5_SCRIPT="$SCRIPT_DIR/pagescript.js"
     
    #$ECHO "$LOGIN_FILE" 
    #$ECHO "$COOKIE_FILE"
    #$ECHO "$GET_COOKIE_SCRIPT"
     
    USERNAME='admin'
    PASSWD='xxxxxx'
     
     
    #execute the script that creates the LOGIN_FILE and the COOKIE_FILE
    $GET_LOGIN_CREDENTIALS
     
    xAuth_SESSION_ID=$($GET_COOKIE_SCRIPT)
     
    $ECHO $xAuth_SESSION_ID
     
    RN_VALUE=$($GET_RN_VALUE_SCRIPT)
     
    $ECHO $RN_VALUE
     
    NONCE_VALUE=$($GET_NONCE_SCRIPT)
    $ECHO $NONCE_VALUE
     
    HIDEPW=$($NODE $MD5_SCRIPT $USERNAME $PASSWD $NONCE_VALUE)
     
    $ECHO $HIDEPW
     
    #--cookie \"xAuth_SESSION_ID=$xAuth_SESSION_ID\" \
    #--header \"Accept[text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8]\" \ 
    #--header \"Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0\" \
    #--header \"Accept-Encoding[gzip, deflate]\" \
    #--header \"Connection[keep-alive]\" \
     
    POST_CMD=" --proxy 192.168.4.118:8118 \
    --referer <a href="http://192.168.1.254/login.lp" target="_blank">http://192.168.1.254/login.lp</a> \
    --header \"Content-Type:application/x-www-form-urlencoded\" \
    --data-urlencode \"rn=$RN_VALUE%20hidepw=$HIDEPW%20user=$USERNAME\" \
    --cookie $COOKIE_FILE --cookie-jar .postcookies.txt \
     http://192.168.1.254/login.lp" 
     
    $ECHO $POST_CMD
     
    #$CURL $POST_CMD > .curl.post
    #RET_VAL=-1 
    POST_RESULT=$($CURL $POST_CMD; RET_VAL=$?; )
    RETURN_VAL=$?
    #$ECHO $RET_VAL
     
    $ECHO $POST_RESULT > .curl.post
    $ECHO $RETURN_VAL 
     
    #--cookie \"xAuth_SESSION_ID=$xAuth_SESSION_ID\" \
     
    GET_CMD=" -s --proxy 192.168.4.118:8118 \
    --referer <a href="http://192.168.1.254/login.lp" target="_blank">http://192.168.1.254/login.lp</a>  \
    --cookie .postcookies.txt --cookie-jar .getcookies.txt \
     <a href="http://192.168.1.254/" target="_blank">http://192.168.1.254/</a> "
     
    $CURL $GET_CMD > .curl.get

  20. #20
    Futur Membre du Club
    Homme Profil pro
    Inscrit en
    Novembre 2013
    Messages
    7
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Royaume-Uni

    Informations professionnelles :
    Secteur : High Tech - Multimédia et Internet

    Informations forums :
    Inscription : Novembre 2013
    Messages : 7
    Points : 9
    Points
    9
    Par défaut TG582n_getAuthCookie.sh
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    #! /usr/bin/sh
    # 
    ## scrape the xAuth_SESSION_ID from the cookie file
     
    ECHO='/usr/bin/echo'
    GREP='/usr/bin/grep'
    AWK='/usr/bin/awk'
     
    SCRIPT_DIR='/home/colin/scripts/TG582n'
     
    COOKIE_FILE="$SCRIPT_DIR/.cookies.txt"
     
    #$ECHO "$COOKIE_FILE"
     
    AUTH_COOKIE_LINE=$($GREP 'xAuth_SESSION_ID' $COOKIE_FILE)
    #$ECHO $AUTH_COOKIE_LINE
     
    AUTH_COOKIE=$($ECHO $AUTH_COOKIE_LINE | $AWK '{split($0,a,"xAuth_SESSION_ID"); print a[2]}' )
    $ECHO $AUTH_COOKIE

Discussions similaires

  1. Partage connexion adsl avec modem routeur et switch
    Par kermed dans le forum Hardware
    Réponses: 2
    Dernier message: 03/12/2007, 23h42
  2. Connection ADSL avec un routeur
    Par SebCBien dans le forum Réseau
    Réponses: 18
    Dernier message: 14/08/2004, 18h43
  3. Pb d'execution de requete avec un script php
    Par ythierrin dans le forum Requêtes
    Réponses: 3
    Dernier message: 22/08/2003, 14h34
  4. Problème avec un script ftp
    Par doohan dans le forum Linux
    Réponses: 2
    Dernier message: 25/06/2003, 17h47
  5. Quel est le meilleur Routeur-adsl ???
    Par loki dans le forum Développement
    Réponses: 4
    Dernier message: 12/11/2002, 18h05

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo