Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
N
nirmalathasa_comp30023_2019_project-2
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
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
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
Abhisha Nirmalathas
nirmalathasa_comp30023_2019_project-2
Commits
7b36fd06
Commit
7b36fd06
authored
May 24, 2019
by
Abhisha Nirmalathas
Browse files
Options
Downloads
Patches
Plain Diff
commented supplementary program
parent
4f80d31c
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
common_password_statistics.py
+6
-0
6 additions, 0 deletions
common_password_statistics.py
with
6 additions
and
0 deletions
common_password_statistics.py
+
6
−
0
View file @
7b36fd06
from
itertools
import
permutations
from
itertools
import
permutations
# common letter substitutions
common_substituions
=
{
common_substituions
=
{
"
a
"
:
[
"
A
"
,
"
@
"
,
"
4
"
],
"
a
"
:
[
"
A
"
,
"
@
"
,
"
4
"
],
"
b
"
:
[
"
8
"
,
"
B
"
],
"
b
"
:
[
"
8
"
,
"
B
"
],
...
@@ -54,6 +55,7 @@ common_substituions = {
...
@@ -54,6 +55,7 @@ common_substituions = {
"
Z
"
:
[
"
z
"
,
"
5
"
,
"
$
"
]
"
Z
"
:
[
"
z
"
,
"
5
"
,
"
$
"
]
}
}
def
create_substituions
(
word
):
def
create_substituions
(
word
):
#creates a file of substitutions which is all possibly permutations
f
=
open
(
"
substition.txt
"
,
"
a
"
)
f
=
open
(
"
substition.txt
"
,
"
a
"
)
perms
=
[
''
.
join
(
p
)
for
p
in
permutations
(
word
)]
perms
=
[
''
.
join
(
p
)
for
p
in
permutations
(
word
)]
perms
=
list
(
dict
.
fromkeys
(
perms
))
perms
=
list
(
dict
.
fromkeys
(
perms
))
...
@@ -63,6 +65,7 @@ def create_substituions(word):
...
@@ -63,6 +65,7 @@ def create_substituions(word):
f
.
close
()
f
.
close
()
print
(
perms
)
print
(
perms
)
def
create_replacements
(
word
,
file
):
def
create_replacements
(
word
,
file
):
# replaces world and writes to file
for
x
in
range
(
len
(
word
)):
for
x
in
range
(
len
(
word
)):
if
(
word
[
x
]
in
common_substituions
):
if
(
word
[
x
]
in
common_substituions
):
for
y
in
common_substituions
[
word
[
x
]]:
for
y
in
common_substituions
[
word
[
x
]]:
...
@@ -71,6 +74,7 @@ def create_replacements(word, file):
...
@@ -71,6 +74,7 @@ def create_replacements(word, file):
file
.
write
(
"
\n
"
)
file
.
write
(
"
\n
"
)
def
create_common_password_substitutions
():
def
create_common_password_substitutions
():
# creates list of passwords with common replacements
f
=
open
(
"
test.txt
"
,
"
r
"
)
f
=
open
(
"
test.txt
"
,
"
r
"
)
words
=
f
.
readlines
()
words
=
f
.
readlines
()
replacements
=
open
(
"
replacements_test.txt
"
,
"
a
"
)
replacements
=
open
(
"
replacements_test.txt
"
,
"
a
"
)
...
@@ -82,6 +86,7 @@ def create_common_password_substitutions():
...
@@ -82,6 +86,7 @@ def create_common_password_substitutions():
f
.
close
()
f
.
close
()
def
get_character_frequencies
():
def
get_character_frequencies
():
#gets the frequencies of characters and builds words
f
=
open
(
"
proj-2_common_passwords.txt
"
,
"
r
"
)
f
=
open
(
"
proj-2_common_passwords.txt
"
,
"
r
"
)
words
=
f
.
readlines
()
words
=
f
.
readlines
()
f
.
close
()
f
.
close
()
...
@@ -103,6 +108,7 @@ def get_character_frequencies():
...
@@ -103,6 +108,7 @@ def get_character_frequencies():
get_character_frequencies
()
get_character_frequencies
()
def
write_out_common_substitutions
():
def
write_out_common_substitutions
():
# writes out common substituion words
f
=
open
(
"
common_subs.txt
"
,
"
w
"
)
f
=
open
(
"
common_subs.txt
"
,
"
w
"
)
for
char
,
subs
in
common_substituions
.
items
():
for
char
,
subs
in
common_substituions
.
items
():
f
.
write
(
char
)
f
.
write
(
char
)
...
...
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