Contenu | Rechercher | Menus

Annonce

Le forum rencontre en ce moment quelques soucis de charge, il est possible qu'une erreur soit affichée quand vous postez un message, ne rechargez pas la page au risque de poster une seconde fois votre message

Si vous rencontrez des soucis à rester connecté sur le forum (ou si vous avez perdu votre mot de passe) déconnectez-vous et reconnectez-vous depuis cette page, en cochant la case "Me connecter automatiquement lors de mes prochaines visites".

#1 Le 24/07/2012, à 20:37

SCRIPT Autenfication Automatique Hotspot

Bonsoir étant en FJT pour utiliser internet je suis amener à m'identifier par un portail captif, hors ce dernier coupe automatiquement la connexion au bout de 30 min sans rien demandé. Je suis donc obliger de me reconnecter manuellement.

Je pensais donc faire un script que je lancerais toute les 15 min en tache cron de manière à automatisé la chose.

Comment dois -je procéder, est-ce possible?

Voici le code source du portail au cas où:

			<html>
				<head>
				<meta name="title" content="clicknews - Votre portail d'information de proximité" />
				<meta name="author" content="http://www.clicknews.fr" />
				<meta name="rating" content="clicknews" />
				<meta name="description" content="Site référencé sur Google par openarea" />
				<meta name="abstract" content="Site référencé sur Google par openarea" />
				<meta name="keywords" content="openarea,area,AreA,hotspot,gratuit,HOTSPOT,GRATUIT,portail,information,local,news,taxi,météo,département,journaux"/>
				<meta name="revisit-after" content="7 days" />
				<meta name="Language" content="fr" />
				<meta name="copyright" content="clicknews.fr" />
				<meta name="robots" content="all" />
					<title>Portail de connexion D'AREA</title>
					<link href="style_clicknews.css" rel="stylesheet" type="text/css">
					<link rel="shortcut icon" type="image/x-icon" href="images/icone.ico">
				</head>
				<body style="background-image:url('images/fond/fond.jpg'); background-color:#B7EAFD; background-repeat:no-repeat; width:99%; height:80%">
				<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
				</script>
				<script type="text/javascript">
				_uacct = "UA-1554811-2";
				urchinTracker();
				</script>
				<table  style="background-image: url('images/band.png'); background-repeat:no-repeat; width:99%;">
					<tr valign="top">
					 	<td colspan="99%" style="border-bottom-color:navy;border-bottom-style:solid;border-bottom-width:1px">					
					 		<b style="vertical-align:top">
					 			<!--bgcolor="#DDF0F7" pour le lien actif -->
	<script type="text/javascript">
        
                function change_onglet(name)
                {
                        document.getElementById(anc_onglet).className = 'onglet_off menu';
                        document.getElementById(name).className = 'onglet_on menu';
                        anc_onglet = name;
                }
				// Image Preloader  v1.0.1
				// documentation: http://www.dithered.com/javascript/image_preloader/index.html
				// license: http://creativecommons.org/licenses/by/1.0/
				// code by Chris Nott (chris[at]dithered[dot]com)


				function preloadImages() {
					if (document.images) {
						for (var i = 0; i < preloadImages.arguments.length; i++) {
							(new Image()).src = preloadImages.arguments[i];
						}
					}
				}

				// Rollover  v2.0.1
				// documentation: http://www.dithered.com/javascript/rollover/index.html
				// license: http://creativecommons.org/licenses/by/1.0/
				// code by Chris Nott (chris[at]dithered[dot]com)


				function isDefined(property) {
				  return (typeof property != 'undefined');
				}

				var rolloverInitialized = false;
				function rolloverInit() {
				   if (!rolloverInitialized && isDefined(document.images)) {
					  
					  // get all images (including all <input type="image">s)
					  // use getElementsByTagName() if supported
					  var images = new Array();
					  if (isDefined(document.getElementsByTagName)) {
						 images = document.getElementsByTagName('img');
						 var inputs = document.getElementsByTagName('input');
						 for (var i = 0; i < inputs.length; i++) {
							if (inputs[i].type == 'image') {
							   images[images.length] = inputs[i];
							}
						 }
					  }
					  
					  // otherwise, use document.images and document.forms collections
					  // remove if not supporting IE4, Opera 4-5
					  else {
						 images = document.images;
						 inputs = new Array();
						 for (var formIndex = 0; formIndex < document.forms.length; formIndex++) {
							for (var elementIndex = 0; elementIndex < document.forms.elements.length; elementIndex++) {
							   if (isDefined(document.forms.elements[i].src)) {
								  inputs[inputs.length] = document.forms.elements[i];
							   }
							}
						 }
					  }
					  
					  // get all images with '_off.' in src value
					  for (var i = 0; i < images.length; i++) {
						 if (images[i].src.indexOf('_off.') != -1) {
							var image = images[i];
							
							// store the off state filename in a property of the image object
							image.offImage = new Image();
							image.offImage.src = image.src;
							
							// store the on state filename in a property of the image object
							// (also preloads the on state image)
							image.onImage = new Image();
							image.onImage.imageElement = image;
							
							// add onmouseover and onmouseout event handlers once the on state image has loaded
							// Safari's onload is screwed up for off-screen images; temporary fix
							if (navigator.userAgent.toLowerCase().indexOf('safari') != - 1) {
							   image.onmouseover = function() {
								  this.src = this.onImage.src;
							   };
							   image.onmouseout = function() {
								  this.src = this.offImage.src;
							   };
							}
							else {
							   image.onImage.onload = function() {
								  this.imageElement.onmouseover = function() {
									 this.src = this.onImage.src;
								  };
								  this.imageElement.onmouseout = function() {
									 this.src = this.offImage.src;
								  };
							   };
							}
							
							// set src of on state image after defining onload event handler
							// so cached images (that load instantly in IE) will trigger onload
							image.onImage.src = image.src.replace(/_off\./, '_on.');
						 }
					  }
				   }
				   rolloverInitialized = true;
				}

				// call rolloverInit when document finishes loading
				if (isDefined(window.addEventListener)) {
				   window.addEventListener('load', rolloverInit, false);
				}
				else if (isDefined(window.attachEvent)) {
				   window.attachEvent('onload', rolloverInit);
				}				
       </script>
   <style type="text/css">
   
		a
		{
		text-decoration:none;
		color:navy;
		}
   </style>
