中国DOS联盟

-- 联合DOS 推动DOS 发展DOS --

联盟域名:www.cn-dos.net 论坛域名:www.cn-dos.net/forum
DOS,代表着自由开放与发展,我们努力起来,学习FreeDOS和Linux的自由开放与GNU精神,共同创造和发展美好的自由与GNU GPL世界吧!

中国DOS联盟论坛
现在时间是 2026-08-02 21:38
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » 用CURL更新病毒库 查看 1,031 回复 7
楼 主 用CURL更新病毒库 发表于 2006-12-22 05:36 ·  中国 上海 电信
高级用户
★★★
积分 916
发帖 377
注册 2004-03-08 00:00
22年会员
UID 19523
性别 男
状态 离线
我每天需要上
http://www.symantec.com/avcenter/download/pages/CS-N95.html
下载病毒库20061220-018-x86.exe

请问如何用CURL来下载每天都更换文件名的病毒库文件

[ Last edited by dato on 2006-12-26 at 02:39 AM ]
2 发表于 2006-12-22 06:12 ·  中国 甘肃 兰州 电信
金牌会员
★★★★
积分 4,103
发帖 1,744
注册 2006-01-20 13:00
20年会员
UID 49241
性别 男
来自 甘肃.临泽
状态 离线
再修改下用,我只是粗劣的写了下

wget -O test.txt "http://www.symantec.com/avcenter/download/pages/CS-N95.html"

for /f "tokens=1,* delims==" %%a in ('type test.txt^|findstr "http://.*-018-x86.exe"') do (
for /f "tokens=1 delims=>" %%? in ('echo "%%b"') do (set "url=%%?")
)
call :down %url%
goto eof
:down
wget %~1
goto :eof

[ Last edited by vkill on 2006-12-22 at 06:41 AM ]
3 发表于 2006-12-22 06:14 ·  中国 甘肃 兰州 电信
金牌会员
★★★★
积分 4,103
发帖 1,744
注册 2006-01-20 13:00
20年会员
UID 49241
性别 男
来自 甘肃.临泽
状态 离线
建议楼主把标题改下

2003下test通过
E:\test>wget "http://definitions.symantec.com/defs/20061220-018-i32.exe
--17:10:07-- http://definitions.symantec.com/defs/20061220-018-i32.exe
=> `20061220-018-i32.exe'
Resolving definitions.symantec.com... done.
Connecting to definitions.symantec.com:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 13,591,304

19% 2,590,314 81.96K/s ETA 02:11

[ Last edited by vkill on 2006-12-22 at 06:16 AM ]
4 发表于 2006-12-22 06:24 ·  中国 江苏 苏州 联通
银牌会员
★★★
积分 1,181
发帖 533
注册 2006-08-14 12:54
19年会员
UID 60484
状态 离线

@echo off
for /f "tokens=5 delims=<=>" %%i in ('curl -s "http://www.symantec.com/avcenter/download/pages/CS-N95.html"^|find "x86.exe"') do set src=%%i
for /f "tokens=6 delims=/." %%i in ("%src%") do set dst=%%i.exe
:LOOP
curl --connect-timeout 30 -m 30 -Y 6144 -y 60 -o %dst% %src%||ping -n 10 127.1>nul & GOTO :LOOP

少许用过些 curl ,你试试能不能用。

[ Last edited by NaturalJ0 on 2006-12-22 at 06:27 AM ]
5 发表于 2006-12-22 06:25 ·  中国 北京 联通
金牌会员
★★★★
积分 2,902
发帖 1,147
注册 2006-09-21 12:00
19年会员
UID 63324
性别 男
状态 离线
再贴一个 CURL 的~:)

不管服务器上有没有文件,都会试图下载以当天命名的文件,如:当天日期-018-x86.exe
服务器上如果没有当天更新的文件,则退出。


@echo off

set "info=http://definitions.symantec.com/defs/"
for /f "tokens=1-3 delims=- " %%i in ('date /t') do curl -O %info%%%i%%j%%k-018-x86.exe




 
    Redtek,一个永远在网上流浪的人……

_.,-*~'`^`'~*-,.__.,-*~'`^`'~*-,._,_.,-*~'`^`'~*-,._,_.,-*~'`^`'~*-,._
6 发表于 2006-12-22 06:28 ·  中国 江苏 苏州 联通
银牌会员
★★★
积分 1,181
发帖 533
注册 2006-08-14 12:54
19年会员
UID 60484
状态 离线
楼上方法挺好,但可能不熟悉 Norton ,官网上的包经常是昨天的,有时候是前天的,很少有今天的。
7 发表于 2006-12-26 02:43 ·  中国 上海 虹口区 电信
高级用户
★★★
积分 916
发帖 377
注册 2004-03-08 00:00
22年会员
UID 19523
性别 男
状态 离线
谢谢大家问题解决,2楼的脚本比较简单

NaturalJ0的脚本可能加了下载参数所以经常出现
curl:<28> Operation timed out after 30 seconds with 1486590 out of 16383336 bytes received
而且这东东不支持续传功能又从头开始下载了,当然这主要可能是我这里的TCP IDE timeout设得太过于小了,

再次谢谢大家的脚本
8 发表于 2006-12-26 04:58 ·  中国 江苏 苏州 联通
银牌会员
★★★
积分 1,181
发帖 533
注册 2006-08-14 12:54
19年会员
UID 60484
状态 离线
不好意思,那个 -m 后面的数字应该大些的,我平常写 600 的,那天不知怎么,写了 30。 直接导致你使用时每 30 秒断一次。而且忘记加上续传功能。= =b

@echo off
for /f "tokens=5 delims=<=>" %%i in ('curl -s "http://www.symantec.com/avcenter/download/pages/CS-N95.html"^|find "x86.exe"') do set src=%%i
for /f "tokens=6 delims=/." %%i in ("%src%") do set dst=%%i.exe
:LOOP
curl --connect-timeout 30 -m 600 -Y 6144 -y 60 -C - -o %dst% %src%||ping -n 10 127.1>nul & GOTO :LOOP
论坛跳转: