Cyber security · GCSE · OCR J277 1.4.1, AQA 8525 3.6.2, Edexcel 1CP2 5.3.1 · about 15 min
Viruses, worms, trojans, ransomware and spyware, and a signature scanner.
[1 mark]How does a worm spread?
[1 mark]What does ransomware do?
[1 mark]What is a trojan?
[1 mark]What does spyware do?
[1 mark]Why can a signature scanner miss new malware?
[1 mark]What does this program print?
sigs = ["evil", "steal"] text = "steal_data()" print([s for s in sigs if s in text])
['steal']
Only 'steal' appears in the text.
Complete the scanner. For each file in files, find every signature from signatures that appears in its contents. Print <name>: INFECTED (<signatures>) with the matches joined by , , or <name>: clean. At the end print infected files: <n>.
# the two lines every program starts with: the commands, then the robot
from bugbot import *
connect()
signatures = ["keylog", "ransom", "botnet", "backdoor"]
files = {
"snake.py": "print('score', score)",
"update.exe": "install backdoor and keylog",
"photo.jpg": "holiday beach sunset",
"free_robux.exe": "encrypt files then ransom the user",
}The hint students can ask for: For each file, collect every signature that appears anywhere in its contents. A file with any matches is infected and you list them; a file with none is clean. Count the infected ones as you go.
from bugbot import *
connect()
signatures = ["keylog", "ransom", "botnet", "backdoor"]
files = {
"snake.py": "print('score', score)",
"update.exe": "install backdoor and keylog",
"photo.jpg": "holiday beach sunset",
"free_robux.exe": "encrypt files then ransom the user",
}
infected = 0
for name, contents in files.items():
hits = [s for s in signatures if s in contents]
if hits:
print(f"{name}: INFECTED ({', '.join(hits)})")
infected = infected + 1
else:
print(f"{name}: clean")
print("infected files:", infected)
Any program that meets the task's checks is marked correct in the simulator; this is one way, not the only way.