<%
Response.Expires = 0  
Response.expiresabsolute = Now() - 1  
Response.addHeader "pragma", "no-cache"  
Response.addHeader "cache-control", "private"  
Response.CacheControl = "no-cache" 
Response.Buffer = True 
Response.Clear
Server.ScriptTimeOut=999999999

Class SenFe_Steal
Private SenFe_Url
Private SenFe_Body
Private SenFe_Code

Private Http,FSO,ADOS

Private Sub Class_Initialize
	Set Http = Server.CreateObject("Msxml2.ServerXMLHTTP")
	Set ADOS = Server.CreateObject("ADODB.Stream")
End Sub 

Private Sub Class_Terminate  
	Set Http = Nothing
	Set ADOS = Nothing
End Sub 

Public Property get Version
	Version="盛飞小偷类 Version 1.0"
End Property

Public Property Let Url(Str)
	Call Steal(Str)
End Property

Public Sub Steal(SenFe_Url)
	If SenFe_Url<>"" Then
		With Http
		.Open "GET",SenFe_Url,False
		.SetRequestHeader "Referer",Mid(SenFe_Url,1,InStr(8,SenFe_Url,"/"))
		.Send()
		If .ReadyState<>4 Then Exit Sub
		SenFe_Body=BytesToBSTR(.ResponseBody,"GB2312")
		End With
		If Err.Number<>0 Then Err.Clear
	Else 
		Response.Write "<SCRIPT>alert(""请先设置待获取的目标网址！"")</SCRIPT>"
	End If
End Sub

Private Function BytesToBstr(Body,Cset) '中文处理
	With ADOS
	.Type = 1
	.Mode =3
	.Open
	.Write body
	.Position = 0
	.Type = 2
	.Charset = Cset
	BytesToBstr = .ReadText 
	.Close
	End With
End Function

Public Sub Code(Start,Start1,Start2,Start3,Over,Over1,Over2,Over3)
	If SenFe_Code="" Then SenFe_Code=SenFe_Body
	If InStr(SenFe_Code,Start)>0 And InStr(SenFe_Code,Over)>0 Then
		Dim StartN,OverN
		Start1 = CInt(ABs(Start1))
		Over1  = CInt(ABs(Over1))
		Start2 = CInt(ABs(Start2))
		Over2  = CInt(ABs(Over2))

		If Start1 = 0 Then Start1 = 1
		If Over1  = 0 Then Over1  = 1
		If Start2 > 1 Then Start2 = 1
		If Over2  > 1 Then Over2  = 1

		If Start1<2 And UBound(Split(SenFe_Code,Start))<2 Then
			StartN=InStr(SenFe_Code,Start)
		Else
			StartN=1
			For I=1 To Start1
				StartN=InStr(StartN,SenFe_Code,Start)+Len(Start)
			Next
			StartN=StartN-Len(Start)
		End If

		If Over1<2 And UBound(Split(SenFe_Code,Over))<2 Then
			OverN=InStr(StartN+Len(Start),SenFe_Code,Over)
		Else
			OverN=InStr(StartN+Len(Start),SenFe_Code,Over)
			For I=1 To Over1
				OverN=InStr(OverN,SenFe_Code,Over)+Len(Over)
			Next
			OverN=OverN-Len(Over)
		End If

		If Start2=0 Then StartN=StartN+Len(Start)
		If Over2=1 Then OverN=OverN+Len(Over)

		StartN = StartN+Start3
		OverN  = OverN+Over3
		SenFe_Code=Mid(SenFe_Code,StartN,OverN-StartN)	'按指定的开始和结束位置取得代码
	Else
		SenFe_Code="没有找到您想要的内容，可能您设定的首尾字符串不存在！"
	End If
End Sub

Public Sub NoBr()
	If SenFe_Code="" Then SenFe_Code=SenFe_Body
	SenFe_Code=Replace(Replace(SenFe_Code,vbCr,""),vbLf,"")
End Sub

Public Sub Change(OldStr,Str)
	If SenFe_Code="" Then SenFe_Code=SenFe_Body
	SenFe_Code=Replace(SenFe_Code,OldStr,Str)
End Sub

Public Sub ReplaceByReg(Patrn,Str)
	If SenFe_Code="" Then SenFe_Code=SenFe_Body
	Dim TempReg
	Set TempReg=New RegExp
		TempReg.IgnoreCase=True
		TempReg.Global=True
		TempReg.Pattern=Patrn
		SenFe_Code=TempReg.Replace(SenFe_Code,str)
	Set TempReg=Nothing
End Sub

Public Sub ChangeX(Start,StartX,StartCusor,Over,OverX,OverCusor,Str)
	If SenFe_Code="" Then SenFe_Code=SenFe_Body
	While InStr(SenFe_Code,Start)>0 And InStr(SenFe_Code,Over)>0
		Dim StartN,OverN
		If CInt(ABs(StartX)) > 1 Then StartX = 1
		If CInt(ABs(OverX))  > 1 Then OverX  = 1

		StartN = InStr(SenFe_Code,Start)+StartCusor
		OverN  = InStr(StartN+Len(Start),SenFe_Code,Over)+OverCusor

		If StartX = 0 Then StartN = StartN+Len(Start)
		If OverX  = 1 Then OverN  = OverN+Len(Over)

		SenFe_Code = Replace(SenFe_Code,Mid(SenFe_Code,StartN,OverN-StartN),Str)
	WEnd
End Sub

Public Property Get Body
	If SenFe_Code="" Then SenFe_Code=SenFe_Body
	Body  = SenFe_Code
	SenFe_Code=""
End Property
End Class
%>