Created
February 1, 2016 05:09
-
-
Save gnilchee/184435cd3f23df8cdf0a to your computer and use it in GitHub Desktop.
Simple Password Generator via Cherrypy
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import random | |
import string | |
import cherrypy | |
class PasswordGenerator(object): | |
@cherrypy.expose | |
def index(self): | |
return ''' | |
<html> | |
<title>Password Generator</title> | |
<body> | |
<center><h1>Password Generator</h1></center> | |
<center><h2>To start generating click <a href="generate">here</a></h2></center> | |
</body> | |
</html> | |
''' | |
@cherrypy.expose | |
def generate(self, length=16): | |
return ''.join(random.sample(string.printable, int(length))) | |
cherrypy.config.update({'server.socket_host': '0.0.0.0', | |
'server.socket_port': 8080, | |
'engine.autoreload_on': False}) | |
if __name__ == '__main__': | |
cherrypy.quickstart(PasswordGenerator()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment