另存为.vbs,代码懒得优化了- Dim FSO, IpList
- Set FSO = CreateObject("Scripting.FileSystemObject")
- IpList = Split(FSO.OpenTextFile("1.txt").ReadAll(), vbCrLf)
- For Each str In IpList
- If str <> vbNullString Then
- GetWeb "http://whois.cooleasy.com/" & str
- GetTxt
- End If
- Next
- FSO.DeleteFile "temp.txt"
- Set FSO = Nothing
- CreateObject("Wscript.Shell").Run "IpList.txt"
-
- Function GetWeb(Url)
- Dim XMLHTTP, STREAM
- Set XMLHTTP = CreateObject("MsXml2.XmlHttp")
- XMLHTTP.open "Get", Url, False
- XMLHTTP.send()
- Do Until XMLHTTP.readyState = 4 : WScript.Sleep 200 : Loop
- Set STREAM = CreateObject("Adodb.Stream")
- STREAM.Mode = 3
- STREAM.Type = 1
- STREAM.Open()
- STREAM.Write(XMLHTTP.responseBody)
- STREAM.SaveToFile "temp.txt", 2
- STREAM.Close
- Set STREAM = Nothing
- XMLHTTP.abort
- Set XMLHTTP = Nothing
- End Function
-
- Function GetTxt
- Dim vbStr, Arr
- vbStr = Replace(FSO.OpenTextFile("temp.txt").ReadAll(), vbLf, vbCrLf)
- Arr = Split(vbStr, vbCrLf)
- For Each str In Arr
- If InStr(str, "NetRange:") Then FSO.OpenTextFile("IpList.txt", 8, True).Write Left(GetUrl(str), Len(GetUrl(str))-8) & vbCrLf
- Next
- End Function
-
- Function GetUrl(Str)
- Dim RegEx
- Set RegEx = New RegExp
- RegEx.Global = True
- RegEx.IgnoreCase = True
- RegEx.Pattern = ".*?>([^<>]+)<.*?"
- GetUrl = RegEx.Replace(Str, "$1")
- End Function
复制代码
|