user = "115用户名" '用户名支持 邮箱、手机 和 数字帐号
pass = "115密码"
Set http = CreateObject("Msxml2.ServerXMLHTTP")
If login(user,pass) Then
code=getCode()
If Len(code) Then
Set o=getSpace(code)
If o.state Then
Popup "获得空间:" & o.picked & ", 获得雨露:" & o.exp, 3, "获得的奖励", 16+4096
Else
Popup "摇奖失败 或者 已经摇过了", 3, "失败", 16+4096
End If
Else
Popup "今天已经摇过了...", 3, "提示", 16+4096
End If
Else
Popup "登录失败!...", 3, "失败", 16+4096
End If
Function HttpPost(ByVal url, ByVal data)
With http
.open "POST", url, False
.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
.send data
HttpPost = .responseText
End With
End Function
Function HttpGet(ByVal url)
With http
.open "GET", url, False
.send
HttpGet = .responseText
End With
End Function
Function UTF8(str)
UTF8 = ""
ZTEP = str & ""
If ZTEP = "" Then Exit Function
For I = 1 To Len(ZTEP)
ZA = Mid(ZTEP, I, 1)
ZC = Asc(ZA)
If ZC > 127 Or ZC < 0 Then
ZC = AscW(ZA)
If ZC < 0 Then ZC = &H10000 + ZC
If ZC < 2048 Then
UTF8 = UTF8 & "%" & Hex(((ZC \ &H40) And &H1F) Or &HC0) & "%" & Hex((ZC And &H3F) Or &H80)
Else
UTF8 = UTF8 & "%" & Hex(((ZC \ &H1000) And &HF) Or &HE0) & "%" & Hex(((ZC \ &H40) And &H3F) Or &H80) & "%" & Hex((ZC And &H3F) + &H80)
End If
Else
UTF8 = UTF8 & ZA
End If
Next
End Function
Function login(user,password)
url="http://passport.115.com/?ac=login"
data="back=http%3A%2F%2Fwww.115.com&goto=http%3A%2F%2F115.com&login%5Baccount%5D=" & UTF8(user) & "&login%5Bpasswd%5D=" & password
login = Len(HttpPost(url,data))<99
End Function
Function getCode()
Set reg = New RegExp
reg.IgnoreCase = True
reg.Global = True
reg.MultiLine = True
reg.Pattern = "Yao\('(.*)',\s*function"
html = HttpGet("http://115.com/?ct=index&ac=home")
If reg.Test(html) Then getCode=Trim(reg.Execute(html).Item(0).Submatches(0)) Else getCode=""
End Function
Function ParseJson(strJson)
Set htmlfile = CreateObject("htmlfile")
Set owindow = htmlfile.parentWindow
owindow.execScript "var json_obj = " & strJson, "JScript"
Set ParseJson = owindow.json_obj
End Function
Function getSpace(code)
url="http://115.com/?ct=ajax_user&ac=pick_space&token=" & code & "&_=" & Rnd
Set getSpace = ParseJson(HttpGet(url))
End Function
Function Popup(msg,t,tit,btn)
CreateObject("Wscript.Shell").Popup msg & vbCrLf & vbCrLf & "本窗口" & t & "秒后自动关闭。", t, tit, btn
End Function