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
31ede3fb
Commit
31ede3fb
authored
May 24, 2019
by
aneesh
Browse files
Options
Downloads
Patches
Plain Diff
11
parent
791b46ef
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
crack.c
+7
-113
7 additions, 113 deletions
crack.c
crack.exe
+0
-0
0 additions, 0 deletions
crack.exe
with
7 additions
and
113 deletions
crack.c
+
7
−
113
View file @
31ede3fb
...
@@ -113,7 +113,7 @@ void variations(char * word_list_file, int hashes[30][32]) {
...
@@ -113,7 +113,7 @@ void variations(char * word_list_file, int hashes[30][32]) {
}
}
void
printRandomString1
(
int
k
)
{
void
printRandomString1
(
int
k
)
{
for
(
int
i
=
0
;
i
<
k
-
1
;
++
i
)
{
for
(
int
i
=
0
;
i
<
k
;
++
i
)
{
BYTE
res
[
6
];
BYTE
res
[
6
];
for
(
int
j
=
0
;
j
<
6
;
j
++
)
for
(
int
j
=
0
;
j
<
6
;
j
++
)
res
[
j
]
=
(
rand
()
%
59
)
+
65
;;
res
[
j
]
=
(
rand
()
%
59
)
+
65
;;
...
@@ -165,117 +165,7 @@ void bruteforce(int hashes[30][32]) {
...
@@ -165,117 +165,7 @@ void bruteforce(int hashes[30][32]) {
}
}
}
}
}
}
// C program to print all permutations with duplicates allowed
/* Function to swap values at two pointers */
void
swap
(
char
*
x
,
char
*
y
)
{
char
temp
;
temp
=
*
x
;
*
x
=
*
y
;
*
y
=
temp
;
}
/* Function to print permutations of string
This function takes three parameters:
1. String
2. Starting index of the string
3. Ending index of the string. */
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
count1
=
0
;
char
word
[
30
];
int
i
;
if
(
l
==
r
)
{
if
(
status
!=
2
)
{
BYTE
n
[
6
];
for
(
int
k
=
0
;
k
<
6
;
++
k
)
{
n
[
k
]
=
a
[
k
];
}
n
[
6
]
=
'\0'
;
sha256_init
(
&
ctx
);
sha256_update
(
&
ctx
,
n
,
sizeof
(
n
));
sha256_final
(
&
ctx
,
buffer
);
for
(
int
j
=
10
;
j
<
30
;
j
++
)
{
cracked
=
true
;
for
(
int
i
=
0
;
i
<
32
;
i
++
)
{
if
(
buffer
[
i
]
!=
hashes
[
j
][
i
])
{
cracked
=
false
;
break
;
}
}
if
(
cracked
==
true
&&
exist
[
j
+
1
]
!=
1
)
{
ctx
.
data
[
6
]
=
'\0'
;
exist
[
j
+
1
]
=
1
;
printf
(
"%s %d
\n
"
,
ctx
.
data
,
j
+
1
);
}
}
}
else
{
BYTE
n
[
6
];
int
count1
=
0
;
for
(
int
k
=
0
;
k
<
6
;
++
k
)
{
n
[
k
]
=
a
[
k
];
if
(
old
[
k
]
==
n
[
k
])
{
++
count1
;
}
}
n
[
6
]
=
'\0'
;
if
(
count1
<
6
)
{
printf
(
"%s
\n
"
,
n
);
for
(
int
k
=
0
;
k
<
7
;
++
k
)
{
old
[
k
]
=
n
[
k
];
}
}
}
}
else
{
for
(
i
=
l
;
i
<=
r
;
i
++
)
{
swap
((
a
+
l
),
(
a
+
i
));
permute
(
a
,
l
+
1
,
r
,
hashes
,
status
);
swap
((
a
+
l
),
(
a
+
i
));
//backtrack
}
}
}
/* Driver program to test above functions */
void
permutations1
(
char
*
word_list_file
,
int
hashes
[
30
][
32
],
int
status
)
{
SHA256_CTX
ctx
;
BYTE
buffer
[
SHA256_BLOCK_SIZE
];
BYTE
password
[
12
];
bool
cracked
=
true
;
char
word
[
30
];
FILE
*
word_list
;
word_list
=
fopen
(
word_list_file
,
"rb"
);
while
(
fgets
(
password
,
7
,
word_list
)
!=
'\0'
)
{
for
(
int
i
=
6
;
i
<
12
;
++
i
)
{
if
(
password
[
i
-
6
]
>=
65
&&
password
[
i
-
6
]
<
90
)
{
password
[
i
]
=
password
[
i
-
6
]
+
32
;
}
else
{
password
[
i
]
=
password
[
i
-
6
]
-
32
;
}
}
password
[
12
]
=
'\0'
;
permute
(
password
,
0
,
11
,
hashes
,
status
);
}
fclose
(
word_list
);
}
void
crack6
(
char
*
word_list_file
,
int
hashes
[
30
][
32
])
{
void
crack6
(
char
*
word_list_file
,
int
hashes
[
30
][
32
])
{
SHA256_CTX
ctx
;
SHA256_CTX
ctx
;
...
@@ -361,7 +251,6 @@ int main(int argc, char * argv[]) {
...
@@ -361,7 +251,6 @@ int main(int argc, char * argv[]) {
}
}
if
(
argc
==
2
)
{
if
(
argc
==
2
)
{
int
k
=
atoi
(
argv
[
1
]);
int
k
=
atoi
(
argv
[
1
]);
printf
(
"%d
\n
"
,
k
);
printRandomString1
(
k
);
printRandomString1
(
k
);
}
}
...
@@ -524,6 +413,7 @@ void makeguess(char * word_list, int hashes[][32], int a) {
...
@@ -524,6 +413,7 @@ void makeguess(char * word_list, int hashes[][32], int a) {
}
}
}
}
for
(
int
i
=
0
;
i
<
100000000000000000
;
++
i
)
{
for
(
int
i
=
0
;
i
<
100000000000000000
;
++
i
)
{
if
(
count
==
a
)
{
if
(
count
==
a
)
{
break
;
break
;
...
@@ -555,6 +445,10 @@ void makeguess(char * word_list, int hashes[][32], int a) {
...
@@ -555,6 +445,10 @@ void makeguess(char * word_list, int hashes[][32], int a) {
}
}
}
}
len
=
0
;
len
=
0
;
}
}
...
...
This diff is collapsed.
Click to expand it.
crack.exe
+
0
−
0
View file @
31ede3fb
No preview for this file type
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