-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmainpassProject.c
More file actions
147 lines (108 loc) · 3.88 KB
/
mainpassProject.c
File metadata and controls
147 lines (108 loc) · 3.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
#include <stdio.h>
#include <stdlib.h>
/* Brute Force Password Generator v2.1.0
Written by: @je
About: this program generates wordlist with keywords provided by user.
wordlist is saved in a file and the file could be used in brute force attacks.
the generated file,s name is "pa$$.txt".
*/
// Global Variables Definition
int cntr = 0;
int index = 0;
int max;
int min;
void guessPass(char* total_info[],int total_info_size,char* pa$$[],FILE * pa$$$);
int MinMaxThrowException(int min , int max);
int main(int argc, char *argv[]) {
char info[80][30];
int column_num[30], row_num=0, j, count=-1;
char tmp;
printf("########################################################################################\n::.Password Generator v2.1.0.::\n\n Written by: @je\n\n About:\n you as a user should provide this program some of your victim,s basic information.\n this makes program guessing the victim,s password.\n you can use the output file (wordlist) as an input for brute force programs!\n Generated file,s name is \"pa$$.txt\" \n########################################################################################\n\n");
// Creating text file for writing passwords into.
FILE *pa$$$ = fopen("pa$$.txt" , "w");
do{
printf("> Enter minimum size of the word for ouput passwords?\n");
scanf("%d", &min);
printf("> Enter maximum size of the word for ouput passwords?\n");
scanf("%d", &max);
} // end do
while(MinMaxThrowException(min,max));
printf("> add keywords and any important information about the victim like firstname,lastname,birth date and ...: (if you finished,enter '.')\n");
do{
count++;
if(count > 0) printf("\n\n> Error: you have entered not enough words according to the 'max' amount!\n> Please try again\n\n"); // catch Exception
j = 0;
while(1){
scanf("%s", &info[j]);
if(info[j][0] == '.') break;
else j++;
} // end while
row_num = j;
} // end do
while(row_num < max ? 1 : 0);
printf("\n> wordlist:\n\n");
// Detecting user input strings sizes.
int size[row_num];
int i;
for(i=0;i<row_num;i++){
int j = 0;
tmp = info[i][0];
while(tmp != '\0'){
tmp = info[i][++j];
} // end while
size[i] = j;
} // end for
char* info_ptr[row_num];
int r,t=row_num-1;
for(r=0;r<row_num;r++){
info_ptr[t] = (char*)info[r];
t--;
} // end for
cntr = 0;
char* pass[row_num];
guessPass(info_ptr,row_num,pass,pa$$$);
fclose(pa$$$);
return 0;
} // end main
// Recursive function.
void guessPass(char* total_info[],int total_info_size,char* pa$$[],FILE * pa$$$){
int LAST_IDX=0;
int loop;
for(loop=total_info_size-1;loop>=0;loop--){
if(index == max-1) LAST_IDX = 1;
pa$$[index] = total_info[loop];
if(index>=min-1 && index<=max-1){
int prt_lp;
for(prt_lp=0;prt_lp<=index;prt_lp++){
printf("%s" , pa$$[prt_lp]);
fprintf(pa$$$,"%s",pa$$[prt_lp]);
} // end for
printf("\n");
fprintf(pa$$$,"\n");
} // end if
if(!LAST_IDX){
index++;
char* total_info_tmp[total_info_size-1];
int itr1;
for(itr1=0;itr1<total_info_size;itr1++){
if(itr1 == total_info_size-1) break;
if(itr1 >= loop) total_info_tmp[itr1] = total_info[itr1+1];
else total_info_tmp[itr1] = total_info[itr1];
}
guessPass(total_info_tmp,total_info_size-1,pa$$,pa$$$);
} // end if
if(loop == 0) index--;
} // end for
return ;
} // end guessPass()
int MinMaxThrowException(int min , int max){
if(min > max){
printf("\n\n> Error: maximum should be higher than minimum!\n> Please try again\n\n");
return 1;
} // end if
if(min <= 0){
printf("\n\n> Error: 'minimum' should be at least '1'!\n> Please try again\n\n");
return 1;
}
return 0;
} // end MinMaxThrowException()