You are working for NoVirus Security Solutions and they ask you to make a scanner that scans a file inputted by the user with the function scanFile(File,VirusDB)
that takes a File and a VirusDB object and return whether a file is safe or not. Remember: the searches need to be non-Case-Sensitive
Your class also has the function setScanIntensity(int)
which changes the scan intensity. This will only receive values 0, 1, 2 or 3. This has been done for you.
The scan intensity determines the arrays from the database that will be used. i.e.:
- scanIntensity 0 means off(every file is considered safe)
- scanIntensity 1 means that only the array intensity1Signatures will be used
- scanIntensity 2 means that the arrays intensity1Signatures and intensity2Signatures will be used
- scanIntensity 3 means that all 3 arrays will be used
The outputs should be:
"Filename is safe"
or "Filename is not safe"
(Filename is the name of the file that you can get with file.getName()
)
String[] intensity1signatures = new String[]{
"malware",
"virus",
"infect"
};
String[] intensity2signatures = new String[]{
"ransomware",
"trojan",
"trojanHorse",
"worm",
"spyware",
"keystrokelogger",
"adware",
"botnet",
"rootkit",
};
String[] intensity3signatures = new String[]{
"DeleteSys32",
"OverideMBR",
"EncryptAll",
"openrandomwebsite",
"openrandwebsite",
"sendalldata",
"recordKeyboard",
"recordmouse",
"destroy",
"overheat",
"getfullcontrol",
"uploadharddrive",
"uploadharddisk",
"overload",
"changeOS",
"encrypt",
"changeDesktop",
"ddos",
"dos",
"hide",
"inject",
"ransom",
"getcreditcardinfo",
"getpasswords",
"getpass",
};
file name | file data | scan intensity | result | comments |
---|---|---|---|---|
file0 | dsadxzdcVirusdsadfads | 0 | "file0 is safe" | scanIntensity 0 means off |
file1 | dsadxzdcViRUsdsadfads | 1 | "file1 is not safe" | make sure that the scan is not case sensitive |
Virus | dsadxz2346dsadfads | 3 | "Virus is safe" | Name doesn't matter |
file4 | gasfdsfwormhmilasd | 1 | "file4 is safe" | worm is in array 2 while the intensity was 1, so 2 shall not be searched |
file5 | ascgEtCReditcaRdiNFolds | 3 | "file5 is not safe" | getcreditcardinfo is int array 3 |