Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
Smash_pass
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Smashpass
Smash_pass
Commits
0590504d
Commit
0590504d
authored
Dec 23, 2024
by
Benjamin REED
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added dictionary
parent
373857fb
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
84173 additions
and
7 deletions
+84173
-7
French.dic
French.dic
+84140
-0
main.py
main.py
+33
-7
No files found.
French.dic
0 → 100644
View file @
0590504d
This diff is collapsed.
Click to expand it.
main.py
View file @
0590504d
...
...
@@ -14,6 +14,8 @@ from cryptography.hazmat.primitives.kdf.pbkdf2 import PBKDF2HMAC
import
rsa
from
rsa
import
RsaKey
DICTIONARY_PATH
=
"French.dic"
DEFAULT_DATABASE_PATH
=
"db.txt"
USAGES
=
{
"new"
:
...
...
@@ -333,11 +335,25 @@ class State:
"""
Generate a password given a 'set' object of characters to choose from.
"""
def
generate_password
(
length
,
charset
):
s
=
[]
for
i
in
range
(
0
,
length
):
s
.
append
(
random
.
choice
(
list
(
charset
)))
return
''
.
join
(
s
)
def
generate_password
(
length
,
charset
,
words
:
bool
=
False
):
if
words
:
s
=
[]
dic
=
open
(
DICTIONARY_PATH
)
lines
=
dic
.
read
()
.
split
(
'
\n
'
)
# 2 MEGABYTES by the way
for
line
in
lines
:
word
=
line
.
split
(
'/'
)[
0
]
if
len
(
word
)
>=
length
:
continue
if
len
(
s
)
+
len
(
word
)
>=
length
:
dic
.
close
()
return
''
.
join
(
s
)
+
generate_password
(
length
-
len
(
s
),
charset
,
False
)
s
.
extend
(
list
(
word
))
dic
.
close
()
print
(
"Catastrophic error generating password."
)
else
:
s
=
[]
for
i
in
range
(
0
,
length
):
s
.
append
(
random
.
choice
(
list
(
charset
)))
return
''
.
join
(
s
)
def
handle_args
(
db
:
str
,
password
:
str
):
state
=
State
(
db
,
password
)
...
...
@@ -627,18 +643,28 @@ def main():
continue
chars
=
set
()
words
=
False
if
charset
==
"all"
:
chars
=
LOWERCASE_ALPHABET
|
UPPERCASE_ALPHABET
|
NUMBERS
|
SPECIAL
else
:
s
=
charset
.
split
(
"-"
)
for
c
in
list
(
s
[
0
]):
chars
|=
CHARSET_MAP
[
c
]
if
c
==
'w'
or
c
==
'm'
:
# words/mots
words
=
True
chars
|=
LOWERCASE_ALPHABET
|
UPPERCASE_ALPHABET
|
NUMBERS
|
SPECIAL
elif
c
not
in
CHARSET_MAP
:
print
(
f
"Unrecognized charset option '{c}', expected 'l', 'u', 'n', 's', or 'w'"
)
else
:
chars
|=
CHARSET_MAP
[
c
]
if
len
(
s
)
>
1
:
for
c
in
s
[
1
]:
# list of chars to exclude
chars
^=
set
(
c
)
if
chars
==
set
():
print
(
"Error: unrecognizable charset provided"
)
continue
password
=
generate_password
(
length
,
chars
)
password
=
generate_password
(
length
,
chars
,
words
)
print
(
password
)
state
.
add_password
(
label
,
password
.
encode
(),
mode
,
key
)
elif
command
==
"list"
or
command
==
"ls"
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment