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

Web Perl Discussion :

authentification web https


Sujet :

Web Perl

  1. #1
    Membre à l'essai
    Inscrit en
    Mai 2006
    Messages
    33
    Détails du profil
    Informations forums :
    Inscription : Mai 2006
    Messages : 33
    Points : 18
    Points
    18
    Par défaut authentification web https
    Salut et merci d'avance pour vos reponses

    je desirerais automatiser mes connexions sur le site "genybet".

    j'ai recupe le formulaire de login suivant:

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    <!--  panel de connexion -->
    <form id="formLogin" name="formLogin" method="post" action="/faces/index.html;jsessionid=8ead2248e378619a8d5d740e59bb" enctype="application/x-www-form-urlencoded" onkeypress="submitFormLogin(event);"><input type="hidden" name="formLogin" value="formLogin" /> <!-- entete --><table id="login-hdr"><tbody><tr><td>Espace client</td><td>&gt;&gt; <script type="text/javascript" language="Javascript">//<![CDATA[
    function dpf(f) {var adp = f.adp;if (adp != null) {for (var i = 0;i < adp.length;i++) {f.removeChild(adp[i]);}}};function apf(f, pvp) {var adp = new Array();f.adp = adp;var i = 0;for (k in pvp) {var p = document.createElement("input");p.type = "hidden";p.name = k;p.value = pvp[k];f.appendChild(p);adp[i++] = p;}};function jsfcljs(f, pvp, t) {apf(f, pvp);var ft = f.target;if (t) {f.target = t;}f.submit();f.target = ft;dpf(f);};
    //]]>
    </script> <a href="#" onclick="if(typeof jsfcljs == 'function'){jsfcljs(document.getElementById('formLogin'),{'j_id19':'j_id19'},'');}return false">Mot de passe oublié ?</a></td></tr></tbody></table><!-- messages d'erreur -->
    <!-- formulaire de connexion --><table id="login-pnl"><tbody><tr><td>Email :</td><td><input id="j_username" type="text" name="j_username" size="23" style="width:133px;" tabindex="1" /></td></tr><tr><td>Mot de passe :</td><td><input id="j_password" type="password" name="j_password" value="" size="23" style="width:133px;" tabindex="2" /></td></tr><tr><td>Date de naissance :</td><td><input id="j_day" type="text" name="j_day" maxlength="2" onkeyup="autoFocus('formLogin',this,3)" size="2" tabindex="3" /><input id="j_month" type="text" name="j_month" maxlength="2" onkeyup="autoFocus('formLogin',this,4)" size="2" tabindex="4" /><input id="j_year" type="text" name="j_year" maxlength="4" size="4" tabindex="5" /></td></tr></tbody></table><!--  footer --><table id="login-footer"><tbody><tr><td><a href="#" onclick="if(typeof jsfcljs == 'function'){jsfcljs(document.getElementById('formLogin'),{'j_id33':'j_id33'},'');}return false"><img id="newCompte" src="/img/login/ouvrir.png;jsessionid=8ead2248e378619a8d5d740e59bb" /></a></td><td><a id="submitLogin" href="#" type="submit" onclick="if(typeof jsfcljs == 'function'){jsfcljs(document.getElementById('formLogin'),{'submitLogin':'submitLogin'},'');}return false"><img src="/img/login/ok.png;jsessionid=8ead2248e378619a8d5d740e59bb" /></a></td></tr></tbody></table><!-- captcha --><input type="hidden" name="javax.faces.ViewState" id="javax.faces.ViewState" value="j_id1" autocomplete="off" /></form></div> <span id="j_id44"><div id="nextRacesContainer"></div></span></div><div id="menu"><script type="text/javascript">
    Pour utiliser perl et le https j'ai lu qu'il etait necessaire d'installer Crypt-SSLeay.
    Pour me connecte je me suis servit du code suivant mais ma connexion ne s'effectue pas.
    Pouvez vous me dire ce qu'il manque?

    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
    use strict;
        use warnings;
        use DateTime;
        use LWP::Simple;    
        use WWW::Mechanize;
    $bot = WWW::Mechanize->new(
                              #agent      => 'Mozilla/4.73 [en] (X11; I; Linux 2.2.16 i686; Nav)',
                              autocheck => 1,
                              cookie_jar => HTTP::Cookies->new(
                              # file           => "$ENV{HOME}/.mailmanrc",
                              autosave       => 1,
                              ignore_discard => 1,        # le cookie devrait être effacé à la fin
            )
        );
     
        $bot->get($base) or die $bot->res->status_line if not $bot->success; 
     
         if ( $bot->current_form->find_input('j_username') ) {               
            warn "Rechargement d'identification utilisateur\n";
            print "### Authentification necessaire ###\n";
         $bot->set_fields( j_username => $compte); # 
         $bot->set_fields( j_password => $pass );
         $bot->set_fields( j_day => 'XX' ); # 
         $bot->set_fields( j_month => 'XX' );
         $bot->set_fields( j_year => 'XXXX' );
         $bot->submit();
    }

  2. #2
    Membre à l'essai
    Inscrit en
    Mai 2006
    Messages
    33
    Détails du profil
    Informations forums :
    Inscription : Mai 2006
    Messages : 33
    Points : 18
    Points
    18
    Par défaut
    Ah un petit UP personne n'a une idee.

  3. #3
    Membre à l'essai
    Inscrit en
    Mai 2006
    Messages
    33
    Détails du profil
    Informations forums :
    Inscription : Mai 2006
    Messages : 33
    Points : 18
    Points
    18
    Par défaut
    J'ai continue dans mes recherches et la je me suis rendu compte qu'il n'y a aucune action de submit demander dans le formulaire de la page d'ouverture de session.
    Mon action est fausse et la je ne vois vraiment pas comment valider mes actions et le javax ne me parle pas du tout.

    Voici ce que donne le mech-dump

    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
    mech-dump https://www.genybet.fr/faces/index.faces?target=/course/391401/partants.html?xtor=AD-29
    Parsing of undecoded UTF-8 will give garbage when decoding entities at /usr/lib/perl5/HTML/PullParser.pm line 83.
    POST https://www.genybet.fr/faces/index.html;jsessionid=4946394519cb46444b04219c88fc [formLogin]
      formLogin=formLogin            (hidden readonly)
      j_username=                    (text)
      j_password=                    (password)
      j_day=                         (text)
      j_month=                       (text)
      j_year=                        (text)
      javax.faces.ViewState=j_id1    (hidden readonly)
     
    POST https://www.genybet.fr/faces/index.html;jsessionid=4946394519cb46444b04219c88fc [j_id49]
      j_id49=j_id49                  (hidden readonly)
      javax.faces.ViewState=j_id1    (hidden readonly)
     
    POST https://www.genybet.fr/faces/index.html;jsessionid=4946394519cb46444b04219c88fc [banniereBonus]
      banniereBonus=banniereBonus    (hidden readonly)
      javax.faces.ViewState=j_id1    (hidden readonly)
     
    POST https://www.genybet.fr/faces/index.html;jsessionid=4946394519cb46444b04219c88fc [banniereAvantages]
      banniereAvantages=banniereAvantages (hidden readonly)
      javax.faces.ViewState=j_id1    (hidden readonly)
     
    POST https://www.genybet.fr/faces/index.html;jsessionid=4946394519cb46444b04219c88fc [banniereAide]
      banniereAide=banniereAide      (hidden readonly)
      javax.faces.ViewState=j_id1    (hidden readonly)
     
    POST https://www.genybet.fr/faces/index.html;jsessionid=4946394519cb46444b04219c88fc [banniereKiosque]
      banniereKiosque=banniereKiosque (hidden readonly)
      javax.faces.ViewState=j_id1    (hidden readonly)

  4. #4
    Membre à l'essai
    Inscrit en
    Mai 2006
    Messages
    33
    Détails du profil
    Informations forums :
    Inscription : Mai 2006
    Messages : 33
    Points : 18
    Points
    18
    Par défaut
    Bon et bien la je dirais "apprend a lire et deja on avancera"

    WWW::mechanize does not support javascript at all. It clearly says that in the documentation


    Il serait preferable d'utiliser :

    Si quelqu'un aurait des exemples utilisant win32::IE::Mechanize je ne dirais pas non

Discussions similaires

  1. authentification web service
    Par dimahoo dans le forum Sécurité
    Réponses: 4
    Dernier message: 29/10/2010, 09h29
  2. [XL-2003] authentification sur site web https
    Par Oliv- dans le forum Macros et VBA Excel
    Réponses: 1
    Dernier message: 06/11/2009, 17h07
  3. Réponses: 4
    Dernier message: 16/05/2007, 09h02
  4. Lecture d'un fichier sur le web (http)
    Par omeya4 dans le forum C++
    Réponses: 3
    Dernier message: 12/06/2006, 21h32

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