Hallo ,
ich versuche per GetObject ein Routerlogin hinzukriegen, damit es auch im hintergrund ablaufen kann..
Nunja, leider ist mein Routerlogin per CGI Script und irgendwie packt ers nicht das Login daher ausführen. Gibts ne alternative wie ichs doch noch hinbekomme?
Das Script:
Spoiler anzeigen
#include <IE.au3>
$oIE=ObjCreate("InternetExplorer.Application.1")
sleep(1000)
$oIE.Visible=1
$oIE.RegisterAsDropTarget = 1
$oIE.RegisterAsBrowser = 1
$oIE.Navigate( "http://192.168.0.1" )
sleep(3000)
$oForm = _IEFormGetObjByName ($oIE, "postform")
$oForm1 = _IEFormGetObjByName ($oIE, "myform")
$oQuery = _IEFormElementGetObjByName ($oForm1, "password")
_IEFormElementSetValue ($oQuery, "mypasswordhere")
_IEFormSubmit ($oForm)
Der HTML-Code:
Spoiler anzeigen
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US" xml:lang="en-US">
<!--@TEMPLATE:build/cooker/webgen/cooker_nonav_template.html@-->
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link rel="stylesheet" rev="stylesheet" href="css_router_table.css" type="text/css" />
<!--@UNIQUE:head@-->
<title>D-Link Gaming Router : Anmeldung</title>
<script language="javascript" type="text/javascript" src="uigenpro.js"></script>
<script language="javascript" type="text/javascript" src="md5.js"></script>
<script language="javascript" type="text/javascript" src="pre_login.js"></script>
<script language="javascript" type="text/javascript">
//<![CDATA[
function onPageLoad()
{
try {document.myform.Password.focus();} catch(e){}
}
function loginReturnValue(xml)
{
var x = getDataFromXML (xml);
if (x == "TIMEOUT") {
alert("Sitzungszeitüberschreitung, bitte versuchen Sie es erneut.");
location.replace ('/');
} else if (x == "ERROR") {
alert("Kennwort ungültig, bitte versuchen Sie es erneut.");
location.replace ('/');
} else {
location.replace (x);
}
}
function sendLogin()
{
// If the 'data' variable is not defined then there was probably some
// problem with loading the page. The best guess is that the user's network
// connection has gone down. Inform the user and try to reload the page.
if (typeof(data) == "undefined") {
alert ("Die Netzwerkverbindung ist offenbar ausgefallen. Klicken Sie auf 'Ok' und versuchen Sie es erneut.");
location.reload(true);
return;
}
var a = new Array;
// Compute the login hash.
var shex = byteArrayToHexString(convertFromBase64(data),0,4);
var goodp = document.myform.Password.value.substr(0,16);
document.myform.Password.value = "";// Make sure password never gets sent as clear text
for (var i = goodp.length; i < 16; i++) {
goodp = goodp.concat('0');
}
var str = shex + goodp;
// Pad the string to 64 bytes.
for (var i = str.length; i < 63; i++) {
str = str.concat('0');
}
str = str.concat((document.myform.username.value == 'user') ? 'U' : '0');
var hash = hex_md5(str);
var saltHash = shex.concat(hash);
a = convertHexString(saltHash, 20, 20);
// Send the new configuration to the server
sendDataToServer ("post_login.cgi?data=" + convertToBase64(a),loginReturnValue)
}
//]]>
</script>
<!--@ENDUNIQUE@-->
</head>
<body onload="onPageLoad();">
<!--@UNIQUE:bodystart@-->
<form name="postform" method="get" action="/post_login.cgi">
<input type="hidden" name="data" />
</form>
<!--@ENDUNIQUE@-->
<div id="outside">
<table border="0" cellpadding="0" cellspacing="0" id="table_shell" summary="">
<tr>
<td id="masthead_leftedge"> </td>
<td id="masthead_container">
<div id="masthead">
<!-- === BEGIN MASTHEAD === -->
<!-- XHTML 1.0-compliant code to deploy flash movie -->
<!-- If you are seeing a textarea-like box, you have a corrupt Flash Player ActiveX control. Try installing the latest and greatest -->
<!-- The VBScript will only run in IE for Windows. Other browsers will ignore the mime-type text/vbscript -->
<!-- Note that the script tags are XHTML-compliant. -->
<script language="vbscript" type="text/vbscript">
//<![CDATA[
//check for Flash Player X
//script for IE on Win32 systems
on error resume next
//set a variable to hold the detection result
Dim checkForFlash6
//assign a boolean value
checkForFlash6 = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.6")))
//note here that if the object is demoted to ShockwaveFlash.ShockwaveFlash.5 or less, checkForFlash6 will still return true
//this is ok as Flash Player 6 can run previous version content.
//change 6 to 7 and you will see the alternate content (if 7 is not installed).
//check that Shockwave Flash Plugin 6 is available
//if false display alternate content, if true show object tag
//quotes need to be doubled in vbscript in order for IE to render them in markup.
//codebase attribute removed from object tag; make sure Flash file has same base URI as current document.
if checkForFlash6 = true then
document.write("<object data=""swf_masthead.swf"" type=""application/x-shockwave-flash"" width=""836"" height=""120""><param name=""movie"" value=""swf_masthead.swf"" /><param name=""menu"" value=""false"" /><param name=""quality"" value=""high"" /><param name=""bgcolor"" value=""#ededed"" /><" & Chr(47) & "object>")
else
document.write("<img src=""img_masthead.jpg"" width=""836"" height=""120"" alt=""Masthead"" />")
end if
//]]>
</script>
<script language="javascript" type="text/javascript">
//<![CDATA[
//check for Flash Player X
//check the navigator.plugins array exists, IE for Windows will fail on this.
if(navigator.plugins.length)
{
//some variables
//a counter
var i;
//codebase attribute removed from object tag; make sure Flash file has same base URI as current document.
var xhtmlContent = "<object data=\"swf_masthead.swf\" type=\"application/x-shockwave-flash\" width=\"836\" height=\"120\"><param name=\"movie\" value=\"swf_masthead.swf\" /><param name=\"menu\" value=\"false\" /><param name=\"quality\" value=\"high\" /><param name=\"bgcolor\" value=\"#ededed\" /><\/object>";
var alternateContent = "<img src=\"img_masthead.jpg\" width=\"836\" height=\"120\" alt=\"Masthead\" />";
//loop through all the plugins installed
for (i=0; i < navigator.plugins.length; i++)
{
//put the plugin string in a variable
var pluginIdent = navigator.plugins[i].description.split(" ");
//The Flash Player identification string is ([] = the array index) [0]Shockwave [1]Flash [2]6.0 [3]r21
//if less than Flash Player 6 is detected, run this code.
if(pluginIdent[0] == "Shockwave" && pluginIdent[1] == "Flash")
{
//set a toggle to show that some sort of Flash Player (of versions 1-5) was found
var isSwfEnabled = true;
//an array of the Flash version number (major.minor)
var versionArray = pluginIdent[2].split(".");
if(versionArray[0] < 6)
{
//show alternate content
document.write(alternateContent);
}
else
{
//Flash Player 6 or greater has been found, roll out the <object> tag.
document.write(xhtmlContent);
}
//need to break this loop as some browsers may have two versions installed
//eg my Firebird release has r65 and r79 installed!
break;
}//end if pluginIdent
}//end for
//check if no Shockwave Flash was detected in the array (no Flash Player installed)
if(!isSwfEnabled)
{
document.write(alternateContent);
}//end if
}
//]]>
</script>
<noscript>
<img src="img_masthead.jpg" width="836" height="120" alt="Masthead" />
</noscript>
<!-- === END MASTHEAD === -->
</div>
</td>
<td id="masthead_rightedge"> </td>
</tr>
<tr>
<td id="topnav_leftedge"> </td>
<td id="topnav_container">
<div id="topnav" class="centered">
<!-- === BEGIN TOPNAV === -->
<table border="0" cellpadding="0" cellspacing="0" summary="">
<tr>
<td id="topnav_nonav"><img src="img_spacer.gif" width="500" height="30" alt="" /></td>
</tr>
</table>
<!-- === END TOPNAV === -->
</div>
</td>
<td id="topnav_rightedge"> </td>
</tr>
<tr>
<td id="content_leftedge"></td>
<td id="content_container">
<table border="0" cellpadding="0" cellspacing="0" summary="">
<tr>
<td id="maincontent_container">
<div id="maincontent_1col">
<!-- === BEGIN MAINCONTENT === -->
<!--@UNIQUE:maincontent@-->
<div id="box_header">
<h1>Anmeldung</h1>
<noscript>
<p class="warning">WARNUNG: JavaScript steht für diesen Browser nicht zur Verfügung!</p>
</noscript>
<p>Am Router anmelden:</p>
<div class="centered">
<form name="myform" action="/dummy" onsubmit="sendLogin(); return false;">
<table border="0" cellpadding="0" cellspacing="0" class="formarea" id="loginpage" summary="">
<tr>
<td class="form_label">Benutzername :</td>
<td class="form_data">
<select name="username">
<option value="admin">Administrator</option>
<option value="user">Benutzer</option>
</select>
</td>
</tr>
<tr>
<td class="form_label">Kennwort :</td>
<td class="form_data">
<input type="password" name="Password" value="" tabindex="100" />
<input class="button_submit_padleft" type="button" name="Login" value="Anmelden" onclick="sendLogin();" />
</td>
</tr>
</table>
</form>
</div>
</div>
<!--@ENDUNIQUE@-->
<!-- === END MAINCONTENT === -->
</div>
<!--@OPTIONAL:the_lpj_output.I18N_ENABLED and this_file ~= 'Reboot.html' and this_file ~= 'forbidden.html' and this_file ~= 'restore_helper.html' and this_file ~= 'ugood.html' and this_file ~= 'ubad.html'@-->
<!-- Read the current language into the 'i18n_language' variable -->
<script language="javascript" type="text/javascript" src="i18n_get_lang.cgi"></script>
<br /><br />
<center>
<form name="langform" action="/dummy" onSubmit="doSave(); return false;">
<select name="lang" onchange="i18n_change_language(document.langform.lang)">
<script language="javascript" type="text/javascript">
//<![CDATA[
document.write ('<option value="EN"'+(i18n_language=="EN"?' selected':'')+'>English<\/option>');
document.write ('<option value="DE"'+(i18n_language=="DE"?' selected':'')+'>Deutsch<\/option>');
//]]>
</script>
</select>
</form>
</center>
<!--@ENDOPTIONAL@-->
</td>
</tr>
</table>
</td>
<td id="content_rightedge"></td>
</tr>
<tr>
<td id="footer_leftedge"></td>
<td id="footer_container">
<table border="0" cellpadding="0" cellspacing="0" summary="">
<tr>
<td id="footermaincontent_container">
<div id="footer">
<!-- === BEGIN FOOTER === -->
<div>Copyright © 2004-2006 D-Link Systems, Inc.</div>
<!-- === END FOOTER === -->
</div>
</td>
</tr>
</table>
</td>
<td id="footer_rightedge"></td>
</tr>
<tr>
<td id="bottom_leftedge"> </td>
<td id="bottom_container">
<div id="bottom_nonav"> </div>
</td>
<td id="bottom_rightedge"> </td>
</tr>
</table>
</div>
</body>
<!--@ENDTEMPLATE@-->
</html>
Alles anzeigen
Fehlercode bei der Anmeldung is dann: 503 Service Unavailable
Bin für jeden Tip dankbar
rouge