批处理登陆邮箱代码分析
六 11
分析Gmail登陆界面的HTML代码
我从源代码上把一些重要的代码摘了下来,可以看看:
<form id=”gaia_loginform” action=”https://www.google.com/accounts/ServiceLoginAuth?service=mail” method=”post”
onsubmit=”return(gaia_onLoginSubmit());”>
上面的form是登陆框的form,最主要的是知道此form的提交地址,以及提交方法,然后我们只要按照form的要求将字符串,也就是网址提交给服务器就OK了。
下面再来看看,输入用户名和密码的地方有什么重要的代码:
<tr>
<td nowrap=”nowrap”>
<div align=”right”>
<span>
用户名:
</span>
</div>
</td>
<td>
<input type=”hidden” name=”continue” id=”continue”
value=”https://mail.google.com/mail/?ui=html&zy=l” />
<input type=”hidden” name=”service” id=”service”
value=”mail” />
<input type=”hidden” name=”rm” id=”rm”
value=”false” />
<input type=”hidden” name=”ltmpl” id=”ltmpl”
value=”default” />
<input type=”hidden” name=”hl” id=”hl”
value=”zh-CN” />
<input type=”hidden” name=”ltmpl” id=”ltmpl”
value=”default” />
<input type=”hidden” name=”ss” id=”ss”
value=”1″ />
<input type=”text” name=”Email” id=”Email”
size=”18″ value=”"
class=’gaia le val’
/>
</td>
</tr>
<tr>
<td></td>
<td align=”left”>
</td>
</tr>
<tr>
<td align=”right”>
<span>
密码:
</span>
</td>
<td>
<input type=”password”
name=”Passwd” id=”Passwd”
size=”18″
/>
</td>
</tr>
好了现在,我们已经知道应该提交什么内容了,而且隐藏的传递的值我们也知道了,主要就是其中的红色字体部分。由于form采用的是post方法向服务器进行提交,那么我就要把网址组成post的形式,就是一个name对应一个value就可以了。
制作登陆Gmail的批处理文件
有了上面的分析我们可以很轻松的写出下面的批处理文件:
@echo off
cmd /c start “” “https://www.google.com/accounts/ServiceLoginAuth?service=mail&rm=false&continue=https://mail.google.com/mail/?ui<mpl=default&hl=zh-CN&ss=1&Email=你的用户名&Passwd=你的密码”
然后把你的用户名和你的密码填到上面就可以了。
用批处理登陆IP网关
分析IP网关登陆界面的HTML代码
我这里所说的IP网关是指我们东北大学上网需要登陆的IP网关,我同样也抽取其中比较总要的代码出来:
<form name=”ipgwform” action=”/ipgw/ipgw.ipgw” method=”post”>
用户名(Username):<input type=”text” name=”uid” SIZE=16 MAXLENGTH=15>
<br>
密 码(Password):<input type=”password” autocomplete=”on” name=”password” SIZE=16 MAXLENGTH=15>
<P>
<table >
<tr><td>
访问范围(Range):</td>
<td><input type=”radio” name=”range” value=”2″ checked>国内(Inside China) </td>
<td><input type=”radio” name=”range” value=”1″>国际(Outside China)</td>
</tr>
<!–tr><td>超时检查(Timeout):</td>
<td><input type=”radio” name=”timeout” value=”0″ checked>20分钟(20 minutes) </td>
<td><input type=”radio” name=”timeout” value=”1″>8小时(8 hours)</td>
</tr–>
</table>
从上面的代码我们找到了我们数据的提交地址和提交方法,那么我们怎么知道我们是“连接”、“断开”或“断开全部”呢?
我们可以在HTML代码中继续找,应该会有这样的标志的,于是我们会发现如下的代码:
<table >
<tr align=center bgcolor=”#ffdead” >
<td><font color=”#ffffff”>
<a href=”javascript:connect()”>
<font color=”#9d271b”>连接网络</font></a> |
<a href=”javascript:disconnect()”>
<font color=”#9d271b”>断开网络</font></a> |
<a href=”javascript:disconnectall()”>
<font color=”#9d271b”>断开全部连接</font></a>
</font></td>
</tr>
很明显当我们点“连接网络”的时候去执行一个叫connect的JavaScript函数了,那么我们去看看这个函数是干什么的?
function connect()
{
thisform = document.ipgwform;
if ( thisform.uid.value == “” ) {
alert (“用户名不能为空,请重新输入。 “);
thisform.uid.focus();
return;
}
if ( thisform.password.value == “” ) {
alert (“密码不能为空,请重新输入。”);
thisform.password.focus();
return;
}
firstornot();
thisform.operation.value=”connect”;
thisform.submit();
}
可以看到首先它进行用户名和密码的检查,然后post的时候多添加了一个name和value,就是operation的值是connect,同样我们可以找到disconnect和disconnectall函数里面都有operation的值。那么我们就很容易做批处理了。
制作登陆IP网关的批处理文件
只要按照要求填写该填的就OK了,如下:
连接网络的代码:
@echo off
cmd /c start “” http://ipgw.neu.edu.cn/ipgw/ipgw.ipgw?uid=你的用户名&password=你的密码&range=2&timeout=1&operation=connect”
断开网络的代码:
@echo off
cmd /c start “” http://ipgw.neu.edu.cn/ipgw/ipgw.ipgw?uid=你的用户名&password=你的密码&range=2&timeout=1&operation=disconnect”
全部断开的代码:
@echo off
cmd /c start “” http://ipgw.neu.edu.cn/ipgw/ipgw.ipgw?uid=你的用户名&password=你的密码&range=2&timeout=1&operation=disconnectall”
只要把上面的代码保存到一个文本文件(txt)文件中,然后把后缀名改为bat,就OK了。
用批处理登陆126邮箱
分析登陆126邮箱界面的HTML代码
这里我也只抽取主要的代码出来:
<form method=”post” action=”http://entry.126.com/cgi/login” name=”form” onSubmit=”return fCheck()”>
<input name=”domain” type=”hidden” value=”126.com” />
<input name=”language” type=”hidden” value=”0″ />
<input name=”bCookie” type=”hidden” value=”" />
<input name=”username” type=”hidden” value=”" />
<div style=”height:9px”></div>
<p><span>用户名</span>
<input type=”text” name=”user” onMouseOver=”fEvent(‘mouseover’,this)” onFocus=”fEvent(‘focus’,this)” onBlur=”fEvent(‘blur’,this)” onMouseOut=”fEvent(‘mouseout’,this)” maxlength=”20″ tabindex=”1″/>
<b title=”@126.com”></b></p>
<div></div>
<p><span>密 码</span>
<input onMouseOver=”fEvent(‘mouseover’,this)” onFocus=”fEvent(‘focus’,this)” onBlur=”fEvent(‘blur’,this)” onMouseOut=”fEvent(‘mouseout’,this)” name=”password” type=”password” size=”16″ tabindex=”2″ maxlength=”20″/>
<a href=”http://reg.163.com/RecoverPasswd1.shtml” target=”_blank” style=”margin-top:7px”>忘记密码了?</a></p>
<div></div>
<p><span>版 本</span>
<select name=”style” id=”login_select”>
<option value=”-1″ selected=”selected”> 默 认 </option>
<option value=”23″> 逍遥 3.0 </option>
<option value=”21″> 极速 3.0 </option>
<option value=”3″> 简约 3.0 </option>
</select>
填写完登陆代码之后,它会对此进行检查和提交服务器前的相关处理,这里主要用的是JavaScript代码,如下:
function fCheck(){
var bOk = false;
var s = “”;
var fm = document.form;
s = fm.style.value;
fm.user.value = fTrim(fm.user.value); //Trim the input value.
if(!fCheckCookie()){
return false;
}
if( fm.user.value ==”") {
document.getElementById(“error_div”).innerHTML = “请输入你的用户名”;
fm.user.focus();
return false;
}
if( fm.password.value.length ==”") {
document.getElementById(“error_div”).innerHTML = “请输入你的密码”;
fm.password.focus();
return false;
}
var remUser = fm.remUser.checked?true:false;
/*
if( remUser){
fm.autocomplete=”on”;
}else{
fm.autocomplete=”off”;
}
*/
var secure = fm.secure;
var url;
if(secure.checked){
url = “https://reg.163.com/logins.jsp“;
}else{
url = “http://reg.163.com/login.jsp“;
}
url +=”?type=1&product=mail126&url=http://entry.mail.126.com/cgi/ntesdoor?hid%3D10010102%26lightweight%3D1%26″;
if( fm.secure.checked )
url += “verifycookie%3D1%26″;
url += “language%3D0%26style%3D” + s ;
try{
var sMailSpeed = getCookie(“mailspeed”);
if(sMailSpeed){
url += “%26webname_prefix%3D”+sMailSpeed.split(“_”)[0];
}
}catch(exp){}
fm.action = url;
var ati = fm.user.value.indexOf( “@”);
if( ati != -1 )
fm.user.value = fm.user.value.substring(0, ati);
visitordata.setVals( [fm.user.value,fm.style.value,fm.secure.checked?1:0 ], remUser );
visitordata.store();
if(!fm.remUser.checked){
setCookie(‘ntes_mail_noremember’,'true’,true);
}
fm.username.value = fm.user.value + “@126.com”;
return true;
}
从这里我们可以得到它是如何处理后然后提交给服务器的。是JavaScript代码,如果了解点JavaScript的话,就容易多了,关于JavaScript,你可以看一点相关的资料。我在这里就不多说了。
制作登陆126邮箱的批处理文件
把下面的用户名和密码换成你自己的,然后保存为一个bat文件就OK了。
@echo off
start “” https://entry.mail.126.com/cgi/login?redirTempName=https.htm&hid=10010102&lightweight=1&verifycookie=1&language=0&style=21&user=用户名&pass=密码”
其中的登陆之后的style你可以根据HTML代码中的值来改动,不如df代表默认的,23代表逍遥3.0等。
用批处理文件登陆Yeah邮箱
分析Yeah邮箱登陆界面的HTML代码
主要的代码如下,红色字体部分为关键代码:
<form method=POST action=”http://reg.163.com/logins.jsp?type=1&url=http://entry.yeah.net/cgi/ntesdoor?lightweight%3D1%26verifycookie%3D1%26” name=”form” onsubmit=”return fCheck()” target=”_top”>
<input name=”bCookie” type=hidden value=”">
<!–登录模块 随机背景–>
<div>
<h2><span>登录@Yeah.net</span></h2>
<div><input type=”hidden” name=”username” / value=”" >
<div>用户名<input type=”text” onmouseover=”this.style.borderColor=’#FFAC00′” name=”user” size=”20″ onmouseout=”this.style.borderColor=’#4C9131′” / value=”" ><span>@</span><select id=”selDomain”><option value=”yeah.net” >yeah.net</option><option value=”netease.com” >netease.com</option></select></div><div>密 码<input type=”password” onmouseover=”this.style.borderColor=’#FFAC00′” name=”password” size=”20″ onmouseout=”this.style.borderColor=’#4C9131′” /><a href=”http://reg.163.com/RecoverPasswd1.shtml“>忘记密码了?</a></div><div><input type=”checkbox” name=”RmbUser” id=”RmbUser” / ><label for=”RmbUser”>在此电脑上记住用户名</label></div>
<div><input type=”submit” value=”登 录” onmouseover=”this.className=’btnLogin2′” onmouseout=”this.className=’btnLogin’” /><input type=”button” value=”注 册” onmouseover=”this.className=’btnReg2′” onmouseout=”this.className=’btnReg’” onclick=”location.href=’http://reg.mail.yeah.net/reg/reg1.jsp’” /></div>
</div>
</div>
</form>
<script language=”JavaScript”>fInitUser();</script>
制作登陆Yeah邮箱的批处理文件
直接给出代码
@echo off
cmd /c start “” http://reg.163.com/logins.jsp?type=1&url=http://entry.yeah.net/cgi/ntesdoor?lightweight%3D1%26verifycookie%3D1%26&username=你的用户名@yeah.net&password=密码
用批处理登陆163邮箱
分析163邮箱登陆界面的HTML代码
主要代码如下:
<form id=”login163″ method=”post” name=”login163″ action=”" onsubmit=”return fLoginFormSubmit();” target=”_top”>
<input name=”verifycookie” type=”hidden” value=”1″ />
<input type=”hidden” name=”style” id=”txtStyle” value=”34″ />
<input type=”hidden” id=”product” name=”product” value=”mail163″ />
<table border=”0″ cellspacing=”0″>
<tr>
<td>用户名</td>
<td><input type=”text” name=”username” onFocus=”fEvent(‘focus’,this)” onBlur=”fEvent(‘blur’,this)” onMouseOver=”fEvent(‘mouseover’,this)” onMouseOut=”fEvent(‘mouseout’,this)” maxlength=”50″ style=”font-weight:bold; font-family:Verdana, Arial, Helvetica, sans-serif”/></td>
<td title=”@163.com”></td>
</tr>
<tr>
<td colspan=”3″></td>
</tr>
<tr>
<td>密 码</td>
<td><input type=”password” name=”password” onMouseOver=”fEvent(‘mouseover’,this)” onFocus=”fEvent(‘focus’,this)” onBlur=”fEvent(‘blur’,this)” onMouseOut=”fEvent(‘mouseout’,this)”/></td>
<td> <a href=”http://reg.163.com/RecoverPasswd1.shtml” target=”_blank” title=”找回密码”>忘记密码了?</a></td>
</tr>
<tr>
<td colspan=”3″></td>
</tr>
<tr>
<td>版 本</td>
<td colspan=”2″>
<select name=”selType” id=”selType” style=” height:auto; font-family:Verdana, Arial, Helvetica, sans-serif; line-height:14px”>
<option value=”-1″ selected=”selected”> 默 认</option>
<option value=”js”> 极速 3.0</option>
<option value=”jy”> 简约 3.0</option>
</select>
</td>
</tr>
<tr>
<td colspan=”3″></td>
</tr>
<tr>
<td colspan=”3″><div style=”width:210px;”>
<input name=”remUser” type=”checkbox” id=”remUsername” checked style=”float:left” />
<span style=” float:left;margin-top:3px;*margin-top:5px”><label for=”remUsername”>记住用户名</label></span>
<input name=”secure” type=”checkbox” id=”secure” checked style=”float:left;margin-left:19px;” />
<span style=” float:left;margin-top:3px;*margin-top:5px”><label for=”secure”>SSL安全登录</label></span> <a href=”http://help.163.com/08/1111/17/4QG2LL4R00752UPN.html” target=”_blank”><img style=” display:inline; margin-top:2px;” src=”http://mimg.163.com/index/new_2008/img/whyssl.gif” border=”0″ alt=”什么是SSL登录” title=”什么是SSL登录” />
</a>
</div></td>
</tr>
<tr>
<td colspan=”3″></td>
</tr>
<tr>
<td colspan=”3″><input name=”登录邮箱” title=”登录邮箱” value=”" type=”submit” onmouseover=”this.className=’btn2′” onmouseout=”this.className=’btn1′” onclick=”setCookie(‘ntes_mail_firstpage’,'normal’);saveLoginType();” />
由于form的action属性是空的,那么我们就要看看fLoginFormSubmit函数的内容了。
function fLoginFormSubmit(){
var fm = window.document.login163;
var user = fm.username;
user.value = fTrim( user.value); //Trim the input value.
if( user.value ==”") {
window.alert(“\请输入您的用户名 ?”);
user.focus();
event.returnValue = false;
return false;
}
if( fm.password.value.length ==”") {
window.alert(“\请输入您的密码 ?”);
fm.password.focus();
event.returnValue = false;
return false;
}
var ati = user.value.indexOf( “@”);
if( ati != -1 ){
user.value = user.value.substring(0, ati);
}
var secure = fm.remUser.checked?true:false;
var url = fm.secure.checked ? “https://reg.163.com/logins.jsp” : “http://reg.163.com/login.jsp“;
url += “?type=1&url=http://fm163.163.com/coremail/fcg/ntesdoor2?”;
url += “lightweight%3D1%26verifycookie%3D1%26″;
if(secure){
user.autocomplete=”on”;
}else{
user.autocomplete=”off”;
}
fGetVersion(fm);
fm.action = url + “language%3D-1%26style%3D” + fm.style.value;
visitordata.setVals( [fm.username.value,fm.style.value,fm.secure.checked?1:0 ], fm.remUser.checked);
visitordata.store();
if(!fm.remUser.checked){
setCookie(‘ntes_mail_noremember’,'true’,true);
}
return true;
}
红色字体为主要的,我们可以找到要提交数据的地址了,那么下面我们就提交地址吧。
制作登陆163邮箱的批处理文件
@echo off
cmd /c start “” “https://reg.163.com/logins.jsp?type=1&url=http://fm163.163.com/coremail/fcg/ntesdoor2?lightweight%3D1%26verifycookie%3D1%26&username=你的用户名&password=你的密码”
如果你需要设置风格的话,可以在后面在加上&style=js,那么代表的就是极速3.0,jy代表的是简约3.0
总结说明
其实只要了解一点HTML和JavaScript的知识就比较容易做了,我们在网络上登陆某个网站的时候,实质上也是将我们的用户名密码按照一定的格式提交给该网站的后台服务程序,所以我们就可以按照这个提交格式来组成一个网址,然后直接提交给该后台服务程序,就相当于我们输入了用户名和密码了,只不过我们用批处理文件做的花,也就不用每次输入用户名和密码,只要点开这个批处理文件就OK了。
如果要写批处理文件,那么需要对批处理的命令有一点的了解。因为我也不是很了解,比如里面的for和if语句什么的,我看的不太懂。不过,幸好我们用到的都是比较基本的,像在这里我们主要是用start命令来打开一个网址,其实不仅仅如此,start还能做很多工作,比如打开某个程序或文件什么的,比如它可以打开word,只要你电脑上装有word,那么当打开后缀为doc的文件的时候,它就会自动启用word来打开doc文件。
而echo off是说我下面的程序的代码在命令窗口执行的时候不打印出来。不过,这只是在打开的时候看不到你的用户名和密码。不过,可以通过右键编辑你的bat文件,这样就可以完整的看到批处理文件的代码。那么也就是说,如果这个电脑有别人再用,我们要是用批处理文件登陆网站的时候,如果恰好这个人又懂一点网络知识的话,就可能看出你的用户名和密码,那么就不安全了。
所以,建议用批处理文件只是在自己的个人电脑上,公用电脑上的花,就要慎用,以防密码和用户名丢失。
RSS