控制台源代码

Call 控制台("http://www.cnblogs.com/895200035qq/articles/6006403.html","魔域") '数据源,网页地址
Function 控制台(数据源,脚本项目)
    注册码 = 获取机器码(脚本项目)
   
    Do
        数据库 = 获得网页源文件_增强版(数据源, "UTF-8")
        If 数据库 = "" Then
            TracePrint "网络异常"
        Else
            Exit Do
        End If
        Delay 1000
    Loop
    //    注册码 = "E2CF58658341510888F7B2457225"
    //    TracePrint 数据库
    机器码位置= instr(1, 数据库, 注册码, 0)
    TracePrint 机器码位置
    If 机器码位置 = 0 Then '未注册/
        MsgBox "该设备未注册,机器码" & 注册码 & "请联系作者重新注册,QQ903498607" & VBCLF& "停止运行", 4096
        ExitScript
    Else
        序列号 = mid(数据库, 机器码位置 - 11, 5)
        TracePrint "序列号是:" & 序列号
        结束位 = instr(机器码位置, 数据库, "结束", 0)
        TracePrint 结束位
        数据 = mid(数据库, 机器码位置, 结束位 - 机器码位置)
        TracePrint 数据
        数据组 = split(数据, "------")
        TracePrint 序列号 & "," & join(数据组, ",")
        If 数据组(1) = "已注销" Then '已注册/已注销
            MsgBox "此机器码:" & 注册码 & "已被注销,请联系作者重新注册,QQ903498607" & VBCLF& "停止运行",4096
            ExitScript
        ElseIf 数据组(1) <> "已注册" Then
            MsgBox "设备注册:未知错误", 4096
            ExitScript
        End If
        TracePrint 获取网络时间_增强版("www.taobao.com")
        Call 时间限制()
    End If
End Function
Function 获得网页源文件_增强版(网页地址, 网页编码)     //多个参数.设置编码.跟乱码说88
    //Plugin.Sys.SetCLB(lib.网络.获得网页源文件_增强版("www.baidu.com","utf-8")) //百度
    //Plugin.Sys.SetCLB(lib.网络.获得网页源文件_增强版("www.sina.com.cn","gbk")) //新浪
    Dim xmlHttp, xmlUrl,ObjStream
    If InStr(网页地址, "http://") = 0 Then
        xmlUrl = "http://" & 网页地址
    Else
        xmlUrl = 网页地址
    End if
    Set xmlHttp = CreateObject("WinHttp.WinHttpRequest.5.1")   //用这个对象,跟缓存/cookie 干扰说88
    xmlHttp.Open "GET", xmlUrl, True
    xmlHttp.Send
    If xmlhttp.waitforresponse() Then
        Set ObjStream = CreateObject("Adodb.Stream")
        ObjStream.Type = 1
        ObjStream.Mode = 3
        ObjStream.Open
        ObjStream.Write xmlHttp.ResponseBody
        ObjStream.Position = 0
        ObjStream.Type = 2
        ObjStream.Charset = 网页编码
        获得网页源文件_增强版 = ObjStream.ReadText
        Set ObjStream = Nothing
    Else
        获得网页源文件_增强版 = ""  //如果获取失败返回值是 空
    End If
    Set xmlHttp = Nothing
End Function
Sub 时间限制()
    //说明:支持远程获取文本内容,如:
    //MsgBox lib.网络.获得网页源文件_增强版("http://www.anjian.com/test.txt","utf-8")
    //MsgBox lib.网络.获得网页源文件_增强版("http://www.anjian.com","utf-8")
    网络时间 = 获取网络时间_增强版("www.taobao.com")//看看淘宝服务器时间
    TracePrint 网络时间
    网络时间 = split(网络时间, " ")
    TracePrint 网络时间(0)
    时间 = split(网络时间(0), "/")
    For Each ss In 时间
        TracePrint ss
    Next
    If 数据组(3) <> "永久" Then
        期限 = split(数据组(3), "-")
        //        期限 = array(clng(数据组(3)), clng(数据组(4)), clng(数据组(5)))
        TracePrint "脚本到期时间" & join(期限)
        If clng(时间(0)) < clng(期限(0)) Then
            TracePrint "有效"
        ElseIf clng(时间(0)) = clng(期限(0)) Then
            TracePrint "判断月份"
            If clng(时间(1)) < clng(期限(1)) Then
                TracePrint "有效"
            ElseIf clng(时间(1)) = clng(期限(1)) Then
                TracePrint "判断日期"
                If clng(时间(2)) < clng(期限(2)) Then
                    TracePrint "脚本有效"
                Else
                    TracePrint "脚本失效"
                    //                Form1.Label7.Caption = "脚本更新,联系作者QQ903498607" & VBCLF& "停止运行"
                    MsgBox 序列号 & "脚本更新," & ",联系作者QQ903498607" & VBCLF& "停止运行", 4096
                    ExitScript
                End If
            Else
                TracePrint "脚本失效"
                //            Form1.Label7.Caption = "脚本更新,联系作者QQ903498607" & VBCLF& "停止运行"
                MsgBox 序列号 & "脚本更新," & ",联系作者QQ903498607" & VBCLF& "停止运行", 4096
                ExitScript
            End If
        Else
            TracePrint "脚本失效"
            //        Form1.Label7.Caption = "脚本更新,联系作者QQ903498607" & VBCLF& "停止运行"
            MsgBox 序列号 & "脚本更新," & ",联系作者QQ903498607" & VBCLF& "停止运行", 4096
            ExitScript
        End If
    Else
        TracePrint "永久版"
    End If
End Sub
Function 获取机器码(脚本项目)
    GetSN = Plugin.Sys.GetHDDSN()
    TextMD51 = Plugin.Encrypt.Md5String(GetSN & "," & 脚本项目)
    Call Plugin.Sys.SetCLB(TextMD51)
    TracePrint TextMD51
    TracePrint "数据"&TextMD51
    TextMD52=TextMD51
    For 28
        TextMD52 = Plugin.Encrypt.Md5String(TextMD52)
        注册码 = 注册码 & Mid(TextMD52, 10, 1)
    Next
    TracePrint 注册码
    获取机器码=注册码
End Function
Function 获取网络时间_增强版(网站地址)
    //TracePrint lib.网络.获取网络时间_增强版("msdn.microsoft.com") //去微软取时间玩
    //TracePrint lib.网络.获取网络时间_增强版("www.taobao.com") //看看淘宝服务器时间
    //TracePrint lib.网络.获取网络时间_增强版("www.qq.com") //看看qq网站时间
    Dim Http, URL,mt
    If InStr(网站地址, "http://") = 0 Then
        Url = "http://" & 网站地址
    Else
        Url = 网站地址
    End if
    Set Http = CreateObject("WinHttp.WinHttpRequest.5.1")
    Http.Open "HEAD", URL, True //head方式,因为服务器返回的头部里面就有时间..所以不需要网页了
    Http.Send
    If Http.waitforresponse() Then
        mt = Http.getresponseheader("Date") //从头部取到时间..js格式的(带有星期几跟时区的格式,跟vbs不一样)
        mt = Cdate(Mid(mt, 5, len(mt) - 8))  //截取js格式的时间字符串.得到vbs的模式的时间
        获取网络时间_增强版 = DateAdd("h", 8, mt) //中国是8时区,而服务器普遍是世界标准时,也就是0时区得时间.所以得加上8小时
    Else
        获取网络时间_增强版 = "" //失败返回值是 空
    End If
    Set Http = Nothing
End Function

posted on 2016-10-29 11:55  1311-小桂哥  阅读(646)  评论(0)    收藏  举报