home *** CD-ROM | disk | FTP | other *** search
/ ftp.wwiv.com / ftp.wwiv.com.zip / ftp.wwiv.com / pub / EVENTS / BRM-UPCK.ZIP / BRM-UPCK.BAT
DOS Batch File  |  1994-03-19  |  4KB  |  173 lines

  1. Black-Robe Mage #1 @9710
  2. Tue Mar 15 22:59:25 1994
  3. 0R: net33: @3113 (via @1021) [07:55 03/19/94]
  4. 0R 34 03/19 02:48 WWIVnet 1040->1021
  5. 0R: net33: @1040 (via @2050) [00:10 03/18/94]
  6. 0R 34 03/17 23:30 WWIVnet ->2050
  7. 0R 34 03/16 20:45 WWIVnet 1040->2050
  8. 0R: net33: @1040 (via @1042) [20:43 03/16/94]
  9. 0R: net33: @1042 (via @9710) [20:14 03/16/94]
  10. 0R: net33: @9710 [12:34 03/15/94]
  11. 0R: net33: @9710 [00:25 03/16/94]
  12. RE: 4.23 Conversion....
  13. BY: Trickster #1 @5922
  14.  
  15. I use the following batch files.  To scan a file for viruses, I
  16. simply type v <filename>, with or without the extension.
  17.  
  18. It looks for your header in c:\wwiv\gfiles\header.msg, and only
  19. puts it in if you've had no viruses or errors.
  20.  
  21. c:\tools should be in your PATH
  22.  
  23. 4c:\tools\v.bat
  24.  
  25. @echo off
  26. if not exist %1 goto a
  27. call vs %1
  28. goto end
  29. :a
  30. if not exist %1.zip goto b
  31. call vs %1.zip
  32. goto end
  33. :b
  34. if not exist %1.arj goto c
  35. call vs %1.arj
  36. goto end
  37. :c
  38. if not exist %1.lzh goto end
  39. call vs %1.lzh
  40. goto end
  41. :end
  42.  
  43. 4c:\tools\vs.bat
  44.  
  45. @echo off
  46. deltree /y c:\unzip
  47. echo Scanning for viruses
  48. md c:\unzip
  49. mybe which %1 c:\tools\open.dat
  50. if errorlevel 12 goto copy
  51. if errorlevel 11 goto lzh
  52. if errorlevel 5 goto copy
  53. if errorlevel 4 goto arj
  54. if errorlevel 3 goto zip
  55. :copy
  56. echo Copying file...
  57. copy %1 c:\unzip
  58. goto cont
  59. :lzh
  60. echo Decompressing (lha e %1 c:\unzip\)
  61. lha e %1 c:\unzip\
  62. goto cont
  63. :arj
  64. echo Decompressing (arj e %1 c:\unzip)
  65. arj e %1 c:\unzip
  66. goto cont
  67. :zip
  68. echo Decompressing (pkunzip %1 c:\unzip)
  69. pkunzip %1 c:\unzip
  70. :cont
  71. echo Scanning...
  72. scan c:\unzip /nomem
  73. if errorlevel 2 goto progerror
  74. if errorlevel 1 goto found
  75. echo No viruses found in %1 > c:\wwiv\gfiles\temp.txt
  76. echo No viruses found in %1
  77. mybe which %1 c:\tools\open.dat
  78. if errorlevel 5 goto end
  79. if errorlevel 4 goto harj
  80. if errorlevel 3 goto hzip
  81. goto end
  82. :hzip
  83. echo Done!  Changing header.
  84. pkhead %1 c:\wwiv\gfiles\header.msg > nul
  85. goto end
  86. :harj
  87. echo Done!  Changing header.
  88. arj c %1 -zc:\wwiv\gfiles\header.msg > nul
  89. goto end
  90. :found
  91. echo %1 has a virus!
  92. echo Virus found in %1 > c:\wwiv\gfiles\temp.txt
  93. goto end
  94. :progerror
  95. echo There has been an error.
  96. echo Error scanning %1 > c:\wwiv\gfiles\temp.txt
  97. :end
  98. echo Updating log.
  99. copy c:\wwiv\gfiles\virus.log+c:\wwiv\gfiles\temp.txt c:\wwiv\gfiles\virus.log > nul
  100. c:
  101. cd \unzip
  102. type c:\wwiv\gfiles\temp.txt
  103. del c:\wwiv\gfiles\temp.txt
  104.  
  105. 4mybe.c
  106.  
  107. #include <stdio.h>
  108. #include <string.h>
  109. #include <stdlib.h>
  110.  
  111. int which(char *s1, FILE *f)
  112. {
  113.   char *s,ext[5],*ep;
  114.   int rval;
  115.  
  116.   if ((s=strchr(strupr(s1),'.')) != NULL) {
  117.     s++;
  118.     while (!feof(f)) {
  119.       ep=ext;
  120.       fscanf(f,"%s %d",ep,&rval);
  121.       strupr(ep);
  122.       if (ep[0]=='.') ep++;
  123.       if (!strcmp(s,ep)) return rval;
  124.     }
  125.   }
  126.   return 1;
  127. }
  128.  
  129. main (int argc, char **argv)
  130. {
  131.   int i,val,debug=0;
  132.   FILE *f;
  133.  
  134.   if (argc<2) return 0;
  135.   if (argv[1][0]=='d' || argv[1][0]=='D') {
  136.     debug=1;
  137.     argv++;
  138.   }
  139.  
  140.   switch(argv[1][0]) {
  141.     case 'w':
  142.       if ((f=fopen(argv[3],"r"))==NULL) {
  143.         fprintf(stderr,"%s not found.",argv[3]);
  144.         return 0;
  145.       }
  146.       val=which(argv[2],f);
  147.       fclose(f);
  148.       break;
  149.     default:
  150.       fprintf(stderr,"error: unknown command %c",argv[1][0]);
  151.       val=0;
  152.       break;
  153.   }
  154.   if (debug) fprintf(stderr,"ERRORLEVEL %d\n",val);
  155.   return val;
  156. }
  157.  
  158. 4c:\tools\open.dat
  159.  
  160. uue 10
  161. obj 0
  162. bat 5
  163. exe 2
  164. com 2
  165. zip 3
  166. arj 4
  167. gif 6
  168. jpg 6
  169. pcx 6
  170. h   7
  171. c   7
  172. bat 8
  173.