ELM 2007/11/26 23:27
NOD32 病毒库镜像脚本 NOD32.php
[code]<?
// author: soff
$LOCALDIR = 'c:\\www';
$UPDATEDIR = 'c:\\www\\nod_upd';
$WGET = 'c:\\cygwin\\bin\\wget.exe';
$UNRAR = '"c:\Program Files\WinRAR\UnRAR.exe"';
$UPDATE_SERVER = 'http://u3.eset.com/';
$USER = 'AV-2631376';
$PASS = '8yoi8b38ax';
$ignore = array('cz.nup', 'fr.nup', 'ge.nup', 'it.nup', 'jp.nup', 'pl.nup
', 'pt.nup', 'sk.nup', 'sp.nup', 'hr.nup', 'hu.nup', 'nl.nup');
if (!is_dir($LOCALDIR))
mkdir($LOCALDIR);
if (!is_dir($UPDATEDIR))
mkdir($UPDATEDIR);
exec("$WGET -t 9 -T 9 -N -nH -nd -P $UPDATEDIR {$UPDATE_SERVER}nod_upd/update
.ver", $output, $ret);
if ($ret > 0) {
echo 'Failed while downloading update.ver.';
exit;
}
exec("$UNRAR x -o+ {$UPDATEDIR}\update.ver", $output, $ret);
if ($ret > 0) {
echo 'Failed while extracting update.ver.';
exit;
}
$content = file_get_contents('update.ver');
preg_match_all("/file=(.+?)\n/ie", $content, $matches);
$list = '';
foreach($matches[1] as $match) {
$match = trim($match);
$last = substr($match, -6);
if (!in_array($last, $ignore))
$list .= "{$UPDATE_SERVER}$match\r\n";
}
file_put_contents('list.txt', $list);
exec("$WGET --http-user=$USER --http-passwd=$PASS -t 9 -T 9 -m -nH -P $LOCALDIR
-i list.txt", $output, $ret);
if ($ret > 0) {
echo 'Failed while downloading files.';
exit;
}
echo 'Updated successfully.';
?>[/code]From: [url]http://zhanjun.net/?q=node/34[/url]