使用 vbs 批量全自动检查友情链接 + 源码

  • A+
所属分类:lcx

使用 vbs 批量全自动检查友情链接 + 源码

批量检查效果图

想起来很长时间都没有检查过友情链接了,上一次检查大概是:2011-10-14 01:20:00,足足快半年了……

统计了一下链接数量,有将近70个,如果手工一个一个看的话,实在是操蛋……

于是写了一小段 vbs 脚本,全自动实现这个检查过程,方便多了……

Link.vbs 源码如下:

Set fso = CreateObject("Scripting.FileSystemObject")
Set file = fso.OpenTextFile(WScript.Arguments(0), 1)

While Not file.AtEndOfStream
    u = file.ReadLine
    If Instr(1, u, "http://", 1) > 0 Then
        tmp = GetUrl(u)
        IF len(tmp) = 0 Then
            WScript.Echo u & " --> Error!"
        Else
            RegExp_Exec "]*href=['""]*http://(" & WScript.Arguments(1) & ")['"" ]*[^]*>([^]*)", tmp
        End IF
    End IF
Wend

WScript.Echo "Done!"

''----------------------------------------------------------------------------

Private Function GetUrl(Url)
    On Error Resume Next
    Set WinHttp = CreateObject("WinHttp.WinHttpRequest.5.1")
    WinHttp.Open "GET", Url, False
    WinHttp.Send
    GetUrl = WinHttp.ResponseText
End Function

Private Function RegExp_Exec(P, S)
    Dim re
    Set re = New RegExp
    re.IgnoreCase = True
    re.Global = True
    re.Pattern = P
    Set Matches = re.Execute(S)
    IF Matches.Count > 0 Then
        WScript.Echo u & ", Count: " & Matches.Count & ", Link text: " & FixString(Matches.Item(0).SubMatches(1)) & ", Url: " & FixString(Matches.Item(0).SubMatches(0))
        'WScript.Echo "匹配总数:" & Matches.Count
        'For Each Match in Matches
        '    WScript.Echo "起始位置:" & Match.FirstIndex
        '    WScript.Echo "字符长度:" & Match.Length
        '    WScript.Echo "匹配的值:" & Match.Value
        'Next
    Else
        WScript.Echo u & " --> Not Found!"
    End IF
End Function

Private Function FixString(S)
    FixString = Trim(Replace(Replace(S, Chr(13), ""), Chr(10), ""))
End Function

很好用哟,亲~

经测试,除了不在首页、JavaScript 动态输出、跳转等情况,本站所有连接检测准确率达到 100%!

使用方法:

0、保存以上代码为:c:Link.vbs。

1、准备 Link.txt,内容为你的友情链接列表,一行一个,需要加“http://”,例如:"https://lcx.cc/"

2、执行命令:cscript C:Link.vbs C:Link.txt lcx.cc

3、等着输出结果。

小技巧:

有的站链接不固定,例如本站,有人做链接是:https://lcx.cc,还有人是:http://www.lcx.cc

碰到这种情况,你就需要一点小技巧,例如:

cscript C:Link.vbs C:Link.txt [www.]*lcx.cc

红色部分是一小段正则表达式,这里就不解释了,自己去查资料,很简单。

输出结果:

输出的格式大概是这样的:

Microsoft (R) Windows Script Host Version 5.8
版权所有(C) Microsoft Corporation 1996-2001。保留所有权利。

