#1 23.05.07 14:44
[?] URL с подстановкой значений логина и пароля...
ситуация такая:
есть ip-камера, для неё есть встроенный интерфейс (как я понял видео оно вещает в сеть и без интерфейса, но доступ к потоку всёравно не дает)
чтобы войти в веб-интерфейс надо залогинится, страница логина простая (два поля f_LOGIN_NAME и f_LOGIN_PSWD). Недостаток софта который поставляется - нет функции отображения нескольких камер в одном окне. Хочу написать прогу такого типа, но выдернуть поток видео не получается...
может кто подскажет как проще можно напрямую выдернуть поток видео в обход логина и пароля, ну или накрайняк прямой URL на веб-интерфейс.....
:)
Offline
#3 24.05.07 11:24
Re: [?] URL с подстановкой значений логина и пароля...
видеопоток передается через компонент activeX
шифрование я отрубил
код страницы веб-интерфейса вот:
Код::
<html>
<head>
<META HTTP-EQUIV=Content-Type CONTENT="text/html; charset=iso-8859-1">
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Expires" CONTENT="-1">
<TITLE>DCS-950G</TITLE>
<style type="text/css">
<!--
body { font-size:10pt;line-hight:1.2em}
td { font-size:10pt;line-hight:1.2em}
font { font-size:10pt;line-hight:1.2em}
-->
</style>
<script language="JavaScript">
<!--
function Audio_on()
{
status=document.CSViewer1.AudioStart();
if (status==0)
{
alert("Play audio fail")
return 0;
}
}
function Audio_off()
{
document.CSViewer1.AudioStop();
}
function Save_Video(save_path)
{
if (p_Audio.check() == 1)
{
p_Audio.audio_on();
}
document.CSViewer1.SetFilePath(save_path);
document.CSViewer1.StartVideoRecord();
}
function SelectPath()
{
document.CSViewer1.SetAVIPath();
}
function AVIPath()
{
str = document.CSViewer1.GetAVIPath();
I4.document.form.file_path.value = str;
}
function Stop_save()
{
document.CSViewer1.StopVideoRecord();
}
function start(ddns,pppoe,control,stream)
{
//resizeBy(-1,-1);
t = document.referrer;
ip = document.domain;
method = "web/login.asp";
if( method == "web/login.asp")
{
if (t.indexOf("/web/") == -1)
{
location.replace("no_account_error.asp");
return;
}
}
document.CSViewer1.SetBasePortNumber(control);
document.CSViewer1.SetStreamPortNumber(stream);
document.CSViewer1.SetRemoteIP(ip);
/*
if( ddns.toLowerCase() == ip.toLowerCase())
{
//when pppoe enable:
if (pppoe_enable == 1)
{
document.CSViewer1.SetRemoteIP(pppoe);
}
else
{
static_ip = "192.168.0.20"
document.CSViewer1.SetRemoteIP(static_ip);
}
}
else
{
document.CSViewer1.SetRemoteIP(ip);
}
*/
cookievalue=GetCookieValue();
cookievalue=cookievalue.substring(0,CookieValue.length-1);
document.CSViewer1.SetClientCookie(cookievalue);
document.CSViewer1.ViewerOpen();
// document.CSViewer1.ZoomInStop();
}
function leave()
{
//resizeBy(+1,+1);
method = "web/login.asp";
if( method == "web/login.asp")
{
if (t.indexOf("/web/") != -1)
{
document.CSViewer1.ViewerClose();
}
}
else
{
document.CSViewer1.ViewerClose();
}
}
function snapshot()
{
document.CSViewer1.SnapVideo();
}
function runwizard()
{
var szHelp="/web/advanced/description.asp"
window.open(szHelp, 'HELP', 'width=480,height=375,location=0,scrollbars=yes,resizable=yes');
}
function GetCookieValue()
{
CookieValue=document.cookie;
startof=CookieValue.indexOf("=",0);
endof=CookieValue.length;
CookieValue=CookieValue.substring(startof+1,endof) + "f";
return CookieValue;
}
-->
</script>
</head>
<body BGCOLOR="c6cbcf" onload="javascript:start('','','5000','5001');" onUnload = "javascript:leave();" leftmargin=0 topmargin=0>
<p><img border="0" src="images/Logo.jpg"></p>
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="82%" id="AutoNumber1" height="315">
<tr>
<td width="16%" height="68" valign="top">
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber3" height="42">
<tr>
<td width="100%" height="41" valign="bottom">
<p align="center"><img border="0" src="images/DCS950.jpg"></td>
</tr>
</table>
</td>
<td width="3%" height="315" rowspan="11" valign="top">
<img border="0" src="images/Centerma.jpg" width="25" height="580"></td>
<td width="81%" height="315" rowspan="11" valign="top" align="center">
<script language="javascript">
<!--
ip = document.domain;
port = 80
document.write("<object classid='clsid:EFFDEEEC-F9E1-4461-91D2-DAEB8CC595F1' id='CSViewer1' codebase='http://" + ip +":"+ port+ "/CSViewer.cab#version=1,81,401,2005' width='640' height='480'>");
document.write("</object>");
-->
</script>
<SCRIPT LANGUAGE=javascript FOR=CSViewer1 EVENT=AVIPath>
<!--
AVIPath()
//-->
</SCRIPT>
</td>
</tr>
<tr>
<td width="16%" height="16" valign="top"><hr width="92%"></td>
</tr>
<tr>
<td width="16%" height="5" >
<center>
<script>
document.write ("<a href=javascript:runwizard();><img border='0' src='images/wizard.jpg'></a>");
</script>
</center>
</td>
<tr>
<td width="16%" height="5" >
<script>
document.write ("<a href=/goform/adv_image?f_CookieValue=" + GetCookieValue() + "><img border='0' src='images/setup.jpg'></a>");
</script>
</td>
</tr>
</tr>
<tr>
<td width="16%" height="3">
<p align="center">
<AD- me name="p_Audio" width="109" height="53" src="advanced/adv_audio_on.asp" border="0" frameborder="0" scrolling="no" marginwidth="1" marginheight="1">
<AD- ame>
</td>
</tr>
<tr>
<td width="16%" height="11" valign="top">
<p align="center">
<AD- me name="I12" width="109" height="120" src="advanced/adv_upside_down.asp" border="0" frameborder="0" scrolling="no" marginwidth="1" marginheight="1">
<AD- ame>
</td>
</tr>
<tr>
<td width="16%" height="57">
<p align="center">
<a href="javascript:snapshot()">
<img border="0" src="images/snap_shot.jpg"></a>
<center>
<script>
document.write ("<a href=/goform/formLogout?f_CookieValue=" + GetCookieValue() + "><img border='0' src='images/logout.jpg'></a>");
</script>
</center>
</td>
</tr>
<tr>
<td width="16%" height="7" valign="top">
<p align="center"></td>
</tr>
<tr>
<td width="16%" height="15" valign="top">
<p align="center">
<AD- me name="I11" width="117" height="30" src="advanced/adv_night_shot.asp" border="0" frameborder="0" scrolling="no" marginwidth="1" marginheight="1">
<AD- ame>
</td>
</tr>
<tr>
<td width="16%" height="51" valign="top">
<p align="center">
<AD- me name="I10" width="120" height="41" src="advanced/adv_wiscolor.asp" border="0" frameborder="0" scrolling="no" marginwidth="1" marginheight="1">
<AD- ame>
</td>
</tr>
<tr>
<td width="16%" height="82" valign="top">
<p align="center">
<iframe name="I4" width="121" height="116" src="advanced/set_video_path.asp" border="0" frameborder="0" scrolling="no" marginwidth="1" marginheight="1">
</p>
</iframe>
</td>
</tr>
<tr>
<td width="16%" height="57" valign="top">
</td>
</tr>
</table>
<form method="POST" name="form1">
</form>
</body>
</html>код страницы авторизации
Код::
<html>
<head>
<META content=text/html;charset=iso-8859-1 http-equiv=content-type>
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Expires" CONTENT="-1">
<TITLE>DCS-950G</TITLE>
<script language>
<!--
var init_flag = 0;
function start_check()
{
init_flag = 1;
document.all.id2.style.visibility = 'hidden'
document.all.divid.style.visibility = 'visible'
document.form.f_LOGIN_NAME.focus();
}
function setdata(form)
{
//resizeBy(-1,-1);
parse_form();
timeout =unescape(Config.timeout)
ip = location.host;
url = "http://"+ ip +"/web/login.asp";
if (timeout == 1)
{
opener.location.href=url;
window.close();
}
}
//define data
function Config(timeout)
{
this.timeout = timeout;
}
function parse_form()
{ //get URL's value
pairs = getAnsString(document.location.href).split("&");
for (pair in pairs)
{
local = pairs[pair].split("=");
Config[local[0]] = local[1];
}
}
function getAnsString(str)
{ //get value
var Strn,NumStart,NumLong;
NumStart = str.lastIndexOf("?") + 1;
NumLong = str.length;
Strn = str.substring(NumStart,NumLong);
return Strn ;
}
function authentication()
{
//set Authentication
var num=form.f_auth0.length
for (i=0;i<=num-1;i++)
{
if (form.f_auth0[i].checked)
{
form.f_auth.value=form.f_auth0[i].value
}
}
}
function check()
{
if ( init_flag ==1)
{
pwd = document.form.f_LOGIN_PASSWD.value;
name = document.form.f_LOGIN_NAME.value;
document.CSViewer1.SetID(name);
if (pwd !="")
{
document.CSViewer1.SetPwd(pwd);
}
document.login_form.f_LOGIN.value=document.CSViewer1.encode();
random_cookie();
document.login_form.submit();
}
}
function random_cookie()
{
Random_value=Math.floor(Math.random()*1000000000000000);
document.cookie="AGID" + "=" + Random_value
CookieValue=document.cookie
start=CookieValue.indexOf("=",0)
endof=CookieValue.length
CookieValue=CookieValue.substring(start+1,endof)
if (CookieValue.length!=15)
{
random_cookie();
}
else
{
document.login_form.f_CookieValue.value=CookieValue;//get cookie
}
}
function GetCookieValue()
{
CookieValue=document.cookie
start=CookieValue.indexOf("=",0)
endof=CookieValue.length
CookieValue=CookieValue.substring(start+1,endof)
if (CookieValue.length!=15)
{
random_cookie();
}
else
{
return CookieValue;
}
}
function leave()
{
//resizeBy(+1,+1);
}
-->
</script>
</head>
<body onload ="start_check(),setdata(this.form);" onUnload ="leave();">
<P> </P>
<P> </P>
<div id=id2 style="align=center ;visibility:visible" >
<font face="Arial" size="5"> <p align="center">Connecting.....</font>
</div>
<!-- <div align="center"> -->
<div id=divid style="align=center width:400px;height:300px; ;visibility: hidden" >
<center>
<table border="1" cellspacing="0" width="371" id="AutoNumber1" height="265" style="border-collapse: collapse" bordercolor="#2945DE" cellpadding="0">
<tr>
<td width="409" height="260">
<form method="POST" action="/goform/formLogin" name="form">
<p align="center">
<b><font face="Arial" size="3">
<img border="0" src="images/banner.jpg" width="407" height="77"></font></b></p>
<div align="center">
<center>
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="73%" id="AutoNumber2" height="72">
<tr>
<td width="26%" height="35">
<font face="Arial" size="2">Camera</font></td>
<td width="53%" height="35"> </td>
</tr>
<tr>
<td width="26%" height="35">
<font face="Arial" size="2">
User Name:</font></td>
<td width="53%" height="35"><font color="#D9D9D9"><input type="text" name="f_LOGIN_NAME" size="18" maxlength="16"></font></td>
</tr>
<tr>
<td width="26%" height="36">
<font face="Arial" size="2">Password:</font></td>
<td width="53%" height="36"><font color="#D9D9D9"><input type="password" name="f_LOGIN_PASSWD" size="18" maxlength="16"></font></td>
</tr>
</table>
</center>
</div>
<p align="left"> <font color="#D9D9D9">
</font><font color="#D9D9D9">
<input type="button" value="Apply" name="B5" onclick="check();"> <input type="reset" value="Cancel" name="B2"></font></p>
</form>
</td>
</tr>
</table>
</center>
</div>
<FORM method=post action=/goform/formLogin target=_top name=login_form>
<input type="hidden" name="f_CookieValue" size="23">
<INPUT type="hidden" name=f_LOGIN size="34" >
</form>
<script language="javascript">
<!--
ip = document.domain;
port = 80
document.write("<object classid='clsid:EFFDEEEC-F9E1-4461-91D2-DAEB8CC595F1' id='CSViewer1' codebase='http://" + ip +":"+port+ "/CSViewer.cab#version=1,81,401,2005' width='1' height='1'>");
document.write("</object>");
-->
</script>
</body>
</html>Исправлено Храмовник (24.05.07 11:25)
Offline
#4 24.05.07 11:26
Re: [?] URL с подстановкой значений логина и пароля...
вчера пробовал через ActiveX напрямую передать поток... не получилось остановить цикл... т.е. программа постоянно передавала компоненту данные и обновлялась. в итоге: зависла среда разработки, и отключилась камера от большого потока запросов :)))
Offline
#5 24.05.07 12:27
Re: [?] URL с подстановкой значений логина и пароля...
взято с http://www.dlink.by/phorum/viewtopic.ph … 3a23ad56e3
Код::
<HTML>
<HEAD>
<TITLE>ViewCams</TITLE>
<META http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<META http-equiv="Pragma" content="no-cache">
<META http-equiv="Expires" content="-1">
<script language="JavaScript">
function start()
{
ShowInner();
ip='192.168.0.20'
ID='ACC';
Pwd='PWD';
control='5000';
stream='5001';
document.CSViewer1.SetID(ID);
document.CSViewer1.SetPwd(Pwd);
document.CSViewer1.encode();
document.CSViewer1.SetBasePortNumber(control);
document.CSViewer1.SetStreamPortNumber(stream);
document.CSViewer1.SetRemoteIP(ip);
str = '1.69.0407.2006(1.06a)';
document.CSViewer1.SetFirmwareVer(str);
cookievalue=GetCookieValue();
cookievalue=cookievalue.substring(0,CookieValue.length-1);
document.CSViewer1.SetClientCookie(cookievalue);
document.CSViewer1.SetModelID('1100')
document.CSViewer1.Width=640; *
document.CSViewer1.Height=480; *
document.CSViewer1.ViewerOpen();
document.CSViewer1.ZoomIn(1);
}
function leave()
{
document.CSViewer1.ViewerClose();
}
</script>
</HEAD>
<body bgColor="#c6cbcf" leftMargin="0" topMargin="0" onload="javascript:start();" onunload="javascript:leave();">
<OBJECT id="CSViewer1" style="LEFT: 0px; POSITION: absolute; TOP: 64px" codeBase="http://192.168.0.20:80/CSViewer.cab#version=1,98,317,2006"
height="480" width="640" ** classid="clsid:EFFDEEEC-F9E1-4461-91D2-DAEB8CC595F1">
</OBJECT>
</body>
</HTML>поиграйся с этими параметрами...
Offline

