home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Devil's Doorknob BBS Capture (1996-2003)
/
devilsdoorknobbbscapture1996-2003.iso
/
Dloads
/
WWIVMODS
/
MODSUNKN.ZIP
/
VIRUSCHK.MOD
< prev
next >
Wrap
Text File
|
1992-01-21
|
9KB
|
260 lines
/***************************************************************************
MOD: Virus Checker
Description: Check for virus on remote upload or ask to check on local upload
uses the archive formats you have specified in INIT.EXE.
Author: Captain Learjet
Modified: Enigma #9 @9973
Rejean F #1 @5499
Comments: Enigma's release had two slight problems in the test_upload
function:
first: it wasn't clearing the temp dir when checking
multiple files.
second: de-archiving was not possible since the string
passed to to run_external wasn't set up properly.
Both are now corrected.
Requirements: You must have McAffe's SCAN.EXE and all de-archiver in your
path somewhere.
Rejean F
#1 @5499
***************************************************************************/
***********************
STEP 1
Back-up your source!
***********************
STEP 2
In BBS.C add the following:
if (strcmp(s,"/O")==0) = Existing
if (countdwn()==1) = Existing
hangup=1; = Existing
if ((strcmp(s,"/?")==0) && (dcs())) = Existing
printmenu(8); = Existing
if (strcmp(s,"/V")==0) + ADD
virus_check(); + ADD
if ((strcmp(s,"UPLOADALL")==0) && (dcs())) { = Existing
i1=0;
***********************
STEP 3
**-- NOTE: In step 3 and 4, the sprintf function might not be exactly as
represented. Also, in step 3, the pl function is probably
different in your source.
In XFER.C add the following:
++status.uptoday; = Existing
save_status(); = Existing
sprintf(s,"+%s uploaded in %s", = Existing
u.filename,directories[dn].name); = Existing
sysoplog(s); = Existing
nl(); = Existing
if(!incom){ + ADD
prt(5,"Test this file? "); + ADD
if(yn()) + ADD
test_upload(u.filename); + ADD
}else + ADD
test_upload(u.filename); + ADD
nl(); = Existing
pl("File uploaded."); = Existing
At the end of the file (after the last line) add:
#include "VIRUSCHK.C"
***********************
STEP 4
In XFEROVL.C add the following:
SETREC(0); = Existing
write(dlf,(void *)&u1,sizeof(uploadsrec)); = Existing
++status.uptoday; = Existing
save_status(); = Existing
sprintf(s,"+%s uploaded in %s", = Existing
u.filename,d.name); = Existing
sysoplog(s); = Existing
if(!incom){ + ADD
prt(5,"Test this file? "); + ADD
if(yn()) + ADD
test_upload(u.filename) + ADD
}else + ADD
test_upload(u.filename); + ADD
} = Existing
return(1); = Existing
} = Existing
***********************
STEP 5
In FCNS.H add these two declaration in the XFER.C section:
void virus_check(void);
void test_upload(char *s);
***********************
STEP 6
Create those two files in your gfiles directory:
VIRUSOK.TXT - Will be added to arc files that pass the test
VIRUSBAD.TXT - Will be added to arc files that fail the test
***********************
STEP 7
Save the two following functions as VIRUSCHK.C
--------------------------------CUT HERE-------------------------------------
void virus_check(void)
{
char s[81];
nl();
prt(2,"Archive to Scan: ");
mpl(12);
input(s,12);
if (!strchr(s,'.'))
strcat(s,".*");
test_upload(s);
topscreen();
}
void test_upload(char *s)
{
char s1[81],s2[81],s3[81],s4[81],s5[81];
int i,i1,i2,type=0,abort=0,next=0,ext;
uploadsrec u;
remove_from_temp("*.*",syscfg.tempdir,0);
align(s);
dliscan();
i=recno(s);
do {
if (i>0) {
SETREC(i);
read(dlf,(void *)&u,sizeof(uploadsrec));
for(i2=0; i2<4; i2++) /*** determine type and assign to ext ***/
if (!strcmp(u.filename+9,syscfg.arcs[i2].extension)) {
sprintf(s1,"%s%s",directories[udir[curdir].subnum].path,
stripfn(u.filename));
ext=i2;
type=1;
}
if ((!strcmp(u.filename+9,"EXE")) || (!strcmp(u.filename+9,"COM")))
type=4;
if (type) {
sprintf(s1,"%s%s",directories[udir[curdir].subnum].path,
stripfn(u.filename));
if (exist(s1)) {
nl();
ansic(2);
sprintf(s2,"Scanning %s for viruses... ",u.filename);
nl();
prt(3,"Please wait.....");nl();
if (type<4) { /*** if archived extract and check for virii ***/
strcpy(s4,syscfg.arcs[ext].arce); /* This part modified */
strcpy(s5,syscfg.tempdir); /* for proper operation */
stuff_in(s2,s4,s1,s5,"","",""); /* of PKUNZIP */
run_external(s2);
sprintf(s3,"SCAN /nomem %s",syscfg.tempdir);
i1=run_external1(s3);
remove_from_temp("*.*",syscfg.tempdir,0);
} else { /*** else just check for virii ***/
sprintf(s2,"SCAN /nomem %s",s1),
i1=run_external1(s2);
}
prt(2,u.filename);
if (i1==1) {
pl(" \a\a\0036FAILED \0030the virus test!");
nl();
sprintf(s2,"%s \0036FAILED \0030the virus test. Please delete the file!",
u.filename);
ssm(1,0,s2);
sysoplog(s2);
} else {
pl(" \0035PASSED \0032the virus test.");
sprintf(s2,"%s \0035PASSED \0030the virus test.",u.filename);
ssm(1,0,s2);
sysoplog(s2);
nl();
}
/*════════ delete area between lines to skip adding file comments ═════════*/
/*** will add file VIRUSOK.TXT to an archive that passed the virii scan ***
*** will add file VIRUSBAD.TXT to an archive that failed the virii scan ***/
/*** if ARJ archive add comment ***/
if (!strcmp(u.filename+9,"ARJ")) {
if (i1==1)
sprintf(s1,"ARJ C %s%s -z%sVIRUSBAD.TXT",
directories[udir[curdir].subnum].path,
stripfn(u.filename),syscfg.gfilesdir);
else
sprintf(s1,"ARJ C %s%s -z%sVIRUSOK.TXT",
directories[udir[curdir].subnum].path,
stripfn(u.filename),syscfg.gfilesdir);
sprintf(s3,"Adding comment to %s",u.filename);
prt(2,s3);
nl();
run_external(s1);
}
/*** end add comment to ARJ ***/
/*** if ZIP archive add comment ***/
if (!strcmp(u.filename+9,"ZIP")) {
if (i1==1)
sprintf(s1,"PKZIP -Z %s%s < %sVIRUSBAD.TXT",
directories[udir[curdir].subnum].path,
stripfn(u.filename), syscfg.gfilesdir);
else
sprintf(s1,"PKZIP -Z %s%s < %sVIRUSOK.TXT",
directories[udir[curdir].subnum].path,
stripfn(u.filename), syscfg.gfilesdir);
sprintf(s3,"Adding comment to %s",u.filename);
prt(2,s3);
nl();
run_external(s1);
}
/*** end add comment to ZIP ***/
/*════════════════════════ end adding file comments ════════════════════════*/
}
checka(&abort,&next);
}
}
i=nrecno(s,i);
} while ((i>0) && (!hangup) && (!abort));
closedl();
remove_from_temp("*.*",syscfg.tempdir,0);
}
--------------------------------CUT HERE-------------------------------------
That's it, all that is left now is to recompile the whole thing. Hope you
won't have problems with this mod.
RejeanF
#1 @5499