home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
DP Tool Club 17
/
CD_ASCQ_17_101194.iso
/
vrac
/
tsbat46.zip
/
SCANZ.BAT
< prev
next >
Wrap
DOS Batch File
|
1994-09-04
|
6KB
|
178 lines
@echo off
echo.
echo ┌───────────────────────────────────────────────────────────┐
echo │ Scan a zip file for viruses including execompressed files │
echo │ By Prof. Timo Salmi, ts@chyde.uwasa.fi, Sun 4-Sep-94 │
echo └───────────────────────────────────────────────────────────┘
echo.
rem To reset screen colors. Adjust or omit as appropriate for you.
set color_=
rem If no parameters then give the instructions
if "%1"=="" goto _help
rem First check that the zip file(s) exists
if exist %1 goto _next1
echo File %1 not found
goto _out
:_next1
rem Check that you have the drive r: available (I have r: as ramdisk)
if exist r:\nul goto _next2
echo Drive R: not found
echo Adjust your configuration, or this batch
goto _out
:_next2
rem Check that the virus programs are available
rem First adjust the paths as befits your own system
if exist d:\virus\scan.exe goto _next3
echo File d:\virus\scan.exe not found
goto _out
:_next3
if exist d:\virus\f-prot.exe goto _next4
echo File d:\virus\f-fchk.exe not found
goto _out
:_next4
if exist d:\virus\tbscan.exe goto _next5
echo File d:\virus\tbscan.exe not found
goto _out
:_next5
rem Check that pkunzip.exe is available
if exist c:\tools\pkunzip.exe goto _next6
echo File c:\tools\pkunzip.exe not found
goto _out
:_next6
rem Check that exeuncompressors are available
if exist c:\box\boxtools\dislite.exe goto _next7
echo File c:\box\boxtools\dislite.exe not found
goto _out
:_next7
if exist c:\box\boxtools\unlzexe.exe goto _next8
echo File c:\box\boxtools\unlzexe.exe not found
goto _out
:_next8
if exist c:\box\boxtools\diet.exe goto _next9
echo File c:\box\boxtools\diet.exe not found
goto _out
:_next9
rem Check that the ask.exe facility is available
set found_=
if exist ask.exe set found_=yes
for %%d in (%path%) do if exist %%d\ask.exe set found_=yes
for %%d in (%path%) do if exist %%dask.exe set found_=yes
if "%found_%"=="yes" goto _next10
echo Timo's ask.exe must be at path or current directory
goto _out
:_next10
rem Make a temporary directory and ensure that it is empty
if not exist r:\tmp$$$\nul mkdir r:\tmp$$$
if exist r:\tmp$$$\*.* echo Deleting all old files from r:\TMP$$$ directory
if exist r:\tmp$$$\*.* del r:\tmp$$$\*.*
rem Unzip all .exe, .com, overlay-files and embedded zips from the zipfile
c:\tools\pkunzip %1 *.exe *.com *.ov* *.zip r:\tmp$$$
if exist r:\tmp$$$\*.zip c:\tools\pkunzip r:\tmp$$$\*.zip *.exe *.com *.ov* r:\tmp$$$
if exist r:\tmp$$$\*.zip del r:\tmp$$$\*.zip
rem if errorlevel=1 goto _ziperror
rem Check for nasties with McAfee scan, first pass
echo %color_%
if exist r:\tmp$$$\*.* d:\virus\scan r:\tmp$$$\*.* /nomem
if errorlevel=2 goto _scanerr
if errorlevel=1 goto _virus
rem Check for nasties with tbscan, first pass
:_ask_tb
ask Perform tbscan virus check (y/n)? /d /u
if errorlevel==89 if not errorlevel==90 goto _do_tb
if errorlevel==78 if not errorlevel==79 goto _do_fprot
goto _ask_tb
:_do_tb
if exist r:\tmp$$$\*.* d:\virus\tbscan r:\tmp$$$\*.* nm nb
pause
cls
echo %color_%
rem Check for nasties with f-prot, first pass
:_do_fprot
if exist r:\tmp$$$\*.* d:\virus\f-prot r:\tmp$$$\*.* /nomem
if exist r:\tmp$$$\*.* d:\virus\f-prot r:\tmp$$$\*.* /nomem /analyse
:_ask_fprot
echo.
ask Next second pass, with expansion, continue (y/n)? /d /u
if errorlevel==89 if not errorlevel==90 goto _expand
if errorlevel==78 if not errorlevel==79 goto _rmdir
goto _ask_fprot
rem Expand execompressed files
:_expand
for %%f in (r:\tmp$$$\*.exe r:\tmp$$$\*.com) do c:\box\boxtools\dislite %%f
for %%f in (r:\tmp$$$\*.exe r:\tmp$$$\*.com) do c:\box\boxtools\diet -ra %%f
for %%f in (r:\tmp$$$\*.exe) do c:\box\boxtools\unlzexe %%f
if exist r:\tmp$$$\*.olz del r:\tmp$$$\*.olz
:_nounlzexe
rem Check for nasties with scan, second pass
if exist r:\tmp$$$\*.* scan /a r:\tmp$$$\*.* /nomem
if errorlevel=2 goto _scanerr
if errorlevel=1 goto _virus
rem Check for nasties with f-prot, second pass
if exist r:\tmp$$$\*.* d:\virus\f-prot r:\tmp$$$\*.* /nomem
goto _rmdir
:_virus
echo Viruses have been detected, batch terminated
echo The infected files remain in directory r:\TMP$$$
echo Take immediate measures to protect yourself
goto _out
rem Error in zipfile
:_ziperror
echo Error in .zip file, batch terminated
rem Remove the temporary directory and its files
:_rmdir
if not exist r:\tmp$$$\*.* goto _chdir
echo y | del r:\tmp$$$\*.* > nul
:_chdir
cd r:\
if exist r:\tmp$$$\nul rmdir r:\tmp$$$
goto _out
rem The instructions
:_help
echo Usage: SCANZ [ZipFileName] (Wildcards are allowed)
echo.
echo You will need the following shareware and PD programs to use this batch.
echo They are available from good BBSes or from garbo.uwasa.fi by anonymous ftp.
echo PKUNZIP.EXE from PKZ204G.EXE
echo SCAN.EXE from SCANV117.ZIP and SCN-210E.ZIP
echo F-PROT.EXE and its auxiliary files from FP-213A.ZIP
echo TBSCAN.EXE and its auxiliary files from TBAV623.ZIP
echo DISLITE.EXE from DISLT115.ZIP
echo UNLZEXE.EXE from UNLZEXE7.ZIP
echo DIET.EXE from DIET144.ZIP
echo ASK.EXE from TSBAT46.ZIP
echo Before using this batch you have to edit all the directory paths of this
echo batch to correspond to your own configuration
echo (or adjust your configuration :-).
echo.
goto _out
:_scanerr
echo Abnormal SCAN program termination
goto _out
:_out
set found_=
set color_=
if "%pcid_%"=="dell" echo
echo on