Punto informatico Network
Login Esegui login | Non sei registrato? Iscriviti ora (è gratuito!)
Username: Password:
  • Annuncio Pubblicitario

Scaricare file che cambia sempre nome

Office fa le bizze? Photoshop non funziona più? Forse possiamo darti una mano...

Scaricare file che cambia sempre nome

Messaggioda crazy.cat » mer feb 23, 2011 8:06 pm

In queste due cartelle ci sono una serie di file exe il cui nome inizia con stinger seguito da una serie di numeri.exe
http://download.nai.com/products/mcafee-avert/
http://downloadcenter.mcafee.com/products/mcafee-avert/

Qualcosa del genere stinger10101375.exe, io avrei bisogno di scaricare il file più recente usando (possibilmente) wget http://www.gnu.org/software/wget/ o altro download manager da linea di comando.
Deve funzionare da ambiente windows e dovrebbe anche salvare il file scaricato con nome diverso, diciamo stinger.exe

Grazie
Quando i molti governano, pensano solo a contentar sé stessi, si ha allora la tirannia più balorda e più odiosa: la tirannia mascherata da libertà.
Avatar utente
crazy.cat
MLI Hero
MLI Hero
 
Messaggi: 30959
Iscritto il: lun gen 12, 2004 1:38 pm
Località: Mestre

Re: Scaricare file che cambia sempre nome

Messaggioda Andy94 » mer feb 23, 2011 9:07 pm

L'unica che mi viene in mente è la regex per prendere tutti i nomi ed inserire in un array i numeri. Quindi prendere quello maggiore, riassociarlo alla parola stinger per ottenere il file più recente che rispetta la nomenclatura (più recente è il file più alto è il numero).

Tuttavia, non conosco Wget ma è molto improbabile che con quello si possa fare. Da riga di comando le regex non sono supportate (ne dubito fortemente) quindi ti serve qualcosa di fatto apposta...
Avatar utente
Andy94
Membro Ufficiale (Gold)
Membro Ufficiale (Gold)
 
Messaggi: 9998
Iscritto il: lun apr 09, 2007 8:39 pm

Re: Scaricare file che cambia sempre nome

Messaggioda Palpas » mer feb 23, 2011 11:30 pm

ciao crazy, per quanto riguarda wget, ecco il comando che ti serve: wget -N -nd -r -l 1 -A exe,"stinger" http://download.nai.com/products/mcafee-avert

Tuttavia come anticipato da andy, wget non ti permette di scaricare solamente il file più recente, penso quindi che per raggiungere il tuo scopo a questo comando dovrai affiancare uno script che elabori i numerini contenenti nel nome del file... [boh]
Zane grazie per l'esperienza MLI
Avatar utente
Palpas
Membro Ufficiale (Gold)
Membro Ufficiale (Gold)
 
Messaggi: 2544
Iscritto il: mar set 25, 2007 4:48 pm


Re: Scaricare file che cambia sempre nome

Messaggioda Al3x » mer feb 23, 2011 11:51 pm

anni fa avevo uno script (a trovarlo) che in automatico scaricava dal sito della symantec le definizioni più aggiornate per la versione corporate.
In questa pagina ne parlano anche se mi pare che la versione descritta non corrisponde a quella che avevo io
http://www.symantec.com/business/suppor ... cale=en_US

Se riuscissi a ritrovarlo basterebbe studiarne il codice per comprenderne il funzionamento
è primavera finalmente! [:)]
Avatar utente
Al3x
Membro Ufficiale (Gold)
Membro Ufficiale (Gold)
 
Messaggi: 7418
Iscritto il: sab gen 10, 2009 12:51 pm
Località: http://127.0.0.1/

Re: Scaricare file che cambia sempre nome

Messaggioda Al3x » gio feb 24, 2011 12:05 am

Trovato qui!
Spero serva a qualcosa

-----XDBdown.cmd----- (You can download a copy of this cmd file from the Symantec link in the above instructions)-----
@set COPY_XDB_TO="c:\Program Files\Symantec AntiVirus\"
@set RAPIDRELEASE=0
@set XDBTEMP=%temp%

