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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Xun Zhang
comp30023-2019-project-2
Commits
9125f42b
Commit
9125f42b
authored
5 years ago
by
ChouTatsumi
Browse files
Options
Downloads
Patches
Plain Diff
crack complete
parent
806f6f80
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
.gitignore
+1
-1
1 addition, 1 deletion
.gitignore
Makefile
+2
-2
2 additions, 2 deletions
Makefile
crack.c
+29
-9
29 additions, 9 deletions
crack.c
passwords_dict.txt
+10000
-0
10000 additions, 0 deletions
passwords_dict.txt
with
10032 additions
and
12 deletions
.gitignore
+
1
−
1
View file @
9125f42b
**/.vscode
**/test.*
**/test
*
.*
**/*.exe
**/*.o
**/cheat
...
...
This diff is collapsed.
Click to expand it.
Makefile
+
2
−
2
View file @
9125f42b
...
...
@@ -10,8 +10,8 @@ sha256.o: sha256.c sha256.h
$(EXE)
:
crack.c sha256.o
$(
CC
)
$(
CFLAGS
)
-o
$(
EXE
)
crack.c sha256.o
test
:
test.c
$(
CC
)
$(
CFLAGS
)
-o
test
test.c
#
test: test.c
#
$(CC) $(CFLAGS) -o test test.c
clean
:
rm
$(
EXE
)
sha256.o
This diff is collapsed.
Click to expand it.
crack.c
+
29
−
9
View file @
9125f42b
...
...
@@ -7,11 +7,13 @@
// constants
#define INPUTSIZE 10000
#define BUFFERSIZE 256
#define PWD4_FILENAME "pwd4sha256"
#define PWD6_FILENAME "pwd6sha256"
#define OUTPUT_FILENAME "found_pwds.txt"
#define DICT_FILENAME "common_passwords.txt"
#define DICT_FILENAME "passwords_dict.txt"
#define DICT_NUMBERS 10000
#define PWD4_DICT_FILENAME "common_pwd4.txt"
#define PWD6_DICT_FILENAME "common_pwd6.txt"
#define PWD4_NUMBERS 10
...
...
@@ -180,9 +182,9 @@ int main(int argc, char** argv) {
// guess common pwd6
FILE
*
dict_fp
;
dict_fp
=
fopen
(
PWD6_DICT_FILENAME
,
"r"
);
char
input
[
INPUT
SIZE
];
char
input
[
BUFFER
SIZE
];
while
(
fgets
(
input
,
INPUT
SIZE
,
dict_fp
)
!=
NULL
)
{
while
(
fgets
(
input
,
BUFFER
SIZE
,
dict_fp
)
!=
NULL
)
{
input
[
PWD6_LEN
]
=
'\0'
;
find
=
check_pwd6_guess
(
&
ctx
,
hash
,
input
,
pwd
,
checked
);
if
(
find
)
{
...
...
@@ -194,7 +196,7 @@ int main(int argc, char** argv) {
// guess common pwd4 plus 2 digits
dict_fp
=
fopen
(
PWD4_DICT_FILENAME
,
"r"
);
while
(
fgets
(
input
,
INPUT
SIZE
,
dict_fp
)
!=
NULL
)
{
while
(
fgets
(
input
,
BUFFER
SIZE
,
dict_fp
)
!=
NULL
)
{
for
(
fifth
=
ASCII_NUM_FROM
;
fifth
<=
ASCII_NUM_TO
;
fifth
++
)
{
input
[
4
]
=
fifth
;
for
(
sixth
=
ASCII_NUM_FROM
;
sixth
<=
ASCII_NUM_TO
;
sixth
++
)
{
...
...
@@ -249,10 +251,28 @@ int main(int argc, char** argv) {
fclose
(
fp
);
}
else
if
(
argc
==
2
)
{
// This part for good guess
// get the number of passwords to produce
FILE
*
fp
;
char
input
[
BUFFERSIZE
];
int
n
=
atoi
(
argv
[
1
]);
fp
=
fopen
(
PWD6_DICT_FILENAME
,
"r"
);
int
i
=
0
;
if
(
n
<=
DICT_NUMBERS
)
{
while
(
++
i
<=
n
&&
fgets
(
input
,
BUFFERSIZE
,
fp
)
!=
NULL
)
{
printf
(
"%s"
,
input
);
}
}
else
{
fprintf
(
stderr
,
"ERROR, too large n
\n
"
);
exit
(
0
);
}
fclose
(
fp
);
}
else
if
(
argc
==
3
)
{
FILE
*
fp
;
FILE
*
wfp
;
BYTE
buffer
[
SHA256_BLOCK_SIZE
];
// read password file and store hashes passwords
...
...
@@ -291,7 +311,6 @@ int main(int argc, char** argv) {
// read guess from file and check guess
fp
=
fopen
(
argv
[
1
],
"r"
);
wfp
=
fopen
(
OUTPUT_FILENAME
,
"w"
);
char
input
[
INPUTSIZE
];
SHA256_CTX
ctx
;
BYTE
hash
[
SHA256_BLOCK_SIZE
];
...
...
@@ -310,12 +329,13 @@ int main(int argc, char** argv) {
if
(
find
)
{
printf
(
"%s %d
\n
"
,
input
,
find
);
fprintf
(
wfp
,
"%s %d
\n
"
,
input
,
find
);
}
}
fclose
(
fp
);
fclose
(
wfp
);
}
else
{
fprintf
(
stderr
,
"ERROR, undefined usage of crack
\n
"
);
exit
(
0
);
}
return
0
;
...
...
This diff is collapsed.
Click to expand it.
passwords_dict.txt
0 → 100644
+
10000
−
0
View file @
9125f42b
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