Ich habe noch ein arbeitsloses IP Switch herum liegen, das ich gerne mal über IPS steuerbar machen möchte. Das Gerät hat ein Webinterface, bei dem man sich zunächst anmelden muss. Nach der Anmeldung (wenn auch nur mit einem leeren Passwort) merkt sich das Gerät den User nicht anhand einer Session, sondern mit SID’s hinter jedem Link. Wenn ich eine Zeit lang keine Aktion gemacht habe, dann lande ich wieder auf der login Seite, muss mich neu anmelden, und es werden neue SID’s generiert.
hier mal der Seitenquelltext des Interfaces, wenn ich schon eingeloggt bin:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="refresh" content="10;url=./index.htm?sid=0034600130">
<title>Status</title>
</head>
<script language=JavaScript>
function onClose()
{
var top=self.screenTop;
if (top>9000) {
window.open('logout.htm?sid=0034600130');
self.blur();
}
}
</script>
<body onLoad="history.go(+1)" onUnload="onClose()" bgcolor="#e4ebf1" leftmargin="0" topmargin="0">
<form action="/status_ctrl" method="post" name="status">
<input name=sessionID type=hidden value=0034600130>
<input name=token type=hidden value=3>
<table width="101%" height="556" border="0" cellpadding="0" cellspacing="0">
<tr bgcolor="#707AAC">
<td width="243" height="80"> </td>
<td width="10" height="80"> </td>
<td height="80" colspan="2" align="center"><font color="#FFFFFF" face="Arial"><strong>IP_POWER Web Configuration - POWER1</strong></font></td>
</tr>
<tr>
<td width="243" height="225" rowspan="4" align="left" valign="top" bgcolor="#8888AD"><table width="100%" height="455" border="0" cellpadding="0" cellspacing="0">
<tr valign="top">
<td height="15" colspan="2" align="center"><font color="#FFFFFF" face="Arial"> </font></td>
</tr>
<tr valign="top">
<td width="80" height="75" rowspan="3" align="center"><font color="#FFFFFF" face="Arial"><strong>Server</strong></font></td>
<td width="160" height="25"><font face="Arial"><a href="password.htm?sid=0034600130">Change Password </a></font></td>
</tr>
<tr valign="top">
<td width="160" height="25"><font face="Arial"><a href="network.htm?sid=0034600130">Network</a></font></td>
</tr>
<tr valign="top">
<td width="160" height="25"><font face="Arial"><a href="logout.htm?sid=0034600130">Logout</a></font></td>
</tr>
<tr valign="top">
<td width="80" height="75" rowspan="3" align="center"><font color="#FFFFFF" face="Arial"><strong>Switch</strong></font></td>
<td width="160" height="25"><font face="Arial">Status</font></td>
</tr>
<tr valign="top">
<td width="160" height="25"><font face="Arial"><a href="outlet_name.htm?sid=0034600130">Outlet Name</a></font></td>
</tr>
<tr valign="top">
<td width="160" height="25"><font face="Arial"><a href="upgrade.htm?sid=0034600130">Firmware Upgrade</a></font></td>
</tr>
<tr valign="top">
<td width="80" height="125"> </td>
<td width="160" height="125"><font face="Arial"><a href="about.htm?sid=0034600130">About</a></font></td>
</tr>
</table></td>
<td width="10" rowspan="4"> </td>
<td height="40" colspan="2" align="center" valign="middle"><font face="Arial"><strong>Status</strong></font></td>
</tr>
<tr>
<td height="186" align="center" valign="middle"><table width="94%" height="207" border="1" cellpadding="0" cellspacing="0">
<tr>
<td><div align="center"><font face="Arial">1</font></div></td>
<td><div align="center"><font face="Arial">2</font></div></td>
<td><div align="center"><font face="Arial">3</font></div></td>
<td><div align="center"><font face="Arial">4</font></div></td>
<td><div align="center"><font face="Arial">5</font></div></td>
<td><div align="center"><font face="Arial">6</font></div></td>
<td><div align="center"><font face="Arial">7</font></div></td>
<td><div align="center"><font face="Arial">8</font></div></td>
</tr>
<tr>
<td width="85"><font face="Arial"><input type="image" src=1-2.gif?sid=0034600130 name="outimg1" width="85" height="87" border="0"></font></td>
<td width="85"><font face="Arial"><input type="image" src=1-2.gif?sid=0034600130 name="outimg2" width="85" height="87" border="0"></font></td>
<td width="85"><font face="Arial"><input type="image" src=1_red.gif?sid=0034600130 name="outimg3" width="85" height="87" border="0"></font></td>
<td width="85"><font face="Arial"><input type="image" src=1-2.gif?sid=0034600130 name="outimg4" width="85" height="87" border="0"></font></td>
<td width="85"><font face="Arial"><input type="image" src=1_red.gif?sid=0034600130 name="outimg5" width="85" height="87" border="0"></font></td>
<td width="85"><font face="Arial"><input type="image" src=1_red.gif?sid=0034600130 name="outimg6" width="85" height="87" border="0"></font></td>
<td width="85"><font face="Arial"><input type="image" src=1_red.gif?sid=0034600130 name="outimg7" width="85" height="87" border="0"></font></td>
<td width="138"><font face="Arial"><input type="image" src=1_red.gif?sid=0034600130 name="outimg8" width="85" height="87" border="0"></font></td>
</tr>
<tr>
<td><div align="center"><font face="Arial">Outlet1 </font></div></td>
<td><div align="center"><font face="Arial">Outlet2 </font></div></td>
<td><div align="center"><font face="Arial">Outlet3 </font></div></td>
<td><div align="center"><font face="Arial">Outlet4 </font></div></td>
<td><div align="center"><font face="Arial">Outlet5 </font></div></td>
<td><div align="center"><font face="Arial">Outlet6 </font></div></td>
<td><div align="center"><font face="Arial">Outlet7 </font></div></td>
<td><div align="center"><font face="Arial">Outlet8 </font></div></td>
</tr>
</table></td>
<td width="18"> </td>
</tr>
<tr>
<td height="70" align="center" valign="middle"><font face="Arial">
</font>
<table width="79%" border="0" cellspacing="0" cellpadding="0">
<tr align="center">
<td height="35" colspan="5"><font face="Arial">Click icon to turn ON/OFF</font>
<p></p>
</td>
</tr>
<tr>
<td width="26%"><div align="right"><font face="Arial">Volt:</font></div></td>
<td width="3%"> </td>
<td width="34%"><font face="Arial">237V</font></td>
<td width="5%"> </td>
<td width="32%"><font face="Arial">
<input name="AllOn" type="submit" value="All On">
</font></td>
</tr>
<tr>
<td><div align="right"><font face="Arial">Current:</font></div></td>
<td> </td>
<td><font face="Arial">00.0A</font></td>
<td> </td>
<td> </td>
</tr>
<tr>
<td><div align="right"><font face="Arial">Temperature:</font></div></td>
<td> </td>
<td><font face="Arial">25.7 °C / 078 °F</font></td>
<td> </td>
<td><font face="Arial">
<input name="AllOff" type="submit" value="All Off">
</font></td>
</tr>
</table>
<font face="Arial"> </font></td>
<td rowspan="2"> </td>
</tr>
<tr>
<td height="160" align="center" valign="middle"> </td>
</tr>
<tr>
<td width="243" height="20" bgcolor="#8888AD"> </td>
<td width="10"> </td>
<td> </td>
<td> </td>
</tr>
</table>
</form>
</body>
</html>
Wie kann ich hier ansetzen es ins IPS einzubauen? Muss ich vor jeder Aktion den Webinhalt parsen, erkennen, ob ich „noch“ eingeloggt bin oder neue Login Anfrage zwischensenden muss, die SID in eine Variable speichern und sie bei jeder zukünftigen Aktion mitsenden?
Oder gibt es einen schöneren Weg?
Sauberer wäre es vermutlich nach jeder Aktion ein Logout zu senden und jedes mal neu einloggen…
Oder gibt es da was einfacheres?