<table style="width:99%">
	<tr>
		<td>
			<table border="0"  width="60%">
				<tr align="center" >
					<td width="5%"></td>
					<form name="portail" method="POST" action="">
						<td  >												
							<input name="portail" type="hidden" value="">					
							<img src="images/fond/connexionfr_off.png" style="cursor:pointer; width:75%" onclick="document.portail.submit();">				
						</td>
					</form>
					
					<form name="contact" method="POST" action="">
						<td>											
							<input name="contact" type="hidden" value="">					
							<img src="images/fond/contact_off.png" style="cursor:pointer; width:75%" onclick="document.contact.submit();">		
						</td>
					</form>
				   	<form id="inter" name="aide" method="POST" action="" >
						<td>	
							<input name="aide" type="hidden" value="">					
							<img src="images/fond/aidefr_off.png" style="cursor:pointer; width:75%" onclick="document.aide.submit();">						
						</td>				
					</form>
				</tr>
			</table>
		</td>
		<form name="langage" method="GET" action=""> 
			<td colspan="99%" align="right"> 									
				<b>Langue:&nbsp;				
					<img name="dp_G" style="cursor:pointer" border="0" src="images/drapeaux/gb_k.gif" alt="British" onclick=" document.location.replace('/?res=notyet&uamip=10.89.2.1&uamport=3990&challenge=05c38ba49065af8bb511e03984b69908&userurl=http://www.google.fr/&nasid=nasfjtauxerre&mac=00-16-01-AE-25-DA&lang=BR');" height="25">
					<img name="dp_F" style="cursor:pointer" border="0" src="images/drapeaux/fr_k.gif" alt="français" onclick=" document.location.replace('/?res=notyet&uamip=10.89.2.1&uamport=3990&challenge=05c38ba49065af8bb511e03984b69908&userurl=http://www.google.fr/&nasid=nasfjtauxerre&mac=00-16-01-AE-25-DA&lang=FR');" height="25">	
				</b>
			</td>	
		</form>	
	</tr>
</table>

								</b>							
						</tr>			
				</table>
				<table border="0" style="width:99%;height:90%;vertical-align:top" >
				   <tr>
					<!--/////////////////////////////////////////////////////////////////////////////////////////-->
						<td nowrap width="162" height="90%" >
							<table align="center" width="100%" height="100%">
								<tr>
									<td height="30%">
											<table border="0" bgcolor="" width="100%" cellspacing="0" cellpadding="0">
   	<tr align="center">
	<td width="" style="font-style:Arial;font-size:18px">XXXXXXXXXXXXXXXXX</td>
   	</tr>
   	<tr  align="center">
	<td width="" style="font-style:Arial;font-size:11px">XXXXXXXXXXXXXXXXXXXx</td>
   	</tr>
   	<tr  align="center">
	<td width=""  style="font-style:Arial;font-size:11px">XXXXXXXXXXXXXXXXXXXXx</td>
   	</tr>
	</table>
	
	
	
									</td>	
								</tr>
								<tr>
									<td height="40%" valign="bottom">
										<div style="vertical-align:middle">
											<img src="images/logo/log_wifi.png" align="right" style=" width:200px;height:100px;vertical-align:middle">
										</div>							
									</td>
								</tr>							
								<tr ><td height="30%"></td></tr>
							</table>						
						</td>
						<!--/////////////////////// partie centrale du bandeau //////////////////////////////////////-->						
						<td width="70%" valign="top">							
							<script language="JavaScript">

var ph="Saisir le Code etablissement ici SVP ! ";
function test()
{
jet=document.getElementById("int_acc").style;
cas=document.getElementById("coche").style;
if(document.connecter_client.id.checked==true){jet.visibility='visible'; cas.visibility='hidden';}else{jet.visibility='hidden'; cas.visibility='visible';}
}
function verif_saisie()
{
	if((document.connecter_client.code_etab.value!=ph)&&(document.connecter_client.code_etab.value!='')&&(document.connecter_client.code_etab.value!=' '))
	{document.connecter_client.action="demandeconnexion.php"; document.connecter_client.submit();}
	else 
	{
		document.connecter_client.code_etab.style.backgroundColor='red'; 
		document.connecter_client.code_etab.style.color='#FFFFFF';
		document.connecter_client.code_etab.style.fontWeight='bold';
	}
}
function ret_color() 
{
		document.connecter_client.code_etab.style.color='black';
		document.connecter_client.code_etab.style.backgroundColor='white'; 
		document.connecter_client.code_etab.style.fontWeight='normal';	
}

function coloriage() //colorie le message quand on passe dessus
{
	if (document.connecter_client.code_etab.value==ph)	
	{
		document.connecter_client.code_etab.style.color='navy';
		document.connecter_client.code_etab.style.backgroundColor='orange'; 
		document.connecter_client.code_etab.style.fontWeight='bold';		
	}
}
function charge() //onblur
{
	if (document.connecter_client.code_etab.value=='')
	{document.connecter_client.code_etab.value=ph;}
}

function decharge() //onfocus 
{
ret_color();
	if (document.connecter_client.code_etab.value==ph)
	document.connecter_client.code_etab.value='';
}
</script>


<script language="javascript">
function check(evenement)
{
		var codeDecimal  = codeTouche(evenement);
		if(codeDecimal == 13)
		{
			document.form1.submit();
		}
}

