Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Let us assume that there is a perfect antivirus program. It examines a program a

ID: 3847513 • Letter: L

Question

Let us assume that there is a perfect antivirus program. It examines a program and says "Yes" if the program will infect our computer. It says "NO" if the program will not infect our computer. Antivirus (Program): If Program causes infection Report "Yes" Else Report "NO" If such a program existed, we could write a program Evil that accepts a program as its input and asks Antivirus to look at it. If Antivirus says "Yes", Evil stops without doing anything else. If Antivirus says "NO" about the program, Evil infects the computer: Evil (Program): If Antivirus (Program) says "Yes" Exit Else infect computer Make an argument for how this program Evil shows that the program Antivirus cannot be written.

Explanation / Answer

Antivirus(program):

if Program causes infection

report 'yes'

else

report 'no'

Evil(program):

if Antivirus(program) says 'yes'

exit

else

infect computer

Argument can be called as a program:

program:

//pls make a note that exit_success is successful execution of program which is "yes"

//exit_failure is unsuccessful execution. "No"
#include <stdlib.h>
#include <stdio.h>

int main ( int argc, char** argv )
{
FILE *input;
int ch;
int fileTested[11];
int signature[] = {8B,EF,33,C0,BF,00,00,00,00,03,FD,B9}; /*hard coded virus signature*/

if ( argc != 2 )
{
   fprintf( stderr, "Need to enter file to scan ");
   return( EXIT_FAILURE );
}

if ( (input = fopen( argv[1], "rb")) == NULL ) /* open file in binary mode to avoid end of line characters*/
{
   perror( argv[1] );
   return( EXIT_FAILURE );
}


while ( (ch = fgetc(input)) != EOF )/*commence loop*/
{
   input = fileTested[];           /*put bytes into array to compare to virus signature array*/

   if (fileTested==signature)       /*do comparison*/

   printf("This file contains a virus "); /*tell if virus signature is present*/

   else
   /*if virus signature isn't found, print results*/
   printf("This file doesn't contain a virus ");
}

if ( fclose( input ) == EOF )
{
   perror( argv[1] );
   return( EXIT_FAILURE );
}

return( EXIT_SUCCESS );
}