本帖最后由 wyl0205 于 2021-10-27 10:09 编辑 [/pre]
通过WEB访问海康威视的录像机,现在通过发送的方式模拟操作自动登录的,还有其他方法自动登录吗?1号机的测试账号密码是正确的,2号机不能用。[pre]#NoTrayIcon
#RequireAdmin
#pre_usex64=n
#include <IE.au3>
Global $Url1 = "http://192.168.62.227/doc/page/login.asp"
Global $Url2 = "http://192.168.62.228 /doc/page/login.asp"
Global $oObject = ObjCreate("Shell.Explorer.2")
Global $login_gui = GUICreate("监控查看工具", @DesktopWidth, 700)
Global $login_GUIActiveX = GUICtrlCreateObj($oObject, 10, 40, @DesktopWidth - 20, 600)
Global $Button1 = GUICtrlCreateButton("1号机", 10, 5, 100, 25)
Global $Button2 = GUICtrlCreateButton("2号机", 150, 5, 100, 25)
Global $Button3 = GUICtrlCreateButton("退出", 290, 5, 100, 25)
$EventObject2 = ObjEvent($oObject, "IEEvent_", "DWebBrowserEvents2") ;注册获取IE对象产生的事件,有事件则调用通过的相关函数
GUISetState()
$oObject.Navigate2($Url1)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case -3
$EventObject2 = 0
Exit
Case $Button3
$EventObject2 = 0
Exit
Case $Button1
$UserName = "test"
$PassWord = "a1234567"
$oObject.Navigate2($Url1)
Sleep(1000)
Send($UserName)
Send("{ENTER}")
Send($PassWord)
Send("{ENTER}")
Case $Button2
$UserName = "lls"
$PassWord = "1234567"
$oObject.Navigate2($Url2)
Sleep(1000)
Send($UserName)
Send("{ENTER}")
Send($PassWord)
Send("{ENTER}")
EndSwitch
WEnd
下面是网页的源代码!问题解决后,测试账号会删除!
<!doctype html>
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset =utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" >
<meta http-equiv="Pragma" content="no-cache" />
<meta http - equiv="Cache-Control" content="no-cache, must-revalidate" />
<meta http-equiv="Expires" content="0" />
<script>
document.write("<link type='text/css' href='../ui/css/ui.css?version=" + new Date().getTime() + "' rel='stylesheet' />");
</script>
</head >
<body ng-keypress="docPress($event)" ng-controller="loginController" ng-cloak class="login-body ng-cloak">
<div class="login" id="login">
<div class ="top">
<div class="logo"></div>
<div class="language">
<div class="language-show" ng-click="showLanguageList($event)"><span class= "current-language" id="current_language"></span></div>
<div class="language-list" id="language_list" ng-click="changeLanguage($event)"></div>
< /div>
</div>
<table cellspacing="0" cellpadding="0" border="0" class="middle">
<tr>
<td class="login-l"> </td>
<td class="login-m">
<div class="login-part">
<div class="line"></div>
<div class="login-error">
<div class="inputValidTip" ng -show="szErrorTip!=''"><i class='error'></i><label>{{szErrorTip}}</label></div>
</div>
<div class="login-用户">
<input type="text" class="login-input"id="username" ng-model="username" maxlength="32" autocomplete="off" placeholder="{{oLan.username}}" />
pwd-link" ng-show="oCap.bSptGuidImport || oCap.bSptQAReset" ng-bind="oLan.forgetPwd" ng-click="forgetPwd()"></span>
<button type="button" class="btn btn-primary login-btn" ng-click=" login()"><label ng-bind="oLan.login"></label></button>
</div>
<!--<div class="login-item anonymous" ng-show="anonymous" >
<span ng-bind="oLan.anonymous" ng-click="login('anonymous')"></span>
</div>-->
<div id="active" class="msg-content-wrap">
<div class="msg-content">
<div class="password">
<span class="desc"><label ng-bind=" oLan.username"></label></span>
<span><label ng-bind ="activeUsername"></label></span>
</div>
<div 密码 lan="oLan" o-password= "oActivePwd" user-name="activeUsername" spec-char="true" ps-length="16" ps-强度="true" hide-default="true"></div>
</div>
</div >
<div id="main_plugin" class="no-window"></div>
</body>
<script id="seajsnode" src="../script/lib/seajs/seajs/sea.min.js"></script>
<script>
document.write("<script src='../script/lib/seajs/config/sea-config.js?version=" + new Date().getTime() + "' ></scr" + "ipt >");
</脚本>
</html>
看看也没什么更好的解决办法了,先这样吧
|