http://iceforce.org/, Count: 1, Link text: Nuclear'Atk 网络安全研究中心, Url: lcx.cc
http://www.weiyang.in/, Count: 1, Link text: Nuclear'Atk 网络安全研究中心, Url: lcx.cc
http://piaoyu.org/, Count: 1, Link text: Nuclear'Atk, Url: lcx.cc
http://www.rlimz.com/, Count: 1, Link text: Nuclear'Atk's Blog, Url: lcx.cc
http://xah-zad.blogbus.com/, Count: 1, Link text: Nuclear'Atk'blog, Url: lcx.cc
http://www.soson13.com/, Count: 1, Link text: Nuclear'Atk, Url: www.lcx.cc
http://www.claepo.com/, Count: 1, Link text: 核攻击, Url: lcx.cc
http://www.9170.org/, Count: 1, Link text: Nuclear'Atk, Url: lcx.cc
http://cctv.gy/ --> Error!
http://blog.hkfx.net/ --> Not Found!
http://bbs.admin8.us/, Count: 1, Link text: Nuclear'Atk, Url: www.lcx.cc
http://www.294133340.net/ --> Not Found!
http://www.hackqing.com/ --> Error!
http://errs.cc/, Count: 1, Link text: Nuclear'Atk, Url: lcx.cc
http://www.webshell.cc/, Count: 1, Link text: Nuclear'Atk, Url: lcx.cc
http://www.xgnbk.tk/ --> Not Found!
http://hi.baidu.com/lelelulu/home, Count: 1, Link text: Nuclear'Atk Blog, Url: lcx.cc
http://www.wksnow.com/, Count: 1, Link text: Nuclear'Atk blog, Url: lcx.cc
http://blog.xxoxo.org/ --> Error!
http://hi.baidu.com/hacktusk/home, Count: 1, Link text: Nuclear-Blog, Url: lcx.cc
http://www.seczero.com/, Count: 1, Link text: ?????????, Url: lcx.cc
http://www.lenhook.com/, Count: 1, Link text: Nuclear'Atk, Url: lcx.cc
http://hi.baidu.com/heilifubolg/home, Count: 1, Link text: Nuclear'Atk blog, Url: lcx.cc
http://hi.baidu.com/南拳daddy/home, Count: 1, Link text: Nuclear'Atk blog, Url: lcx.cc
http://hi.baidu.com/dragoneeg/home, Count: 1, Link text: 核攻击网络安全, Url: lcx.cc
http://www.cnlonger.org/ --> Not Found!
http://t00ls.blog.163.com/ --> Not Found!
http://www.r00ts.info/, Count: 2, Link text: https://lcx.cc/?cc=showuser, Url: lcx.cc
http://hi.baidu.com/hkmaya66/home/home, Count: 1, Link text: 核攻击, Url: lcx.cc
http://hackhexin.tk --> Not Found!
http://hi.baidu.com/canghaiwuhen/home --> Not Found!
http://www.yuluo.org/, Count: 1, Link text: Nuclear'Atk, Url: lcx.cc
http://www.ayhacker.net/, Count: 1, Link text: Nuclear'Atk, Url: lcx.cc
http://hi.baidu.com/ciqing_s/home, Count: 1, Link text: Nuclear'Atk、blo, Url: lcx.cc
http://itrobin.com/, Count: 1, Link text: Nuclear'Atk, Url: lcx.cc
http://hi.baidu.com/hackxl96/home, Count: 1, Link text: Nuclear'Atk, Url: lcx.cc
http://www.cmdsir.com/, Count: 1, Link text: Nuclear'Atk, Url: lcx.cc
http://www.hack1990.com/, Count: 1, Link text: Nuclear'Atk, Url: lcx.cc
http://hi.baidu.com/%C9%C1%B5%E7%D0%A1%D7%D3_tysan/home, Count: 1, Link text: Nuclear'Atk, Url: lcx.cc
http://hi.baidu.com/artcracker/home, Count: 1, Link text: Nuclear'Atk 博客, Url: lcx.cc
http://hi.baidu.com/bian花/home, Count: 1, Link text: Nuclear'Atk, Url: lcx.cc
http://hi.baidu.com/chaizp/home, Count: 1, Link text: Nuclear'Atk 博客, Url: lcx.cc
http://hi.baidu.com/danlianyizhihua/home, Count: 1, Link text: Nuclear'Atk 博客, Url: lcx.cc
http://hi.baidu.com/drak_影/home, Count: 1, Link text: Nuclear'Atk, Url: lcx.cc
http://hi.baidu.com/f4tb0y%5F/home, Count: 1, Link text: Nuclear'Atk, Url: lcx.cc
http://hi.baidu.com/hack_slying/home, Count: 1, Link text: Nuclear'Atk 博客, Url: lcx.cc
http://hi.baidu.com/hackerbxs/home, Count: 1, Link text: Nuclear'Atk_核攻, Url: lcx.cc
http://hi.baidu.com/hacklsh/home, Count: 1, Link text: Nuclear'Atk 博客, Url: lcx.cc
http://hi.baidu.com/hhhacker/home, Count: 1, Link text: Nuclear'Atk, Url: lcx.cc
http://hi.baidu.com/justincom/home, Count: 1, Link text: Nuclear'Atk 博客, Url: lcx.cc
http://hi.baidu.com/neuin/home, Count: 1, Link text: Nuclear'Atk, Url: lcx.cc
http://hi.baidu.com/q1018554277/home, Count: 1, Link text: Nuclear'Atk, Url: lcx.cc
http://hi.baidu.com/scjhack/home, Count: 1, Link text: Nuclear'Atk, Url: lcx.cc
http://hi.baidu.com/smowu/home, Count: 1, Link text: Nuclear'Atk, Url: lcx.cc
http://hi.baidu.com/wdlei/home, Count: 1, Link text: Nuclear' Atk, Url: lcx.cc
http://hi.baidu.com/wenroudaoke/home, Count: 1, Link text: lcx, Url: lcx.cc
http://hi.baidu.com/顶级葙守/home, Count: 1, Link text: 核攻击's Blog, Url: lcx.cc
http://kook.at/, Count: 1, Link text: Nuclear'Atk 博客, Url: lcx.cc
http://t00ls.in/ --> Error!
http://www.0855.tv/, Count: 1, Link text: Nuclear'Atk, Url: lcx.cc
http://www.cmd58.com/, Count: 1, Link text: Nuclear'Atk, Url: lcx.cc
http://www.f4le.com/ --> Not Found!
http://www.fuxkit.com/, Count: 1, Link text: Nuclear 'Atk 博客, Url: lcx.cc
http://www.hack6.com/, Count: 1, Link text: Nuclear'Atk, Url: lcx.cc
http://www.iliangjian.com/, Count: 1, Link text: 吐司核攻击, Url: lcx.cc
http://www.shellsec.com/, Count: 1, Link text: Nuclear'Atk ?????¢, Url: lcx.cc
http://www.oldjun.com/ --> Not Found!
http://www.yesck.com/, Count: 1, Link text: Nuclear'Atk, Url: lcx.cc
Done!

数据说明:

最前边为当前检查的链接,Count 代表正则表达匹配结果数量,Link text 为第一个结果中的链接文字,Url 为第一个结果中的链接地址。

没有找到本站链接(0个匹配结果),则显示:Not Found!,这个就要注意了,为了准确,手动再去看看。

Error! 表示下载目标 Url 的时候发生错误,没有取到数据,这说明目标网站无法访问。

留言评论(旧系统):

【匿名者】 @ 2012-03-17 13:12:29

这个给力,百度的博客还要手工写link.txt。有没有批量导出?

本站回复:

擦,你就懒得右键 --> 查看源代码 --> 复制、粘贴 --> 简单的整理下么……

佚名 @ 2014-04-07 11:06:36

为何不用站长工具

本站回复:

因为它不好用

佚名 @ 2016-02-22 00:45:59

核老大好像好久没更新文章了。。

本站回复:

最近比较忙,还有很多东西不能发布,所以~

文章来源于lcx.cc:使用 vbs 批量全自动检查友情链接 + 源码

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: