diff --git a/src/css/style.css b/src/css/style.css index d1241c76fce843a27ee9ac6b2415c62db47307f4..aec9ac9e37d5d606ed17d44f63d0581f69c47414 100644 --- a/src/css/style.css +++ b/src/css/style.css @@ -14,6 +14,9 @@ div#box { padding: 0% 2% 3% 2%; border-radius: 0.7em; } +div#form { + text-align : center; +} div#log{ padding-left: 10%; width : 90%; diff --git a/src/index.py b/src/index.py index e97d57af7748f79728c6efa2f886cf40823df14b..7f6ccc718aa4da4e22edbc738678c93840847a29 100755 --- a/src/index.py +++ b/src/index.py @@ -25,36 +25,48 @@ print("Content-type: text/html; charset=utf-8\n") html = """<!DOCTYPE html> <head> - <title>Testeur de mot de passes</title> +<meta charset="UTF-8"> +<meta name="author" content="David Beniamine"> +<link type="text/css" rel="stylesheet" href="css/style.css" /> +<title>Testeur de mot de passes</title> </head> <body> -<h1> Testez la qualité d'un mot de passe </h1> +<div id="box"> +<div id="content"> +<div id="logos"> +<img style="float:left" src="img/tl.png" alt="Tetras Libre" /> +<h1> +Tetras Pass +</h1> +</div> """ if form.getvalue("password") is None: # Password not defined => show the form - passwordPrompt="Veuillez saisir le mot de passe à tester ci dessous :" - inputsPrompt="Veuillez saisir une suite de mots ou de dates au format jj/mm/yyyy séparées par des virgules:" - sendPrompt="Tester" + passwordPrompt = "Veuillez saisir le mot de passe à tester ci dessous :" + inputsPrompt = "Veuillez saisir une liste de mots ou de dates au format jj/mm/yyyy, un indice par ligne:" + sendPrompt = "Lancer le test" html += """ - <form action="/index.py" method="post"> + <form action="/index.py" method="post" id="mainform"> + <div id="form"> <h2> Defenseur.se </h2> <p> {} </p> <input type="password" name="password" value="" /> <h2> Attaquant.e </h2> <p> {} </p> - <input type="text" name="inputs" value="" /> + <textarea name="inputs" form="mainform"></textarea> <p> <input type="submit" name="send" value="{}"> </p> + </div> </form> """.format(passwordPrompt, inputsPrompt, sendPrompt) else: # Split user inputs field = form.getvalue("inputs") if field is not None: - inputs = field.split(',') + inputs = field.split('\n') else: inputs = None # Retrieve results @@ -66,10 +78,10 @@ else: line = re.sub('\*\*(.*)\*\*', '<em>\g<1></em>', line) if line[0] == "\t": if inlist: - html +="<li>{}</li>".format(line) + html += "<li>{}</li>".format(line) else: inlist = True - html +="<ul><li>{}</li>".format(line) + html += "<ul><li>{}</li>".format(line) elif line[0] != "\n": if inlist: html += "</ul>" @@ -77,6 +89,8 @@ else: html += "<h3>{}</h3>".format(line) html += """ +</div> +</div> </body> <foot> <p> diff --git a/src/style.css b/src/style.css deleted file mode 100644 index d1241c76fce843a27ee9ac6b2415c62db47307f4..0000000000000000000000000000000000000000 --- a/src/style.css +++ /dev/null @@ -1,149 +0,0 @@ -body { - font-family: sans; - width: 90%; - max-width : 75em; /*1200px*/ - height: 100%; - margin: auto; - color: #2e3436; - background-color:#E5E4E2; - padding : 1%; -} -/*Boite principale*/ -div#box { - background-color:#ffffff; - padding: 0% 2% 3% 2%; - border-radius: 0.7em; -} -div#log{ - padding-left: 10%; - width : 90%; - max-height : 400px; -} -div.scroll{ - overflow: auto; -} -/*Contenu*/ -div#content { - padding: 1.5% 3%; -} - -div.hllinks{ - padding: 1% 3%; -} - - -div.right{ - float:right; - width:49%; -} -div.left{ - float:left; - width:49%; -} -/* Footer*/ -div#foot { - color: gray; - font-size: small; - border-top : thin solid; - margin : 5%; -} - - -/* images floattantes*/ -div#logos img{ - max-height : 100px; - max-width : 150px; - vertical-align: middle; -} -img.middle { - vertical-align:middle; -} -img.middle-right { - vertical-align:middle; - float:right; -} -img.right{ - float : right; - border : thin solid; - box-shadow: 0.1em 0.1em 0.2em 0.2em #bbbabb; - margin : auto auto 5% 5%; - padding : 0.1em; -} -/*Comportement des liens*/ -a -{ - color: #2e3436; -} - -a:visited -{ - color : #aaa9aa; -} -a:hover -{ - text-decoration : underline ; - color : #888788; -} -/* Titres*/ -div.titlebox -{ -} -div#Title -{ - text-align : center; - font-weight : bold ; - background-color : #eeecee; - border-radius : 0.5em; - padding : 1%; - margin: 5% 20%; -} -h1 -{ - text-align : center; - font-weight : bold ; - background-color : #eeecee; - border-radius : 0.5em; - padding : 2%; - margin: 5% 20% 10% 20%; -} -h2 -{ - font-size : large; - text-align:center; - background-color : #eeecee; - border-radius : 0.5em; - margin : 5% 25%; - padding : 1.5%; -} -h3 -{ - font-size : large; - text-align: left; - margin : 5%; -} -/* text*/ -.right { - text-align : right; -} - -/*tables*/ - -table { - width: 100%; - text-align : left; -} - -th { - height: 50px; - background-color: #eeecee; -} -th, td { - padding: 15px; - border-bottom: 1px solid #ddd; -} -tr:nth-child(odd){ - background-color: #f2f2f2 -} -tr:hover { - background-color: #f5f5f5 -}