-
-
Notifications
You must be signed in to change notification settings - Fork 924
/
reconftw.sh
executable file
·4117 lines (3706 loc) · 188 KB
/
reconftw.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
#!/usr/bin/env bash
# Welcome to reconFTW main script
# ██▀███ ▓█████ ▄████▄ ▒█████ ███▄ █ █████▒▄▄▄█████▓ █ █░
# ▓██ ▒ ██▒▓█ ▀ ▒██▀ ▀█ ▒██▒ ██▒ ██ ▀█ █ ▓██ ▒ ▓ ██▒ ▓▒▓█░ █ ░█░
# ▓██ ░▄█ ▒▒███ ▒▓█ ▄ ▒██░ ██▒▓██ ▀█ ██▒▒████ ░ ▒ ▓██░ ▒░▒█░ █ ░█
# ▒██▀▀█▄ ▒▓█ ▄ ▒▓▓▄ ▄██▒▒██ ██░▓██▒ ▐▌██▒░▓█▒ ░ ░ ▓██▓ ░ ░█░ █ ░█
# ░██▓ ▒██▒░▒████▒▒ ▓███▀ ░░ ████▓▒░▒██░ ▓██░░▒█░ ▒██▒ ░ ░░██▒██▓
# ░ ▒▓ ░▒▓░░░ ▒░ ░░ ░▒ ▒ ░░ ▒░▒░▒░ ░ ▒░ ▒ ▒ ▒ ░ ▒ ░░ ░ ▓░▒ ▒
# ░▒ ░ ▒░ ░ ░ ░ ░ ▒ ░ ▒ ▒░ ░ ░░ ░ ▒░ ░ ░ ▒ ░ ░
# ░░ ░ ░ ░ ░ ░ ░ ▒ ░ ░ ░ ░ ░ ░ ░ ░
# ░ ░ ░░ ░ ░ ░ ░ ░
#
# Error Management
#set -eEuo pipefail
#function handle_error() {
# local lineno="$1"
# local msg="$2"
# local command="$3"
# echo "##### ERROR [Line $lineno] - $msg (Command: $command) #####"
#}
#trap 'handle_error ${LINENO} "$BASH_COMMAND" "${FUNCNAME[@]}"' ERR
function banner_graber() {
source "${SCRIPTPATH}"/banners.txt
randx=$(shuf -i 1-23 -n 1)
tmp="banner${randx}"
banner_code=${!tmp}
echo -e "${banner_code}"
}
function banner() {
banner_code=$(banner_graber)
printf "\n${bgreen}${banner_code}"
printf "\n ${reconftw_version} by @six2dez${reset}\n"
}
function test_connectivity() {
if nc -zw1 google.com 443 2>/dev/null; then
echo -e "Connection: ${bgreen}OK${reset}"
else
echo -e "${bred}[!] Please check your internet connection and then try again...${reset}"
exit 1
fi
}
###############################################################################################################
################################################### TOOLS #####################################################
###############################################################################################################
function check_version() {
timeout 10 git fetch || (true && echo "git fetch timeout reached")
exit_status=$?
if [[ ${exit_status} -eq 0 ]]; then
BRANCH=$(git rev-parse --abbrev-ref HEAD)
HEADHASH=$(git rev-parse HEAD)
UPSTREAMHASH=$(git rev-parse "${BRANCH}"@\{upstream\})
if [[ ${HEADHASH} != "${UPSTREAMHASH}" ]]; then
printf "\n${yellow} There is a new version, run ./install.sh to get latest version${reset}\n\n"
fi
else
printf "\n${bred} Unable to check updates ${reset}\n\n"
fi
}
function tools_installed() {
printf "\n\n${bgreen}#######################################################################${reset}\n"
printf "${bblue}[$(date +'%Y-%m-%d %H:%M:%S')] Checking installed tools ${reset}\n\n"
allinstalled=true
[ -n "$GOPATH" ] || {
printf "${bred} [*] GOPATH var [NO]${reset}\n"
allinstalled=false
}
[ -n "$GOROOT" ] || {
printf "${bred} [*] GOROOT var [NO]${reset}\n"
allinstalled=false
}
[ -n "$PATH" ] || {
printf "${bred} [*] PATH var [NO]${reset}\n"
allinstalled=false
}
[ -f "${tools}/dorks_hunter/dorks_hunter.py" ] || {
printf "${bred} [*] dorks_hunter [NO]${reset}\n"
allinstalled=false
}
[ -f "${tools}/fav-up/favUp.py" ] || {
printf "${bred} [*] fav-up [NO]${reset}\n"
allinstalled=false
}
[ -f "${tools}/Corsy/corsy.py" ] || {
printf "${bred} [*] Corsy [NO]${reset}\n"
allinstalled=false
}
[ -f "${tools}/testssl.sh/testssl.sh" ] || {
printf "${bred} [*] testssl [NO]${reset}\n"
allinstalled=false
}
[ -f "${tools}/CMSeeK/cmseek.py" ] || {
printf "${bred} [*] CMSeeK [NO]${reset}\n"
allinstalled=false
}
[ -f "${fuzz_wordlist}" ] || {
printf "${bred} [*] OneListForAll [NO]${reset}\n"
allinstalled=false
}
[ -f "${lfi_wordlist}" ] || {
printf "${bred} [*] lfi_wordlist [NO]${reset}\n"
allinstalled=false
}
[ -f "${ssti_wordlist}" ] || {
printf "${bred} [*] ssti_wordlist [NO]${reset}\n"
allinstalled=false
}
[ -f "${subs_wordlist}" ] || {
printf "${bred} [*] subs_wordlist [NO]${reset}\n"
allinstalled=false
}
[ -f "${subs_wordlist_big}" ] || {
printf "${bred} [*] subs_wordlist_big [NO]${reset}\n"
allinstalled=false
}
[ -f "${resolvers}" ] || {
printf "${bred} [*] resolvers [NO]${reset}\n"
allinstalled=false
}
[ -f "${resolvers_trusted}" ] || {
printf "${bred} [*] resolvers_trusted [NO]${reset}\n"
allinstalled=false
}
command -v brutespray &>/dev/null || {
printf "${bred} [*] brutespray [NO]${reset}\n"
allinstalled=false
}
command -v xnLinkFinder &>/dev/null || {
printf "${bred} [*] xnLinkFinder [NO]${reset}\n"
allinstalled=false
}
command -v waymore &>/dev/null || {
printf "${bred} [*] waymore [NO]${reset}\n"
allinstalled=false
}
[ -f "${tools}/commix/commix.py" ] || {
printf "${bred} [*] commix [NO]${reset}\n"
allinstalled=false
}
[ -f "${tools}/getjswords.py" ] || {
printf "${bred} [*] getjswords [NO]${reset}\n"
allinstalled=false
}
[ -f "${tools}/JSA/jsa.py" ] || {
printf "${bred} [*] JSA [NO]${reset}\n"
allinstalled=false
}
[ -f "${tools}/CloudHunter/cloudhunter.py" ] || {
printf "${bred} [*] CloudHunter [NO]${reset}\n"
allinstalled=false
}
[ -f "${tools}/ultimate-nmap-parser/ultimate-nmap-parser.sh" ] || {
printf "${bred} [*] nmap-parse-output [NO]${reset}\n"
allinstalled=false
}
[ -f "${tools}/pydictor/pydictor.py" ] || {
printf "${bred} [*] pydictor [NO]${reset}\n"
allinstalled=false
}
[ -f "${tools}/urless/urless/urless.py" ] || {
printf "${bred} [*] urless [NO]${reset}\n"
allinstalled=false
}
[ -f "${tools}/smuggler/smuggler.py" ] || {
printf "${bred} [*] smuggler [NO]${reset}\n"
allinstalled=false
}
[ -f "${tools}/regulator/main.py" ] || {
printf "${bred} [*] regulator [NO]${reset}\n"
allinstalled=false
}
[ -f "${tools}/nomore403/nomore403" ] || {
printf "${bred} [*] nomore403 [NO]${reset}\n"
allinstalled=false
}
[ -f "${tools}/ffufPostprocessing/ffufPostprocessing" ] || {
printf "${bred} [*] ffufPostprocessing [NO]${reset}\n"
allinstalled=false
}
[ -f "${tools}/misconfig-mapper/misconfig-mapper" ] || {
printf "${bred} [*] misconfig-mapper [NO]${reset}\n"
allinstalled=false
}
[ -f "${tools}/Spoofy/spoofy.py" ] || {
printf "${bred} [*] spoofy [NO]${reset}\n"
allinstalled=false
}
[ -f "${tools}/SwaggerSpy/swaggerspy.py" ] || {
printf "${bred} [*] swaggerspy [NO]${reset}\n"
allinstalled=false
}
[ -f "${tools}/LeakSearch/LeakSearch.py" ] || {
printf "${bred} [*] LeakSearch [NO]${reset}\n"
allinstalled=false
}
command -v github-endpoints &>/dev/null || {
printf "${bred} [*] github-endpoints [NO]${reset}\n"
allinstalled=false
}
command -v github-subdomains &>/dev/null || {
printf "${bred} [*] github-subdomains [NO]${reset}\n"
allinstalled=false
}
command -v gitlab-subdomains &>/dev/null || {
printf "${bred} [*] gitlab-subdomains [NO]${reset}\n"
allinstalled=false
}
command -v katana &>/dev/null || {
printf "${bred} [*] katana [NO]${reset}\n"
allinstalled=false
}
command -v wafw00f &>/dev/null || {
printf "${bred} [*] wafw00f [NO]${reset}\n"
allinstalled=false
}
command -v dnsvalidator &>/dev/null || {
printf "${bred} [*] dnsvalidator [NO]${reset}\n"
allinstalled=false
}
command -v metafinder &>/dev/null || {
printf "${bred} [*] metafinder [NO]${reset}\n"
allinstalled=false
}
command -v whois &>/dev/null || {
printf "${bred} [*] whois [NO]${reset}\n"
allinstalled=false
}
command -v dnsx &>/dev/null || {
printf "${bred} [*] dnsx [NO]${reset}\n"
allinstalled=false
}
command -v gotator &>/dev/null || {
printf "${bred} [*] gotator [NO]${reset}\n"
allinstalled=false
}
command -v nuclei &>/dev/null || {
printf "${bred} [*] Nuclei [NO]${reset}\n"
allinstalled=false
}
[ -d ${NUCLEI_TEMPLATES_PATH} ] || {
printf "${bred} [*] Nuclei templates [NO]${reset}\n"
allinstalled=false
}
[ -d ${tools}/fuzzing-templates ] || {
printf "${bred} [*] Fuzzing templates [NO]${reset}\n"
allinstalled=false
}
command -v gf &>/dev/null || {
printf "${bred} [*] Gf [NO]${reset}\n"
allinstalled=false
}
command -v Gxss &>/dev/null || {
printf "${bred} [*] Gxss [NO]${reset}\n"
allinstalled=false
}
command -v subjs &>/dev/null || {
printf "${bred} [*] subjs [NO]${reset}\n"
allinstalled=false
}
command -v ffuf &>/dev/null || {
printf "${bred} [*] ffuf [NO]${reset}\n"
allinstalled=false
}
command -v massdns &>/dev/null || {
printf "${bred} [*] Massdns [NO]${reset}\n"
allinstalled=false
}
command -v qsreplace &>/dev/null || {
printf "${bred} [*] qsreplace [NO]${reset}\n"
allinstalled=false
}
command -v interlace &>/dev/null || {
printf "${bred} [*] interlace [NO]${reset}\n"
allinstalled=false
}
command -v anew &>/dev/null || {
printf "${bred} [*] Anew [NO]${reset}\n"
allinstalled=false
}
command -v unfurl &>/dev/null || {
printf "${bred} [*] unfurl [NO]${reset}\n"
allinstalled=false
}
command -v crlfuzz &>/dev/null || {
printf "${bred} [*] crlfuzz [NO]${reset}\n"
allinstalled=false
}
command -v httpx &>/dev/null || {
printf "${bred} [*] Httpx [NO]${reset}\n${reset}"
allinstalled=false
}
command -v jq &>/dev/null || {
printf "${bred} [*] jq [NO]${reset}\n${reset}"
allinstalled=false
}
command -v notify &>/dev/null || {
printf "${bred} [*] notify [NO]${reset}\n${reset}"
allinstalled=false
}
command -v dalfox &>/dev/null || {
printf "${bred} [*] dalfox [NO]${reset}\n${reset}"
allinstalled=false
}
command -v puredns &>/dev/null || {
printf "${bred} [*] puredns [NO]${reset}\n${reset}"
allinstalled=false
}
command -v emailfinder &>/dev/null || {
printf "${bred} [*] emailfinder [NO]${reset}\n"
allinstalled=false
}
command -v analyticsrelationships &>/dev/null || {
printf "${bred} [*] analyticsrelationships [NO]${reset}\n"
allinstalled=false
}
command -v mapcidr &>/dev/null || {
printf "${bred} [*] mapcidr [NO]${reset}\n"
allinstalled=false
}
command -v ppmap &>/dev/null || {
printf "${bred} [*] ppmap [NO]${reset}\n"
allinstalled=false
}
command -v cdncheck &>/dev/null || {
printf "${bred} [*] cdncheck [NO]${reset}\n"
allinstalled=false
}
command -v interactsh-client &>/dev/null || {
printf "${bred} [*] interactsh-client [NO]${reset}\n"
allinstalled=false
}
command -v tlsx &>/dev/null || {
printf "${bred} [*] tlsx [NO]${reset}\n"
allinstalled=false
}
command -v smap &>/dev/null || {
printf "${bred} [*] smap [NO]${reset}\n"
allinstalled=false
}
command -v gitdorks_go &>/dev/null || {
printf "${bred} [*] gitdorks_go [NO]${reset}\n"
allinstalled=false
}
command -v ripgen &>/dev/null || {
printf "${bred} [*] ripgen [NO]${reset}\n${reset}"
allinstalled=false
}
command -v dsieve &>/dev/null || {
printf "${bred} [*] dsieve [NO]${reset}\n${reset}"
allinstalled=false
}
command -v inscope &>/dev/null || {
printf "${bred} [*] inscope [NO]${reset}\n${reset}"
allinstalled=false
}
command -v enumerepo &>/dev/null || {
printf "${bred} [*] enumerepo [NO]${reset}\n${reset}"
allinstalled=false
}
command -v Web-Cache-Vulnerability-Scanner &>/dev/null || {
printf "${bred} [*] Web-Cache-Vulnerability-Scanner [NO]${reset}\n"
allinstalled=false
}
command -v subfinder &>/dev/null || {
printf "${bred} [*] subfinder [NO]${reset}\n${reset}"
allinstalled=false
}
command -v ghauri &>/dev/null || {
printf "${bred} [*] ghauri [NO]${reset}\n${reset}"
allinstalled=false
}
command -v hakip2host &>/dev/null || {
printf "${bred} [*] hakip2host [NO]${reset}\n${reset}"
allinstalled=false
}
command -v gau &>/dev/null || {
printf "${bred} [*] gau [NO]${reset}\n${reset}"
allinstalled=false
}
command -v crt &>/dev/null || {
printf "${bred} [*] crt [NO]${reset}\n${reset}"
allinstalled=false
}
command -v gitleaks &>/dev/null || {
printf "${bred} [*] gitleaks [NO]${reset}\n${reset}"
allinstalled=false
}
command -v trufflehog &>/dev/null || {
printf "${bred} [*] trufflehog [NO]${reset}\n${reset}"
allinstalled=false
}
command -v s3scanner &>/dev/null || {
printf "${bred} [*] s3scanner [NO]${reset}\n${reset}"
allinstalled=false
}
command -v mantra &>/dev/null || {
printf "${bred} [*] mantra [NO]${reset}\n${reset}"
allinstalled=false
}
command -v nmapurls &>/dev/null || {
printf "${bred} [*] nmapurls [NO]${reset}\n"
allinstalled=false
}
command -v porch-pirate &>/dev/null || {
printf "${bred} [*] porch-pirate [NO]${reset}\n"
allinstalled=false
}
command -v shortscan &>/dev/null || {
printf "${bred} [*] shortscan [NO]${reset}\n"
allinstalled=false
}
command -v sns &>/dev/null || {
printf "${bred} [*] sns [NO]${reset}\n"
allinstalled=false
}
command -v sourcemapper &>/dev/null || {
printf "${bred} [*] sourcemapper [NO]${reset}\n"
allinstalled=false
}
command -v jsluice &>/dev/null || {
printf "${bred} [*] jsluice [NO]${reset}\n"
allinstalled=false
}
if [[ ${allinstalled} == true ]]; then
printf "${bgreen} Good! All installed! ${reset}\n\n"
else
printf "\n${yellow} Try running the installer script again ./install.sh"
printf "\n${yellow} If it fails for any reason try to install manually the tools missed"
printf "\n${yellow} Finally remember to set the ${bred}\${tools}${yellow} variable at the start of this script"
printf "\n${yellow} If nothing works and the world is gonna end you can always ping me :D ${reset}\n\n"
fi
printf "${bblue}[$(date +'%Y-%m-%d %H:%M:%S')] Tools check finished\n"
printf "${bgreen}#######################################################################\n${reset}"
}
#####################################################################cc##########################################
################################################### OSINT #####################################################
###############################################################################################################
function google_dorks() {
mkdir -p osint
if { [[ ! -f "$called_fn_dir/.${FUNCNAME[0]}" ]] || [[ $DIFF == true ]]; } && [[ $GOOGLE_DORKS == true ]] && [[ $OSINT == true ]]; then
start_func "${FUNCNAME[0]}" "Google Dorks in process"
python3 ${tools}/dorks_hunter/dorks_hunter.py -d "$domain" -o osint/dorks.txt || {
echo "dorks_hunter command failed"
exit 1
}
end_func "Results are saved in $domain/osint/dorks.txt" "${FUNCNAME[0]}"
else
if [[ $GOOGLE_DORKS == false ]] || [[ $OSINT == false ]]; then
printf "\n${yellow}[$(date +'%Y-%m-%d %H:%M:%S')] ${FUNCNAME[0]} skipped in this mode or defined in reconftw.cfg ${reset}\n"
else
printf "${yellow}[$(date +'%Y-%m-%d %H:%M:%S')] ${FUNCNAME[0]} are already processed, to force executing ${FUNCNAME[0]} delete\n $called_fn_dir/.${FUNCNAME[0]} ${reset}\n\n"
fi
fi
}
function github_dorks() {
mkdir -p osint
if { [[ ! -f "$called_fn_dir/.${FUNCNAME[0]}" ]] || [[ $DIFF == true ]]; } && [[ $GITHUB_DORKS == true ]] && [[ $OSINT == true ]]; then
start_func "${FUNCNAME[0]}" "Github Dorks in process"
if [[ -s ${GITHUB_TOKENS} ]]; then
if [[ $DEEP == true ]]; then
gitdorks_go -gd ${tools}/gitdorks_go/Dorks/medium_dorks.txt -nws 20 -target "$domain" -tf "${GITHUB_TOKENS}" -ew 3 | anew -q osint/gitdorks.txt || {
echo "gitdorks_go/anew command failed"
exit 1
}
else
gitdorks_go -gd ${tools}/gitdorks_go/Dorks/smalldorks.txt -nws 20 -target $domain -tf "${GITHUB_TOKENS}" -ew 3 | anew -q osint/gitdorks.txt || {
echo "gitdorks_go/anew command failed"
exit 1
}
fi
else
printf "\n${bred}[$(date +'%Y-%m-%d %H:%M:%S')] Required file ${GITHUB_TOKENS} not exists or empty${reset}\n"
fi
end_func "Results are saved in $domain/osint/gitdorks.txt" "${FUNCNAME[0]}"
else
if [[ $GITHUB_DORKS == false ]] || [[ $OSINT == false ]]; then
printf "\n${yellow}[$(date +'%Y-%m-%d %H:%M:%S')] ${FUNCNAME[0]} skipped in this mode or defined in reconftw.cfg ${reset}\n"
else
printf "${yellow}[$(date +'%Y-%m-%d %H:%M:%S')] ${FUNCNAME[0]} is already processed, to force executing ${FUNCNAME[0]} delete\n $called_fn_dir/.${FUNCNAME[0]} ${reset}\n\n"
fi
fi
}
function github_repos() {
mkdir -p .tmp
if { [[ ! -f "$called_fn_dir/.${FUNCNAME[0]}" ]] || [[ $DIFF == true ]]; } && [[ $GITHUB_REPOS == true ]] && [[ $OSINT == true ]]; then
start_func "${FUNCNAME[0]}" "Github Repos analysis in process"
if [[ -s ${GITHUB_TOKENS} ]]; then
GH_TOKEN=$(cat ${GITHUB_TOKENS} | head -1)
echo $domain | unfurl format %r >.tmp/company_name.txt
enumerepo -token-string "${GH_TOKEN}" -usernames .tmp/company_name.txt -o .tmp/company_repos.txt 2>>"$LOGFILE" >/dev/null
[ -s ".tmp/company_repos.txt" ] && jq -r '.[].repos[]|.url' <.tmp/company_repos.txt >.tmp/company_repos_url.txt 2>>"$LOGFILE"
mkdir -p .tmp/github_repos 2>>"$LOGFILE" >>"$LOGFILE"
mkdir -p .tmp/github 2>>"$LOGFILE" >>"$LOGFILE"
[ -s ".tmp/company_repos_url.txt" ] && interlace -tL .tmp/company_repos_url.txt -threads ${INTERLACE_THREADS} -c "git clone _target_ .tmp/github_repos/_cleantarget_" 2>>"$LOGFILE" >/dev/null 2>&1
[ -d ".tmp/github/" ] && ls .tmp/github_repos >.tmp/github_repos_folders.txt
[ -s ".tmp/github_repos_folders.txt" ] && interlace -tL .tmp/github_repos_folders.txt -threads ${INTERLACE_THREADS} -c "gitleaks detect --source .tmp/github_repos/_target_ --no-banner --no-color -r .tmp/github/gh_secret_cleantarget_.json" 2>>"$LOGFILE" >/dev/null
[ -s ".tmp/company_repos_url.txt" ] && interlace -tL .tmp/company_repos_url.txt -threads ${INTERLACE_THREADS} -c "trufflehog git _target_ -j 2>&1 | jq -c > _output_/_cleantarget_" -o .tmp/github/ >>"$LOGFILE" 2>&1
if [[ -d ".tmp/github/" ]]; then
cat .tmp/github/* 2>/dev/null | jq -c | jq -r >osint/github_company_secrets.json 2>>"$LOGFILE"
fi
else
printf "\n${bred}[$(date +'%Y-%m-%d %H:%M:%S')] Required file ${GITHUB_TOKENS} not exists or empty${reset}\n"
fi
end_func "Results are saved in $domain/osint/github_company_secrets.json" ${FUNCNAME[0]}
else
if [[ $GITHUB_REPOS == false ]] || [[ $OSINT == false ]]; then
printf "\n${yellow}[$(date +'%Y-%m-%d %H:%M:%S')] ${FUNCNAME[0]} skipped in this mode or defined in reconftw.cfg ${reset}\n"
else
printf "${yellow}[$(date +'%Y-%m-%d %H:%M:%S')] ${FUNCNAME[0]} is already processed, to force executing ${FUNCNAME[0]} delete\n $called_fn_dir/.${FUNCNAME[0]} ${reset}\n\n"
fi
fi
}
function metadata() {
mkdir -p osint
if { [[ ! -f "${called_fn_dir}/.${FUNCNAME[0]}" ]] || [[ ${DIFF} == true ]]; } && [[ ${METADATA} == true ]] && [[ ${OSINT} == true ]] && ! [[ ${domain} =~ ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9] ]]; then
start_func ${FUNCNAME[0]} "Scanning metadata in public files"
metafinder -d "$domain" -l $METAFINDER_LIMIT -o osint -go -bi &>>"$LOGFILE" || {
echo "metafinder command failed"
exit 1
}
mv "osint/${domain}/"*".txt" "osint/" 2>>"$LOGFILE"
rm -rf "osint/${domain}" 2>>"$LOGFILE"
end_func "Results are saved in $domain/osint/[software/authors/metadata_results].txt" ${FUNCNAME[0]}
else
if [[ $METADATA == false ]] || [[ $OSINT == false ]]; then
printf "\n${yellow}[$(date +'%Y-%m-%d %H:%M:%S')] ${FUNCNAME[0]} skipped in this mode or defined in reconftw.cfg ${reset}\n"
elif [[ $domain =~ ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9] ]]; then
return
else
if [[ $METADATA == false ]] || [[ $OSINT == false ]]; then
printf "\n${yellow}[$(date +'%Y-%m-%d %H:%M:%S')] ${FUNCNAME[0]} skipped in this mode or defined in reconftw.cfg ${reset}\n"
else
printf "${yellow}[$(date +'%Y-%m-%d %H:%M:%S')] ${FUNCNAME[0]} is already processed, to force executing ${FUNCNAME[0]} delete\n $called_fn_dir/.${FUNCNAME[0]} ${reset}\n\n"
fi
fi
fi
}
function apileaks() {
mkdir -p osint
if { [[ ! -f "$called_fn_dir/.${FUNCNAME[0]}" ]] || [[ $DIFF == true ]]; } && [[ $API_LEAKS == true ]] && [[ $OSINT == true ]] && ! [[ $domain =~ ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9] ]]; then
start_func ${FUNCNAME[0]} "Scanning for leaks in APIs public directories"
porch-pirate -s "$domain" --dump 2>>"$LOGFILE" >${dir}/osint/postman_leaks.txt || {
echo "porch-pirate command failed (probably by rate limit)"
}
pushd "${tools}/SwaggerSpy" >/dev/null || {
echo "Failed to pushd to ${tools}/SwaggerSpy in ${FUNCNAME[0]} @ line ${LINENO}"
}
python3 swaggerspy.py $domain 2>>"$LOGFILE" | grep -i "[*]\|URL" >${dir}/osint/swagger_leaks.txt
popd >/dev/null || {
echo "Failed to popd in ${FUNCNAME[0]} @ line ${LINENO}"
}
[ -s "osint/postman_leaks.txt" ] && trufflehog filesystem ${dir}/osint/postman_leaks.txt -j 2>/dev/null | jq -c | anew -q ${dir}/osint/postman_leaks_trufflehog.json
[ -s "osint/swagger_leaks.txt" ] && trufflehog filesystem ${dir}/osint/swagger_leaks.txt -j 2>/dev/null | jq -c | anew -q ${dir}/osint/swagger_leaks_trufflehog.json
end_func "Results are saved in $domain/osint/[software/authors/metadata_results].txt" ${FUNCNAME[0]}
else
if [[ $API_LEAKS == false ]] || [[ $OSINT == false ]]; then
printf "\n${yellow}[$(date +'%Y-%m-%d %H:%M:%S')] ${FUNCNAME[0]} skipped in this mode or defined in reconftw.cfg ${reset}\n"
elif [[ $domain =~ ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9] ]]; then
return
else
if [[ $API_LEAKS == false ]] || [[ $OSINT == false ]]; then
printf "\n${yellow}[$(date +'%Y-%m-%d %H:%M:%S')] ${FUNCNAME[0]} skipped in this mode or defined in reconftw.cfg ${reset}\n"
else
printf "${yellow}[$(date +'%Y-%m-%d %H:%M:%S')] ${FUNCNAME[0]} is already processed, to force executing ${FUNCNAME[0]} delete\n $called_fn_dir/.${FUNCNAME[0]} ${reset}\n\n"
fi
fi
fi
}
function emails() {
mkdir -p {.tmp,osint}
if { [[ ! -f "$called_fn_dir/.${FUNCNAME[0]}" ]] || [[ $DIFF == true ]]; } && [[ $EMAILS == true ]] && [[ $OSINT == true ]] && ! [[ $domain =~ ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9] ]]; then
start_func ${FUNCNAME[0]} "Searching emails/users/passwords leaks"
emailfinder -d $domain 2>>"$LOGFILE" | anew -q .tmp/emailfinder.txt || {
echo "emailfinder command failed"
exit 1
}
[ -s ".tmp/emailfinder.txt" ] && cat .tmp/emailfinder.txt | grep "@" | grep -iv "|_" | anew -q osint/emails.txt
pushd "${tools}/LeakSearch" >/dev/null || {
echo "Failed to cd directory in ${FUNCNAME[0]} @ line ${LINENO}"
}
python3 LeakSearch.py -k $domain -o ${dir}/.tmp/passwords.txt 1>>"$LOGFILE" || {
echo "LeakSearch command failed"
}
popd >/dev/null || {
echo "Failed to popd in ${FUNCNAME[0]} @ line ${LINENO}"
}
[ -s ".tmp/passwords.txt" ] && cat .tmp/passwords.txt | anew -q osint/passwords.txt
end_func "Results are saved in $domain/osint/emails|passwords.txt" ${FUNCNAME[0]}
else
if [[ $EMAILS == false ]] || [[ $OSINT == false ]]; then
printf "\n${yellow}[$(date +'%Y-%m-%d %H:%M:%S')] ${FUNCNAME[0]} skipped in this mode or defined in reconftw.cfg ${reset}\n"
elif [[ $domain =~ ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9] ]]; then
return
else
if [[ $EMAILS == false ]] || [[ $OSINT == false ]]; then
printf "\n${yellow}[$(date +'%Y-%m-%d %H:%M:%S')] ${FUNCNAME[0]} skipped in this mode or defined in reconftw.cfg ${reset}\n"
else
printf "${yellow}[$(date +'%Y-%m-%d %H:%M:%S')] ${FUNCNAME[0]} is already processed, to force executing ${FUNCNAME[0]} delete\n $called_fn_dir/.${FUNCNAME[0]} ${reset}\n\n"
fi
fi
fi
}
function domain_info() {
mkdir -p osint
if { [[ ! -f "$called_fn_dir/.${FUNCNAME[0]}" ]] || [[ $DIFF == true ]]; } && [[ $DOMAIN_INFO == true ]] && [[ $OSINT == true ]] && ! [[ $domain =~ ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9] ]]; then
start_func ${FUNCNAME[0]} "Searching domain info (whois, registrant name/email domains)"
whois -H $domain >osint/domain_info_general.txt || { echo "whois command failed"; }
curl -s "https://aadinternals.azurewebsites.net/api/tenantinfo?domainName=${domain}" -H "Origin: https://aadinternals.com" | jq -r .domains[].name >osint/azure_tenant_domains.txt
end_func "Results are saved in $domain/osint/domain_info_[general/name/email/ip].txt" ${FUNCNAME[0]}
else
if [[ $DOMAIN_INFO == false ]] || [[ $OSINT == false ]]; then
printf "\n${yellow}[$(date +'%Y-%m-%d %H:%M:%S')] ${FUNCNAME[0]} skipped in this mode or defined in reconftw.cfg ${reset}\n"
elif [[ $domain =~ ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9] ]]; then
return
else
if [[ $DOMAIN_INFO == false ]] || [[ $OSINT == false ]]; then
printf "\n${yellow}[$(date +'%Y-%m-%d %H:%M:%S')] ${FUNCNAME[0]} skipped in this mode or defined in reconftw.cfg ${reset}\n"
else
printf "${yellow}[$(date +'%Y-%m-%d %H:%M:%S')] ${FUNCNAME[0]} is already processed, to force executing ${FUNCNAME[0]} delete\n $called_fn_dir/.${FUNCNAME[0]} ${reset}\n\n"
fi
fi
fi
}
function third_party_misconfigs() {
mkdir -p osint
if { [[ ! -f "$called_fn_dir/.${FUNCNAME[0]}" ]] || [[ $DIFF == true ]]; } && [[ $THIRD_PARTIES == true ]] && [[ $OSINT == true ]] && ! [[ $domain =~ ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9] ]]; then
start_func ${FUNCNAME[0]} "Searching for third parties misconfigurations"
company_name=$(echo $domain | unfurl format %r)
pushd "${tools}/misconfig-mapper" >/dev/null || {
echo "Failed to cd directory in ${FUNCNAME[0]} @ line ${LINENO}"
}
./misconfig-mapper -target $company_name -service "*" | grep -v "\[-\]" >${dir}/osint/3rdparts_misconfigurations.txt
popd >/dev/null || {
echo "Failed to popd in ${FUNCNAME[0]} @ line ${LINENO}"
}
end_func "Results are saved in $domain/osint/3rdparts_misconfigurations.txt" ${FUNCNAME[0]}
else
if [[ $THIRD_PARTIES == false ]] || [[ $OSINT == false ]]; then
printf "\n${yellow}[$(date +'%Y-%m-%d %H:%M:%S')] ${FUNCNAME[0]} skipped in this mode or defined in reconftw.cfg ${reset}\n"
elif [[ $domain =~ ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9] ]]; then
return
else
if [[ $THIRD_PARTIES == false ]] || [[ $OSINT == false ]]; then
printf "\n${yellow}[$(date +'%Y-%m-%d %H:%M:%S')] ${FUNCNAME[0]} skipped in this mode or defined in reconftw.cfg ${reset}\n"
else
printf "${yellow}[$(date +'%Y-%m-%d %H:%M:%S')] ${FUNCNAME[0]} is already processed, to force executing ${FUNCNAME[0]} delete\n $called_fn_dir/.${FUNCNAME[0]} ${reset}\n\n"
fi
fi
fi
}
function spoof() {
mkdir -p osint
if { [[ ! -f "$called_fn_dir/.${FUNCNAME[0]}" ]] || [[ $DIFF == true ]]; } && [[ $SPOOF == true ]] && [[ $OSINT == true ]] && ! [[ $domain =~ ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9] ]]; then
start_func ${FUNCNAME[0]} "Searching for spoofable domains"
pushd "${tools}/Spoofy" >/dev/null || {
echo "Failed to cd directory in ${FUNCNAME[0]} @ line ${LINENO}"
}
./spoofy.py -d $domain >${dir}/osint/spoof.txt
popd >/dev/null || {
echo "Failed to popd in ${FUNCNAME[0]} @ line ${LINENO}"
}
end_func "Results are saved in $domain/osint/spoof.txt" ${FUNCNAME[0]}
else
if [[ $SPOOF == false ]] || [[ $OSINT == false ]]; then
printf "\n${yellow}[$(date +'%Y-%m-%d %H:%M:%S')] ${FUNCNAME[0]} skipped in this mode or defined in reconftw.cfg ${reset}\n"
elif [[ $domain =~ ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9] ]]; then
return
else
if [[ $SPOOF == false ]] || [[ $OSINT == false ]]; then
printf "\n${yellow}[$(date +'%Y-%m-%d %H:%M:%S')] ${FUNCNAME[0]} skipped in this mode or defined in reconftw.cfg ${reset}\n"
else
printf "${yellow}[$(date +'%Y-%m-%d %H:%M:%S')] ${FUNCNAME[0]} is already processed, to force executing ${FUNCNAME[0]} delete\n $called_fn_dir/.${FUNCNAME[0]} ${reset}\n\n"
fi
fi
fi
}
function ip_info() {
mkdir -p osint
if { [[ ! -f "$called_fn_dir/.${FUNCNAME[0]}" ]] || [[ $DIFF == true ]]; } && [[ $IP_INFO == true ]] && [[ $OSINT == true ]] && [[ $domain =~ ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9] ]]; then
start_func ${FUNCNAME[0]} "Searching ip info"
if [[ -n $WHOISXML_API ]]; then
curl "https://reverse-ip.whoisxmlapi.com/api/v1?apiKey=${WHOISXML_API}&ip=${domain}" 2>/dev/null | jq -r '.result[].name' 2>>"$LOGFILE" | sed -e "s/$/ ${domain}/" | anew -q osint/ip_${domain}_relations.txt
curl "https://www.whoisxmlapi.com/whoisserver/WhoisService?apiKey=${WHOISXML_API}&domainName=${domain}&outputFormat=json&da=2®istryRawText=1®istrarRawText=1&ignoreRawTexts=1" 2>/dev/null | jq 2>>"$LOGFILE" | anew -q osint/ip_${domain}_whois.txt
curl "https://ip-geolocation.whoisxmlapi.com/api/v1?apiKey=${WHOISXML_API}&ipAddress=${domain}" 2>/dev/null | jq -r '.ip,.location' 2>>"$LOGFILE" | anew -q osint/ip_${domain}_location.txt
end_func "Results are saved in $domain/osint/ip_[domain_relations|whois|location].txt" ${FUNCNAME[0]}
else
printf "\n${yellow}[$(date +'%Y-%m-%d %H:%M:%S')] No WHOISXML_API var defined, skipping function ${reset}\n"
fi
else
if [[ $IP_INFO == false ]] || [[ $OSINT == false ]]; then
printf "\n${yellow}[$(date +'%Y-%m-%d %H:%M:%S')] ${FUNCNAME[0]} skipped in this mode or defined in reconftw.cfg ${reset}\n"
elif [[ ! $domain =~ ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9] ]]; then
return
else
if [[ $IP_INFO == false ]] || [[ $OSINT == false ]]; then
printf "\n${yellow}[$(date +'%Y-%m-%d %H:%M:%S')] ${FUNCNAME[0]} skipped in this mode or defined in reconftw.cfg ${reset}\n"
else
printf "${yellow}[$(date +'%Y-%m-%d %H:%M:%S')] ${FUNCNAME[0]} is already processed, to force executing ${FUNCNAME[0]} delete\n $called_fn_dir/.${FUNCNAME[0]} ${reset}\n\n"
fi
fi
fi
}
###############################################################################################################
############################################### SUBDOMAINS ####################################################
###############################################################################################################
function subdomains_full() {
mkdir -p {.tmp,webs,subdomains}
NUMOFLINES_subs="0"
NUMOFLINES_probed="0"
printf "${bgreen}#######################################################################\n\n"
! [[ $domain =~ ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9] ]] && printf "${bblue}[$(date +'%Y-%m-%d %H:%M:%S')] Subdomain Enumeration $domain\n\n"
[[ $domain =~ ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9] ]] && printf "${bblue}[$(date +'%Y-%m-%d %H:%M:%S')] Scanning IP $domain\n\n"
[ -s "subdomains/subdomains.txt" ] && cp subdomains/subdomains.txt .tmp/subdomains_old.txt
[ -s "webs/webs.txt" ] && cp webs/webs.txt .tmp/probed_old.txt
if ([[ ! -f "$called_fn_dir/.sub_active" ]] || [[ ! -f "$called_fn_dir/.sub_brute" ]] || [[ ! -f "$called_fn_dir/.sub_permut" ]] || [[ ! -f "$called_fn_dir/.sub_recursive_brute" ]]) || [[ $DIFF == true ]]; then
resolvers_update
fi
[ -s "${inScope_file}" ] && cat ${inScope_file} | anew -q subdomains/subdomains.txt
if ! [[ $domain =~ ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9] ]] && [[ $SUBDOMAINS_GENERAL == true ]]; then
sub_passive
sub_crt
sub_active
sub_noerror
sub_brute
sub_permut
sub_regex_permut
#sub_gpt
sub_recursive_passive
sub_recursive_brute
sub_dns
sub_scraping
sub_analytics
else
notification "IP/CIDR detected, subdomains search skipped" info
echo $domain | anew -q subdomains/subdomains.txt
fi
webprobe_simple
if [[ -s "subdomains/subdomains.txt" ]]; then
[ -s "$outOfScope_file" ] && deleteOutScoped $outOfScope_file subdomains/subdomains.txt
NUMOFLINES_subs=$(cat subdomains/subdomains.txt 2>>"$LOGFILE" | anew .tmp/subdomains_old.txt | sed '/^$/d' | wc -l)
fi
if [[ -s "webs/webs.txt" ]]; then
[ -s "$outOfScope_file" ] && deleteOutScoped $outOfScope_file webs/webs.txt
NUMOFLINES_probed=$(cat webs/webs.txt 2>>"$LOGFILE" | anew .tmp/probed_old.txt | sed '/^$/d' | wc -l)
fi
printf "${bblue}\n[$(date +'%Y-%m-%d %H:%M:%S')] Total subdomains: ${reset}\n\n"
notification "- ${NUMOFLINES_subs} alive" good
[ -s "subdomains/subdomains.txt" ] && cat subdomains/subdomains.txt | sort
notification "- ${NUMOFLINES_probed} new web probed" good
[ -s "webs/webs.txt" ] && cat webs/webs.txt | sort
notification "Subdomain Enumeration Finished" good
printf "${bblue}[$(date +'%Y-%m-%d %H:%M:%S')] Results are saved in $domain/subdomains/subdomains.txt and webs/webs.txt${reset}\n"
printf "${bgreen}#######################################################################\n\n"
}
function sub_passive() {
mkdir -p .tmp
if { [[ ! -f "$called_fn_dir/.${FUNCNAME[0]}" ]] || [[ $DIFF == true ]]; } && [[ $SUBPASSIVE == true ]]; then
start_subfunc ${FUNCNAME[0]} "Running : Passive Subdomain Enumeration"
subfinder -all -d "$domain" -max-time ${SUBFINDER_ENUM_TIMEOUT} -silent -o .tmp/subfinder_psub.txt 2>>"$LOGFILE" >/dev/null
if [[ -s ${GITHUB_TOKENS} ]]; then
if [[ $DEEP == true ]]; then
github-subdomains -d $domain -t $GITHUB_TOKENS -o .tmp/github_subdomains_psub.txt 2>>"$LOGFILE" >/dev/null
else
github-subdomains -d $domain -k -q -t $GITHUB_TOKENS -o .tmp/github_subdomains_psub.txt 2>>"$LOGFILE" >/dev/null
fi
fi
if [[ -s ${GITLAB_TOKENS} ]]; then
gitlab-subdomains -d "$domain" -t "$GITLAB_TOKENS" 2>>"$LOGFILE" | tee .tmp/gitlab_subdomains_psub.txt >/dev/null
fi
if [[ $INSCOPE == true ]]; then
check_inscope .tmp/subfinder_psub.txt 2>>"$LOGFILE" >/dev/null
check_inscope .tmp/github_subdomains_psub.txt 2>>"$LOGFILE" >/dev/null
check_inscope .tmp/gitlab_subdomains_psub.txt 2>>"$LOGFILE" >/dev/null
fi
NUMOFLINES=$(find .tmp -type f -iname "*_psub.txt" -exec cat {} + | sed "s/*.//" | anew .tmp/passive_subs.txt | sed '/^$/d' | wc -l)
end_subfunc "${NUMOFLINES} new subs (passive)" ${FUNCNAME[0]}
else
if [[ $SUBPASSIVE == false ]]; then
printf "\n${yellow}[$(date +'%Y-%m-%d %H:%M:%S')] ${FUNCNAME[0]} skipped in this mode or defined in reconftw.cfg ${reset}\n"
else
printf "${yellow}[$(date +'%Y-%m-%d %H:%M:%S')] ${FUNCNAME[0]} is already processed, to force executing ${FUNCNAME[0]} delete\n $called_fn_dir/.${FUNCNAME[0]} ${reset}\n\n"
fi
fi
}
function sub_crt() {
mkdir -p {.tmp,subdomains}
if { [[ ! -f "$called_fn_dir/.${FUNCNAME[0]}" ]] || [[ $DIFF == true ]]; } && [[ $SUBCRT == true ]]; then
start_subfunc ${FUNCNAME[0]} "Running : Crtsh Subdomain Enumeration"
crt -s -json -l ${CTR_LIMIT} $domain 2>>"$LOGFILE" | jq -r '.[].subdomain' 2>>"$LOGFILE" | sed -e 's/^\*\.//' | anew -q .tmp/crtsh_subs_tmp.txt 2>>"$LOGFILE" >/dev/null
[[ $INSCOPE == true ]] && check_inscope .tmp/crtsh_subs_tmp.txt 2>>"$LOGFILE" >/dev/null
NUMOFLINES=$(cat .tmp/crtsh_subs_tmp.txt 2>>"$LOGFILE" | sed 's/\*.//g' | anew .tmp/crtsh_subs.txt | sed '/^$/d' | wc -l)
end_subfunc "${NUMOFLINES} new subs (cert transparency)" ${FUNCNAME[0]}
else
if [[ $SUBCRT == false ]]; then
printf "\n${yellow}[$(date +'%Y-%m-%d %H:%M:%S')] ${FUNCNAME[0]} skipped in this mode or defined in reconftw.cfg ${reset}\n"
else
printf "${yellow}[$(date +'%Y-%m-%d %H:%M:%S')] ${FUNCNAME[0]} is already processed, to force executing ${FUNCNAME[0]} delete\n $called_fn_dir/.${FUNCNAME[0]} ${reset}\n\n"
fi
fi
}
function sub_active() {
mkdir -p {.tmp,subdomains}
if [[ ! -f "$called_fn_dir/.${FUNCNAME[0]}" ]] || [[ $DIFF == true ]]; then
start_subfunc ${FUNCNAME[0]} "Running : Active Subdomain Enumeration"
find .tmp -type f -iname "*_subs.txt" -exec cat {} + | anew -q .tmp/subs_no_resolved.txt
[ -s "$outOfScope_file" ] && deleteOutScoped $outOfScope_file .tmp/subs_no_resolved.txt
if [[ $AXIOM != true ]]; then
resolvers_update_quick_local
[ -s ".tmp/subs_no_resolved.txt" ] && puredns resolve .tmp/subs_no_resolved.txt -w .tmp/subdomains_tmp.txt -r $resolvers --resolvers-trusted $resolvers_trusted -l $PUREDNS_PUBLIC_LIMIT --rate-limit-trusted $PUREDNS_TRUSTED_LIMIT --wildcard-tests $PUREDNS_WILDCARDTEST_LIMIT --wildcard-batch $PUREDNS_WILDCARDBATCH_LIMIT 2>>"$LOGFILE" >/dev/null
else
resolvers_update_quick_axiom
[ -s ".tmp/subs_no_resolved.txt" ] && axiom-scan .tmp/subs_no_resolved.txt -m puredns-resolve -r /home/op/lists/resolvers.txt --resolvers-trusted /home/op/lists/resolvers_trusted.txt --wildcard-tests $PUREDNS_WILDCARDTEST_LIMIT --wildcard-batch $PUREDNS_WILDCARDBATCH_LIMIT -o .tmp/subdomains_tmp.txt $AXIOM_EXTRA_ARGS 2>>"$LOGFILE" >/dev/null
fi
echo $domain | dnsx -retry 3 -silent -r $resolvers_trusted 2>>"$LOGFILE" | anew -q .tmp/subdomains_tmp.txt
if [[ $DEEP == true ]]; then
cat .tmp/subdomains_tmp.txt | tlsx -san -cn -silent -ro -c $TLSX_THREADS -p $TLS_PORTS | anew -q .tmp/subdomains_tmp.txt
else
cat .tmp/subdomains_tmp.txt | tlsx -san -cn -silent -ro -c $TLSX_THREADS | anew -q .tmp/subdomains_tmp.txt
fi
[[ $INSCOPE == true ]] && check_inscope .tmp/subdomains_tmp.txt 2>>"$LOGFILE" >/dev/null
NUMOFLINES=$(cat .tmp/subdomains_tmp.txt 2>>"$LOGFILE" | grep "\.$domain$\|^$domain$" | grep -E '^((http|https):\/\/)?([a-zA-Z0-9]([a-zA-Z0-9\-]*[a-zA-Z0-9])?\.)+[a-zA-Z]{1,}(\/.*)?$' | anew subdomains/subdomains.txt | sed '/^$/d' | wc -l)
end_subfunc "${NUMOFLINES} subs DNS resolved from passive" ${FUNCNAME[0]}
else
printf "${yellow}[$(date +'%Y-%m-%d %H:%M:%S')] ${FUNCNAME[0]} is already processed, to force executing ${FUNCNAME[0]} delete\n $called_fn_dir/.${FUNCNAME[0]} ${reset}\n\n"
fi
}
function sub_noerror() {
mkdir -p {.tmp,subdomains}
if { [[ ! -f "$called_fn_dir/.${FUNCNAME[0]}" ]] || [[ $DIFF == true ]]; } && [[ $SUBNOERROR == true ]]; then
start_subfunc ${FUNCNAME[0]} "Running : Checking NOERROR DNS response"
if [[ $(echo "${RANDOM}thistotallynotexist${RANDOM}.$domain" | dnsx -r $resolvers -rcode noerror,nxdomain -retry 3 -silent | cut -d' ' -f2) == "[NXDOMAIN]" ]]; then
resolvers_update_quick_local
if [[ $DEEP == true ]]; then
dnsx -d $domain -r $resolvers -silent -rcode noerror -w $subs_wordlist_big | cut -d' ' -f1 | anew -q .tmp/subs_noerror.txt 2>>"$LOGFILE" >/dev/null
else
dnsx -d $domain -r $resolvers -silent -rcode noerror -w $subs_wordlist | cut -d' ' -f1 | anew -q .tmp/subs_noerror.txt 2>>"$LOGFILE" >/dev/null
fi
[[ $INSCOPE == true ]] && check_inscope .tmp/subs_noerror.txt 2>>"$LOGFILE" >/dev/null
NUMOFLINES=$(cat .tmp/subs_noerror.txt 2>>"$LOGFILE" | sed "s/*.//" | grep ".$domain$" | grep -E '^((http|https):\/\/)?([a-zA-Z0-9]([a-zA-Z0-9\-]*[a-zA-Z0-9])?\.)+[a-zA-Z]{1,}(\/.*)?$' | anew subdomains/subdomains.txt | sed '/^$/d' | wc -l)
end_subfunc "${NUMOFLINES} new subs (DNS noerror)" ${FUNCNAME[0]}
else
printf "\n${yellow}[$(date +'%Y-%m-%d %H:%M:%S')] Detected DNSSEC black lies, skipping this technique ${reset}\n"
fi
else
if [[ $SUBNOERROR == false ]]; then
printf "\n${yellow}[$(date +'%Y-%m-%d %H:%M:%S')] ${FUNCNAME[0]} skipped in this mode or defined in reconftw.cfg ${reset}\n"
else
printf "${yellow}[$(date +'%Y-%m-%d %H:%M:%S')] ${FUNCNAME[0]} is already processed, to force executing ${FUNCNAME[0]} delete\n $called_fn_dir/.${FUNCNAME[0]} ${reset}\n\n"
fi
fi
}
function sub_dns() {
mkdir -p {.tmp,subdomains}
if [[ ! -f "$called_fn_dir/.${FUNCNAME[0]}" ]] || [[ $DIFF == true ]]; then
start_subfunc ${FUNCNAME[0]} "Running : DNS Subdomain Enumeration and PTR search"
if [[ $AXIOM != true ]]; then
[ -s "subdomains/subdomains.txt" ] && cat subdomains/subdomains.txt | dnsx -r $resolvers_trusted -a -aaaa -cname -ns -ptr -mx -soa -silent -retry 3 -json -o subdomains/subdomains_dnsregs.json 2>>"$LOGFILE" >/dev/null
[ -s "subdomains/subdomains_dnsregs.json" ] && cat subdomains/subdomains_dnsregs.json | jq -r 'try .a[], try .aaaa[], try .cname[], try .ns[], try .ptr[], try .mx[], try .soa[]' 2>/dev/null | grep ".$domain$" | grep -E '^((http|https):\/\/)?([a-zA-Z0-9]([a-zA-Z0-9\-]*[a-zA-Z0-9])?\.)+[a-zA-Z]{1,}(\/.*)?$' | anew -q .tmp/subdomains_dns.txt
[ -s "subdomains/subdomains_dnsregs.json" ] && cat subdomains/subdomains_dnsregs.json | jq -r 'try .a[]' | sort -u | hakip2host | cut -d' ' -f 3 | unfurl -u domains | sed -e 's/*\.//' -e 's/\.$//' -e '/\./!d' | grep ".$domain$" | grep -E '^((http|https):\/\/)?([a-zA-Z0-9]([a-zA-Z0-9\-]*[a-zA-Z0-9])?\.)+[a-zA-Z]{1,}(\/.*)?$' | anew -q .tmp/subdomains_dns.txt
[ -s "subdomains/subdomains_dnsregs.json" ] && cat subdomains/subdomains_dnsregs.json | jq -r 'try "\(.host) - \(.a[])"' 2>/dev/null | sort -u -k2 | anew -q subdomains/subdomains_ips.txt
resolvers_update_quick_local
[ -s ".tmp/subdomains_dns.txt" ] && puredns resolve .tmp/subdomains_dns.txt -w .tmp/subdomains_dns_resolved.txt -r $resolvers --resolvers-trusted $resolvers_trusted -l $PUREDNS_PUBLIC_LIMIT --rate-limit-trusted $PUREDNS_TRUSTED_LIMIT --wildcard-tests $PUREDNS_WILDCARDTEST_LIMIT --wildcard-batch $PUREDNS_WILDCARDBATCH_LIMIT 2>>"$LOGFILE" >/dev/null
else
[ -s "subdomains/subdomains.txt" ] && axiom-scan subdomains/subdomains.txt -m dnsx -retry 3 -a -aaaa -cname -ns -ptr -mx -soa -json -o subdomains/subdomains_dnsregs.json $AXIOM_EXTRA_ARGS 2>>"$LOGFILE" >/dev/null
[ -s "subdomains/subdomains_dnsregs.json" ] && cat subdomains/subdomains_dnsregs.json | jq -r 'try .a[]' | sort -u | anew -q .tmp/subdomains_dns_a_records.txt
[ -s "subdomains/subdomains_dnsregs.json" ] && cat subdomains/subdomains_dnsregs.json | jq -r 'try .a[]' | sort -u | hakip2host | cut -d' ' -f 3 | unfurl -u domains | sed -e 's/*\.//' -e 's/\.$//' -e '/\./!d' | grep ".$domain$" | grep -E '^((http|https):\/\/)?([a-zA-Z0-9]([a-zA-Z0-9\-]*[a-zA-Z0-9])?\.)+[a-zA-Z]{1,}(\/.*)?$' | anew -q .tmp/subdomains_dns.txt
[ -s "subdomains/subdomains_dnsregs.json" ] && cat subdomains/subdomains_dnsregs.json | jq -r 'try .a[], try .aaaa[], try .cname[], try .ns[], try .ptr[], try .mx[], try .soa[]' 2>/dev/null | grep ".$domain$" | grep -E '^((http|https):\/\/)?([a-zA-Z0-9]([a-zA-Z0-9\-]*[a-zA-Z0-9])?\.)+[a-zA-Z]{1,}(\/.*)?$' | anew -q .tmp/subdomains_dns.txt
[ -s "subdomains/subdomains_dnsregs.json" ] && cat subdomains/subdomains_dnsregs.json | jq -r 'try "\(.host) - \(.a[])"' 2>/dev/null | sort -u -k2 | anew -q subdomains/subdomains_ips.txt
resolvers_update_quick_axiom
[ -s ".tmp/subdomains_dns.txt" ] && axiom-scan .tmp/subdomains_dns.txt -m puredns-resolve -r /home/op/lists/resolvers.txt --resolvers-trusted /home/op/lists/resolvers_trusted.txt --wildcard-tests $PUREDNS_WILDCARDTEST_LIMIT --wildcard-batch $PUREDNS_WILDCARDBATCH_LIMIT -o .tmp/subdomains_dns_resolved.txt $AXIOM_EXTRA_ARGS 2>>"$LOGFILE" >/dev/null
fi
[[ $INSCOPE == true ]] && check_inscope .tmp/subdomains_dns_resolved.txt 2>>"$LOGFILE" >/dev/null
NUMOFLINES=$(cat .tmp/subdomains_dns_resolved.txt 2>>"$LOGFILE" | grep "\.$domain$\|^$domain$" | grep -E '^((http|https):\/\/)?([a-zA-Z0-9]([a-zA-Z0-9\-]*[a-zA-Z0-9])?\.)+[a-zA-Z]{1,}(\/.*)?$' | anew subdomains/subdomains.txt | sed '/^$/d' | wc -l)
end_subfunc "${NUMOFLINES} new subs (dns resolution)" ${FUNCNAME[0]}
else
printf "${yellow}[$(date +'%Y-%m-%d %H:%M:%S')] ${FUNCNAME[0]} is already processed, to force executing ${FUNCNAME[0]} delete\n $called_fn_dir/.${FUNCNAME[0]} ${reset}\n\n"
fi
}
function sub_brute() {
mkdir -p {.tmp,subdomains}
if { [[ ! -f "$called_fn_dir/.${FUNCNAME[0]}" ]] || [[ $DIFF == true ]]; } && [[ $SUBBRUTE == true ]]; then
start_subfunc ${FUNCNAME[0]} "Running : Bruteforce Subdomain Enumeration"
if [[ $AXIOM != true ]]; then
resolvers_update_quick_local
if [[ $DEEP == true ]]; then
puredns bruteforce $subs_wordlist_big $domain -w .tmp/subs_brute.txt -r $resolvers --resolvers-trusted $resolvers_trusted -l $PUREDNS_PUBLIC_LIMIT --rate-limit-trusted $PUREDNS_TRUSTED_LIMIT --wildcard-tests $PUREDNS_WILDCARDTEST_LIMIT --wildcard-batch $PUREDNS_WILDCARDBATCH_LIMIT 2>>"$LOGFILE" >/dev/null
else
puredns bruteforce $subs_wordlist $domain -w .tmp/subs_brute.txt -r $resolvers --resolvers-trusted $resolvers_trusted -l $PUREDNS_PUBLIC_LIMIT --rate-limit-trusted $PUREDNS_TRUSTED_LIMIT --wildcard-tests $PUREDNS_WILDCARDTEST_LIMIT --wildcard-batch $PUREDNS_WILDCARDBATCH_LIMIT 2>>"$LOGFILE" >/dev/null
fi
[ -s ".tmp/subs_brute.txt" ] && puredns resolve .tmp/subs_brute.txt -w .tmp/subs_brute_valid.txt -r $resolvers --resolvers-trusted $resolvers_trusted -l $PUREDNS_PUBLIC_LIMIT --rate-limit-trusted $PUREDNS_TRUSTED_LIMIT --wildcard-tests $PUREDNS_WILDCARDTEST_LIMIT --wildcard-batch $PUREDNS_WILDCARDBATCH_LIMIT 2>>"$LOGFILE" >/dev/null
else
resolvers_update_quick_axiom
if [[ $DEEP == true ]]; then
axiom-scan $subs_wordlist_big -m puredns-single $domain -r /home/op/lists/resolvers.txt --resolvers-trusted /home/op/lists/resolvers_trusted.txt --wildcard-tests $PUREDNS_WILDCARDTEST_LIMIT --wildcard-batch $PUREDNS_WILDCARDBATCH_LIMIT -o .tmp/subs_brute.txt $AXIOM_EXTRA_ARGS 2>>"$LOGFILE" >/dev/null
else
axiom-scan $subs_wordlist -m puredns-single $domain -r /home/op/lists/resolvers.txt --resolvers-trusted /home/op/lists/resolvers_trusted.txt --wildcard-tests $PUREDNS_WILDCARDTEST_LIMIT --wildcard-batch $PUREDNS_WILDCARDBATCH_LIMIT -o .tmp/subs_brute.txt $AXIOM_EXTRA_ARGS 2>>"$LOGFILE" >/dev/null
fi
[ -s ".tmp/subs_brute.txt" ] && axiom-scan .tmp/subs_brute.txt -m puredns-resolve -r /home/op/lists/resolvers.txt --resolvers-trusted /home/op/lists/resolvers_trusted.txt --wildcard-tests $PUREDNS_WILDCARDTEST_LIMIT --wildcard-batch $PUREDNS_WILDCARDBATCH_LIMIT -o .tmp/subs_brute_valid.txt $AXIOM_EXTRA_ARGS 2>>"$LOGFILE" >/dev/null
fi
[[ $INSCOPE == true ]] && check_inscope .tmp/subs_brute_valid.txt 2>>"$LOGFILE" >/dev/null
NUMOFLINES=$(cat .tmp/subs_brute_valid.txt 2>>"$LOGFILE" | sed "s/*.//" | grep ".$domain$" | grep -E '^((http|https):\/\/)?([a-zA-Z0-9]([a-zA-Z0-9\-]*[a-zA-Z0-9])?\.)+[a-zA-Z]{1,}(\/.*)?$' | anew subdomains/subdomains.txt | sed '/^$/d' | wc -l)
end_subfunc "${NUMOFLINES} new subs (bruteforce)" ${FUNCNAME[0]}
else
if [[ $SUBBRUTE == false ]]; then
printf "\n${yellow}[$(date +'%Y-%m-%d %H:%M:%S')] ${FUNCNAME[0]} skipped in this mode or defined in reconftw.cfg ${reset}\n"
else
printf "${yellow}[$(date +'%Y-%m-%d %H:%M:%S')] ${FUNCNAME[0]} is already processed, to force executing ${FUNCNAME[0]} delete\n $called_fn_dir/.${FUNCNAME[0]} ${reset}\n\n"
fi
fi
}
function sub_scraping() {
mkdir -p {.tmp,subdomains}
if { [[ ! -f "$called_fn_dir/.${FUNCNAME[0]}" ]] || [[ $DIFF == true ]]; } && [[ $SUBSCRAPING == true ]]; then
start_subfunc ${FUNCNAME[0]} "Running : Source code scraping subdomain search"