@rem ==============================================================================================
@rem Set RAPIDRELEASE=1 to download repidrelease definitions, RAPIDRELEASE=0 for fully QA'd definitions (standard).
@rem Change COPY_XDB_TO= to point to the SAV CE server directory (or where you want the XDB file copied)
@rem you can also run the script directly from the SAV folder and it will copy the definitions there.
@rem XDBTEMP is the temp folder the script will use while downloading definitions, set to %temp% to use system default
@rem ==============================================================================================
@rem Script for downloading virus definition updates for
@rem Symantec Antivirus Corporate Edition version 8.x and 9.x
@rem This unsupported utility is provided for your convenience only.
@rem Symantec Technical Support cannot provide support for the creation,
@rem use, or troubleshooting of Windows scripts.

@rem ==============================================================================================
@echo off


rem ========= check that OS is win2k or better ============
if not "%OS%" == "Windows_NT" goto BADOS
if "%APPDATA%" == "" goto BADOS

rem ========= make sure to be in script directory ============
if exist rtvscan.exe set COPY_XDB_TO=%CD%
for %%i in (%0) do @%%~di
for %%i in (%0) do @cd %%~pi
if exist rtvscan.exe set COPY_XDB_TO=%CD%

rem =========== get name/size of last file from "xdbdown.lastfile" ============
if not exist xdbdown.lastfile goto NOLAST
for /f "tokens=1" %%f in (xdbdown.lastfile) do set lastfile=%%f
for /f "tokens=2" %%f in (xdbdown.lastfile) do set lastsize=%%f
:NOLAST

rem ========= jump to temp dir ============
if not exist "%XDBTEMP%\xdbtmp" md "%XDBTEMP%\xdbtmp"
if exist "%XDBTEMP%\xdbtmp\*.xdb" del "%XDBTEMP%\xdbtmp\*.xdb"
pushd "%XDBTEMP%\xdbtmp"

rem =========== make ftp script for checking xdb directory on ftp ===========
echo open ftp.symantec.com> check.txt
echo anonymous>> check.txt
echo email@address.com>> check.txt
set xdbfolder=xdb
if "%RAPIDRELEASE%" == "1" set xdbfolder=rapidrelease
echo cd AVDEFS/norton_antivirus/%xdbfolder%>> check.txt
echo dir *.xdb chk.lst>> check.txt
echo bye>> check.txt

rem =========== get filename and size from ftp ============
if exist chk.lst del chk.lst
ftp -s:check.txt
if not exist chk.lst goto ERROR
for /f "tokens=9" %%f in (chk.lst) do set xdbfile=%%f
for /f "tokens=5" %%f in (chk.lst) do set xdbsize=%%f
if "%xdbfile%" == "" goto ERROR
if "%xdbsize%" == "" goto ERROR

rem =========== compare ftp name/size to local ============
if not "%xdbfile%" == "%lastfile%" goto DOWNLOAD
if not "%xdbsize%" == "%lastsize%" goto DOWNLOAD
popd
echo.
echo Already downloaded latest %xdbfolder% file: %xdbfile% - size %xdbsize%
echo %date% %time% Already downloaded latest %xdbfolder% file: %xdbfile% - size %xdbsize% >> XDBdown.log
goto END

:DOWNLOAD
rem ========= make ftp script for downloading new xdb file =========
echo open ftp.symantec.com> down.txt
echo anonymous>> down.txt
echo email@address.com>> down.txt
echo cd AVDEFS/norton_antivirus/%xdbfolder%>> down.txt
echo bin>> down.txt
echo hash>> down.txt
echo get %xdbfile%>> down.txt
echo bye>> down.txt

rem ============= download new file =================
ftp -s:down.txt
for %%i in (%xdbfile%) do @set newsize=%%~zi
if not "%newsize%" == "%xdbsize%" goto ERROR
move %xdbfile% %COPY_XDB_TO%
if exist %xdbfile% goto ERRORMOVE
popd
echo.
echo %xdbfile% %xdbsize% > xdbdown.lastfile
echo Downloaded new %xdbfolder% file: %xdbfile% - size %xdbsize%
echo %date% %time% Downloaded new %xdbfolder% file: %xdbfile% - size %xdbsize% >> XDBdown.log
goto END


