Счастливым обладателям nod32 standart версии <= 2.7 (и создание своего зеркала)Помощь в создании сервера обновлений для nod32 версий 2.X "Стандарт" без наличия nod32 административного.
(статья появилась в связи с наличием текущих версий 3.X :), но надеюсь кому и поможет | | Автор статьи: smaharbA | Редакторы: Последняя редакция №10 от 10.04.09 | История URL: http://kb.mista.ru/article.php?id=723 | |
Ключевые слова: антивирус, antivirus, eset, nod32
Создаем два файлика, первый update.vbs, второй eset-sched.reg
помещаем в папку %programfiles%\Eset\updfiles, выполняем их поочередно.
Все теперь можно копировать папку %programfiles%\Eset\updfiles на сменный носитель с именем *:\nod_upd и обновлять с него антивирус на других компьютерах. Теперь о главном (создания сервера обновлений)
Пуск - Настройка - Панель управления - Установка и удаление программ. Нажимаем "Установка компонентов Windows", отмечаем "Сервер приложений" и/или "Службы IIS". После установки заходим в оснастку "Диспетчер служб IIS" (или в соответствующую для текущей системы), раскрываем узел "Веб-узлы", далее правой кнопкой мыши - "Создать Веб-узел", даем название новому узлу "Обновление антивируса", выбираем порт 8081 (можно любой другой, но выбрал этот по аналогии с портом nod32 admin), задаем домашний каталог для веб-узла %programfiles%\Eset\updfiles, отмечаем "Чтение" и "Обзор" (для проверки). Далее на вновь созданном веб-узле правой кнопкой "Свойства" переходим на вкладку "Заголовки HTTP", по кнопке "Типы MIME" создаем новый тип, заполняем в форме поля "Расширение" и "Тип MIME" следующим ".*" (без кавычек конечно). Проверяем созданный веб-узел набирав в адресной строке браузера http://localhost:8081, так же проверяем с другого компьютера заменив localhost на IP-адрес компьютера обновлений. Вы должны увидеть список файлов каталога %programfiles%\Eset\updfiles и попробовать скачать любой файл, если нет доступа или невиден перечень файлов читаем справку по "Службам IIS" и настраиваем заново.
Для создания сервера обновлений не обязательно использовать IIS подойдет любой веб-сервер либо вообще использовать "Общую папку" в сети Netbios (Windows) (об этом писать не стал, литературы предостаточно).
Содержимое файлов:
update.vbs
set fso=createobject("scripting.filesystemobject")
set updatefolder=fso.getfile(WScript.ScriptFullName).parentfolder
set upd=fso.opentextfile(updatefolder.path & "\lastupd.ver",1,-1)
update=replace(upd.readall,vbcrlf,vbcr)
upd.close
set re=new RegExp
re.global=true
re.ignorecase=true
re.pattern="\[(.*?)\]"
set m=re.execute(update)
updatever=""
for each c in m
s=c.value
re.pattern=replace(replace(s,"]",""),"[","name=")
for each f in updatefolder.files
if left(ucase(f.name),3)="NOD" and right(ucase(f.name),4)=".NUP" then
set file=f.openastextstream()
i=0
do while (not file.atendofstream) and (i<20)
if re.test(file.readline) then
s=replace(replace(s,"]","\]"),"[","\[")
re.pattern="\r" & s & "\rversion=.*?size=\d+"
set mn=re.execute(update)
for each n in mn
re.pattern="\rfile=.*?\r"
updatever=updatever & re.replace(n.value,vbcr & "file=" & f.name & vbcr) & vbcr
next
exit do
end if
i=i+1
loop
file.close
end if
next
next
re.pattern="\r\[.*?\]\rversion=.*?size=\d+"
if re.test(updatever) then
fso.opentextfile(updatefolder.path & "\update.ver",2,true).write(replace(updatever,vbcr,vbcrlf))
end if
eset-sched.reg
REGEDIT4
[HKEY_LOCAL_MACHINE\SOFTWARE\Eset\Nod\CurrentVersion\Scheduler\646338398]
"Params"=hex:3c,3f,78,6d,6c,20,76,65,72,73,69,6f,6e,3d,22,31,2e,30,22,3f,3e,0a,\
3c,4e,4f,44,33,32,5f,43,4f,4d,4d,3e,0a,20,3c,53,43,48,45,44,55,4c,45,44,5f,\
54,41,53,4b,20,50,4c,55,47,49,4e,3d,22,36,43,35,30,34,33,34,33,22,20,41,43,\
54,49,4f,4e,3d,22,30,22,20,44,45,53,43,52,49,50,54,49,4f,4e,3d,22,77,73,63,\
72,69,70,74,2e,65,78,65,22,3e,0a,20,20,3c,44,41,54,41,3e,0a,20,20,20,3c,4e,\
4f,44,45,20,4e,41,4d,45,3d,22,46,49,4c,45,4e,41,4d,45,22,20,56,41,4c,55,45,\
3d,22,25,73,79,73,74,65,6d,72,6f,6f,74,25,5c,73,79,73,74,65,6d,33,32,5c,77,\
73,63,72,69,70,74,2e,65,78,65,22,20,54,59,50,45,3d,22,53,54,52,49,4e,47,22,\
20,2f,3e,0a,20,20,20,3c,4e,4f,44,45,20,4e,41,4d,45,3d,22,44,49,52,45,43,54,\
4f,52,59,22,20,56,41,4c,55,45,3d,22,25,70,72,6f,67,72,61,6d,66,69,6c,65,73,\
25,5c,45,73,65,74,5c,75,70,64,66,69,6c,65,73,22,20,54,59,50,45,3d,22,53,54,\
52,49,4e,47,22,20,2f,3e,0a,20,20,20,3c,4e,4f,44,45,20,4e,41,4d,45,3d,22,43,\
4d,44,4c,49,4e,45,22,20,56,41,4c,55,45,3d,22,2f,2f,62,20,75,70,64,61,74,65,\
2e,76,62,73,22,20,54,59,50,45,3d,22,53,54,52,49,4e,47,22,20,2f,3e,0a,20,20,\
3c,2f,44,41,54,41,3e,0a,20,3c,2f,53,43,48,45,44,55,4c,45,44,5f,54,41,53,4b,\
3e,0a,3c,2f,4e,4f,44,33,32,5f,43,4f,4d,4d,3e,0a,00
"Name"="Создание зеркала"
"ActionCode"=dword:00000000
"ModuleID"=dword:6c504343
"TriggerType"=dword:00000004
"TriggerSettings"=dword:00030000
"StartFailSettings"=dword:00000000
"Enabled"=dword:00000001
"LastExec"=dword:4948c941
[HKEY_LOCAL_MACHINE\SOFTWARE\Eset\Nod\CurrentVersion\Scheduler\646339407]
"Params"=hex:3c,3f,78,6d,6c,20,76,65,72,73,69,6f,6e,3d,22,31,2e,30,22,3f,3e,0a,\
3c,4e,4f,44,33,32,5f,43,4f,4d,4d,3e,0a,20,3c,53,43,48,45,44,55,4c,45,44,5f,\
54,41,53,4b,20,50,4c,55,47,49,4e,3d,22,36,43,35,30,34,33,34,33,22,20,41,43,\
54,49,4f,4e,3d,22,30,22,20,44,45,53,43,52,49,50,54,49,4f,4e,3d,22,77,73,63,\
72,69,70,74,2e,65,78,65,22,3e,0a,20,20,3c,44,41,54,41,3e,0a,20,20,20,3c,4e,\
4f,44,45,20,4e,41,4d,45,3d,22,46,49,4c,45,4e,41,4d,45,22,20,56,41,4c,55,45,\
3d,22,25,73,79,73,74,65,6d,72,6f,6f,74,25,5c,73,79,73,74,65,6d,33,32,5c,77,\
73,63,72,69,70,74,2e,65,78,65,22,20,54,59,50,45,3d,22,53,54,52,49,4e,47,22,\
20,2f,3e,0a,20,20,20,3c,4e,4f,44,45,20,4e,41,4d,45,3d,22,44,49,52,45,43,54,\
4f,52,59,22,20,56,41,4c,55,45,3d,22,25,70,72,6f,67,72,61,6d,66,69,6c,65,73,\
25,5c,45,73,65,74,5c,75,70,64,66,69,6c,65,73,22,20,54,59,50,45,3d,22,53,54,\
52,49,4e,47,22,20,2f,3e,0a,20,20,20,3c,4e,4f,44,45,20,4e,41,4d,45,3d,22,43,\
4d,44,4c,49,4e,45,22,20,56,41,4c,55,45,3d,22,2f,2f,62,20,75,70,64,61,74,65,\
2e,76,62,73,22,20,54,59,50,45,3d,22,53,54,52,49,4e,47,22,20,2f,3e,0a,20,20,\
3c,2f,44,41,54,41,3e,0a,20,3c,2f,53,43,48,45,44,55,4c,45,44,5f,54,41,53,4b,\
3e,0a,3c,2f,4e,4f,44,33,32,5f,43,4f,4d,4d,3e,0a,00
"Name"="Создание зеркала"
"ActionCode"=dword:00000000
"ModuleID"=dword:6c504343
"TriggerType"=dword:00000004
"TriggerSettings"=dword:00040000
"StartFailSettings"=dword:00000000
"Enabled"=dword:00000001
"LastExec"=dword:4948c962
PS: Немного дополнив файл eset-sched.reg можно обойти ограничение пробной версии, но это уже выходит за рамки правил.
Продолжаем разговор :)
Создаем каталог к примеру c:\avir_upd
в нем создадим скрипт(ы) с именами eset_upd.vbs и(или) nod_upd.vbs (это кому какое зеркало нужно, первое для версии 3.x второе для 2.x, можно и оба скрипта)
с таким содержимым, содержимое у обеих одинаковое, важно название - обязательно eset_upd.vbs и nod_upd.vbs
dim files,servers,afiles,aservers
filefullname=false
timeout=1
set fso=createobject("scripting.filesystemobject")
set script=fso.getfile(wscript.scriptfullname)
files=fso.GetBaseName(script.path) & ".files"
servers=fso.GetBaseName(script.path) & ".servers"
if not fso.fileexists(files) then
msgbox "Нет списка скачиваемых файлов"
end if
if not fso.fileexists(files) then
msgbox "Нет списка сереров обновлений"
end if
folder=fso.GetFile(script.path).parentfolder.path & "\" & fso.GetBaseName(script.path)
afiles=readfile(files)
aservers=readfile(servers)
if lbound(aservers)=-1 then
msgbox "Список серверов обновлений пуст"
end if
if lbound(afiles)=-1 then
msgbox "Список скачиваемых файлов пуст"
end if
on error resume next
n=0
for each c in aservers
if readserver(trim(c),timeout)=200 then
if not fso.folderexists(folder) then
fso.createfolder(folder)
end if
stat=0
for n=n to ubound(afiles)
if right(trim(c),1)="/" then
c=left(trim(c),len(trim(c))-1)
end if
path="/" & fso.GetBaseName(c)
if afiles(n)<>"update.ver" then
if left(path,instr(path,"_")-1)="/nod" then
path="/" & mid(path,instr(path,"_")+1) & "/engine"
else
path="/" & mid(path,instr(path,"_")+1) & "/engine3"
end if
end if
stat=filefromserver(fso.GetParentFolderName(c) & path,afiles(n),folder,timeout)
if stat<>200 then
exit for
end if
next
if stat=200 then
updatever folder
wscript.quit
end if
end if
next
function readfile(byval file)
dim str,arr(),f,k, fso
set fso=createobject("scripting.filesystemobject")
redim arr(-1)
set f=fso.opentextfile(file)
k=-1
do while not f.atendofstream
str=trim(f.readline)
if trim(str)<>"" then
k=k+1
redim preserve arr(k)
arr(k)=str
end if
loop
f.close
readfile=arr
end function
function readserver(byval server, byval ftimeout)
set http=createobject("WinHttp.WinHttpRequest.5.1")
on error resume next
http.Open "GET",server & "/update.ver",0
http.send
if err.number<>0 then
exit function
end if
on error goto 0
tstart=now
do while datediff("s",tstart,now)<=ftimeout and not http.status
wscript.sleep 100
loop
readserver=http.status
end function
function filefromserver(byval server, byval file, byval fold, byval ftimeout)
dim status, stream, f
filefromserver=0
set http=createobject("WinHttp.WinHttpRequest.5.1")
on error resume next
http.Open "GET",server & "/" & file,0
http.send
if err.number<>0 then
exit function
end if
on error goto 0
tstart=now
do while datediff("s",tstart,now)<=ftimeout and not http.status
status=http.status
wscript.sleep 100
loop
if status=200 then
set stream=createobject("adodb.stream")
stream.type=1
stream.open
stream.write(http.responseBody)
stream.savetofile fold & "\" & file,2
stream.close
end if
filefromserver=status
end function
function updatever(byval fold)
dim fso,k,names(),str, path
path=""
set regexp=createobject("vbscript.regexp")
regexp.pattern="\[update_info\](.*?)\[update_data\]"
regexp.ignorecase=true
regexp.global=true
set regexp2=createobject("vbscript.regexp")
regexp2.pattern="\rname=(.*?)\r|^name=(.*?)\r"
regexp2.ignorecase=true
regexp2.global=true
set fso=createobject("scripting.filesystemobject")
set fo=fso.getfolder(fold)
set upd=fso.opentextfile(fo.path & "\update.ver",2,true)
for each f in fo.files
if lcase(fso.GetExtensionName(f.path))="nup" then
set fs=f.OpenAsTextStream(1)
str=""
do while not fs.atendofstream and fs.line<25
str=str & replace(trim(fs.readline),chr(0),"") & vbcr
loop
if regexp.test(str) then
str=regexp.execute(str)(0).SubMatches(0)
str=regexp2.replace(str,"[$1]" & vbcr)
do while instr(str,vbcr & vbcr)
str=replace(str,vbcr & vbcr,vbcr)
loop
if filefullname then
path="/" & fso.GetBaseName(script.path) & "/"
end if
str=str & "file=" & path & f.name & vbcr & "size=" & f.size & vrcr
str=replace(str,vbcr,vbcrlf)
upd.writeline(str)
end if
fs.close
end if
next
upd.close
end function
|