Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
Pass Checker
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
tetras-libre
Pass Checker
Commits
a793b239
Unverified
Commit
a793b239
authored
8 years ago
by
David Beniamine
Browse files
Options
Downloads
Patches
Plain Diff
small refactor
parent
44727a9e
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/console.py
+8
-20
8 additions, 20 deletions
src/console.py
src/index.py
+3
-3
3 additions, 3 deletions
src/index.py
src/test_pass.py
+27
-9
27 additions, 9 deletions
src/test_pass.py
with
38 additions
and
32 deletions
src/console.py
+
8
−
20
View file @
a793b239
...
@@ -16,32 +16,20 @@
...
@@ -16,32 +16,20 @@
# You should have received a copy of the GNU Affero General Public License
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from
zxcvbn
import
zxcvbn
from
getpass
import
getpass
from
dateutil.parser
import
parse
import
getpass
from
test_pass
import
test_pass
from
test_pass
import
test_pass
# Read password
# Read password
passwd
=
getpass
.
getpass
(
"
Merci d
'
entrer un mot de passe qui ne sera pas affiché
\n
"
)
passwd
=
getpass
(
"
Merci d
'
entrer un mot de passe qui ne sera pas affiché
\n
"
)
word
=
"
a
"
user_inputs
=
[]
user_inputs
=
[]
while
word
!=
""
:
while
True
:
word
=
input
(
"
Veuillez entrer un mot d
'
aide ou une date au format jj/mm/yyyy pour le système ou tappez [entrer]
"
word
=
input
(
"
Veuillez entrer un mot d
'
aide ou une date au format jj/mm/yyyy pour le système ou tappez [entrer]
"
"
pour arrêter
\n
"
)
"
pour arrêter
\n
"
)
if
word
!=
""
:
if
word
==
""
:
try
:
break
date
=
parse
(
word
)
words
=
[
date
.
day
]
words
.
append
(
date
.
month
)
words
.
append
(
date
.
year
)
except
:
words
=
[
word
]
finally
:
for
word
in
words
:
user_inputs
.
append
(
word
)
user_inputs
.
append
(
word
)
# TODO call wrapper
lines
=
test_pass
(
passwd
,
user_inputs
)
lines
=
test_pass
(
passwd
,
user_inputs
)
for
line
in
lines
:
for
line
in
lines
:
print
(
line
)
print
(
line
)
This diff is collapsed.
Click to expand it.
src/index.py
+
3
−
3
View file @
a793b239
...
@@ -28,7 +28,7 @@ html = """<!DOCTYPE html>
...
@@ -28,7 +28,7 @@ html = """<!DOCTYPE html>
<meta charset=
"
UTF-8
"
>
<meta charset=
"
UTF-8
"
>
<meta name=
"
author
"
content=
"
David Beniamine
"
>
<meta name=
"
author
"
content=
"
David Beniamine
"
>
<link type=
"
text/css
"
rel=
"
stylesheet
"
href=
"
css/style.css
"
/>
<link type=
"
text/css
"
rel=
"
stylesheet
"
href=
"
css/style.css
"
/>
<title>Te
steur de mot de passe
s</title>
<title>Te
tras Pas
s</title>
</head>
</head>
<body>
<body>
<div id=
"
box
"
>
<div id=
"
box
"
>
...
@@ -44,7 +44,7 @@ Tetras Pass
...
@@ -44,7 +44,7 @@ Tetras Pass
if
form
.
getvalue
(
"
password
"
)
is
None
:
if
form
.
getvalue
(
"
password
"
)
is
None
:
# Password not defined => show the form
# Password not defined => show the form
passwordPrompt
=
"
Veuillez saisir le mot de passe à tester ci dessous :
"
passwordPrompt
=
"
Veuillez saisir le mot de passe à tester ci dessous :
"
inputsPrompt
=
"
Veuillez saisir une liste d
e
mots ou de dates au format jj/mm/yyyy, un indice par ligne:
"
inputsPrompt
=
"
Veuillez saisir une liste d
'
indices :
mots ou de dates au format jj/mm/yyyy, un indice par ligne:
"
sendPrompt
=
"
Lancer le test
"
sendPrompt
=
"
Lancer le test
"
html
+=
"""
html
+=
"""
...
@@ -66,7 +66,7 @@ else:
...
@@ -66,7 +66,7 @@ else:
# Split user inputs
# Split user inputs
field
=
form
.
getvalue
(
"
inputs
"
)
field
=
form
.
getvalue
(
"
inputs
"
)
if
field
is
not
None
:
if
field
is
not
None
:
inputs
=
field
.
split
(
'
\n
'
)
inputs
=
field
.
split
(
'
\
r\
n
'
)
else
:
else
:
inputs
=
None
inputs
=
None
# Retrieve results
# Retrieve results
...
...
This diff is collapsed.
Click to expand it.
src/test_pass.py
+
27
−
9
View file @
a793b239
...
@@ -17,6 +17,8 @@
...
@@ -17,6 +17,8 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import
os
import
os
from
dateutil.parser
import
parse
from
itertools
import
combinations
from
zxcvbn
import
zxcvbn
from
zxcvbn
import
zxcvbn
from
zxcvbn.matching
import
add_frequency_lists
from
zxcvbn.matching
import
add_frequency_lists
...
@@ -38,11 +40,29 @@ def add_dictionnaries():
...
@@ -38,11 +40,29 @@ def add_dictionnaries():
add_frequency_lists
(
dicts
)
add_frequency_lists
(
dicts
)
# Process user inputs:
# Generate all possibile combinations of 2 parts of dates
def
process_input
(
inputs
):
dates
=
[]
words
=
[]
for
i
in
inputs
:
try
:
date
=
parse
(
i
)
dates
+=
date
.
strftime
(
"
%d-%m-%y-%B-%Y-%A
"
).
split
(
'
-
'
)
except
:
words
.
append
(
i
)
for
n
in
range
(
2
,
4
):
for
subset
in
combinations
(
dates
,
n
):
words
.
append
(
""
.
join
(
subset
))
print
(
words
)
return
words
def
test_pass
(
password
,
inputs
):
def
test_pass
(
password
,
inputs
):
# Read input
# Read input
add_dictionnaries
()
add_dictionnaries
()
results
=
zxcvbn
(
password
,
inputs
)
results
=
zxcvbn
(
password
,
process_input
(
inputs
)
)
lines
=
[]
lines
=
[]
lines
.
append
(
"
Résultats du test
\n
"
)
lines
.
append
(
"
Résultats du test
\n
"
)
...
@@ -63,6 +83,7 @@ def test_pass(password, inputs):
...
@@ -63,6 +83,7 @@ def test_pass(password, inputs):
lines
.
append
(
"
\n
"
)
lines
.
append
(
"
\n
"
)
lines
.
append
(
"
Methode de hack utilisées
"
)
lines
.
append
(
"
Methode de hack utilisées
"
)
# Print hack methods
# Print hack methods
print
(
results
[
"
sequence
"
])
for
seq
in
results
[
"
sequence
"
]:
for
seq
in
results
[
"
sequence
"
]:
if
seq
[
"
pattern
"
]
==
"
bruteforce
"
:
if
seq
[
"
pattern
"
]
==
"
bruteforce
"
:
lines
.
append
(
"
\t
Mot de passe trouvé par force brute
"
)
lines
.
append
(
"
\t
Mot de passe trouvé par force brute
"
)
...
@@ -83,16 +104,13 @@ def test_pass(password, inputs):
...
@@ -83,16 +104,13 @@ def test_pass(password, inputs):
lines
.
append
(
"
Score Global {}/4 : {}
"
.
format
(
results
[
"
score
"
],
valeur
[
results
[
"
score
"
]]))
lines
.
append
(
"
Score Global {}/4 : {}
"
.
format
(
results
[
"
score
"
],
valeur
[
results
[
"
score
"
]]))
for
key
,
values
in
results
[
"
feedback
"
].
items
():
for
key
,
values
in
results
[
"
feedback
"
].
items
():
# Tel that we sould add the key line if there are some contents
if
values
!=
[]
and
values
!=
""
:
needappend
=
True
lines
.
append
(
"
{} :
"
.
format
(
tr
(
key
)))
else
:
continue
if
not
isinstance
(
values
,
list
):
if
not
isinstance
(
values
,
list
):
# Simplify things by always using lists
# Simplify things by always using lists
values
=
[
values
]
values
=
[
values
]
for
val
in
values
:
for
val
in
values
:
if
val
!=
""
:
if
needappend
:
# Append key line
lines
.
append
(
"
{} :
"
.
format
(
tr
(
key
)))
needappend
=
False
lines
.
append
(
"
\t
{}
"
.
format
(
tr
(
val
)))
lines
.
append
(
"
\t
{}
"
.
format
(
tr
(
val
)))
return
lines
return
lines
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment