Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
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
Xun Zhang
comp30023-2019-project-2
Commits
fe60ed1f
Commit
fe60ed1f
authored
May 25, 2019
by
ChouTatsumi
Browse files
Options
Downloads
Patches
Plain Diff
test pwd6
parent
e3a4e66a
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
crack.c
+108
-26
108 additions, 26 deletions
crack.c
found_pwds.txt
+1
-0
1 addition, 0 deletions
found_pwds.txt
with
109 additions
and
26 deletions
crack.c
+
108
−
26
View file @
fe60ed1f
...
...
@@ -13,6 +13,8 @@
#define OUTPUT_FILENAME "found_pwds.txt"
#define PWD4_NUMBERS 10
#define PWD_NUMBERS 30
#define PWD4_LEN 4
#define PWD6_LEN 6
#define ASCII_FROM 32
#define ASCII_TO 126
...
...
@@ -73,45 +75,125 @@ int main(int argc, char** argv) {
// create guess and check it
SHA256_CTX
ctx
;
BYTE
buf
[
SHA256_BLOCK_SIZE
];
int
checked
[
PWD_NUMBERS
];
int_array_init
(
checked
,
PWD4_NUMBERS
);
// open output file
fp
=
fopen
(
OUTPUT_FILENAME
,
"w"
);
// violent crack PWD4
char
guess
[
5
];
guess
[
4
]
=
'\0'
;
int
checked
[
PWD4_NUMBERS
];
int_array_init
(
checked
,
PWD4_NUMBERS
);
char
pw4guess
[
PWD4_LEN
+
1
];
pw4guess
[
PWD4_LEN
]
=
'\0'
;
int
first
,
second
,
third
,
fourth
;
for
(
first
=
ASCII_FROM
;
first
<=
ASCII_TO
;
first
++
)
{
guess
[
0
]
=
first
;
pw4
guess
[
0
]
=
first
;
for
(
second
=
ASCII_FROM
;
second
<=
ASCII_TO
;
second
++
)
{
guess
[
1
]
=
second
;
pw4
guess
[
1
]
=
second
;
for
(
third
=
ASCII_FROM
;
third
<=
ASCII_TO
;
third
++
)
{
guess
[
2
]
=
third
;
pw4
guess
[
2
]
=
third
;
for
(
fourth
=
ASCII_FROM
;
fourth
<=
ASCII_TO
;
fourth
++
)
{
guess
[
3
]
=
fourth
;
pw4
guess
[
3
]
=
fourth
;
// generate hash and check
sha256_init
(
&
ctx
);
sha256_update
(
&
ctx
,
(
BYTE
*
)
guess
,
4
);
sha256_update
(
&
ctx
,
(
BYTE
*
)
pw4
guess
,
PWD4_LEN
);
sha256_final
(
&
ctx
,
buf
);
for
(
int
i
=
0
;
i
<
PWD4_NUMBERS
;
i
++
)
{
for
(
i
=
0
;
i
<
PWD4_NUMBERS
;
i
++
)
{
if
(
!
checked
[
i
]
&&
!
memcmp
(
pwd
[
i
],
buf
,
SHA256_BLOCK_SIZE
))
{
checked
[
i
]
=
1
;
printf
(
"%s %d
\n
"
,
guess
,
i
+
1
);
fprintf
(
fp
,
"%s %d
\n
"
,
guess
,
i
+
1
);
printf
(
"%s %d
\n
"
,
pw4
guess
,
i
+
1
);
fprintf
(
fp
,
"%s %d
\n
"
,
pw4
guess
,
i
+
1
);
}
}
}}}}
// crack PWD6
char
pw6guess
[
PWD6_LEN
+
1
];
pw6guess
[
PWD6_LEN
]
=
'\0'
;
int
fifth
,
sixth
;
// guess pure number password
for
(
first
=
ASCII_NUM_FROM
;
first
<=
ASCII_NUM_TO
;
first
++
)
{
pw6guess
[
0
]
=
first
;
for
(
second
=
ASCII_NUM_FROM
;
second
<=
ASCII_NUM_TO
;
second
++
)
{
pw6guess
[
1
]
=
second
;
for
(
third
=
ASCII_NUM_FROM
;
third
<=
ASCII_NUM_TO
;
third
++
)
{
pw6guess
[
2
]
=
third
;
for
(
fourth
=
ASCII_NUM_FROM
;
fourth
<=
ASCII_NUM_TO
;
fourth
++
)
{
pw6guess
[
3
]
=
fourth
;
for
(
fifth
=
ASCII_NUM_FROM
;
fifth
<=
ASCII_NUM_TO
;
fifth
++
)
{
pw6guess
[
4
]
=
fifth
;
for
(
sixth
=
ASCII_NUM_FROM
;
sixth
<=
ASCII_NUM_TO
;
sixth
++
)
{
pw6guess
[
5
]
=
sixth
;
// generate hash and check
sha256_init
(
&
ctx
);
sha256_update
(
&
ctx
,
(
BYTE
*
)
pw6guess
,
PWD6_LEN
);
sha256_final
(
&
ctx
,
buf
);
for
(
i
=
PWD4_NUMBERS
;
i
<
PWD_NUMBERS
;
i
++
)
{
if
(
!
checked
[
i
]
&&
!
memcmp
(
pwd
[
i
],
buf
,
SHA256_BLOCK_SIZE
))
{
checked
[
i
]
=
1
;
printf
(
"%s %d
\n
"
,
pw6guess
,
i
+
1
);
fprintf
(
fp
,
"%s %d
\n
"
,
pw6guess
,
i
+
1
);
}
}
}}}}}}
// guess pure lowercase alphabets password, and first letter Capitalize
for
(
first
=
ASCII_LOWERCASE_FROM
;
first
<=
ASCII_LOWERCASE_TO
;
first
++
)
{
pw6guess
[
0
]
=
first
;
for
(
second
=
ASCII_LOWERCASE_FROM
;
second
<=
ASCII_LOWERCASE_TO
;
second
++
)
{
pw6guess
[
1
]
=
second
;
for
(
third
=
ASCII_LOWERCASE_FROM
;
third
<=
ASCII_LOWERCASE_TO
;
third
++
)
{
pw6guess
[
2
]
=
third
;
for
(
fourth
=
ASCII_LOWERCASE_FROM
;
fourth
<=
ASCII_LOWERCASE_TO
;
fourth
++
)
{
pw6guess
[
3
]
=
fourth
;
for
(
fifth
=
ASCII_LOWERCASE_FROM
;
fifth
<=
ASCII_LOWERCASE_TO
;
fifth
++
)
{
pw6guess
[
4
]
=
fifth
;
for
(
sixth
=
ASCII_LOWERCASE_FROM
;
sixth
<=
ASCII_LOWERCASE_TO
;
sixth
++
)
{
pw6guess
[
5
]
=
sixth
;
// generate hash and check
sha256_init
(
&
ctx
);
sha256_update
(
&
ctx
,
(
BYTE
*
)
pw6guess
,
PWD6_LEN
);
sha256_final
(
&
ctx
,
buf
);
for
(
i
=
PWD4_NUMBERS
;
i
<
PWD_NUMBERS
;
i
++
)
{
if
(
!
checked
[
i
]
&&
!
memcmp
(
pwd
[
i
],
buf
,
SHA256_BLOCK_SIZE
))
{
checked
[
i
]
=
1
;
printf
(
"%s %d
\n
"
,
pw6guess
,
i
+
1
);
fprintf
(
fp
,
"%s %d
\n
"
,
pw6guess
,
i
+
1
);
}
}
// crack PWD6
// first lettle capitalize
pw6guess
[
0
]
=
first
-
ASCII_LOWERCASE_FROM
+
ASCII_UPPERCASE_FROM
;
// generate hash and check
sha256_init
(
&
ctx
);
sha256_update
(
&
ctx
,
(
BYTE
*
)
pw6guess
,
PWD6_LEN
);
sha256_final
(
&
ctx
,
buf
);
for
(
i
=
PWD4_NUMBERS
;
i
<
PWD_NUMBERS
;
i
++
)
{
if
(
!
checked
[
i
]
&&
!
memcmp
(
pwd
[
i
],
buf
,
SHA256_BLOCK_SIZE
))
{
checked
[
i
]
=
1
;
printf
(
"%s %d
\n
"
,
pw6guess
,
i
+
1
);
fprintf
(
fp
,
"%s %d
\n
"
,
pw6guess
,
i
+
1
);
}
}
}}}}}}
fclose
(
fp
);
}
else
if
(
argc
==
2
)
{
...
...
This diff is collapsed.
Click to expand it.
found_pwds.txt
+
1
−
0
View file @
fe60ed1f
...
...
@@ -8,3 +8,4 @@ sp*t 1
spOt 4
spot 5
xunz 8
Terenc 25
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