前段时间写的一个小脚本,用来检查大量域名注册情况,源码如下:
Function echo(s) Wscript.Echo s End Function Public Function MidStr(s, a, b) '从指定字符串中截取两个字符串中间的字符:截取S中从A与B之间的字符串 Dim tmp IF InStr(s, a) > 0 And InStr(s, b) > 0 Then '判断特征字符是否存在 tmp = Mid(s, InStr(s, a) + Len(a)) '从s中截取所有a首次出现位置之后的字符 If InStr(tmp, b) > 0 Then '判断截取位置是否正确 tmp = Left(tmp, InStr(tmp, b) - 1) '在tmp中截取从开始到B首次出现位置之前的字符串 Else tmp = "" End IF End IF MidStr = tmp End Function Public Function FixStr(ByVal S) '删除字符串首尾空格、回车、换行 Do While Left(S, 1) = vbCr Or Left(S, 1) = vbLf Or Left(S, 1) = " " '删除字符串首:空格、回车、换行 S = Mid(S, 2) 'Echo Asc(Left(S, 1)) Loop Do While Right(S, 1) = vbCr Or Right(S, 1) = vbLf Or Right(S, 1) = " " '删除字符串尾:空格、回车、换行 S = Left(S, Len(S) - 1) 'Echo Asc(Right(S, 1)) Loop FixStr = S End Function Public Function GetRndItem(b) '从字符串数组中随机挑选一条 'Randomize 不能写在函数内部,会导致短时间间隔内相邻两次随机数一致,写在程序开始位置即可 GetRndItem = b(Int((UBound(b) - LBound(b) + 1) * Rnd + LBound(b))) '根据数组上、下标产生随机数,并获取该条数据 End Function Public Function RndNum(ByVal MinNum, ByVal MaxNum) '生成指定范围的随机数字(最小数,最大数):MinNum <= 返回值 <= MaxNum 'Randomize 不能写在函数内部,会导致短时间间隔内相邻两次随机数一致,写在程序开始位置即可 RndNum = Int((MaxNum - MinNum + 1) * Rnd + MinNum) '生成随机数字 End Function function geturl(url) Dim WinHttp Set WinHttp = CreateObject("WinHttp.WinHttpRequest.5.1") WinHttp.Open "GET", url, False '--------- '读取http代理列表(配合代理之王,防止封IP) if fso.FileExists("proxy.txt") then dim p p = split(FixStr(fso.OpenTextfile("proxy.txt", 1, False).Readall), vbcrlf) WinHttp.SetProxy 2, GetRndItem(p) '设置http代理 end if '--------- Randomize WinHttp.SetRequestHeader "Connection", "Close" WinHttp.SetRequestHeader "User-Agent", Int((99999999 * Rnd) + 11111111) WinHttp.SetRequestHeader "X-Forwarded-For", Int((255 * Rnd) + 1) & "." & Int((255 * Rnd) + 1) & "." & Int((255 * Rnd) + 1) & "." & Int((255 * Rnd) + 1) '--------- WinHttp.Send 'geturl = "status = " & WinHttp.Status & ", size = " & len(WinHttp.ResponseText) 'geturl = Bytes2BSTR(WinHttp.ResponseBody) geturl = WinHttp.ResponseText end function public function check(s) dim html, tmp html = geturl("http://panda.www.net.cn/cgi-bin/check.cgi?area_domain=" & s) if instr(html, "|216|") > 0 or instr(html, "<original>") = 0 then '|216|Query frequency is too high, please try again later check = html 'echo html 'wscript.quit else tmp = now & _ ", " & midstr(html, "<returncode>", "</returncode>") & _ ", " & midstr(html, "<key>", "</key>") & _ ", " & midstr(html, "<original>", "</original>") check = tmp fso.OpenTextFile(f, 8, True).WriteLine tmp end if end function '--------------------------------------------------------------------------------------------------- echo "--------------------------------------------------" echo "批量检查域名是否已注册(抢注域名神器)" echo "" echo "by: Nuclear'Atk" echo "qq: 624118310(root@lcx.cc)" echo "blog: https://lcx.cc/" echo "usage:" echo " cscript check.vbs mode number_start number_end domain_length domain_type" echo "example:" echo " cscript /nologo check.vbs order 1111 2222 5 .com" echo " cscript /nologo check.vbs random 1111 2222 5 .com" echo "--------------------------------------------------" on error resume next Randomize dim fso set fso = CreateObject("Scripting.FileSystemObject") '获取参数 if WScript.Arguments.Count <> 5 then '参数不对则退出 echo "arguments count error!" wscript.quit else dim m, s, e, l, t, f m = WScript.Arguments(0) '生成模式(随机或顺序) s = WScript.Arguments(1) '起始数字 e = WScript.Arguments(2) '结束数字 l = WScript.Arguments(3) '域名长度 t = WScript.Arguments(4) '域名后缀 f = l & t & ".txt" '日志文件名 end if '批量生成域名并查询 dim x select case m case "order" '按顺序产生 dim i for i = s to e x = right(replace(space(l), " ", "0") & i, l) & t '组成域名 if instr(fso.OpenTextfile(f, 1, False).Readall, x) = 0 then '只查询没查过的域名(判断日志文件中是否存在该域名) echo check(x) else echo now & ", " & x & ", pass..." end if next echo now & ", done!" case "random" '随机产生 do x = right(replace(space(l), " ", "0") & RndNum(s, e), l) & t '组成域名 if instr(fso.OpenTextfile(f, 1, False).Readall, x) = 0 then '只查询没查过的域名(判断日志文件中是否存在该域名) echo check(x) else echo now & ", " & x & ", pass..." end if loop case else echo "mode error!" end select
说明及用法:
-------------------------------------------------- 批量检查域名是否已注册(抢注域名神器) by: Nuclear'Atk qq: 624118310(root@lcx.cc) blog: https://lcx.cc/ usage: cscript check.vbs mode number_start number_end domain_length domain_type example: cscript /nologo check.vbs order 1111 2222 5 .com cscript /nologo check.vbs random 1111 2222 5 .com --------------------------------------------------
由于当时只用来抢注数字域名,所以只具备两个模式:
1、按顺序生成特定位数、后缀的数字域名,并且检查。
2、随机生成特定位数、后缀范围内的数字域名,并且检查,适合在域名范围很大的情况下使用,例如检查7位数字域名,总量在百万以上,全部检查扫描一遍时间太久,则使用随机产生方式撞运气(会过滤掉已检查的重复域名),效率更快。
稍微改改代码,就可以检查拼音域名,或其他特定字典生成域名,支持任何后缀!
可以同时开启几十个进程协同工作(数量无上限),本人测试开启50进程同步扫描,峰值每秒扫描30-40个域名(5位数字com域名,一小时即可全部扫完!),使用 cmd 命令或者批处理即可实现,例子代码如下:
echo off & color a & cls rem setlocal EnableDelayedExpansion rem for /l %%i in (0,500,9999) do @( rem set /a sum=%%i+499 rem echo cscript check.vbs order %%i !sum! 4 .cc rem start cscript check.vbs order %%i !sum! 4 .cc rem ) for /l %%i in (1,1,10) do @( start cscript check.vbs random 0 99999 5 .cc ) rem pause
注意!如果同时开启多个进程协同工作,则需要配合“King Of The Proxy (代理之王) v1.0 发布、HTTP代理采集、验证工具”,用法很简单,使用代理之王验证完IP后,结果保存到同目录“proxy.txt”(默认文件名)即可自动调用,防止IP被封。
使用的接口为万网接口:http://panda.www.net.cn/cgi-bin/check.cgi?area_domain=baidu.com
返回值及含义(每个域名后缀都不一样,自己测一下就知道了):
210 : Domain name is available
211 : Domain name is not available
212 : Domain name is invalid
214 : Unknown error
其他功能及用法,交给各位自己发现吧!
留言评论(旧系统):