Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
A
achattaraj_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
Aneesh Chattaraj
achattaraj_comp30023_2019_project-2
Commits
c48fe901
Commit
c48fe901
authored
May 24, 2019
by
aneesh
Browse files
Options
Downloads
Patches
Plain Diff
crack fixwd
parent
7cf648c4
No related branches found
No related tags found
No related merge requests found
Pipeline
#2866
canceled
May 24, 2019
Stage: build
Stage: test
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
crack.c
+108
-99
108 additions, 99 deletions
crack.c
with
108 additions
and
99 deletions
crack.c
+
108
−
99
View file @
c48fe901
...
...
@@ -9,6 +9,7 @@
#include
<stdbool.h>
int
exist
[
30
];
BYTE
old
[
6
];
int
count
=
0
;
void
printRandomString
(
int
hashes
[
30
][
32
])
{
bool
cracked
=
true
;
...
...
@@ -16,8 +17,12 @@ SHA256_CTX ctx;
BYTE
buffer
[
SHA256_BLOCK_SIZE
];
int
count
=
0
;
for
(
int
i
=
0
;
i
<
100000000000000000
;
++
i
)
{
if
(
count
=
30
)
{
break
;
}
BYTE
res
[
6
];
for
(
int
j
=
0
;
j
<
6
;
j
++
)
res
[
j
]
=
(
rand
()
%
26
)
+
97
;;
...
...
@@ -39,6 +44,7 @@ SHA256_CTX ctx;
if
(
cracked
==
true
&&
exist
[
k
+
1
]
!=
1
){
ctx
.
data
[
6
]
=
'\0'
;
exist
[
k
+
1
]
=
1
;
++
count
;
printf
(
"%s %d
\n
"
,
ctx
.
data
,
k
+
1
);
}
}
...
...
@@ -52,11 +58,15 @@ void variations(char *word_list_file, int hashes[30][32])
BYTE
buffer
[
SHA256_BLOCK_SIZE
];
BYTE
password
[
6
];
bool
cracked
=
true
;
int
count
=
0
;
FILE
*
word_list
;
word_list
=
fopen
(
word_list_file
,
"rb"
);
while
(
fgets
(
password
,
7
,
word_list
)
!=
'\0'
){
if
(
count
==
30
)
{
break
;
}
for
(
int
c
=
0
;
c
<
6
;
++
c
)
{
BYTE
password1
[
6
];
...
...
@@ -101,6 +111,7 @@ void variations(char *word_list_file, int hashes[30][32])
if
(
cracked
==
true
&&
exist
[
j
+
1
]
!=
1
){
ctx
.
data
[
6
]
=
'\0'
;
exist
[
j
+
1
]
=
1
;
count
++
;
printf
(
"%s %d
\n
"
,
ctx
.
data
,
j
+
1
);
}
}
...
...
@@ -116,11 +127,11 @@ void variations(char *word_list_file, int hashes[30][32])
}
void
printRandomString1
(
int
k
)
{
int
count
=
0
;
for
(
int
i
=
0
;
i
<
k
;
++
i
)
{
for
(
int
i
=
0
;
i
<
k
-
1
;
++
i
)
{
BYTE
res
[
6
];
for
(
int
j
=
0
;
j
<
6
;
j
++
)
res
[
j
]
=
(
rand
()
%
26
)
+
97
;;
res
[
j
]
=
(
rand
()
%
59
)
+
65
;;
res
[
6
]
=
'\0'
;
printf
(
"%s
\n
"
,
res
);
}
...
...
@@ -132,7 +143,7 @@ void bruteforce(int hashes[30][32]){
BYTE
buffer
[
SHA256_BLOCK_SIZE
];
BYTE
password
[
4
];
bool
cracked
=
true
;
int
count
=
0
;
for
(
int
c1
=
32
;
c1
<
127
;
c1
++
){
password
[
0
]
=
c1
;
...
...
@@ -192,7 +203,7 @@ void permute(char *a, int l, int r,int hashes[30][32],int status)
{
SHA256_CTX
ctx
;
BYTE
buffer
[
SHA256_BLOCK_SIZE
];
bool
cracked
=
true
;
int
count
=
0
;
int
count
1
=
0
;
char
word
[
30
];
int
i
;
...
...
@@ -226,19 +237,19 @@ if (l == r)
}
}
}
else
{
BYTE
n
[
6
];
int
count
=
0
;
int
count
1
=
0
;
for
(
int
k
=
0
;
k
<
6
;
++
k
)
{
n
[
k
]
=
a
[
k
];
if
(
old
[
k
]
==
n
[
k
])
{
++
count
;
++
count
1
;
}
}
n
[
6
]
=
'\0'
;
if
(
count
<
6
)
if
(
count
1
<
6
)
{
printf
(
"%s
\n
"
,
n
);
for
(
int
k
=
0
;
k
<
7
;
++
k
)
...
...
@@ -267,7 +278,7 @@ void permutations1(char *word_list_file, int hashes[30][32],int status)
BYTE
buffer
[
SHA256_BLOCK_SIZE
];
BYTE
password
[
12
];
bool
cracked
=
true
;
int
count
=
0
;
char
word
[
30
];
...
...
@@ -304,7 +315,7 @@ void crack6(char *word_list_file, int hashes[30][32])
BYTE
buffer
[
SHA256_BLOCK_SIZE
];
BYTE
password
[
6
];
bool
cracked
=
true
;
int
count
=
0
;
char
word
[
30
];
...
...
@@ -330,6 +341,7 @@ void crack6(char *word_list_file, int hashes[30][32])
if
(
cracked
==
true
&&
exist
[
j
+
1
]
!=
1
){
ctx
.
data
[
6
]
=
'\0'
;
exist
[
j
+
1
]
=
1
;
++
count
;
printf
(
"%s %d
\n
"
,
ctx
.
data
,
j
+
1
);
}
}
...
...
@@ -362,7 +374,7 @@ void crack6(char *word_list_file, int hashes[30][32])
b
++
;
}
bruteforce
(
hashes
);
unsigned
char
buff6
[
640
];
file_6
=
fopen
(
"pwd6sha256"
,
"rb"
);
fread
(
buff6
,
sizeof
(
buff6
),
1
,
file_6
);
...
...
@@ -374,7 +386,7 @@ void crack6(char *word_list_file, int hashes[30][32])
printf
(
"
\n
"
);
}
hashes
[
a
][
b
]
=
buff6
[
i
];
printf
(
"%x"
,
hashes
[
a
][
b
]);
b
++
;
}
...
...
@@ -406,7 +418,7 @@ if (argc==3)
int
i
,
a
=
0
,
b
=
0
;
fseek
(
password_file
,
0L
,
SEEK_END
);
int
sz
=
ftell
(
password_file
);
printf
(
"%d
\n
"
,
sz
);
rewind
(
password_file
);
int
hashes
[
sz
/
32
][
32
];
unsigned
char
buff
[
sz
];
...
...
@@ -419,7 +431,7 @@ if (argc==3)
}
hashes
[
a
][
b
]
=
buff
[
i
];
printf
(
"%x"
,
hashes
[
a
][
b
]);
b
++
;
}
...
...
@@ -430,6 +442,3 @@ if (argc==3)
return
0
;
}
\ No newline at end of file
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