' VDU - Virus Destruction Utility ' Written by Richard Karsmakers ' December 18th 1987 ' ' This program is Public Domain and may ' be copied freely to anyone you want ' in the original form only! ' ' *** Variable initialisation ' starttime%=TIMER !Get start time os%=LPEEK(&H4F2) !Get operating system address IF PEEK(os%+1)=&H1E !Normal ST? wp%=&H9B2 !Write-protect status ELSE !MEGA ST? wp%=&H9F8 !Write-protect status ENDIF bp%=&H472 !BIOS 'Get_bpb' pointer address ad%=&H4C2 !_Drvbits, drives attached disk$=SPACE$(512) !Disk buffer ' ' *** Startup sequence ' ALERT 1,"THE VIRUS DESTRUCTION UTILITY V2.0|Written by Richard Karsmakers|Thanks to Frank Lemmen and| STRIKE-a-LIGHT",1,"OK|More|Cancel",buf% IF buf%=2 ALERT 1,"This is version 2.0!|Recognizes '1st Freezer' disks|and non-exec boot stuff.",1,"OK",dummy% ALERT 1,"Additional ideas by:| Math Claessens| W.F. Kilwinger|An ST NEWS Production",1,"OK",dummy% ALERT 1,"You computer should be|turned off/on before|running this utility!",1,"OK",dummy% ALERT 1,"When a virus is recognized,|it will be eliminated|automatically!",1,"OK",dummy% ALERT 1,"Cases of doubt will be|recognized as well...",1,"OK",dummy% ALERT 1,"In '100% Safe' cases, it is|possible to immunize the disk|so that it cannot be infected|by the current ST virus.",1,"OK",dummy% ENDIF IF buf%=3 EDIT ENDIF ' ' *** Get drive to check ' ALERT 2,"Which drive to check?",1,"A|B",buf% devno%=buf%-1 ' ' ac$=BIN$(LPEEK(ad%)) !Get active drives IF LEN(ac$)>2 !RAM-and/or harddisks attached norm%=FALSE ELSE !Only drive A or A+B attached norm%=TRUE ENDIF ' ' *** Check if computer is infected ' buf%=LPEEK(bp%) !Get 'Bpb_get' pointer IF buf%0 ALERT 1,"An error occured during|boot sector read....|Is the disk formatted?",1,"OK",dummy% GOTO the_end ELSE ' ' *** Check executability of boot sector ' exec%=DPEEK(VARPTR(disk$)+510) !Buffer checksum VOID XBIOS(18,L:VARPTR(disk$),L:-1,-1,1) exed%=DPEEK(VARPTR(disk$)+510) !New checksum IF exec%=exed% !Compare both checksums execflag%=TRUE !The same? Then executable ELSE execflag%=FALSE ENDIF ' ' *** Check for Atari bootsector ' IF DPEEK(VARPTR(disk$))=&H6038 AND DPEEK(VARPTR(disk$)+&H50)=&H4A80 AND DPEEK(VARPTR(disk$)+&H100)=&HB645 AND LPEEK(VARPTR(disk$)+&H180)=&H20417461 atari%=TRUE ELSE atari%=FALSE ENDIF ' ' *** Check for current virus ' IF DPEEK(VARPTR(disk$))=&H6038 AND LPEEK(VARPTR(disk$)+&H7A)=&H4E560000 AND LPEEK(VARPTR(disk$)+&HE0)=&H3F3C0001 curvir%=TRUE ELSE curvir%=FALSE ENDIF ' ' *** Check for key setting ' IF DPEEK(VARPTR(disk$)+2)=&H1092 key%=TRUE ELSE key%=FALSE ENDIF ' ' *** Check for "1st Freezer" disks ' IF MID$(disk$,&HF5,7)="freezer" freezer%=TRUE ELSE freezer%=FALSE ENDIF ' ' *** Check 100% safe ' IF DPEEK(VARPTR(disk$))=&H0 safe%=TRUE ELSE safe%=FALSE ENDIF ' ' *** Check if 'immunized' ' IF DPEEK(VARPTR(disk$))=&H6038 immu%=TRUE ELSE immu%=FALSE ENDIF ' ' *** Display results of the check ' IF atari%=TRUE !Atari bootsector? ALERT 1,"This disk is OK!|(and already immune)",1,"OK",dummy% GOTO the_end ENDIF IF safe%=TRUE !first two bytes zero? ALERT 1,"This disk is OK!|(but not immune)",1,"OK|Immunize",dummy% IF dummy%=2 @immunize ENDIF GOTO the_end ENDIF IF curvir%=TRUE AND key%=TRUE !Virus present and key set? ALERT 1,"Watch it! This disk is|not only infected but|the 'key' is also set!!",1,"Repair!",dummy% @repair GOTO the_end ENDIF IF curvir%=TRUE AND execflag%=FALSE !Non-executable infected boot sector? ALERT 1,"The virus is on the disk|all right, but is not|executable...",1,"Repair|Cancel",dummy% IF dummy%=1 @repair ENDIF GOTO the_end ENDIF IF curvir%=TRUE !Virus bootsector executable? ALERT 1,"This disk is infected!",1,"Repair!",dummy% @repair GOTO the_end ENDIF IF freezer%=TRUE AND execflag%=TRUE !1st Freezer disk and executable ALERT 1,"This is a '1st Freezer' disk!|It is executable|but it's no virus....|(It it safe)",1,"OK",dummy% GOTO the_end ENDIF IF freezer%=TRUE !st Freezer disk but not executable (?!) ALERT 1,"This is a '1st Freezer' disk,|but it's not executable?!?!|It's no virus, however.|(Disk is safe)",1,"OK",dummy% GOTO the_end ENDIF IF execflag%=TRUE !Executable sector? Warning! ALERT 1,"This disk is executable!|Might be an auto-boot|disk or an unknown virus...",1,"Repair|Cancel",dummy% IF dummy%=1 @repair ENDIF GOTO the_end ENDIF IF immu%=TRUE !Disk immune ALERT 1,"This disk is OK!|(it was immunized already)",1,"OK",dummy% GOTO the_end ELSE ALERT 1,"This disk is non-executable|but I cannot call it 100%|safe...There's something|written on the bootsector!",1,"Repair|Cancel",buf% IF buf%=1 @repair ENDIF GOTO the_end ENDIF ENDIF the_end: ALERT 2,"Should I check another disk?",1,"YES|NO",dummy% EXIT IF dummy%=2 LOOP time%=(TIMER-starttime%)/200 minute%=time%/60 second%=time%-(minute%*60) minute$=STR$(minute%)+"'"+STR$(second%)+CHR$(34) counter$=STR$(counter%) ALERT 1,"This session took "+minute$+"|and "+counter$+" viruses were destroyed.",1,"OK",dummy% ALERT 1,"If you meet the guy who|made the virus, tell him|to f.ck off!!!",1,"OK",dummy% ALERT 1,"Special remark from Eerk of|STRIKE-a-LIGHT: Virus makers|are completely ignorant of all|sense of responsibility!",1,"OK",dummy% EDIT PROCEDURE repair IF devno%<2 !Drive A or B? again: IF PEEK(wp%+devno%)=255 !Check if disk is write protected ALERT 1,"Please remove write-protect|so that I can repair|the disk!",1,"OK|Cancel",dummy% IF dummy%=2 GOTO cancel ENDIF GOTO again ENDIF ENDIF ' ' *** Clear virus ' DPOKE (VARPTR(disk$)+2),0 !Clear 2nd and 3rd byte (key). Leave 'immune' intact FOR x%=32 TO 511 !Erase irrelevant bootsector data POKE (VARPTR(disk$)+x%),0 NEXT x% ' ' *** Write bootsector back (repaired) ' buf%=XBIOS(9,L:VARPTR(disk$),L:0,devno%,1,0,0,1) IF buf%<>0 ALERT 1,"Error writing boot sector!",1,"OK",dummy% ELSE INC counter% ENDIF cancel: RETURN PROCEDURE immunize IF devno%<2 !Drive A or B? wider: IF PEEK(wp%+devno%)=255 !Check if disk is write protected ALERT 1,"Please remove write-protect|so that I can immunize|the disk!",1,"OK|Cancel",dummy% IF dummy%=2 GOTO outof ENDIF GOTO wider ENDIF ENDIF ' ' *** POKE bytes that virus uses to recognize if it's already present ' LPOKE (VARPTR(disk$)),&H60380000 ' ' *** Write bootsector back (repaired) ' buf%=XBIOS(9,L:VARPTR(disk$),L:0,devno%,1,0,0,1) IF buf%<>0 ALERT 1,"Error writing boot sector!",1,"OK",dummy% ENDIF outof: RETURN