Advertisement
Guest User

Untitled

a guest
Oct 3rd, 2017
183
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.93 KB | None | 0 0
  1. #!/usr/bin/env bash
  2. # Script to automate hacked account cleanup
  3. # UH-Cerrie 2017
  4.  
  5. # Capture cPanel username
  6. echo -e "Enter the hacked cPanel account username:"
  7. read cpuser
  8. # Generate new cPanel account password
  9. cppass=$(openssl rand -base64 8)
  10. # Enable change of cPanel account password via shell
  11. export ALLOW_PASSWORD_CHANGE=1
  12. # Change the password and sync FTP password for cPanel user
  13. /scripts/chpass $cpuser $cppass
  14. /scripts/ftpupdate
  15. # Reset change password perms
  16. export ALLOW_PASSWORD_CHANGE=0
  17. # Clear out any hacked files before restore
  18. # dont enable yet
  19. rm -rf /home/$cpuserx/public_html/
  20. # dont ebale yet
  21. # Clear any hacked cron for pulling remote content etc.
  22. > /var/spool/cron/$cpuser
  23. # CXlear any hacked contact email address for password reset etc.
  24. > /home/$cpuser/.contactemail
  25. # All done
  26. echo -e "The new password $cpuser is $cppass"
  27. echo -e "Please restore the users public_html/ folder from a CLEAN backup"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement