-
Notifications
You must be signed in to change notification settings - Fork 8
/
cdpg.sh
1410 lines (1399 loc) · 46.8 KB
/
cdpg.sh
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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/bin/bash
#
# [Program]
#
# CDPG v1.0(Build 31)
# Common Detailed Passwords Generator
#
#
#
# [Author]
#
# AlMA PRO LEADER
# alma.pro.leader@gmail.com
# http://www.arm-y.org
#
#
# [License]
#
# This program is free software; you can c_ristribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# any later version.
#
# [A.R.M-Y H4CK3RZ]
#
# This program is made by A.R.M-Y H4CK3RZ for the penetration testing course here http://www.arm-y.org/course | http://fb.com/A.R.M.Libya.Official
# It's included in the course files' folder which is named "AlMAPRO" if you have the folder then put it on the desktop of your ROOT user so all files
# work fine! And be sure to focus on the "UPPERCASE" and "lowercase" letters.
# This course is made for educational purposes ONLY. We are NOT responsible for any harmful use of the files or techniques of hacking included in
# the course. All victims in the course are not hacked for joy, but for either showing the people how it's done or personal purposes.
# All victims, even the ones whom deserves it are NOT harmed by our hack attacks as we UNDO all the hacks and exploits afterwards.
#
#
folder_name="AlMAPRO"; # Free to name it ^^
wtp='/dev/stdout'; # Where to print? [Default: /dev/stdout].
# Colours
c_r="\x1B[01;31m";
c_b="\x1B[01;34m";
c_g="\x1B[01;32m";
c_y="\x1B[01;33m";
rclrs="\x1B[0m";
#
# Here comes the Logo :v
# Our pride B|;
#
main_logo="\t\t $c_g""Common Detailed Passwords Generator$rclrs"" - $c_r""A.R.M-Y H4CK3RZ$rclrs""
\t\t\t\thttp://www.arm-y.org
\t \t \t \t ------------------
\t\t\t\t $c_r""Use it wisely ^^$rclrs""";
#
#
#
#
>&2 echo -e "$main_logo";
final=();
spl_arr=();
spc_arr=();
pipe="no";
advanced_pipe="no"; # Added May 25, 2016 - AlMA PRO LEADER | This is the massive! Isn't it?
arrays=(); # Added for the massive above.
temp_path="/root/Desktop/$folder_name/cdpg_tmp/"; # Temp files path. NOTE: Do NOT set it to /tmp folder or any folder inside of it. Why?
# because if you turn off your computer you'll never continue from the last password and will start all over again.
dtl="";
nmb="";
spcl="";
dflt_spcl='_,.,+,-,(,)'; # Default special chars. free to modify ^^
output_file="";
output_file_name=""; # Do NOT modify this.
output2file=""; # Do NOT modify this.
newline=$'\n'; # Do NOT modify this.
check_arr=""; # Do NOT modify this.
short_l=0; # If = 0 or 1 then disable shortest length.
long_l=0; # If = 0 then disable longest length.
mask_v=""; # If empty then no mask will be used.
res=1; # Passwords count.
normal_mode="n"; # By default normal mode is off so the passwords are more aggressive.
debug_mode="off"; # By default no debug data will be shown. Set it to 'on' to see the debug data by default or use '-d' on startup.
#
# The files below are set to empty by default! If you modify them to real files, your masks, details, numbers and specials
# will be read from the files.
#
#The files are modifiable xD -----.
dtl_file=""; # Details' file. |======================================================================================
nmb_file=""; # Numbers' file. | Those files were founded after suggestion of Zeko Ly https://www.facebook.com/Zeko.Ly
spcl_file=""; # Specials' file. |======================================================================================
msk_file=""; # Masks' file. _____|
#
#
# Here comes the Help :v
#
hlogo="\t\t\t\t~*[$c_b""Help Message$rclrs""]*~
\t\tIt's so simple
\t\t[$c_b""Normal Mode$rclrs""]
\t\t$c_r""Details$rclrs"" first, $c_y""Example$rclrs"" : alma,pro,leader,hacker,libya,MrRobot,anything,..
\t\tThen $c_r""Numbers$rclrs"", Phone number,birthdate,...
\t\tAny $c_r""numbers$rclrs"" that the victim may have in $c_b""his$rclrs""/$c_b""her$rclrs"" $c_r""life$rclrs"", $c_y""Example$rclrs"": 911,12345678,87654321,..
\t\tThen $c_r""Specials$rclrs"", Any Characters that the victim might use! Or let it empty so you'll be asked about using $c_r""specials$rclrs"".
\t\t[$c_b""Pipe Mode$rclrs""]
\t\tWrite the $c_r""details$rclrs"" normally but... Add ($c_r"";$rclrs"") at the $c_r""details$rclrs""' end, then write the $c_r""numbers$rclrs"" normally, then the $c_r""specials$rclrs""
\t\t($c_r""Don't forget to write them inside$rclrs"" $c_b""''$rclrs"") $c_y""Example$rclrs"" : 'alma,pro,leader,....;911,12345678,0912345678;-,_,.,+....'
\t\tIf you write ($c_r"",$rclrs"") in the $c_r""specials$rclrs""' place at the end of the pipe mode input,
\t\t[$c_y""Ex$rclrs"": 'detail,..;911,..;,' ], the default $c_r""specials$rclrs"" will be used.
\t\tAnd if you don't want to use $c_r""specials$rclrs"", then write $c_r""nothing$rclrs"" in $c_r""specials$rclrs""' place.
\t\t[$c_y""Ex$rclrs"": 'detail,...,911,...;' ]
\t\tIf the script starts with:
\t\t-h \tThis message will visit your screen ^^ - Use also $c_b""--help$rclrs""
\t\t-p \tPipe mode is on and you have to write in pipe mode input.
\t\t-l \tLongest password length - if you want to set a limit for the passwords length.
\t\t-s \tShortest password length - if you want to set a limit for the passwords length.
\t\t-n \tNormal passwords mode - Set normal_mode to on, if off, then passwords are more aggressive. (Default: Off)
\t\t-m \tMask mix - if you have a specific mask for your passwords then add it after this.
\t\t \t($c_r""You must add the mask inside $rclrs""$c_b""''$rclrs"").
\t\t \t$c_b""Now the format$rclrs"":
\t\t \t\t ! = Detail.
\t\t \t\t @ = Number.
\t\t \t\t # = Special.
\t\t \t$c_y""Example$rclrs"": -m $c_b""'$rclrs""#!#@#$c_b""'$rclrs""
\t\t \t: This will generate passwords of the format,
\t\t \t: 'Special Detail Special Number Special' ==> '-alma-123-'. And so...
\t\t-M Read masks from file - Read more than one mask from a file in the format of one mask per line.
\t\t-D Read details from file - Read more than one details' input
\t\t \t$c_y""Example$rclrs"": Let's say you have alot of details, but you don't want them in the same input,
\t\t \t: so you use -D to read from a file with the format of one details' input per line.
\t\t \t: Every details input will be used alone with the current mask, current numbers and the current specials.
\t\t-N Read numbers from file - Read more than one numbers' input
\t\t \t$c_y""Example$rclrs"" : Let's say you have alot of number, phone numbers' list,
\t\t \t: so you use -N to read from a file with the format of one numbers' input per line.
\t\t \t: Every numbers input will be used alone with the current mask, current details and the current specials.
\t\t \t: The numbers' list format could be one number in each numbers' input.
\t\t-S Read specials from file - Read more than one specials' input
\t\t \t$c_y""Example$rclrs"" : Let's say you have alot of specials, but you don't want them in the same input,
\t\t \t: so you use -S to read from a file with the format of one specials' input per line.
\t\t \t: Every specials input will be used alone with the current mask, current numbers and the current details.
\t\t-ap \tAdvanced pipe mode - This kind of pipe mode is a bit advanced and different that the other pipe mode.
\t\t \t$c_y""Example$rclrs"" : If your victim has 2 names (or more) or even if you're not sure which name is
\t\t \t : your victim's real name, and in numbers as well, there is a missing truth!!
\t\t \t : This pipe mode gives you the chance to play 'Choose from the brackets' game.
\t\t \t$c_y""Example$rclrs"" : -ap 'alma,aima;pro;leader' - This will give you:
\t\t \t : $c_y""almaproleader$rclrs"" - $c_y""aimaproleader$rclrs"". So the truth is ($c_b""almaproleader$rclrs"").
\t\t \t : When I write in CAPS I keep the ($c_r""L$rclrs"") small ^^.
\t\t \t$c_y""Example2$rclrs"": -ap 'alma,aima;pro,0912345678;leader,0923456781' - This will give you:
\t\t \t : almaproleader - almapro0923456781 - alma0912345678leader - alma09123456780923456781
\t\t \t : aimaproleader - aimapro0923456781 - aima0912345678leader - aima09123456780923456781
\t\t \t : And that's if you use $c_r""-n$rclrs"" - otherwise! It's a massive list B|.
\t\t \t$c_r""NOTE$rclrs"": When using $c_b""-ap$rclrs"" it disables (-O, -m, -M, -D, -S, -N) - But $c_r""not$rclrs"" (-o, -n, -s, -l).
\t\t*~* [$c_b""Output File$rclrs""] *~*
\t\tIf you add $c_r""-o$rclrs"" to the startup command, you'll have the passwords in a file of your choice.
\t\t$c_y""Example$rclrs"": -o alma-ps.txt | $c_y""Example 2$rclrs"": -o 'alma pro.txt'
\t\tIf you add $c_r""-O$rclrs"" to the startup command, then every file will be saved by the mask's name.
\t\t$c_y""Example$rclrs"": -O alma - This will save the file as (alma.txt) if no mask is given.
\t\t : But if you give a mask using (-m) or masks using (-M), your file will be name by the current mask.
\t\t$c_y""Example$rclrs"": -O alma -m '!@#' - This will name the file (alma-dns.txt). And so .....
\t\t $c_r""Note$rclrs"": Don't add (.txt) when using -O.
\t\t*~* [$c_b""Debug Mode$rclrs] *~*
\t\tUse $c_b-d$rclrs in the startup command and you'll see debug data on the screen.
\t\t$c_r""Got it$rclrs""? Okay then, $c_g""go get them$rclrs"" ^_*
";
logo="\t\tAny Detail you get, add it with ($c_r"",$rclrs"") [$c_r""ex$rclrs"": $c_b""detail$rclrs""$c_r"",$rclrs""$c_b""detail$rclrs""$c_r"",$rclrs""$c_b""...$rclrs""]
\t\tNumbers and Specials come after details, so don't rush ^^
\t\t$c_r""But!!$rclrs"" If you want to $c_r""skip details$rclrs"" and use $c_r""only Numbers$rclrs"",
\t\tthen write numbers in details and press $c_b""[ENTER]$rclrs"" when asked for numbers.
";
#
# Functions & Checks
#
function print_error(){
>&2 echo -e "$c_r$1$rclrs";
}
function print_good(){
>&2 echo -e "$c_g$1$rclrs";
}
function print_info(){
>&2 echo -e "$c_b$1$rclrs";
}
function print_debug(){
if [ "$debug_mode" == "on" ]; then
>&2 echo -e "\t\t[$c_y!$rclrs] $1"
fi;
}
if ! [ -d "/root/Desktop/$folder_name" ]; then
echo ;
print_error "You don't have $folder_name folder on Desktop!!";
sleep 2;
print_good "Creating $folder_name folder....."
mkdir "/root/Desktop/$folder_name";
sleep 2;
print_good "Done."
sleep 2;
echo ;
fi;
function check_int(){
ok="n";
if [[ $1 =~ ^-?[0-9]+$ ]]; then
ok="y";
fi;
echo "$ok";
}
function check_ps(){
if [ -f "$2" ]; then
if grep -Fxq -e "$1" "$2"; then return 1; fi;
fi;
print_debug "File is ==> $2";
print_debug "Password is ==> $1";
if [ "$2" == "$temp_path.tmp" ]; then
print_debug "Outputing to the pipe"
echo "$1";
fi;
echo "$1" >> "$2";
}
function all_cases(){
if [ "$normal_mode" == "y" ]; then
echo "$1";
return;
fi;
all_cases_arr=("$1");
upp=$(echo ${1:0:1} | tr '[:lower:]' '[:upper:]');
all_cases_arr+=("$upp");
downn=$(echo ${1:0:1} | tr '[:upper:]' '[:lower:]');
all_cases_arr+=("$downn");
upp=$(case_change "$1" "ua");
all_cases_arr+=("$upp");
downn=$(case_change "$1" "da");
all_cases_arr+=("$downn");
upp=$(case_change "$1" "uf");
all_cases_arr+=("$upp");
downn=$(case_change "$1" "df");
all_cases_arr+=("$downn");
echo "${all_cases_arr[@]}";
}
function file_name(){
spl_arr=($(spl "$1" "/"));
leno=${#spl_arr[@]};
fleno=$(($leno-1));
echo "${spl_arr[$fleno]}";
}
function echo_done(){
if ! [[ $# -gt 1 ]]; then
if [ -f "$temp_path$(file_name "$1").tmp" ]; then
mv "$temp_path$(file_name "$1").tmp" "$1";
files_to_erase=("$temp_path$(file_name "$1")-D.tmp" "$temp_path$(file_name "$1")-N.tmp");
for file_to_erase in "${files_to_erase[@]}"; do
if [ -f "$file_to_erase" ]; then rm "$file_to_erase"; fi;
done;
fi;
fi;
}
function echo_it(){
if ! [[ $# -lt 2 ]]; then
if ! [ "$3" == "" ]; then print_debug "Password is ==> $1"; check_ps "$1" "$2"; return; fi;
if [ -f "$2" ]; then
if grep -sFxq -e "$1" "$2"; then return; fi;
fi;
ok="n";
now_ps="$1";
if ! [ "$short_l" == "0" ] && ! [ "$short_l" == "1" ]; then
if ! [ "$long_l" == "0" ]; then
if [ "${#1}" -gt "$short_l" ] || [ "${#1}" == "$short_l" ]; then
if [ "${#1}" -lt "$long_l" ] || [ "${#1}" == "$long_l" ];then
ok="y";
else
now_ps="${1::-(${#1}-$long_l)}";
ok="y";
fi;
btween_def=$(($long_l-$short_l+1));
check_ps "${now_ps::-$btween_def}" "$temp_path$output_file_name.tmp";
now_ps_=$(rev $now_ps);
if [ "$normal_mode" == "n" ]; then check_ps "$(rev ${now_ps::-$btween_def})" "$temp_path$output_file_name.tmp"; fi;
fi;
else
if [ "${#1}" -gt "$short_l" ]; then
ok="y";
fi;
fi;
else
if ! [ "$long_l" == "0" ]; then
if [ "${#1}" -lt "$long_l" ] || [ "${#1}" == "$long_l" ];then
ok="y";
else
now_ps="${1::-(${#1}-$long_l)}";
ok="y";
fi;
else
ok="y";
fi;
fi;
if [ "$ok" == "y" ]; then print_debug "Password is ==> $now_ps"; check_ps "$now_ps" "$temp_path$output_file_name.tmp"; fi;
fi;
}
function spl() {
oldifs="$IFS";
IFS="$2";
read -a spl_arr <<< "$1";
IFS="$oldifs";
echo "${spl_arr[@]}";
}
function rev(){
rv="";
for l in `echo $1 | grep -o .`;do
rv="$l$rv";
done;
echo $rv;
}
function str_replace(){
echo "$(echo "$1" | sed s/"$2"/"$3"/g)";
}
function case_change(){
words_case=();
final_words_case="";
if ! [[ $# -gt 1 ]]; then return; fi;
if [[ "$1" == *" "* ]]; then
spl_arr=($(spl "$1" " "));
words_case=("${spl_arr[@]}");
else
words_case=("$1");
fi;
for r1 in "${words_case[@]}"; do
if ! [[ "$r1" == "" ]]; then
if [ "$2" == "uf" ]; then
final_words_case="$final_words_case$(echo ${r1:0:1} | tr '[:lower:]' '[:upper:]')$(echo ${r1:1}) ";
elif [ "$2" == "df" ]; then
final_words_case="$final_words_case$(echo ${r1:0:1} | tr '[:upper:]' '[:lower:]')$(echo ${r1:1}) ";
elif [ "$2" == "ua" ]; then
final_words_case="$final_words_case$(echo $r1 | tr '[:lower:]' '[:upper:]') ";
else
final_words_case="$final_words_case$(echo $r1 | tr '[:upper:]' '[:lower:]') ";
fi;
fi;
done;
if [ ${#final_words_case} -gt 1 ]; then
final_words_case="${final_words_case::-1}";
fi;
echo "$final_words_case";
}
function final_mix(){
declare -a arr1=("${!1}");
declare -a arr2=("${!2}");
declare -a arr3=("${!3}");
print_debug "Output File is ==> $output_file";
print_debug "Temp output file is ==> $temp_path$output_file_name.tmp";
print_debug "arr1 ==> ${arr1[*]}";
print_debug "arr1 count ==> ${#arr1[@]}";
print_debug "arr2 ==> ${arr2[*]}";
print_debug "arr2 count ==> ${#arr2[@]}";
print_debug "arr3 ==> ${arr3[*]}";
print_debug "arr3 count ==> ${#arr3[@]}";
res=0;
res=$(($res+$((${#arr1[@]}*${#arr1[@]}*$((${#arr3[@]}+1))))));
res=$(($res+$(($((${#arr2[@]}+1))*$((${#arr2[@]}+1))*$((${#arr3[@]}+1))))));
res=$(($res+$((${#arr1[@]}*$((${#arr2[@]}+1))*$((${#arr3[@]}+1))))));
res=$(($res+$(($((${#arr2[@]}+1))*${#arr1[@]}*$((${#arr3[@]}))))));
if [ "$normal_mode" == "n" ]; then res=$(($res*2)); fi;
>&2 echo -e "\t\tYou'll have ($c_b"""$res"$rclrs"") Passwords or $c_r""less$rclrs";
sleep 2;
if [ -f "$temp_path$output_file_name.tmp" ] && ! [ "$output_file_name.tmp" == ".tmp" ]; then
print_good "\t\t .....";
print_info "\t\t[!] File with this name was detected in the temp folder ....";
sleep 2;
echo "";
print_error "\t\t[!_!] This function does not generate alot of passwords, so ....";
sleep 2;
print_good "\t\t .....";
print_error "\t\t[:'(] We have to erase the file and start all over again!";
sleep 2;
rm "$temp_path$output_file_name.tmp";
fi;
for ((i1=0;i1<$((${#arr1[@]}+1));i1++)); do
r1="${arr1[$i1]}";
for ((i=0;i<$((${#arr3[@]}+1));i++)); do
for ((i2=0;i2<$((${#arr1[@]}+1));i2++)); do
rr1="${arr1[$i2]}";
echo_it "$r1${arr3[$i]}$rr1" "$temp_path$output_file_name.tmp";
if [ "$normal_mode" == "n" ]; then echo_it "$(rev $r1${arr3[$i]}$rr1)" "$temp_path$output_file_name.tmp"; fi;
done;
done;
done;
for ((i1=0;i1<$((${#arr2[@]}+1));i1++)); do
r1="${arr2[$i1]}";
for ((i=0;i<$((${#arr3[@]}+1));i++)); do
for ((i2=0;i2<$((${#arr2[@]}+1));i2++)); do
rr1="${arr2[$i2]}";
echo_it "$r1${arr3[$i]}$rr1" "$temp_path$output_file_name.tmp";
if [ "$normal_mode" == "n" ]; then echo_it "$(rev $r1${arr3[$i]}$rr1)" "$temp_path$output_file_name.tmp"; fi;
done;
done;
done;
for ((i1=0;i1<$((${#arr1[@]}+1));i1++)); do
r1="${arr1[$i1]}";
for ((i=0;i<$((${#arr3[@]}+1));i++)); do
for ((i2=0;i2<$((${#arr2[@]}+1));i2++)); do
rr1="${arr2[$i2]}";
echo_it "$r1${arr3[$i]}$rr1" "$temp_path$output_file_name.tmp";
if [ "$normal_mode" == "n" ]; then echo_it "$(rev $r1${arr3[$i]}$rr1)" "$temp_path$output_file_name.tmp"; fi;
done;
done;
done;
for ((i1=0;i1<$((${#arr2[@]}+1));i1++)); do
r1="${arr2[$i1]}";
for ((i=0;i<$((${#arr3[@]}+1));i++)); do
for ((i2=0;i2<$((${#arr1[@]}+1));i2++)); do
rr1="${arr1[$i2]}";
echo_it "$r1${arr3[$i]}$rr1" "$temp_path$output_file_name.tmp";
if [ "$normal_mode" == "n" ]; then echo_it "$(rev $r1${arr3[$i]}$rr1)" "$temp_path$output_file_name.tmp"; fi;
done;
done;
done;
}
function cof(){ #Count of
if [ "$1" == "!" ]; then
echo "$(($2+1))";
elif [ "$1" == "@" ]; then
echo "$(($3+1))";
elif [ "$1" == "#" ]; then
echo "$(($4+1))";
else
echo "0";
fi;
}
function getitfrom(){
declare -a arrayis=("${!1}");
if [ "${#arrayis[@]}" == "0" ] || [ "$(($2+1))" -gt "${#arrayis[@]}" ]; then echo ""; return; fi;
echo "${arrayis[$2]}";
}
function getpos(){
declare -a arrayis=("${!1}");
for ((ipos=0;ipos<${#arrayis[@]};ipos++)); do
if [ "${arrayis[$ipos]}" == "$2" ]; then echo "$ipos"; return; fi;
done;
echo "0";
}
function isitthis(){
declare -a arrayis=("${!1}");
declare -a secarr=("${!5}");
sarr=(${secarr[@]});
prtd=($(spl "$3" "|"));
found="n";
if [ "${prtd[1]}" == "1" ]; then
tmp_pass="$(rev ${prtd[0]})";
if ! [ "${#sarr[@]}" == "0" ]; then
for sarr_s in "${sarr[@]}"; do
if [[ "$tmp_pass" == "$4${arrayis[$2]}$sarr_s"* ]]; then
echo "$4${arrayis[$2]}";
echo "${arrayis[$2]}";
found="y";
fi;
done;
else
if [[ "$tmp_pass" == "$4${arrayis[$2]}"* ]]; then
echo "$4${arrayis[$2]}";
echo "${arrayis[$2]}";
found="y";
fi;
fi;
elif [ "${prtd[1]}" == "0" ]; then
tmp_pass="${prtd[0]}";
if ! [ "${#sarr[@]}" == "0" ]; then
for sarr_s in "${sarr[@]}"; do
if [[ "$tmp_pass" == "$4${arrayis[$2]}$sarr_s"* ]]; then
echo "$4${arrayis[$2]}";
echo "${arrayis[$2]}";
found="y";
fi;
done;
else
if [[ "$tmp_pass" == "$4${arrayis[$2]}"* ]]; then
echo "$4${arrayis[$2]}";
echo "${arrayis[$2]}";
found="y";
fi;
fi;
fi;
if [ "$found" == "n" ]; then
arrr=(${arrayis[@]});
isitthis "arrr[@]" "$(($2+1))" "$3" "$4" "sarr[@]";
fi;
}
function make_config(){
if [ "`head -n 1 "$temp_path$output_file_name.tmp"`" == "$first_pass" ]; then
pass_here="`tail -n 1 "$temp_path$output_file_name.tmp"`|0";
bpass_here="`tail -n 2 "$temp_path$output_file_name.tmp" | head -n 1 -`";
prt=($(spl "$pass_here" "|"));
if [ "$(rev ${prt[0]})" == "$bpass_here" ]; then pass_here="${prt[0]}|1"; fi;
pass2find="";
prt1=($(spl "${all_s[0]}" "|"));
print_debug "prt1 ==> ${prt1[*]}";
if [ "${prt1[0]}" == "!" ]; then
arry1=(${dtl_arr[@]});
elif [ "${prt1[0]}" == "@" ]; then
arry1=(${nmb_arr[@]});
elif [ "${prt1[0]}" == "#" ]; then
arry1=(${spcl_arr[@]});
else
arry1=("${prt1[0]}");
fi;
prt2=($(spl "${all_s[1]}" "|"));
print_debug "prt2 ==> ${prt2[*]}";
if [ "${prt2[0]}" == "!" ]; then
arry2=(${dtl_arr[@]});
elif [ "${prt2[0]}" == "@" ]; then
arry2=(${nmb_arr[@]});
elif [ "${prt2[0]}" == "#" ]; then
arry2=(${spcl_arr[@]});
else
arry2=("${prt2[0]}");
fi;
prt3=($(spl "${all_s[2]}" "|"));
print_debug "prt3 ==> ${prt3[*]}";
if [ "${prt3[0]}" == "!" ]; then
arry3=(${arr1[@]});
elif [ "${prt3[0]}" == "@" ]; then
arry3=(${arr2[@]});
elif [ "${prt3[0]}" == "#" ]; then
arry3=(${arr3[@]});
else
arry3=("${prt3[0]}");
fi;
prt=($(spl "$pass_here" "|"));
a1c=0;
a2c=0;
a3c=0;
if [ "${prt[1]}" == "0" ]; then
print_debug "It's normal (not reversed).\r\nprt[0] ==> ${prt[0]}";
done="n";
until [ "$done" == "y" ]; do
for ((i1=0;i1<${#arry1[@]};i1++)); do
for ((i2=0;i2<${#arry2[@]};i2++)); do
for ((i3=0;i3<${#arry3[@]};i3++)); do
print_debug "The mix of the passwords now is ==> ${arry1[$i1]}${arry2[$i2]}${arry3[$i3]}";
if [[ "${prt[0]}" == "${arry1[$i1]}${arry2[$i2]}${arry3[$i3]}"* ]]; then
print_debug "Found ==> ${arry1[$i1]}${arry2[$i2]}${arry3[$i3]}
\t\ta1c ==> $i1
\t\ta2c ==> $i2
\t\ta3c ==> $i3";
a1c=$i1;
a2c=$i2;
a3c=$i3;
done="y";
fi;
done;
done;
done;
done;
else
done="n";
until [ "$done" == "y" ]; do
for ((i1=0;i1<${#arry1[@]};i1++)); do
for ((i2=0;i2<${#arry2[@]};i2++)); do
for ((i3=0;i3<${#arry3[@]};i3++)); do
print_debug "The mix of the passwords now is ==> $(rev ${arry1[$i1]}${arry2[$i2]}${arry3[$i3]})";
if [[ "${prt[0]}" == *"$(rev ${arry1[$i1]}${arry2[$i2]}${arry3[$i3]})" ]]; then
print_debug "Found ==> $(rev ${arry1[$i1]}${arry2[$i2]}${arry3[$i3]})
\t\ta1c ==> $i1
\t\ta2c ==> $i2
\t\ta3c ==> $i3";
a1c=$i1;
a2c=$i2;
a3c=$i3;
done="y";
fi;
done;
done;
done;
done;
fi;
fi;
all_s[0]="${arry1[$a1c]}|$a1c";
all_s[1]="${arry2[$a2c]}|$a2c";
all_s[2]="${arry3[$a3c]}|$a3c";
print_debug "all_s[0] ==> ${all_s[0]}
all_s[1] ==> ${all_s[1]}
all_s[2] ==> ${all_s[2]}";
now_pass="${arry1[$a1c]}${arry2[$a2c]}${arry3[$a3c]}";
print_debug "now_pass ==> $now_pass";
if [ "${prt[1]}" == "1" ]; then print_debug "The password is reversed"; now_pass="$(rev $now_pass)"; fi;
print_debug "now_pass ==> $now_pass";
for ((i=3;i<${#all_s[@]};$i++)); do
s_arr="${all_s[$i]}";
ok_this="n";
prtc=($(spl "$s_arr" "|"));
print_debug "prtc ==> ${prtc[@]}";
if [ "${prtc[0]}" == "!" ]; then
arryc=(${arr1[@]});
elif [ "${prtc[0]}" == "@" ]; then
arryc=(${arr2[@]});
elif [ "${prtc[0]}" == "#" ]; then
arryc=(${arr3[@]});
else
arryc=("${prtc[0]}");
fi;
until [ "$ok_this" == "y" ]; do
for ((i1=0;i1<${#arryc[@]};$i1++)); do
if [ "${prt[1]}" == "0" ]; then
if [[ "${prt[0]}" == "$now_pass${arryc[$i1]}"* ]]; then
all_s[$i]="${prtc[0]}|$i1"; ok_this="y";
fi;
else
if [[ "${prt[0]}" == *"$(rev ${arryc[$i1]})$now_pass" ]]; then
all_s[$i]="${prtc[0]}|$i1"; ok_this="y";
fi;
fi;
done;
done;
done;
rea="`wc -l < "$temp_path$output_file_name.tmp"`";
>&2 echo -e "\t\tContinuing from the password ($c_b""${prt[0]}$rclrs"") which is the number ($c_b""$rea$rclrs"") and around $c_b""$(($rea*100/$res))$rclrs""%";
}
function continue_from(){
if [ -f "$temp_path$output_file_name.tmp" ]; then >&2 echo; print_info "\t\t[!] File with this name was detected in the temp folder......"; sleep 3; fi;
if ! [ -f "$temp_path$output_file_name.tmp.config" ]; then return 1; fi
config_arr=($(cat "$temp_path$output_file_name.tmp.config"));
echo "${config_arr[@]}";
}
function write_config(){
echo $1 > $temp_path$output_file_name.tmp.config;
echo $2 >> $temp_path$output_file_name.tmp.config;
echo $3 >> $temp_path$output_file_name.tmp.config;
echo $4 >> $temp_path$output_file_name.tmp.config;
echo $5 >> $temp_path$output_file_name.tmp.config;
echo $6 >> $temp_path$output_file_name.tmp.config;
echo $7 >> $temp_path$output_file_name.tmp.config;
}
function mask_all(){
declare -a arr1=("${!1}");
declare -a arr2=("${!2}");
declare -a arr3=("${!3}");
mask_arr=($(echo "$4" | grep -o .));
d_c=${#arr1[@]};
n_c=${#arr2[@]};
s_c=${#arr3[@]};
all_s=();
final_pass="";
first_pass="";
res=1;
for msk in "${mask_arr[@]}"; do
all_s+=("$msk|0");
arry2=();
if [ "$msk" == "!" ]; then
first_pass="$first_pass${arr1[0]}";
arry2=(${arr1[@]})
res=$(($res*$d_c));
elif [ "$msk" == "@" ]; then
first_pass="$first_pass${arr2[0]}";
arry2=(${arr2[@]})
res=$(($res*$n_c));
elif [ "$msk" == "#" ]; then
first_pass="$first_pass${arr3[0]}";
arry2=(${arr3[@]})
res=$(($res*$s_c));
else
first_pass="$first_pass$msk";
arry2=("$msk");
fi;
final_pass="$final_pass${arry2[-1]}"
done;
all_c=${#all_s[@]};
if [ "$normal_mode" == "n" ]; then res=$(($res*2)); fi;
>&2 echo -e "\t\tYou'll have ($c_b"""$res"$rclrs"") Passwords or $c_r""less$rclrs";
sleep 2;
if ! [ "$6" == "" ]; then
config_arr=($(continue_from));
if ! [ "$!" == "1" ]; then
first_pass="${config_arr[0]}";
all_s=($(spl "${config_arr[1]}" ","))
all_c=${#all_s[@]};
mask_v="${config_arr[2]}";
dtl="${config_arr[3]}";
nmb="${config_arr[4]}";
spcl="${config_arr[5]}";
if [[ "$dtl" == *","* ]]; then dtl_arr=($(spl "$dtl" ",")); else dtl_arr=($dtl); fi;
if [[ "$nmb" == *","* ]]; then nmb_arr=($(spl "$nmb" ",")); else nmb_arr=($nmb); fi;
if [[ "$spcl" == *","* ]]; then spcl_arr=($(spl "$spcl" ",")); else spcl_arr=($spcl); fi;
if [ -f "$temp_path$output_file_name.tmp" ]; then
rea="`wc -l < "$temp_path$output_file_name.tmp"`";
else
rea=0;
fi;
>&2 echo -e "\t\tContinuing from the password ($c_b""${config_arr[-1]}$rclrs"") which is the number ($c_b""$rea$rclrs"") and around $c_b""$(($rea*100/$res))$rclrs""%";
else
print_error "\t\t[!] No configuration file was found! Try --config or delete the file from the temp folder..";
print_error "\t\tAborting....";
sleep 3;
exit;
fi;
fi;
last_pass="";
until [ "$last_pass" == "$final_pass" ]; do
now_ps="";
first_pass="";
for ((i=0;i<$all_c;i++)); do
prt=($(spl ${all_s[$i]} "|"));
print_debug "${prt[0]} == ${prt[1]}";
arry2=();
if [ "${prt[0]}" == "!" ]; then
arry2=(${arr1[@]})
elif [ "${prt[0]}" == "@" ]; then
arry2=(${arr2[@]})
elif [ "${prt[0]}" == "#" ]; then
arry2=(${arr3[@]})
else
arry2=("${prt[0]}");
fi;
now_ps="$now_ps$(getitfrom "arry2[@]" ${prt[1]})";
first_pass="$first_pass$(getitfrom "arry2[@]" "0")";
if [ "${prt[0]}" == "!" ] || [ "${prt[0]}" == "@" ] || [ "${prt[0]}" == "#" ]; then
if [ "${prt[1]}" -gt "$(cof ${prt[0]} $d_c $n_c $s_c)" ] || [ "${prt[1]}" == "$(cof ${prt[0]} $d_c $n_c $s_c)" ]; then
print_debug "prt[1] is [greater than] $(cof ${prt[0]} $d_c $n_c $s_c)";
prt1=($(spl ${all_s[$i+1]} "|"));
if [ "${prt1[0]}" == "!" ]; then
all_s[$i+1]="${prt1[0]}|$((${prt1[1]}+1))";
elif [ "${prt1[0]}" == "@" ]; then
all_s[$i+1]="${prt1[0]}|$((${prt1[1]}+1))";
elif [ "${prt1[0]}" == "#" ]; then
all_s[$i+1]="${prt1[0]}|$((${prt1[1]}+1))";
else
for (( ii = $i+2; ii < $all_c; ii++ )); do
prt2=($(spl ${all_s[$ii]} "|"));
if [ "${prt2[0]}" == "!" ] || [ "${prt2[0]}" == "@" ] || [ "${prt2[0]}" == "#" ]; then
all_s[$ii]="${prt2[0]}|$((${prt2[1]}+1))";
break;
fi
done;
fi;
prt[1]="0";
all_s[$i]="${prt[0]}|0";
fi;
if [[ "$i" == "0" ]]; then
all_s[$i]="${prt[0]}|$((${prt[1]}+1))";
fi;
else
if [ "$i" == "0" ]; then
for (( ii = 1; ii < $all_c; ii++ )); do
prt2=($(spl ${all_s[$ii]} "|"));
if [ "${prt2[0]}" == "!" ] || [ "${prt2[0]}" == "@" ] || [ "${prt2[0]}" == "#" ]; then
all_s[$ii]="${prt2[0]}|$((${prt2[1]}+1))";
break;
fi
done;
fi;
fi;
done;
last_pass=$now_ps;
print_debug $first_pass;
print_debug $now_ps;
all_ss="";
for ss in "${all_s[@]}"; do
all_ss="$all_ss,$ss";
done;
echo_it $now_ps "$2";
write_config "$first_pass" "$all_ss" "$mask_v" "$dtl" "$nmb" "$spcl" "$now_ps";
if [ "$normal_mode" == "n" ]; then
echo_it $(rev $now_ps) "$2";
write_config "$first_pass" "$all_ss" "$mask_v" "$dtl" "$nmb" "$spcl" "$(rev $now_ps)";
fi;
done;
}
if ! [ "$1" == "" ];then
if [ "$1" == "-h" ] || [ "$1" == "--help" ]; then
>&2 echo -e "$hlogo";
sleep 5;
exit;
fi;
args_len=$#;
args=("$@");
for ((i=0;i<$args_len;i++)); do
if [ "${args[$i]}" == "-p" ]; then
pipe="yes";
pipe_input="$(str_replace "${args[$(($i+1))]}" " " "%20")";
spl_arr=($(spl "$pipe_input" ";"));
dtl="${spl_arr[0]}";
nmb="${spl_arr[1]}";
if [ "${spl_arr[2]}" == "" ]; then
spcl="";
elif [ "${spl_arr[2]}" == "," ]; then
spcl="$dflt_spcl";
else
spcl="${spl_arr[2]}";
fi;
elif [ "${args[$i]}" == "-m" ]; then
if ! [ "${args[$(($i+1))]}" == "" ]; then mask_v="${args[$(($i+1))]}"; fi;
elif [ "${args[$i]}" == "-l" ]; then
if [ $(check_int "${args[$(($i+1))]}") == "y" ]; then long_l=${args[$(($i+1))]}; fi;
elif [ "${args[$i]}" == "-s" ]; then
if [ $(check_int "${args[$(($i+1))]}") == "y" ]; then short_l=${args[$(($i+1))]}; fi;
elif [ "${args[$i]}" == "-o" ]; then
output_file="$(realpath "${args[$(($i+1))]}")";
output_file_name=$(file_name "$output_file");
elif [ "${args[$i]}" == "-n" ]; then
normal_mode="y";
elif [ "${args[$i]}" == "-M" ]; then
msk_file="$(realpath "${args[$(($i+1))]}")";
elif [ "${args[$i]}" == "-S" ]; then
spcl_file="$(realpath "${args[$(($i+1))]}")";
elif [ "${args[$i]}" == "-N" ]; then
nmb_file="$(realpath "${args[$(($i+1))]}")";
elif [ "${args[$i]}" == "-D" ]; then
dtl_file="$(realpath "${args[$(($i+1))]}")";
elif [ "${args[$i]}" == "-O" ]; then
output2file="$(realpath "${args[$(($i+1))]}")";
elif [ "${args[$i]}" == "-ap" ]; then
advanced_pipe="yes";
arrays=($(spl "${args[$(($i+1))]}" ";"));
elif [ "${args[$i]}" == "-d" ]; then
debug_mode="on";
fi;
done;
fi;
if [ "$advanced_pipe" == "no" ]; then
if [ "$pipe" == "no" ]; then
>&2 echo -e "$logo";
if [ "$dtl_file" == "" ]; then
read -r -p "Details Please > " dtl;
if [ "$dtl" == "" ] ;then
print_info "\t\tDid you know that empty details' line will never make a passwords list 0.0?
\t\tPlease enter a minimum of two details Or I'll kill myself again.
";
sleep 3;
print_error "\t\tKilling my self in :";
sleep 1;
>&2 echo -e "\t\t5";
sleep 1;
>&2 echo -e "\t\t4";
sleep 1;
>&2 echo -e "\t\t3";
sleep 1;
>&2 echo -e "\t\t2";
sleep 1;
>&2 echo -e "\t\t1";
sleep 1;
print_error "\t\t\tR.I.P [Me] |':";
sleep 3;
exit;
fi;
fi;
if [ "$nmb_file" == "" ]; then read -r -p "Numbers Please > " nmb; fi;
if [ "$spcl_file" == "" ]; then
read -r -p "Specials Please > " spcl;
if [ "$spcl" == "" ]; then
read -r -p "Do you want to use the default Specials? [ Write anything for NO or nothing for YES ] > " ansr;
if [ "$ansr" == "" ]; then
spcl="$dflt_spcl";
fi;
fi;
fi;
read -r -p "Shortest password length [Default: $short_l] > " shrt;
if ! [ "$shrt" == "" ]; then
if [ $(check_int $shrt) == "y" ]; then
short_l=$shrt;
else
print_error "Error: Input was not integer!! Using default value!";
fi;
fi;
read -r -p "Longest password length [Default: $long_l] > " lng;
if ! [ "$lng" == "" ]; then
if [ $(check_int $lng) == "y" ]; then
long_l=$lng;
else
print_error "Error: Input was not integer!! Using default value!";
fi;
fi;
if [ "$msk_file" == "" ]; then
read -r -p "Mask [Default: $mask_v] Write a white space for NO (If not empty) > " msk;
if ! [ "$lng" == "" ]; then
if ! [ "$msk" == "" ]; then
mask_v="$mask_v";
elif [ "$msk" == " " ]; then
mask_v="";
else
mask_v="$msk";
fi;
fi;
fi;
fi;
if [[ "$dtl" == *","* ]]; then dtl_arr=($(spl "$dtl" ",")); else dtl_arr=($dtl); fi;
if [[ "$nmb" == *","* ]]; then nmb_arr=($(spl "$nmb" ",")); else nmb_arr=($nmb); fi;
if [[ "$spcl" == *","* ]]; then spcl_arr=($(spl "$spcl" ",")); else spcl_arr=($spcl); fi;
if [ "${#dtl_arr[@]}" == "1" ]; then
echo "";
print_error "** Only one detail was given!! and that's not enough!! **";
sleep 5;
exit;
fi;
fi;
if [ ! -d "$temp_path" ]; then
mkdir -p "$temp_path";
fi;
print_good "\t\tNow will start working ^^";
sleep 3;
function dtl_mix(){
declare -a dtls=("${!1}");
now_dtl=();
for dtl in "${dtls[@]}"; do
tmp_arr=($(all_cases "$dtl"));
for tmp_s in "${tmp_arr[@]}"; do
tmp_here="n";
for now_d in "${now_dtl[@]}"; do
if [ "$now_d" == "$tmp_s" ]; then
tmp_here="y";
break;
fi;
done;
if [ "$tmp_here" == "n" ]; then now_dtl+=("$tmp_s"); fi;
if ! [[ "${now_dtl[@]}" =~ "$(rev $tmp_s)" ]]; then now_dtl+=("$(rev $tmp_s)"); fi;
done;
done;
echo "${now_dtl[@]}";
}
function advanced_mix(){
declare -a arrys=("${!1}");
for a in "${arrys[@]}"; do
a="$a,";
tmp_a=();
spl_arr=($(spl "$a" ","));
for aa in "${spl_arr[@]}"; do
tmp_arr=($(all_cases "$aa"));
for aaa in "${tmp_arr[@]}"; do
tmp_here='n';
for t in "${tmp_a[@]}"; do
if [ "$t" == "$aaa" ]; then
tmp_here="y"; break;
fi;
done;
if [ "$tmp_here" == "n" ]; then tmp_a+=("$aaa"); fi
if ! [[ "${tmp_a[@]}" =~ "$(rev $aaa)" ]]; then tmp_a+=("$(rev $aaa)"); fi;
done;
done;
final_a="${tmp_a[0]}";
for ((ta=1;ta<${#tmp_a[@]};ta++)); do
final_a="$final_a,${tmp_a[$ta]}";
done;
echo "$final_a";
done;
}
function do_files(){
declare -a arr1=("${!1}");
declare -a arr2=("${!2}");
declare -a arr3=("${!3}");
mask_v="$4";
m2use="1";
d2use="1";
n2use="1";
s2use="1";
if ! [ "$msk_file" == "" ]; then
if ! [ -f "$msk_file" ] || [ "`wc -l < "$msk_file"`" == "0" ]; then
>&2 echo "";
print_error "\t\t[!] Masks' file was not found or was empty!! Using mask input...";
m2use="0";
sleep 3;
fi;
else
m2use="0";
fi;
if ! [ "$dtl_file" == "" ]; then
if ! [ -f "$dtl_file" ] || [ "`wc -l < "$dtl_file"`" == "0" ]; then
>&2 echo "";
print_error "\t\t[!] Detials' file was not found or was empty!! Using details input...";
d2use="0";
sleep 3;
fi;
else
d2use="0";
fi;
if ! [ "$nmb_file" == "" ]; then
if ! [ -f "$nmb_file" ] || [ "`wc -l < "$nmb_file"`" == "0" ]; then
>&2 echo "";
print_error "\t\t[!] Numbers' file was not found or was empty!! Using numbers input...";
n2use="0";
sleep 3;
fi;
else
n2use="0";
fi;
if ! [ "$spcl_file" == "" ]; then
if ! [ -f "$spcl_file" ] || [ "`wc -l < "$spcl_file"`" == "0" ]; then
>&2 echo "";
print_error "\t\t[!] Specials' file was not found or was empty!! Using specials input...";
s2use="0";
sleep 3;
fi;
else
s2use="0";
fi;
if [ "$d2use" == "0" ] && [ "${#dtl_arr[@]}" == "0" ]; then
>&2 echo "";
print_error "\t\t[!] No details were found!! Aborting.......";
sleep 3;
exit;
fi;
>&2 echo "";
print_info "\t\t[!] Now will start generating multiple passwords' counts. It may take so long!!!";
>&2 echo "";