home *** CD-ROM | disk | FTP | other *** search
- /* VirusZ for Directory Opus 5.5 and VirusZ.
- by Leo 'Nudel' Davidson for Gods'Gift Utilities
- email: leo.davidson@keble.oxford.ac.uk www: http://users.ox.ac.uk/~kebl0364
-
- $VER: VirusZ.dopus 1.1 (13.6.96)
-
- VirusZ II [v1.31] (C)1991-96 by Georg Hörmann.
- Checks selected files and directories in the source lister.
- (I can add filename-on-commandline support if anyone wants it).
-
- If VirusZ's ARexx port is not found, the program will be run for
- you (you should edit the path below) and quit afterwards.
-
- Thanks to John Veldthuis <johnv@tower.actrix.gen.nz> for giving
- me a virus-infected file (!) to test my Virus_Checker7.dopus
- script which this one was based on.
-
- Call as:
- ------------------------------------------------------------------------------
- ARexx: DOpus5:ARexx/VirusZ.dopus5 {Qp} {Ql}
- ------------------------------------------------------------------------------
- Turn off all switches.
-
- --- Path to Virus_Checker command ------------------------------------------*/
- VirusZ = "DH0:Tools/Virus/VirusZ"
- /*--------------------------------------------------------------------------*/
-
- options results
- options failat 99
- signal on syntax;signal on ioerr /* Error trapping */
- parse arg DOpusPort source_handle.0 FilePath
-
- If DOpusPort="" THEN Do
- Say "Not correctly called from Directory Opus 5!"
- Say "Load this ARexx script into an editor for more info."
- EXIT
- END
- If ~Show("P",DOpusPort) Then Do
- Say DOpusPort "is not a valid port."
- EXIT
- End
- Address value DOpusPort
-
- dopus version
- If ( result='RESULT' | translate(result,'.',' ') < 5.1218 ) then do
- dopus request '"This script requires DOpus v5.5 or greater." OK'
- EXIT
- end
-
- Quit_After = "NO"
- If ~Show("P",'VIRUSZ_II.REXX') Then Do
- Address Command VirusZ
- Address Command "WaitForPort" 'VIRUSZ_II.REXX'
- Quit_After = "YES"
- If ~Show("P",'VIRUSZ_II.REXX') then do
- lister request source_handle.0 '"Error loading VirusZ!'|| '0a'x ||'Check its command-path in the ARexx script." OK'
- EXIT
- END
- END
-
- /* If file/dir-path was specified on command line, check it, else
- go through all the selected ones. */
-
- BadList = ""
- BadNumber = 0
-
- lister set source_handle.0 busy 1
-
- lister query source_handle.0 numselentries /* Get info about selected */
- Lister_NumSelEnt = RESULT /* entries & path to them */
- lister query source_handle.0 path
- Lister_Path = Strip(RESULT,"B",'"')
-
- lister set source_handle.0 newprogress abort bar name title
- lister set source_handle.0 newprogress title "Checking for viruses..."
- lister set source_handle.0 newprogress info "Checking for viruses..."
- lister set source_handle.0 newprogress bar Lister_NumSelEnt 0
-
- Do i=1 to Lister_NumSelEnt
- lister query source_handle.0 abort
- If RESULT=1 Then Call END_PART_2
-
- lister query source_handle.0 firstsel
- Temp_Name = Strip(RESULT,"B",'"')
- lister select source_handle.0 '"'Temp_Name'"' 0
- Temp_Path = Lister_Path || Temp_Name
- lister set source_handle.0 newprogress name Temp_Name
- lister set source_handle.0 newprogress bar Lister_NumSelEnt i
- lister query source_handle.0 entry '"'Temp_Name'"'
- Temp_Type = Word(RESULT,(Words(RESULT)) - 4)
- Select
- When Temp_Type < 0 Then
- Address 'VIRUSZ_II.REXX' "CHECKDIR" '"'Temp_Path'"' "DECREXEC DECRDATA"
- When Temp_Type > 0 Then
- Address 'VIRUSZ_II.REXX' "CHECKFILE" '"'Temp_Path'"' "DECREXEC DECRDATA"
- When Temp_Type = 0 Then do
- lister request source_handle.0 '"Error: listery query entry format changed." OK'
- Call END_PART_2
- END
- End
-
- If RC = 10 Then
- lister request source_handle.0 "'Error: VirusZ could not check"||"0a"x||Temp_Path"' OK"
- If RC = 5 Then do
- command flash
- command beep
- BadNumber = BadNumber + 1
- BadList = BadList||'0a'x||Temp_Path
- END
- End
-
- If BadNumber > 0 Then Do
- If BadNumber = 1 Then
- BadNote = "The following is infected:0m"
- Else
- BadNote = "The following are infected:0m"
- BadList = "0;41;30m *VIRUS WARNING* 0m"||'0a'x||"1m"BadNote||'0a'x||BadList
- dopus front
- dopus screen
- doscr = RESULT ; dosname=Word(doscr,"1") ; dosbar=Word(doscr,"5")+1 ; doswidth=Word(doscr,"2") ; dosheight=Word(doscr,"3")-dosbar
- Open(Output_Shell,"CON:0/"|| dosbar ||"/"|| doswidth ||"/"|| dosheight ||"/Virus Warning/CLOSE/WAIT/SCREEN"||dosname,"W")
- WriteLN(Output_Shell,BadList)
- command wait alarm
- Close(Output_Shell)
- END
-
- /*-- Restore the Lister for normal use --------------------------------------*/
- syntax:;ioerr:
- END_PART_2:
-
- lister set source_handle.0 newprogress off
-
- lister refresh source_handle.0
- lister set source_handle.0 busy 0
-
- END_PART:
- If Quit_After = "YES" Then Address 'VIRUSZ_II.REXX' "QUIT"
- EXIT
-