:ERROR
popd
echo.
echo ERROR: problem downloading %xdbfolder% definition file. xdbfile=%xdbfile% xdbsize=%xdbsize% newsize=%newsize% (lastfile=%lastfile% lastsize=%lastsize%).
echo %date% %time% ERROR: problem downloading %xdbfolder% definition file. xdbfile=%xdbfile% xdbsize=%xdbsize% newsize=%newsize% (lastfile=%lastfile% lastsize=%lastsize%). >> XDBdown.log
type "%XDBTEMP%\xdbtmp\chk.lst" >> XDBdown.log
echo. >> XDBdown.log
goto END

:ERRORMOVE
popd
echo.
echo ERROR: problem moving definition file to SAV folder. COPY_XDB_TO=%COPY_XDB_TO% newsize=%newsize% (lastfile=%lastfile% lastsize=%lastsize%).
echo %date% %time% ERROR: problem moving definition file to SAV folder. COPY_XDB_TO=%COPY_XDB_TO% newsize=%newsize% (lastfile=%lastfile% lastsize=%lastsize%). >> XDBdown.log
goto END

:BADOS
echo.
echo ERROR: this script needs Windows 2000 or better.
echo %date% %time% ERROR: this script needs Windows 2000 or better. >> XDBdown.log
goto END

:END
if exist "%XDBTEMP%\xdbtmp\check.txt" del "%XDBTEMP%\xdbtmp\check.txt"
if exist "%XDBTEMP%\xdbtmp\down.txt" del "%XDBTEMP%\xdbtmp\down.txt"
if exist "%XDBTEMP%\xdbtmp\chk.lst" del "%XDBTEMP%\xdbtmp\chk.lst"
rd "%XDBTEMP%\xdbtmp"
set COPY_XDB_TO=
set RAPIDRELEASE=
set lastsize=
set lastfile=
set newsize=
set xdbsize=
set xdbfile=
set xdbfolder=
set xdbtemp=
-----End XDBdown.cmd-----
è primavera finalmente! [:)]
Avatar utente
Al3x
Membro Ufficiale (Gold)
Membro Ufficiale (Gold)
 
Messaggi: 7418
Iscritto il: sab gen 10, 2009 12:51 pm
Località: http://127.0.0.1/

Re: Scaricare file che cambia sempre nome

Messaggioda crazy.cat » gio feb 24, 2011 5:10 am

Palpas ha scritto:ecco il comando che ti serve: wget -N -nd -r -l 1 -A exe,"stinger" http://download.nai.com/products/mcafee-avert

Non scarica solo gli exe, ma anche la struttura delle varie cartelle presenti nel http sotto forma di un file html e qualche altro accessorio.
Gli exe li scarica anche bene, solo che arrivato al numero 18 mi soon stufato e ho smesso.
Ma non potrebbero lasciarci solo l'ultimo file??????

Adesso guardo lo script di al3x sperando che il comando ftp mi lasci anche scaricare da un sito http....

Ho paura che chi vuole stinger sul megalabcd dovrà aggiornarsi a manina ogni volta gli script.
Quando i molti governano, pensano solo a contentar sé stessi, si ha allora la tirannia più balorda e più odiosa: la tirannia mascherata da libertà.
Avatar utente
crazy.cat
MLI Hero
MLI Hero
 
Messaggi: 30959
Iscritto il: lun gen 12, 2004 1:38 pm
Località: Mestre


Torna a Software

Chi c’è in linea

Visitano il forum: Nessuno e 28 ospiti

Powered by phpBB © 2002, 2005, 2007, 2008 phpBB Group
Traduzione Italiana phpBB.it

megalab.it: testata telematica quotidiana registrata al Tribunale di Cosenza n. 22/09 del 13.08.2009, editore Master New Media S.r.l.; © Copyright 2008 Master New Media S.r.l. a socio unico - P.I. 02947530784. GRUPPO EDIZIONI MASTER Spa Tutti i diritti sono riservati. Per la pubblicità: Master Advertising