Advertisement
Guest User

Deluge WebUI Password Reset

a guest
Nov 17th, 2016
758
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.40 KB | None | 0 0
  1. Save the following text as something.py, and do 'chmod +x something.py'. Run the command with './something.py ~/.config/deluge' If your deluge config directory is not at the default location, change the argument accordingly.
  2.  
  3. ### COPY AFTER THIS LINE ###
  4.  
  5. #!/usr/bin/env python
  6. # Changes the password for Deluge's Web UI
  7.  
  8. from deluge.config import Config
  9. import hashlib
  10. import os.path
  11. import sys
  12.  
  13. if len(sys.argv) == 2:
  14. deluge_dir = os.path.expanduser(sys.argv[1])
  15.  
  16. if os.path.isdir(deluge_dir):
  17. try:
  18. config = Config("web.conf", config_dir=deluge_dir)
  19. except IOError, e:
  20. print "Can't open web ui config file: ", e
  21. else:
  22. password = raw_input("Enter new password: ")
  23. s = hashlib.sha1()
  24. s.update(config['pwd_salt'])
  25. s.update(password)
  26. config['pwd_sha1'] = s.hexdigest()
  27. try:
  28. config.save()
  29. except IOError, e:
  30. print "Couldn't save new password: ", e
  31. else:
  32. print "New password successfully set!"
  33. else:
  34. print "%s is not a directory!" % deluge_dir
  35. else:
  36. print "Usage: %s <deluge config dir>" % (os.path.basename(sys.argv[0]))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement