62,041
社区成员
发帖
与我相关
我的任务
分享
<html>
<head>
<script type="text/javascript">
myform.submit();
</script>
<body>
<form action="目标网站" name="myform" method="post">
<input type="hidden" value="123" name="loginname" />
<input type="hidden" value="456" name="password" />
</form>
</body>
</head>
</html>
var url=根据一键登录所选的地址。
$.post(url,{"name":"123","pwd":"123"}function(data) {
if (data == null || data == "") {
}
else {
if(data==1){跳转}
}
});
logina.aspx
try{
if(page.request.form["name"]!=null&&page.request.form["pwd"]!=null)//这个地方你再严谨些
{去数据库验证,通过返回1}
}catch{}
loginb.aspx同理
<script type="text/javascript">
function GetPageSize() {
var scrW, scrH;
if (window.innerHeight && window.scrollMaxY) {
// Mozilla
scrW = window.innerWidth + window.scrollMaxX;
scrH = window.innerHeight + window.scrollMaxY;
} else if (document.body.scrollHeight > document.body.offsetHeight) {
// all but IE Mac
scrW = document.body.scrollWidth;
scrH = document.body.scrollHeight;
} else if (document.body) {
// IE Mac
scrW = document.body.offsetWidth;
scrH = document.body.offsetHeight;
}
var winW, winH;
if (window.innerHeight) {
// all except IE
winW = window.innerWidth;
winH = window.innerHeight;
} else if (document.documentElement && document.documentElement.clientHeight) {
// IE 6 Strict Mode
winW = document.documentElement.clientWidth;
winH = document.documentElement.clientHeight;
} else if (document.body) {
// other
winW = document.body.clientWidth;
winH = document.body.clientHeight;
}
// for small pages with total size less then the viewport
var pageW = (scrW < winW) ? winW : scrW;
var pageH = (scrH < winH) ? winH : scrH;
return { PageW: pageW, PageH: pageH, WinW: winW, WinH: winH };
}
function setPageSize() {
//处理浏览器窗口大小信息
var winInfo = GetPageSize();
//alert("pageW:"+winInfo.PageW+"pageH:"+winInfo.PageH+"winW:"+winInfo.WinW+"winH:"+winInfo.WinH);
loginForm.clientWidthScreen.value = winInfo.WinW;
loginForm.clientHeightScreen.value = winInfo.WinH;
loginForm.pageWidthScreen.value = winInfo.PageW;
loginForm.pageHeightScreen.value = winInfo.PageH;
//alert(loginForm.clientWidthScreen.value);
}
function loginUser() {
setPageSize(); //获取当前窗口大小进行保存
var url = "http://1.2.3.4/loginAction_loginUserForInterface.action";
var loginname = "123";
var userId = "";
var password = "111";
var fydm = "M53";
var loginType = "1";
var datas = {
loginname: loginname,
userId: userId,
password: password,
fydm: fydm
}
$.post(url, datas, function (data) {
if (data == 'true') {
location.href = "/view/sbxx/sbxxlist.jsp";
}
function searchfy() {
var url = "/xtgl/gnqxgl/showtree.jsp?type=login";
dialog("法院选择", "iframe:" + url, "350", "450", "iframe");
}
$(document).ready(function () {
loginUser();
});
</script>
</head>
<body>
<form name="loginForm" action="" method="post">
<input name="clientWidthScreen" type="hidden" value="1024" />
<input name="clientHeightScreen" type="hidden" value="768" />
<input name="pageWidthScreen" type="hidden" value="1024" />
<input name="pageHeightScreen" type="hidden" value="768" />
</form>
</body>
</html>
<script type="text/javascript">
$(document).ready(function () {
//window.open("http://www.baidu.com");
//window.open ('MessageBoard.jsp', 'MessageWindow', 'height=300, width=400, top=0, left=0, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=n o, status=no')
setPageSize();
});
function setPageSize() {
//处理浏览器窗口大小信息
var winInfo = GetPageSize();
//alert("pageW:"+winInfo.PageW+"pageH:"+winInfo.PageH+"winW:"+winInfo.WinW+"winH:"+winInfo.WinH);
loginForm.clientWidthScreen.value = winInfo.WinW;
loginForm.clientHeightScreen.value = winInfo.WinH;
loginForm.pageWidthScreen.value = winInfo.PageW;
loginForm.pageHeightScreen.value = winInfo.PageH;
//alert(loginForm.clientWidthScreen.value);
}
</script>
我用wireshark抓了一下包,发现在它的原网站post出去以后,数据和form用submit提交的一样,而我用相同代码执行,却发出去的包不一样.
原网站发出的是:POST /loginAction_loginUserForInterface.action HTTP/1.1 (application/x-www.form-urlencoded)
而我发出的是:OPTIONS /loginAction_loginUserForInterface.action HTTP/1.1
StringBuilder sb = new StringBuilder();
sb.Append("name=1&");
sb.Append("pwd=1");
string vpcURL = "https://目标页面";
System.Net.WebClient webClient = new System.Net.WebClient();
webClient.Headers.Add("Content-Type", "application/x-www-form-urlencoded");
byte[] response = webClient.UploadData(vpcURL, "POST", System.Text.Encoding.ASCII.GetBytes(sb.ToString()));
string responseData = System.Text.Encoding.ASCII.GetString(response, 0, response.Length);
在目标页面接收传来的参数
try{
foreach (string item in Page.Request.Form) {if (Page.Request.Form[item] != ""){}}
}catch{}