标题: [其他] 免费杀软ClamAV命令行版的自动获得 [打印本页]
作者: lifenjoiner 时间: 2010-9-25 23:27 标题: 免费杀软ClamAV命令行版的自动获得
这里不提供下载,而是实现自动下载!
工具:wget + 7za + 2 bat + 1 vbs
NewClamAV.bat- @echo off
- setlocal enabledelayedexpansion
- pushd "%~dp0"
- set tpd=bak
- set ds="%cd%"\db
- set uf=%ds%\update.txt
- set pf=main.cvd bytecode.cvd safebrowsing.cvd daily.cvd
- set wf=%ds%\ClamAV.html
- set pl=%ds%\ClamAVUrl.txt
- set wb=http://db.local.clamav.net
- set ewb=http://sourceforge.net/projects/clamav/files/clamav/win32
-
- if not exist %tpd% md %tpd%
-
- if exist %uf% echo.上次更新时间: &type %uf%
-
- echo.转移现有版本
- for /f "usebackq" %%f in (`dir /b /o:ge`) do (
- if not %%~xf==.bat move /Y %%f %tpd%\
- )
- :可以是其它工具下载好的
- move /Y %tpd%\*.zip .\
-
- echo.准备
- if not exist %ds% md %ds%
-
-
- echo.look for newest engine ...
- wget -O %wf% -c http://www.clamav.net/lang/en/download/sources
-
- cscript /H:cscript
- GetUrlFromUrl.vbs %wf% |findstr .*\.tar\.gz\.sig >%pl%
- cscript /H:wscript
-
- for /f "usebackq" %%e in (`type %pl%`) do (
- set pkg=%%e
- )
- set pkg=!pkg:http://downloads.sourceforge.net/clamav/clamav=ClamAV!
- set pkg=!pkg:.tar.gz.sig=-win32!
-
- echo.download newest engine ...
- wget -O %pkg%.zip -c %ewb%/%pkg%.zip/download || goto :EOF
- 7za e -o"%cd%" %pkg%.zip *\*.*
-
- echo.download newest db ...
- del /q db\*.cvd
- for %%d in (%pf%) do (
- wget.exe -O %ds%\%%d -c "%wb%/%%d"
- )
- echo downloading completed.
- echo %date% %time% > %uf%
- del /q %wf% %pkg%.zip
- endlocal
- popd
复制代码
GetUrlFromUrl.vbs- 'Usage:
- 'CScript %Epath%\GetUrlFromUrl <url> [FileWriteTo]
-
- On Error Resume Next
-
- set objArgs = WScript.Arguments
- url=objArgs(0)
- txtfl=objArgs(1)
-
- set IE=CreateObject("InternetExplorer.Application")
- IE.navigate("about:blank")
- 'IE.visible=true
-
- IE.navigate(url)
-
- set wd=IE.Document
-
- do
- WScript.Sleep(100)
- loop while IE.readyState<>4
-
- set olinks=wd.links
- for each link in olinks
- lstr=lstr&vbCrLf&link.href
- next
- IE.Quit()
-
- WScript.Echo(lstr)
复制代码
ScanWithClamAV.bat- @echo off
- setlocal
- ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
- set egn=clamscan.exe
- set hlp=-h
- set swch=%* --database=db --recursive=yes --verbose --bell
- set tip=-=[I can't clean but can move/rename the infected files...]=-$_-=[I'm a Linux Style Software...]=-
- ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
- cd /d "%~dp0"
-
- if "h"%*=="h" (goto showhelp) else (goto doscan)
-
- :showhelp
- %egn% %hlp%
- goto waitshow
-
- :doscan
- %egn% %swch%
-
- :waitshow
- echo.
- echo %tip%
- pause
复制代码
使用方法:
把三个脚本放一目录,运行NewClamAV.bat,自动获得最新扫描引擎及病毒库。
ScanWithClamAV.bat只是便宜放在SendTo的。
另:
脚本不是一个时期完成的,风格难免有所差异,见谅!
这个什么ClamAV估计你不满意(:,不过,大蜘蛛、小红伞……也是可以的,自己动手吧^_^
[ 本帖最后由 lifenjoiner 于 2010-9-28 19:51 编辑 ]
作者: 523066680 时间: 2010-9-28 08:59
感觉不错阿 ,俺正在ubuntu,等回win了看看。
作者: yahan 时间: 2010-12-25 21:39
这么好的东东怎么没人顶啊
欢迎光临 批处理之家 (http://www.bathome.net/) |
Powered by Discuz! 7.2 |