function codeTouche(evenement)
{
		for (prop in evenement)
		{
				if(prop == 'which') return(evenement.which);
		}
		return(evenement.keyCode);
}
</script>

		<table id="conteneur" width="99%" border="0" cellspacing="0" cellpadding="0" align="center">   	
	   <tr width="99%">		
								<td width="99%" align="center">
						
			<img src="images/fond/hotspot.png" style="background-color:transparent;vertical-align:bottom" vspace="0"> 
			<table border="0" width="100%" align="top" style="background-image:url('images/fond/f_hotspot.png');background-repeat:repeat-y; background-color:transparent; background-position:center">
				<tr>
						<form name="connecter_client" METHOD="POST" action="#" >
						
							<td width="99%" align="center" >
							
								<INPUT TYPE="HIDDEN" NAME="chal" VALUE="05c38ba49065af8bb511e03984b69908">
								<INPUT TYPE="HIDDEN" NAME="uamip" VALUE="10.89.2.1">
								<INPUT TYPE="HIDDEN" NAME="uamport" VALUE="3990">
								<INPUT TYPE="HIDDEN" NAME="userurl" VALUE="http://www.google.fr/">
								<INPUT TYPE="hidden" NAME="login" VALUE="login">
									<center style="width:70%">
							
										<table border="0" width="99%"  bgcolor="" align="center" style="vertical-align:middle" >
											<tbody align="center" valign="middle">										<tr>
													<td align="center">
														<input name="id_verif_code_etab" style="height:0" type="hidden" value="nasfjtauxerre">
														<input name="code_etab" type="text" size="20" value="Saisir le Code etablissement ici SVP ! " style="width: 300px" onfocus="decharge();" onblur="charge();" onmouseout="ret_color();" onmouseover="coloriage();"  >
													</td>
												</tr>
												<tr>
													<td colspan="99%">
													  	<center style="width:100%">
<script language="javascript">
function identifier_safari()
{
var v3=navigator.appVersion;

	if(v3.indexOf("Safari",0)>0)
	{return(0);}
	else {return(1);}
}

function formate()
{
inf=document.getElementById("info").style;
cont=document.getElementById("contrat").style;



	if(flag==0)
	{
		if (identifier_safari()==0)
		{
			inf.width="";
			inf.height="";
			inf.visibility="visible";
		}
		else
		{
			cont.width="100%";
			cont.height="100%";
			cont.visibility='visible';
		}

		flag=1;
	}
	else
	{
		if (flag==1)
		{
			if (identifier_safari()==0)
			{
				inf.width="0px";
				inf.height="0px";
				inf.visibility="hidden";	
			}
			else
			{
				cont.width="0px";
				cont.height="0px";
				cont.visibility='hidden';
			}
			
			flag=0;
		}
	}
}
</script>
<br>
<table align="center" width="">
	<tr>
		<td align="center" style="height: 10px">
		<a href="#" onclick="formate()"><font face="Arial" size="3" style="font-weight:bold; color:navy"> Lire les conditions d'utilisation du Wifi AreA</font></a>
		</td>
	</tr>
	<tr>
		<td>
			<div align="center" id="info">
				<table width="">
	
					<tr>
						<td width="">
							<table border="0" bgcolor="" cellpadding="0" cellspacing="0"   >
								<tr>
									<td width="" align="center">
									<iframe id="contrat" src="contrat.htm" marginwidth="0" marginheight="0" allowtransparency="true" style="background-color:transparent; background-image:url('images/fond/wifi.png'); background-repeat:no-repeat;background-position:center; border-color:transparent"></iframe>
									</td>
								</tr>

							</table>
						</td>
					</tr>
				</table>
			</div>
		</td>
	</tr>
</table>
<script language="javascript">
inf=document.getElementById("info").style;
cont=document.getElementById("contrat").style;
but=document.getElementById("desc");

	if (identifier_safari()==0)
	{
		inf.width="0px";
		inf.height="0px";
		inf.visibility="hidden";	
	}
	else
	{
		cont.width="0px";
		cont.height="0px";
		cont.visibility='hidden';
	}

var flag=0;

</script>
</center>
													</td>
												</tr>
										
												<tr>
										
													<td>
														<center>
															J'accepte ces conditions :
															
															<input name="id" type="checkbox" onClick="test();">
															<div style="font-weight:bold" id="coche"> Cochez la case pour vous connecter</div>													
																
															<div id="int_acc" style="visibility: hidden"> 
															
															
																<table >
																 	<tr>
																 		<td>
																 			<a href="#" onclick="verif_saisie();" name="login">	
																			<font face="Arial" size="3" style="font-weight:bold; color:navy">
																			
																					<b valign="middle">
																						Connectez-Vous!
																					</b> 
																			</font>															
																		</td>
																		<td width="100"></td>
																		<td>
	
																			<a href="#" onclick="verif_saisie();" name="login">
																			<img src="images/bt_connexion.gif" width="75px" style=" border:0px; " alt="BOUTON DE CONNEXION">
																			
																		</td>
																	</tr>
																</table>	
															</div>
														</center>
													</td>
												</tr>
												
											</tbody>
										</table>
									</center>
								</td>
						</form>
						
				</tr>
			</table>
			 <img src="images/fond/b_hotspot.png" style="background-color:transparent">
								</td>
									<br><br>
					
				
	   </tr>
	</table>
						
						</td>						
						<td>
						<table align="center" width="100%" height="100%">
							<tr>
								<td height="40%" valign="middle">		
								</td>
							</tr>
							<tr>
								<td height="30%">		
								</td>
							</tr>
							<tr> <td height="30%"></td></tr>							
						</table>						
						</td>					
					</tr>
				</table>
				
				<table border="0" style="width:99%;vertical-align:bottom" >
					
					<tr >					
						<td width="99%" colspan="99%" align="right" nowrap valign="bottom" style="background-image:url('images/bas/trame.png') ; bottom:0;background-position:right;;background-repeat:no-repeat" >
						
<table border="0" bgcolor="" colspan="99%" style="width:100%; vertical-align:text-bottom">
	<tr valign="bottom" >
		<td width="70%" colspan="99%" align="right" >
			<font face="Arial" size="1" color="blue">
				<i>Copyright AreA 2011 © </i>
			</font>
		</td>
	</tr>	
</table>
	
						</td>					
					</tr>
				</table>
				</body>
			</html>

Dernière modification par tggege (Le 24/07/2012, à 20:38)

Hors ligne

#2 Le 25/07/2012, à 05:20

Re : SCRIPT Autenfication Automatique Hotspot

Ce que tu cherches à faire est tout à fait possible, il faut que tu identifies la requête qui est envoyée au serveur lors de la connexion (si tu utilises firefox il y a des plugins qui peuvent t'aider à voir les requêtes envoyées au serveur). Ensuite tu peux utiliser des outils comme wget ou curl pour envoyer cette requête comme si tu t'identifiais manuellement.
En pratique je t'avoue que j'ai la flemme de lire le code de la page, essaie dans un premier temps par toi même et on t'aidera sur les points où tu bloques


GUL les mardis à Bordeaux : Giroll
Hide in your shell, scripts & astuces :  applications dans un tunnelsmart wgettrouver des pdfinstall. auto de paquetssauvegarde auto♥ awk
  ⃛ɹǝsn xnuᴉꞁ uʍop-ǝpᴉsdnGMT-4

Hors ligne

#3 Le 25/07/2012, à 18:37

Re : SCRIPT Autenfication Automatique Hotspot

J'ai effectué un wireshark quelles sont les requêtes à analyser?

edit: le fichier wireshark

Dernière modification par tggege (Le 25/07/2012, à 18:52)

Hors ligne

#4 Le 26/12/2012, à 19:01

Re : SCRIPT Autenfication Automatique Hotspot

curl -m 5 -d chal=a317130bd89502644005eafbf6ab5d63 -d uamip=10.89.2.1 -d uamport=3990 -d userurl=login -d id_verif_code_etab=nasfjtauxerre -d code_etab=auxerre89 action=login "http://www.clicknews.fr/?res=notyet&uamip=10.89.2.1&uamport=3990&challenge=a317130bd89502644005eafbf6ab5d63&userurl=http%3a%2f%2fwww.google.fr%2f&nasid=nasfjtauxerre&mac=74-E5-0B-2D-B8-B0"

la commande suivante ne fonctionne pas

Hors ligne

Haut de page ↑