-
Notifications
You must be signed in to change notification settings - Fork 59
Expand file tree
/
Copy pathjshunter.go
More file actions
executable file
·4205 lines (3687 loc) · 173 KB
/
jshunter.go
File metadata and controls
executable file
·4205 lines (3687 loc) · 173 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
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
package main
import (
"bufio"
"context"
"crypto/tls"
"encoding/csv"
"encoding/json"
"flag"
"fmt"
"io"
"io/ioutil"
"math"
"net"
"net/http"
"net/url"
"os"
"regexp"
"runtime"
"sort"
"strings"
"sync"
"time"
"math/rand"
"golang.org/x/net/proxy"
)
var (
version = "v0.5"
colors = map[string]string{
"RED": "\033[0;31m",
"GREEN": "\033[0;32m",
"BLUE": "\033[0;34m",
"YELLOW": "\033[0;33m",
"CYAN": "\033[0;36m",
"PURPLE": "\033[0;35m",
"NC": "\033[0m",
}
// Global deduplication for all outputs
globalSeenParams = make(map[string]bool)
globalSeenAll = make(map[string]bool)
globalSeenMutex sync.Mutex
globalFoundAny = false // Track if any findings were made across all files
missingMessages = make([]string, 0) // Buffer for MISSING messages
missingMutex sync.Mutex
)
var (
//regex-cc1a2b
regexPatterns = map[string]*regexp.Regexp{
"Google API": regexp.MustCompile(`AIza[0-9A-Za-z-_]{35}`),
"Firebase": regexp.MustCompile(`AAAA[A-Za-z0-9_-]{7}:[A-Za-z0-9_-]{140}(?:\s|$|[^A-Za-z0-9_-])`),
"Amazon Aws Access Key ID": regexp.MustCompile(`A[SK]IA[0-9A-Z]{16}`),
"Amazon Mws Auth Token": regexp.MustCompile(`amzn\\.mws\\.[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}`),
"Amazon Aws Url": regexp.MustCompile(`s3\.amazonaws.com[/]+|[a-zA-Z0-9_-]*\.s3\.amazonaws.com`),
"Amazon Aws Url2": regexp.MustCompile(`([a-zA-Z0-9-._]+\.s3\.amazonaws\.com|s3://[a-zA-Z0-9-._]+|s3-[a-z]{2}-[a-z]+-[0-9]+\.amazonaws\.com|s3.amazonaws.com/[a-zA-Z0-9-._]+|s3.console.aws.amazon.com/s3/buckets/[a-zA-Z0-9-._]+)`),
"Facebook Access Token": regexp.MustCompile(`EAACEdEose0cBA[0-9A-Za-z]+`),
"Authorization Basic": regexp.MustCompile(`(?i)\bauthorization\s*:\s*basic\s+[a-zA-Z0-9=:_\+\/-]{20,100}`),
"Authorization Bearer": regexp.MustCompile(`(?i)\bauthorization\s*:\s*bearer\s+[a-zA-Z0-9_\-\.=:_\+\/]{20,100}`),
"Authorization Api": regexp.MustCompile(`(?i)\bapi[_-]?key\s*[:=]\s*["']?[a-zA-Z0-9_\-]{20,100}["']?`),
"Twilio Api Key": regexp.MustCompile(`SK[0-9a-fA-F]{32}`),
"Twilio Account Sid": regexp.MustCompile(`(?i)\b(?:twilio|tw)\s*[_-]?account[_-]?sid\s*[:=]\s*["']?AC[a-zA-Z0-9_\-]{32}["']?`),
"Twilio App Sid": regexp.MustCompile(`AP[a-zA-Z0-9_\-]{32}`),
"Paypal Braintre Access Token": regexp.MustCompile(`access_token\$production\$[0-9a-z]{16}\$[0-9a-f]{32}`),
"Square Oauth Secret": regexp.MustCompile(`sq0csp-[0-9A-Za-z\-_]{43}|sq0[a-z]{3}-[0-9A-Za-z\-_]{22,43}`),
"Square Access Token": regexp.MustCompile(`sqOatp-[0-9A-Za-z\-_]{22}`),
"Stripe Standard Api": regexp.MustCompile(`sk_live_[0-9a-zA-Z]{24}`),
"Stripe Restricted Api": regexp.MustCompile(`rk_live_[0-9a-zA-Z]{24}`),
"Authorization Github Token": regexp.MustCompile(`\bghp_[a-zA-Z0-9]{36}\b`),
"Github Access Token": regexp.MustCompile(`[a-zA-Z0-9_-]*:[a-zA-Z0-9_\-]+@github\.com*`),
"Rsa Private Key": regexp.MustCompile(`-----BEGIN RSA PRIVATE KEY-----`),
"Ssh Dsa Private Key": regexp.MustCompile(`-----BEGIN DSA PRIVATE KEY-----`),
"Ssh Dc Private Key": regexp.MustCompile(`-----BEGIN EC PRIVATE KEY-----`),
"Pgp Private Block": regexp.MustCompile(`-----BEGIN PGP PRIVATE KEY BLOCK-----`),
"Ssh Private Key": regexp.MustCompile(`(?s)-----BEGIN OPENSSH PRIVATE KEY-----[a-zA-Z0-9+\/=\n]+-----END OPENSSH PRIVATE KEY-----`),
"Json Web Token": regexp.MustCompile(`ey[A-Za-z0-9-_=]+\.[A-Za-z0-9-_=]+\.?[A-Za-z0-9-_.+/=]*$`),
"Putty Private Key": regexp.MustCompile(`(?s)PuTTY-User-Key-File-2.*?-----END`),
"Ssh2 Encrypted Private Key": regexp.MustCompile(`(?s)-----BEGIN SSH2 ENCRYPTED PRIVATE KEY-----[a-zA-Z0-9+\/=\n]+-----END SSH2 ENCRYPTED PRIVATE KEY-----`),
"Generic Private Key": regexp.MustCompile(`(?s)-----BEGIN.*PRIVATE KEY-----[a-zA-Z0-9+\/=\n]+-----END.*PRIVATE KEY-----`),
"Username Password Combo": regexp.MustCompile(`(?i)^[a-z]+:\/\/[^\/]*:[^@]+@`),
"Facebook Oauth": regexp.MustCompile(`(?i)(?:facebook|fb)[_\-]?(?:app[_\-]?)?(?:secret|client[_\-]?secret|oauth)\s*[:=]\s*['\"]?[0-9a-f]{32}['\"]?`),
"Twitter Oauth": regexp.MustCompile(`(?i)\b(?:twitter|tw)\s*[_-]?oauth[_-]?token\s*[:=]\s*["']?[0-9a-zA-Z]{35,44}["']?`),
"Github Token": regexp.MustCompile(`(?i)\b(gh[pousr]_[0-9a-zA-Z]{36})\b`),
"Google Oauth Client Secret": regexp.MustCompile(`\"client_secret\":\"[a-zA-Z0-9-_]{24}\"`),
"Aws Api Key": regexp.MustCompile(`\bAKIA[0-9A-Z]{16}\b`),
"Slack Token": regexp.MustCompile(`\"api_token\":\"(xox[a-zA-Z]-[a-zA-Z0-9-]+)\"`),
"Ssh Priv Key": regexp.MustCompile(`([-]+BEGIN [^\s]+ PRIVATE KEY[-]+[\s]*[^-]*[-]+END [^\s]+ PRIVATE KEY[-]+)`),
"Slack Webhook Url": regexp.MustCompile(`https://hooks.slack.com/services/[A-Za-z0-9]+/[A-Za-z0-9]+/[A-Za-z0-9]+`),
"Heroku Api Key 2": regexp.MustCompile(`[hH]eroku[a-zA-Z0-9]{32}`),
"Dropbox Access Token": regexp.MustCompile(`(?i)^sl\.[A-Za-z0-9_-]{16,50}$`),
"Salesforce Access Token": regexp.MustCompile(`00D[0-9A-Za-z]{15,18}![A-Za-z0-9]{40}`),
"Twitter Bearer Token": regexp.MustCompile(`(?i)^AAAAAAAAAAAAAAAAAAAAA[A-Za-z0-9]{30,45}$`),
"Firebase Url": regexp.MustCompile(`https://[a-z0-9-]+\.firebaseio\.com`),
"Pem Private Key": regexp.MustCompile(`-----BEGIN (?:[A-Z ]+ )?PRIVATE KEY-----`),
"Google Cloud Sa Key": regexp.MustCompile(`"type": "service_account"`),
"Stripe Publishable Key": regexp.MustCompile(`pk_live_[0-9a-zA-Z]{24}`),
"Azure Storage Account Key": regexp.MustCompile(`(?i)^[A-Za-z0-9]{44}=[A-Za-z0-9+/=]{0,43}$`),
"Instagram Access Token": regexp.MustCompile(`IGQV[A-Za-z0-9._-]{10,}`),
"Stripe Test Publishable Key": regexp.MustCompile(`pk_test_[0-9a-zA-Z]{24}`),
"Stripe Test Secret Key": regexp.MustCompile(`sk_test_[0-9a-zA-Z]{24}`),
"Slack Bot Token": regexp.MustCompile(`xoxb-[A-Za-z0-9-]{24,34}`),
"Slack User Token": regexp.MustCompile(`xoxp-[A-Za-z0-9-]{24,34}`),
"Google Gmail Api Key": regexp.MustCompile(`AIza[0-9A-Za-z\\-_]{35}`),
"Google Gmail Oauth": regexp.MustCompile(`\b[0-9]+-[0-9A-Za-z_]{32}\.apps\.googleusercontent\.com\b`),
"Google Oauth Access Token": regexp.MustCompile(`ya29\.[0-9A-Za-z\\-_]+`),
"Mailchimp Api Key": regexp.MustCompile(`[0-9a-f]{32}-us[0-9]{1,2}`),
"Mailgun Api Key": regexp.MustCompile(`key-[0-9a-zA-Z]{32}`),
"Google Drive Oauth": regexp.MustCompile(`\b[0-9]+-[0-9A-Za-z_]{32}\.apps\.googleusercontent\.com\b`),
"Paypal Braintree Access Token": regexp.MustCompile(`access_token\\$production\\$[0-9a-z]{16}\\$[0-9a-f]{32}`),
"Picatic Api Key": regexp.MustCompile(`sk_live_[0-9a-z]{32}`),
"Stripe Api Key": regexp.MustCompile(`sk_live_[0-9a-zA-Z]{24}`),
"Stripe Restricted Api Key": regexp.MustCompile(`rk_live_[0-9a-zA-Z]{24}`),
"Square Access Token 2": regexp.MustCompile(`sq0atp-[0-9A-Za-z\\-_]{22}`),
"Square Oauth Secret 2": regexp.MustCompile(`sq0csp-[0-9A-Za-z\\-_]{43}`),
"Twitter Access Token": regexp.MustCompile(`(?i)\b(?:twitter|tw)\s*[_-]?access[_-]?token\s*[:=]\s*["']?[0-9]+-[0-9a-zA-Z]{40}["']?`),
"Heroku Api Key 3": regexp.MustCompile(`(?i)[hH][eE][rR][oO][kK][uU].*[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}`),
"Generic Api Key": regexp.MustCompile(`(?i)\bapi[_-]?key\s*[:=]\s*['\"]?[0-9a-zA-Z]{32,45}['\"]?`),
"Generic Secret": regexp.MustCompile(`(?i)\bsecret\s*[:=]\s*['\"]?[0-9a-zA-Z]{32,45}['\"]?`),
"Slack Webhook": regexp.MustCompile(`https://hooks[.]slack[.]com/services/T[a-zA-Z0-9_]{8}/B[a-zA-Z0-9_]{8}/[a-zA-Z0-9_]{24}`),
"Gcp Service Account": regexp.MustCompile(`\"type\": \"service_account\"`),
"Password in Url": regexp.MustCompile(`[a-zA-Z]{3,10}://[^/\\s:@]{3,20}:[^/\\s:@]{3,20}@.{1,100}[\"'\\s]`),
"Discord Webhook url": regexp.MustCompile(`https://discord(?:app)?\.com/api/webhooks/[0-9]{18,20}/[A-Za-z0-9_-]{64,}`),
"Discord bot Token": regexp.MustCompile(`[MN][A-Za-z\d]{23}\.[\w-]{6}\.[\w-]{27}`),
"Okta Api Token": regexp.MustCompile(`00[a-zA-Z0-9]{30}\.[a-zA-Z0-9\-_]{30,}\.[a-zA-Z0-9\-_]{30,}`),
"Sendgrid Api Key": regexp.MustCompile(`SG\.[A-Za-z0-9_-]{22}\.[A-Za-z0-9_-]{43}`),
"Mapbox Access Token": regexp.MustCompile(`pk\.[a-zA-Z0-9]{60}\.[a-zA-Z0-9]{22}`),
"Gitlab Personal Access token": regexp.MustCompile(`glpat-[A-Za-z0-9\-]{20}`),
"Datadog Api Key": regexp.MustCompile(`ddapi_[a-zA-Z0-9]{32}`),
"shopify Access Token": regexp.MustCompile(`shpat_[A-Za-z0-9]{32}`),
"Atlassian Access Token": regexp.MustCompile(`[a-zA-Z0-9]{20,}\.[a-zA-Z0-9_-]{6,}\.[a-zA-Z0-9_-]{25,}`),
"Crowdstrike Api Key": regexp.MustCompile(`(?i)^[A-Za-z0-9]{32}\.[A-Za-z0-9]{16}$`),
"Quickbooks Api Key": regexp.MustCompile(`A[0-9a-f]{32}`),
"Cisco Api Key": regexp.MustCompile(`cisco[A-Za-z0-9]{30}`),
"Cisco Access Token": regexp.MustCompile(`access_token=\w+`),
"Segment Write Key": regexp.MustCompile(`sk_[A-Za-z0-9]{32}`),
"Tiktok Access Token": regexp.MustCompile(`tiktok_access_token=[a-zA-Z0-9_]+`),
"Slack Client Secret": regexp.MustCompile(`xoxs-[0-9]{1,9}.[0-9A-Za-z]{1,12}.[0-9A-Za-z]{24,64}`),
"Phone Number": regexp.MustCompile(`^\+\d{9,14}$`),
"Email": regexp.MustCompile(`[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}`),
"Ali Cloud Access Key": regexp.MustCompile(`^LTAI[A-Za-z0-9]{12,20}$`),
"Tencent Cloud Access Key": regexp.MustCompile(`^AKID[A-Za-z0-9]{13,20}$`),
"OpenAI API Key": regexp.MustCompile(`sk-[a-zA-Z0-9]{20}T3BlbkFJ[a-zA-Z0-9]{20}`),
"OpenAI API Key Project": regexp.MustCompile(`sk-proj-[a-zA-Z0-9]{48,}`),
"OpenAI API Key Svc": regexp.MustCompile(`sk-svcacct-[a-zA-Z0-9_-]{80,}`),
"Anthropic API Key": regexp.MustCompile(`sk-ant-api[a-zA-Z0-9-]{37,}`),
"HuggingFace Token": regexp.MustCompile(`hf_[a-zA-Z0-9]{34,}`),
"Cohere API Key": regexp.MustCompile(`(?i)cohere[_-]?api[_-]?key\s*[:=]\s*["']?[a-zA-Z0-9]{40}["']?`),
"Replicate API Token": regexp.MustCompile(`r8_[a-zA-Z0-9]{40}`),
"Google AI API Key": regexp.MustCompile(`(?i)(?:gemini|palm|bard)[_-]?api[_-]?key\s*[:=]\s*["']?AIza[a-zA-Z0-9_-]{35}["']?`),
"AWS Secret Access Key": regexp.MustCompile(`(?i)(?:aws)?[_-]?secret[_-]?(?:access)?[_-]?key\s*[:=]\s*["']?[A-Za-z0-9/+=]{40}["']?`),
"AWS Session Token": regexp.MustCompile(`(?i)aws[_-]?session[_-]?token\s*[:=]\s*["']?[A-Za-z0-9/+=]{100,}["']?`),
"MongoDB Connection String": regexp.MustCompile(`mongodb(?:\+srv)?://[a-zA-Z0-9._-]+:[^@\s"']+@[a-zA-Z0-9._-]+`),
"PostgreSQL Connection String": regexp.MustCompile(`postgres(?:ql)?://[a-zA-Z0-9._-]+:[^@\s"']+@[a-zA-Z0-9._-]+`),
"MySQL Connection String": regexp.MustCompile(`mysql://[a-zA-Z0-9._-]+:[^@\s"']+@[a-zA-Z0-9._-]+`),
"Redis Connection String": regexp.MustCompile(`redis://[a-zA-Z0-9._-]+:[^@\s"']+@[a-zA-Z0-9._-]+`),
"MSSQL Connection String": regexp.MustCompile(`(?i)(?:server|data source)=[^;]+;.*(?:password|pwd)=[^;]+`),
"Database URL Generic": regexp.MustCompile(`(?i)(?:database|db)[_-]?url\s*[:=]\s*["']?[a-z]+://[^:]+:[^@]+@[^\s"']+["']?`),
"Azure Client Secret": regexp.MustCompile(`(?i)(?:azure|ad)[_-]?(?:client)?[_-]?secret\s*[:=]\s*["']?[a-zA-Z0-9~._-]{34,}["']?`),
"Azure Storage Connection": regexp.MustCompile(`DefaultEndpointsProtocol=https?;AccountName=[^;]+;AccountKey=[a-zA-Z0-9+/=]{86,}`),
"Azure SAS Token": regexp.MustCompile(`(?i)[?&]sig=[a-zA-Z0-9%]{43,}`),
"Azure SQL Connection": regexp.MustCompile(`(?i)Server=tcp:[^;]+;.*Password=[^;]+`),
"DigitalOcean Token": regexp.MustCompile(`dop_v1_[a-f0-9]{64}`),
"DigitalOcean OAuth": regexp.MustCompile(`doo_v1_[a-f0-9]{64}`),
"DigitalOcean Refresh": regexp.MustCompile(`dor_v1_[a-f0-9]{64}`),
"Linode API Token": regexp.MustCompile(`(?i)linode[_-]?(?:api)?[_-]?token\s*[:=]\s*["']?[a-f0-9]{64}["']?`),
"Vultr API Key": regexp.MustCompile(`(?i)vultr[_-]?api[_-]?key\s*[:=]\s*["']?[A-Z0-9]{36}["']?`),
"Hetzner API Token": regexp.MustCompile(`(?i)hetzner[_-]?(?:api)?[_-]?token\s*[:=]\s*["']?[a-zA-Z0-9]{64}["']?`),
"Oracle Cloud API Key": regexp.MustCompile(`(?i)oci[_-]?api[_-]?key\s*[:=]\s*["']?-----BEGIN (?:RSA )?PRIVATE KEY-----`),
"IBM Cloud API Key": regexp.MustCompile(`(?i)ibm[_-]?(?:cloud)?[_-]?api[_-]?key\s*[:=]\s*["']?[a-zA-Z0-9_-]{44}["']?`),
"NPM Access Token": regexp.MustCompile(`npm_[a-zA-Z0-9]{36}`),
"PyPI API Token": regexp.MustCompile(`pypi-[a-zA-Z0-9_-]{100,}`),
"NuGet API Key": regexp.MustCompile(`oy2[a-z0-9]{43}`),
"RubyGems API Key": regexp.MustCompile(`rubygems_[a-f0-9]{48}`),
"CircleCI Token": regexp.MustCompile(`(?i)circle[_-]?(?:ci)?[_-]?token\s*[:=]\s*["']?[a-f0-9]{40}["']?`),
"Travis CI Token": regexp.MustCompile(`(?i)travis[_-]?(?:ci)?[_-]?token\s*[:=]\s*["']?[a-zA-Z0-9]{22}["']?`),
"Jenkins API Token": regexp.MustCompile(`(?i)jenkins[_-]?(?:api)?[_-]?token\s*[:=]\s*["']?[a-f0-9]{32,}["']?`),
"Bitbucket App Password": regexp.MustCompile(`(?i)bitbucket[_-]?(?:app)?[_-]?(?:password|secret)\s*[:=]\s*["']?[a-zA-Z0-9]{18,}["']?`),
"Codecov Token": regexp.MustCompile(`(?i)codecov[_-]?token\s*[:=]\s*["']?[a-f0-9-]{36}["']?`),
"Vercel Token": regexp.MustCompile(`(?i)vercel[_-]?token\s*[:=]\s*["']?[a-zA-Z0-9]{24}["']?`),
"Netlify Token": regexp.MustCompile(`(?i)netlify[_-]?(?:auth)?[_-]?token\s*[:=]\s*["']?[a-zA-Z0-9_-]{40,}["']?`),
"Vault Token": regexp.MustCompile(`(?i)(?:vault[_-]?token|hvs)\s*[:=]?\s*["']?(?:hvs\.)?[a-zA-Z0-9_-]{24,}["']?`),
"Kubernetes Token": regexp.MustCompile(`eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9\.[a-zA-Z0-9_-]+\.[a-zA-Z0-9_-]+`),
"Docker Registry Password": regexp.MustCompile(`(?i)docker[_-]?(?:registry)?[_-]?(?:password|pass|pwd)\s*[:=]\s*["']?[^\s"']{8,}["']?`),
"Terraform Cloud Token": regexp.MustCompile(`(?i)(?:tfe|terraform)[_-]?token\s*[:=]\s*["']?[a-zA-Z0-9]{14}\.[a-zA-Z0-9_-]{67}["']?`),
"Pulumi Access Token": regexp.MustCompile(`pul-[a-f0-9]{40}`),
"Adyen API Key": regexp.MustCompile(`(?i)adyen[_-]?api[_-]?key\s*[:=]\s*["']?AQE[a-zA-Z0-9_-]{50,}["']?`),
"Klarna API Key": regexp.MustCompile(`(?i)klarna[_-]?api[_-]?(?:key|secret)\s*[:=]\s*["']?[a-zA-Z0-9_-]{30,}["']?`),
"Razorpay Key": regexp.MustCompile(`rzp_(?:live|test)_[a-zA-Z0-9]{14}`),
"Coinbase API Secret": regexp.MustCompile(`(?i)coinbase[_-]?(?:api)?[_-]?secret\s*[:=]\s*["']?[a-zA-Z0-9]{64}["']?`),
"Binance API Secret": regexp.MustCompile(`(?i)binance[_-]?(?:api)?[_-]?secret\s*[:=]\s*["']?[a-zA-Z0-9]{64}["']?`),
"Twilio Auth Token": regexp.MustCompile(`(?i)twilio[_-]?auth[_-]?token\s*[:=]\s*["']?[a-f0-9]{32}["']?`),
"Pusher Secret": regexp.MustCompile(`(?i)pusher[_-]?(?:app)?[_-]?secret\s*[:=]\s*["']?[a-f0-9]{20}["']?`),
"Vonage API Secret": regexp.MustCompile(`(?i)(?:vonage|nexmo)[_-]?(?:api)?[_-]?secret\s*[:=]\s*["']?[a-zA-Z0-9]{16}["']?`),
"Plivo Auth Token": regexp.MustCompile(`(?i)plivo[_-]?auth[_-]?(?:token|id)\s*[:=]\s*["']?[a-zA-Z0-9]{40,}["']?`),
"MessageBird API Key": regexp.MustCompile(`(?i)messagebird[_-]?(?:api)?[_-]?key\s*[:=]\s*["']?[a-zA-Z0-9]{25}["']?`),
"Intercom Access Token": regexp.MustCompile(`(?i)intercom[_-]?(?:access)?[_-]?token\s*[:=]\s*["']?[a-zA-Z0-9=_-]{60,}["']?`),
"Zendesk API Token": regexp.MustCompile(`(?i)zendesk[_-]?(?:api)?[_-]?token\s*[:=]\s*["']?[a-zA-Z0-9]{40}["']?`),
"Algolia Admin API Key": regexp.MustCompile(`(?i)algolia[_-]?(?:admin)?[_-]?(?:api)?[_-]?key\s*[:=]\s*["']?[a-f0-9]{32}["']?`),
"Elasticsearch API Key": regexp.MustCompile(`(?i)(?:elastic|es)[_-]?(?:api)?[_-]?key\s*[:=]\s*["']?[a-zA-Z0-9_-]{50,}["']?`),
"Mixpanel API Secret": regexp.MustCompile(`(?i)mixpanel[_-]?(?:api)?[_-]?secret\s*[:=]\s*["']?[a-f0-9]{32}["']?`),
"Amplitude API Key": regexp.MustCompile(`(?i)amplitude[_-]?(?:api)?[_-]?key\s*[:=]\s*["']?[a-f0-9]{32}["']?`),
"Segment Write Key Alt": regexp.MustCompile(`(?i)segment[_-]?(?:write)?[_-]?key\s*[:=]\s*["']?[a-zA-Z0-9]{32}["']?`),
"New Relic License Key": regexp.MustCompile(`(?i)new[_-]?relic[_-]?license[_-]?key\s*[:=]\s*["']?[a-f0-9]{40}["']?`),
"New Relic API Key": regexp.MustCompile(`NRAK-[A-Z0-9]{27}`),
"New Relic Insights Key": regexp.MustCompile(`NRI[IQ]-[a-zA-Z0-9_-]{32}`),
"Loggly Token": regexp.MustCompile(`(?i)loggly[_-]?(?:customer)?[_-]?token\s*[:=]\s*["']?[a-f0-9-]{36}["']?`),
"Splunk HEC Token": regexp.MustCompile(`(?i)splunk[_-]?(?:hec)?[_-]?token\s*[:=]\s*["']?[a-f0-9-]{36}["']?`),
"Sumo Logic Access Key": regexp.MustCompile(`(?i)sumo[_-]?logic[_-]?(?:access)?[_-]?(?:key|id)\s*[:=]\s*["']?su[a-zA-Z0-9]{12}["']?`),
"Grafana API Key": regexp.MustCompile(`eyJr[a-zA-Z0-9_-]{50,}={0,2}`),
"PagerDuty API Key": regexp.MustCompile(`(?i)pagerduty[_-]?(?:api)?[_-]?key\s*[:=]\s*["']?[a-zA-Z0-9+/=_-]{20}["']?`),
"Supabase Service Role Key": regexp.MustCompile(`eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9\.[a-zA-Z0-9_-]+\.[a-zA-Z0-9_-]+`),
"Firebase Admin SDK Key": regexp.MustCompile(`(?i)firebase[_-]?(?:admin)?[_-]?sdk[_-]?key\s*[:=]\s*["']?[a-zA-Z0-9_-]{100,}["']?`),
"Auth0 Client Secret": regexp.MustCompile(`(?i)auth0[_-]?(?:client)?[_-]?secret\s*[:=]\s*["']?[a-zA-Z0-9_-]{64,}["']?`),
"Okta API Token Alt": regexp.MustCompile(`(?i)okta[_-]?(?:api)?[_-]?token\s*[:=]\s*["']?00[a-zA-Z0-9_-]{40}["']?`),
"Cloudinary Secret": regexp.MustCompile(`(?i)cloudinary[_-]?(?:api)?[_-]?secret\s*[:=]\s*["']?[a-zA-Z0-9_-]{27}["']?`),
"Cloudinary URL": regexp.MustCompile(`cloudinary://[0-9]+:[a-zA-Z0-9_-]+@[a-z]+`),
"Backblaze Application Key": regexp.MustCompile(`(?i)b2[_-]?(?:application)?[_-]?key\s*[:=]\s*["']?K[a-zA-Z0-9]{30,}["']?`),
"Wasabi Access Key": regexp.MustCompile(`(?i)wasabi[_-]?(?:access)?[_-]?key\s*[:=]\s*["']?[A-Z0-9]{20}["']?`),
"LaunchDarkly SDK Key": regexp.MustCompile(`(?i)(?:ld)?[_-]?sdk[_-]?key\s*[:=]\s*["']?sdk-[a-f0-9-]{36}["']?`),
"LaunchDarkly API Key": regexp.MustCompile(`(?i)launchdarkly[_-]?(?:api)?[_-]?key\s*[:=]\s*["']?api-[a-f0-9-]{36}["']?`),
"Split.io API Key": regexp.MustCompile(`(?i)split[_-]?(?:io)?[_-]?(?:api)?[_-]?key\s*[:=]\s*["']?[a-zA-Z0-9]{50,}["']?`),
"Statsig Secret": regexp.MustCompile(`(?i)statsig[_-]?(?:secret)?[_-]?key\s*[:=]\s*["']?secret-[a-zA-Z0-9]{50,}["']?`),
"GitLab Pipeline Token": regexp.MustCompile(`glptt-[a-f0-9]{40}`),
"GitLab Runner Token": regexp.MustCompile(`GR1348941[a-zA-Z0-9_-]{20}`),
"GitHub App Private Key": regexp.MustCompile(`-----BEGIN RSA PRIVATE KEY-----[\s\S]+?-----END RSA PRIVATE KEY-----`),
"Bitbucket OAuth Secret": regexp.MustCompile(`(?i)bitbucket[_-]?(?:oauth)?[_-]?secret\s*[:=]\s*["']?[a-zA-Z0-9]{32,}["']?`),
"Contentful Management Token": regexp.MustCompile(`CFPAT-[a-zA-Z0-9_-]{43}`),
"Contentful Delivery Token": regexp.MustCompile(`(?i)contentful[_-]?(?:delivery)?[_-]?token\s*[:=]\s*["']?[a-zA-Z0-9_-]{43}["']?`),
"Sanity Token": regexp.MustCompile(`sk[a-zA-Z0-9]{32,}`),
"Strapi API Token": regexp.MustCompile(`(?i)strapi[_-]?(?:api)?[_-]?token\s*[:=]\s*["']?[a-f0-9]{256}["']?`),
"Postmark Server Token": regexp.MustCompile(`(?i)postmark[_-]?(?:server)?[_-]?token\s*[:=]\s*["']?[a-f0-9-]{36}["']?`),
"SparkPost API Key": regexp.MustCompile(`(?i)sparkpost[_-]?(?:api)?[_-]?key\s*[:=]\s*["']?[a-f0-9]{40}["']?`),
"Mailjet API Secret": regexp.MustCompile(`(?i)mailjet[_-]?(?:api)?[_-]?secret\s*[:=]\s*["']?[a-f0-9]{32}["']?`),
"Mandrill API Key": regexp.MustCompile(`(?i)mandrill[_-]?(?:api)?[_-]?key\s*[:=]\s*["']?[a-zA-Z0-9_-]{22}["']?`),
"Customer.io API Key": regexp.MustCompile(`(?i)customer[_-]?io[_-]?(?:api)?[_-]?key\s*[:=]\s*["']?[a-f0-9]{32}["']?`),
"Mapbox Secret Token": regexp.MustCompile(`sk\.[a-zA-Z0-9]{60,}\.[a-zA-Z0-9_-]{22,}`),
"Here API Key": regexp.MustCompile(`(?i)here[_-]?(?:api)?[_-]?key\s*[:=]\s*["']?[a-zA-Z0-9_-]{43}["']?`),
"TomTom API Key": regexp.MustCompile(`(?i)tomtom[_-]?(?:api)?[_-]?key\s*[:=]\s*["']?[a-zA-Z0-9]{32}["']?`),
"LinkedIn Client Secret": regexp.MustCompile(`(?i)linkedin[_-]?(?:client)?[_-]?secret\s*[:=]\s*["']?[a-zA-Z0-9]{16}["']?`),
"Spotify Client Secret": regexp.MustCompile(`(?i)spotify[_-]?(?:client)?[_-]?secret\s*[:=]\s*["']?[a-f0-9]{32}["']?`),
"Dropbox App Secret": regexp.MustCompile(`(?i)dropbox[_-]?(?:app)?[_-]?secret\s*[:=]\s*["']?[a-z0-9]{15}["']?`),
"Private Key Inline": regexp.MustCompile(`(?i)(?:private[_-]?key|priv[_-]?key)\s*[:=]\s*["'][a-zA-Z0-9+/=\n]{100,}["']`),
"Password Hardcoded": regexp.MustCompile(`(?i)(?:password|passwd|pwd)\s*[:=]\s*["'][^"']{8,50}["']`),
"Secret Key Hardcoded": regexp.MustCompile(`(?i)(?:secret[_-]?key|signing[_-]?key|encryption[_-]?key)\s*[:=]\s*["'][a-zA-Z0-9+/=_-]{20,}["']`),
}
asciiArt = `
________ __
__ / / __/ / __ _____ / /____ ____
/ // /\ \/ _ \/ // / _ \/ __/ -_) __/
\___/___/_//_/\_,_/_//_/\__/\__/_/
` + version + ` Created by cc1a2b
`
)
// progressReader wraps an io.Reader to track download progress
type progressReader struct {
reader io.Reader
total int64
current int64
lastUpdate time.Time
onProgress func(int64)
}
func (pr *progressReader) Read(p []byte) (int, error) {
n, err := pr.reader.Read(p)
pr.current += int64(n)
// Only update progress every 100ms to avoid too many updates
if pr.onProgress != nil && time.Since(pr.lastUpdate) > 100*time.Millisecond {
pr.onProgress(pr.current)
pr.lastUpdate = time.Now()
}
return n, err
}
// flagList is a custom type for handling multiple header flags
type flagList []string
func (f *flagList) String() string {
return strings.Join(*f, ", ")
}
func (f *flagList) Set(value string) error {
*f = append(*f, value)
return nil
}
// Config holds all configuration options
type Config struct {
// Basic options
URL, List, JSFile, Output, Regex, Cookies, Proxy string
Threads int
Quiet, Help, Update, ExtractEndpoints, SkipTLS, FoundOnly bool
// Advanced HTTP
Headers []string // Custom HTTP headers
UserAgent string // Custom User-Agent (single string or randomly selected from file)
UserAgents []string // List of User-Agents (when loaded from file)
RateLimit int // Delay between requests (ms)
Timeout int // Request timeout (seconds)
Retry int // Retry failed requests
// JS Analysis
Deobfuscate, SourceMap, Eval, ObfsDetect bool
// Security Analysis
Secrets, Tokens, Params, ParamURLs, Internal, GraphQL, Bypass, Firebase, Links bool
// Crawling & Scope
CrawlDepth int // Recursive JS crawling depth
Domain string // Scope to specific domain
Ext string // Match specific JS file extensions
// Output
JSON, CSV, Verbose, Burp bool
}
func main() {
var (
url, list, jsFile, output, regex, cookies, proxy string
threads int
quiet, help, update, extractEndpoints, skipTLS, foundOnly bool
)
// Advanced HTTP
var headers flagList
var userAgent string
var rateLimit, timeout, retry int
// JS Analysis
var deobfuscate, sourceMap, eval, obfsDetect bool
// Security Analysis
var secrets, tokens, params, paramURLs, internal, graphql, bypass, firebase, links bool
// Crawling & Scope
var crawlDepth int
var domain, ext string
// Output
var jsonOut, csvOut, verbose, burp bool
flag.StringVar(&url, "u", "", "Input a URL")
flag.StringVar(&url, "url", "", "Input a URL")
flag.StringVar(&list, "l", "", "Input a file with URLs (.txt)")
flag.StringVar(&list, "list", "", "Input a file with URLs (.txt)")
flag.StringVar(&jsFile, "f", "", "Path to JavaScript file")
flag.StringVar(&jsFile, "file", "", "Path to JavaScript file")
flag.StringVar(&output, "o", "", "Output file path")
flag.StringVar(&output, "output", "", "Output file path")
flag.StringVar(®ex, "r", "", "RegEx for filtering results (endpoints and sensitive data)")
flag.StringVar(®ex, "regex", "", "RegEx for filtering results (endpoints and sensitive data)")
flag.StringVar(&cookies, "c", "", "Cookies for authenticated JS files")
flag.StringVar(&cookies, "cookies", "", "Cookies for authenticated JS files")
flag.StringVar(&proxy, "p", "", "Set proxy (host:port)")
flag.StringVar(&proxy, "proxy", "", "Set proxy (host:port)")
flag.IntVar(&threads, "t", 5, "Number of concurrent threads")
flag.IntVar(&threads, "threads", 5, "Number of concurrent threads")
flag.BoolVar(&quiet, "q", false, "Quiet mode: suppress ASCII art output")
flag.BoolVar(&quiet, "quiet", false, "Quiet mode: suppress ASCII art output")
flag.BoolVar(&help, "h", false, "Display help message")
flag.BoolVar(&help, "help", false, "Display help message")
flag.BoolVar(&update, "update", false, "Update the tool with latest patterns")
flag.BoolVar(&update, "up", false, "Update the tool to latest version")
flag.BoolVar(&extractEndpoints, "ep", false, "Extract endpoints from JavaScript files")
flag.BoolVar(&extractEndpoints, "end-point", false, "Extract endpoints from JavaScript files")
flag.BoolVar(&skipTLS, "k", false, "Skip TLS certificate verification")
flag.BoolVar(&skipTLS, "skip-tls", false, "Skip TLS certificate verification")
flag.BoolVar(&foundOnly, "fo", false, "Only show results when sensitive data is found (hide MISSING messages)")
flag.BoolVar(&foundOnly, "found-only", false, "Only show results when sensitive data is found (hide MISSING messages)")
// Advanced HTTP flags
flag.Var(&headers, "H", "Custom HTTP headers (repeatable, format: 'Key: Value')")
flag.Var(&headers, "header", "Custom HTTP headers (repeatable, format: 'Key: Value')")
flag.StringVar(&userAgent, "U", "", "Custom User-Agent string or path to file containing user agents (one per line)")
flag.StringVar(&userAgent, "user-agent", "", "Custom User-Agent string or path to file containing user agents (one per line)")
flag.IntVar(&rateLimit, "R", 0, "Delay between requests (ms)")
flag.IntVar(&rateLimit, "rate-limit", 0, "Delay between requests (ms)")
flag.IntVar(&timeout, "T", 30, "Request timeout (seconds)")
flag.IntVar(&timeout, "timeout", 30, "Request timeout (seconds)")
flag.IntVar(&retry, "y", 2, "Retry failed requests")
flag.IntVar(&retry, "retry", 2, "Retry failed requests")
// JS Analysis flags
flag.BoolVar(&deobfuscate, "d", false, "Deobfuscate minified/obfuscated code")
flag.BoolVar(&deobfuscate, "deobfuscate", false, "Deobfuscate minified/obfuscated code")
flag.BoolVar(&sourceMap, "m", false, "Parse source maps for original JS")
flag.BoolVar(&sourceMap, "sourcemap", false, "Parse source maps for original JS")
flag.BoolVar(&eval, "e", false, "Analyze eval() & dynamic code")
flag.BoolVar(&eval, "eval", false, "Analyze eval() & dynamic code")
flag.BoolVar(&obfsDetect, "z", false, "Detect obfuscation techniques")
flag.BoolVar(&obfsDetect, "obfs-detect", false, "Detect obfuscation techniques")
// Security Analysis flags
flag.BoolVar(&secrets, "s", false, "API keys, tokens, credentials detection")
flag.BoolVar(&secrets, "secrets", false, "API keys, tokens, credentials detection")
flag.BoolVar(&tokens, "x", false, "JWT/auth tokens extraction")
flag.BoolVar(&tokens, "tokens", false, "JWT/auth tokens extraction")
flag.BoolVar(¶ms, "P", false, "Hidden parameters discovery")
flag.BoolVar(¶ms, "params", false, "Hidden parameters discovery")
flag.BoolVar(¶mURLs, "PU", false, "Advanced URL parameter extraction with base URLs")
flag.BoolVar(¶mURLs, "param-urls", false, "Advanced URL parameter extraction with base URLs")
flag.BoolVar(&internal, "i", false, "Internal/private endpoints only")
flag.BoolVar(&internal, "internal", false, "Internal/private endpoints only")
flag.BoolVar(&graphql, "g", false, "GraphQL endpoints & queries")
flag.BoolVar(&graphql, "graphql", false, "GraphQL endpoints & queries")
flag.BoolVar(&bypass, "B", false, "WAF bypass patterns detection")
flag.BoolVar(&bypass, "bypass", false, "WAF bypass patterns detection")
flag.BoolVar(&firebase, "F", false, "Firebase config/secrets detection")
flag.BoolVar(&firebase, "firebase", false, "Firebase config/secrets detection")
flag.BoolVar(&links, "L", false, "Extract all links/URLs from JS")
flag.BoolVar(&links, "links", false, "Extract all links/URLs from JS")
// Crawling & Scope flags
flag.IntVar(&crawlDepth, "w", 1, "Recursive JS crawling depth")
flag.IntVar(&crawlDepth, "crawl", 1, "Recursive JS crawling depth")
flag.StringVar(&domain, "D", "", "Scope to specific domain")
flag.StringVar(&domain, "domain", "", "Scope to specific domain")
flag.StringVar(&ext, "E", "", "Match specific JS file extensions (comma-separated)")
flag.StringVar(&ext, "ext", "", "Match specific JS file extensions (comma-separated)")
// Output flags
flag.BoolVar(&jsonOut, "j", false, "Structured JSON output")
flag.BoolVar(&jsonOut, "json", false, "Structured JSON output")
flag.BoolVar(&csvOut, "C", false, "CSV for Excel/Sheets import")
flag.BoolVar(&csvOut, "csv", false, "CSV for Excel/Sheets import")
flag.BoolVar(&verbose, "v", false, "Detailed analysis output")
flag.BoolVar(&verbose, "verbose", false, "Detailed analysis output")
flag.BoolVar(&burp, "n", false, "Burp Suite export format")
flag.BoolVar(&burp, "burp", false, "Burp Suite export format")
flag.Parse()
// Process User-Agent: check if it's a file path or a string
var userAgentsList []string
finalUserAgent := userAgent
if userAgent != "" {
// Check if it looks like a file path (contains path separators or common file extensions)
if strings.Contains(userAgent, "/") || strings.Contains(userAgent, "\\") ||
strings.HasSuffix(userAgent, ".txt") || strings.HasSuffix(userAgent, ".list") {
// Try to read as file
if fileInfo, err := os.Stat(userAgent); err == nil && !fileInfo.IsDir() {
// It's a file, read user agents from it
file, err := os.Open(userAgent)
if err == nil {
defer file.Close()
scanner := bufio.NewScanner(file)
for scanner.Scan() {
line := strings.TrimSpace(scanner.Text())
if line != "" && !strings.HasPrefix(line, "#") {
userAgentsList = append(userAgentsList, line)
}
}
if len(userAgentsList) > 0 {
// Select a random user agent from the list
rand.Seed(time.Now().UnixNano())
finalUserAgent = userAgentsList[rand.Intn(len(userAgentsList))]
if !quiet {
fmt.Printf("[%sINFO%s] Loaded %d user agents from file, using: %s\n",
colors["CYAN"], colors["NC"], len(userAgentsList), finalUserAgent)
}
} else {
if !quiet {
fmt.Printf("[%sWARN%s] User-Agent file is empty or contains no valid entries, using as string\n",
colors["YELLOW"], colors["NC"])
}
}
} else {
if !quiet {
fmt.Printf("[%sWARN%s] Could not read User-Agent file, using as string: %v\n",
colors["YELLOW"], colors["NC"], err)
}
}
}
}
}
// Create config object
config := Config{
URL: url, List: list, JSFile: jsFile, Output: output, Regex: regex,
Cookies: cookies, Proxy: proxy, Threads: threads,
Quiet: quiet, Help: help, Update: update, ExtractEndpoints: extractEndpoints,
SkipTLS: skipTLS, FoundOnly: foundOnly,
Headers: headers, UserAgent: finalUserAgent, UserAgents: userAgentsList, RateLimit: rateLimit,
Timeout: timeout, Retry: retry,
Deobfuscate: deobfuscate, SourceMap: sourceMap, Eval: eval, ObfsDetect: obfsDetect,
Secrets: secrets, Tokens: tokens, Params: params, ParamURLs: paramURLs, Internal: internal,
GraphQL: graphql, Bypass: bypass, Firebase: firebase, Links: links,
CrawlDepth: crawlDepth, Domain: domain, Ext: ext,
JSON: jsonOut, CSV: csvOut, Verbose: verbose, Burp: burp,
}
if help {
customHelp()
return
}
if update {
updateTool()
return
}
if config.URL == "" && config.List == "" && config.JSFile == "" {
if isInputFromStdin() {
// Show ASCII art before processing stdin if not quiet
if !config.Quiet {
time.Sleep(100 * time.Millisecond)
displayAsciiArt()
}
// Read all stdin content
stdinContent, err := ioutil.ReadAll(os.Stdin)
if err != nil {
if !config.Quiet {
fmt.Fprintf(os.Stderr, "Error reading from stdin: %v\n", err)
}
return
}
content := string(stdinContent)
// Check if it looks like a list of URLs (each line is a URL)
lines := strings.Split(content, "\n")
urlCount := 0
jsLineCount := 0
totalLines := 0
for _, line := range lines {
line = strings.TrimSpace(line)
if line == "" {
continue
}
totalLines++
// Check if line looks like a URL
if strings.HasPrefix(line, "http://") || strings.HasPrefix(line, "https://") {
urlCount++
}
// Check if line looks like JavaScript
if strings.Contains(line, "function") ||
strings.Contains(line, "const ") ||
strings.Contains(line, "let ") ||
strings.Contains(line, "var ") ||
strings.Contains(line, "URLSearchParams") ||
strings.Contains(line, ".get(") ||
strings.Contains(line, "fetch(") ||
strings.Contains(line, "axios.") ||
strings.Contains(line, "//") ||
strings.Contains(line, "/*") {
jsLineCount++
}
}
// Determine if it's JavaScript or URL list
// Priority: If most lines are URLs, always treat as URL list (process each URL)
isJavaScript := false
if totalLines > 0 {
urlRatio := float64(urlCount) / float64(totalLines)
// If more than 50% are URLs, treat as URL list (process each URL individually)
if urlRatio > 0.5 {
isJavaScript = false
} else if config.ParamURLs || config.Params {
// Using -PU/-P flags, check if it's actually JS code
if jsLineCount > 5 ||
strings.Contains(content, "function ") ||
strings.Contains(content, "const urlParams") ||
strings.Contains(content, "new URLSearchParams") ||
strings.Contains(content, "URLSearchParams.get") {
// Clear JavaScript patterns
isJavaScript = true
} else {
// Default: treat as JavaScript when using -PU/-P
isJavaScript = true
}
} else {
// Without -PU/-P, check if it's JavaScript
if jsLineCount > 5 || strings.Contains(content, "function ") {
isJavaScript = true
}
}
}
if isJavaScript {
// Process as JavaScript content directly
source := "stdin"
bodyBytes := []byte(content)
if config.ParamURLs {
paramURLs := extractURLParamsWithBaseURLs(content, source)
if len(paramURLs) > 0 {
globalSeenMutex.Lock()
globalFoundAny = true // Mark that we found something
for _, paramURL := range paramURLs {
if !globalSeenAll[paramURL] {
globalSeenAll[paramURL] = true
fmt.Println(paramURL)
}
}
globalSeenMutex.Unlock()
}
} else if config.ExtractEndpoints {
endpoints := extractEndpointsFromContent(content, config.Regex, "")
displayEndpoints(endpoints, source)
} else {
// Process as sensitive data search - use reportMatchesWithConfig directly
reportMatchesWithConfig(source, bodyBytes, &config)
}
} else {
// Treat each line as URL/file path (old behavior)
scanner := bufio.NewScanner(strings.NewReader(content))
for scanner.Scan() {
inputURL := strings.TrimSpace(scanner.Text())
if inputURL == "" {
continue
}
if config.ExtractEndpoints {
processInputsForEndpointsWithConfig(inputURL, &config)
} else {
processInputsWithConfig(inputURL, &config)
}
}
if err := scanner.Err(); err != nil {
if !config.Quiet {
fmt.Fprintln(os.Stderr, "Error reading from stdin:", err)
}
}
}
return
}
customHelp()
os.Exit(1)
}
if !config.Quiet {
time.Sleep(100 * time.Millisecond)
displayAsciiArt()
}
if config.Quiet {
disableColors()
}
if config.JSFile != "" {
if config.ExtractEndpoints {
processJSFileForEndpointsWithConfig(config.JSFile, &config)
} else {
processJSFileWithConfig(config.JSFile, &config)
}
return
}
if config.ExtractEndpoints && (config.URL != "" || config.List != "") {
processInputsForEndpointsWithConfig(config.URL, &config)
} else {
processInputsWithConfig(config.URL, &config)
}
}
func displayAsciiArt() {
versionStatus := getVersionStatus()
var statusColor string
var statusText string
switch versionStatus {
case "latest":
statusColor = colors["GREEN"]
statusText = "latest"
case "outdated":
statusColor = colors["RED"]
statusText = "outdated"
default:
statusColor = colors["YELLOW"]
statusText = "Unknown"
}
fmt.Printf(`
________ __
__ / / __/ / __ _____ / /____ ____
/ // /\ \/ _ \/ // / _ \/ __/ -_) __/
\___/___/_//_/\_,_/_//_/\__/\__/_/
%s (%s%s%s%s) Created by cc1a2b
`, version, statusColor, statusText, colors["NC"], "")
}
func customHelp() {
displayAsciiArt()
fmt.Println("Usage:")
fmt.Println(" -u, --url URL Input a URL")
fmt.Println(" -l, --list FILE.txt Input a file with URLs (.txt)")
fmt.Println(" -f, --file FILE.js Path to JavaScript file")
fmt.Println()
fmt.Println("Basic Options:")
fmt.Println(" -t, --threads INT Number of concurrent threads (default: 5)")
fmt.Println(" -c, --cookies <cookies> Authentication cookies for protected resources")
fmt.Println(" -p, --proxy host:port HTTP proxy configuration (e.g., 127.0.0.1:8080 for Burp Suite)")
fmt.Println(" -q, --quiet Suppress ASCII art output")
fmt.Println(" -o, --output FILENAME.txt Output file path")
fmt.Println(" -r, --regex <pattern> RegEx for filtering results (endpoints and sensitive data)")
fmt.Println(" --update, --up Update the tool to latest version")
fmt.Println(" -ep, --end-point Extract endpoints from JavaScript files")
fmt.Println(" -k, --skip-tls Skip TLS certificate verification")
fmt.Println(" -fo, --found-only Only show results when sensitive data is found (hide MISSING messages)")
fmt.Println()
fmt.Println("HTTP Configuration:")
fmt.Println(" -H, --header \"Key: Value\" Custom HTTP headers (repeatable, including Auth)")
fmt.Println(" -U, --user-agent UA Custom User-Agent string or file path (one per line)")
fmt.Println(" -R, --rate-limit MS Request rate limiting delay (milliseconds)")
fmt.Println(" -T, --timeout SEC HTTP request timeout (seconds)")
fmt.Println(" -y, --retry INT Retry attempts for failed requests (default: 2)")
fmt.Println()
fmt.Println("JavaScript Analysis:")
fmt.Println(" -d, --deobfuscate Deobfuscate minified and obfuscated JavaScript")
fmt.Println(" -m, --sourcemap Parse source maps for original code analysis")
fmt.Println(" -e, --eval Analyze dynamic code execution (eval, Function)")
fmt.Println(" -z, --obfs-detect Detect code obfuscation patterns and techniques")
fmt.Println()
fmt.Println("Security Analysis:")
fmt.Println(" -s, --secrets Detect API keys, tokens, and credentials")
fmt.Println(" -x, --tokens Extract JWT and authentication tokens")
fmt.Println(" -P, --params Discover hidden parameters and variables")
fmt.Println(" -PU, --param-urls Advanced parameter extraction with URL context")
fmt.Println(" -i, --internal Filter for internal/private endpoints")
fmt.Println(" -g, --graphql Analyze GraphQL endpoints and queries")
fmt.Println(" -B, --bypass Detect WAF bypass patterns and techniques")
fmt.Println(" -F, --firebase Analyze Firebase configurations and keys")
fmt.Println(" -L, --links Extract and analyze all embedded links")
fmt.Println()
fmt.Println("Scope & Discovery:")
fmt.Println(" -w, --crawl DEPTH Recursive JavaScript discovery depth (default: 1)")
fmt.Println(" -D, --domain DOMAIN Limit analysis to specific domain")
fmt.Println(" -E, --ext Filter by JavaScript file extensions")
fmt.Println()
fmt.Println("Output Formats:")
fmt.Println(" -j, --json Structured JSON output format")
fmt.Println(" -C, --csv CSV format for spreadsheet analysis")
fmt.Println(" -v, --verbose Detailed analysis and debug output")
fmt.Println(" -n, --burp Burp Suite compatible export format")
fmt.Println(" -h, --help Display this help message")
}
func processStdin(output, regex, cookies, proxy string, threads int) {
scanner := bufio.NewScanner(os.Stdin)
for scanner.Scan() {
line := scanner.Text()
fmt.Println("Processing line from stdin:", line)
}
if err := scanner.Err(); err != nil {
fmt.Fprintln(os.Stderr, "Error reading from stdin:", err)
}
}
func isInputFromStdin() bool {
fi, err := os.Stdin.Stat()
if err != nil {
fmt.Println("Error checking stdin:", err)
return false
}
return fi.Mode()&os.ModeCharDevice == 0
}
func disableColors() {
for k := range colors {
colors[k] = ""
}
}
func processJSFile(jsFile, regex string) {
// Create minimal config for backward compatibility
config := &Config{
Regex: regex,
}
processJSFileWithConfig(jsFile, config)
}
func processInputs(url, list, output, regex, cookie, proxy string, threads int, skipTLS, foundOnly bool) {
// Create config for backward compatibility
config := &Config{
URL: url, List: list, Output: output, Regex: regex,
Cookies: cookie, Proxy: proxy, Threads: threads,
SkipTLS: skipTLS, FoundOnly: foundOnly,
Timeout: 30, Retry: 2,
}
processInputsWithConfig(url, config)
return
}
func processInputsOld(url, list, output, regex, cookie, proxy string, threads int, skipTLS, foundOnly bool) {
var wg sync.WaitGroup
urlChannel := make(chan string)
var fileWriter *os.File
if output != "" {
var err error
fileWriter, err = os.Create(output)
if err != nil {
fmt.Printf("Error creating output file: %v\n", err)
return
}
defer fileWriter.Close()
}
for i := 0; i < threads; i++ {
wg.Add(1)
go func() {
defer wg.Done()
for u := range urlChannel {
// Create minimal config for each request
config := &Config{
Regex: regex, Cookies: cookie, Proxy: proxy,
SkipTLS: skipTLS, FoundOnly: foundOnly,
Timeout: 30, Retry: 1,
}
_, sensitiveData := searchForSensitiveDataWithConfig(u, config)
// Don't print sensitive data if ParamURLs flag is set (user only wants URL params)
if !config.ParamURLs {
if fileWriter != nil {
fmt.Fprintln(fileWriter, "URL:", u)
for name, matches := range sensitiveData {
for _, match := range matches {
fmt.Fprintf(fileWriter, "Sensitive Data [%s%s%s]: %s\n", colors["YELLOW"], name, colors["NC"], match)
}
}
} else {
for name, matches := range sensitiveData {
for _, match := range matches {
fmt.Printf("Sensitive Data [%s%s%s]: %s\n", colors["YELLOW"], name, colors["NC"], match)
}
}
}
}
}
}()
}
if err := enqueueURLs(url, list, urlChannel, regex); err != nil {
fmt.Printf("Error in input processing: %v\n", err)
close(urlChannel)
return
}
close(urlChannel)
wg.Wait()
// Print buffered MISSING messages only if no findings were made
// This is for the old/legacy function - always clear buffer
globalSeenMutex.Lock()
foundAny := globalFoundAny
globalSeenMutex.Unlock()
if !foundAny && !foundOnly {
missingMutex.Lock()
for _, msg := range missingMessages {
fmt.Printf("[%sMISSING%s] No sensitive data found at: %s\n", colors["BLUE"], colors["NC"], msg)
}
missingMessages = missingMessages[:0] // Clear the buffer
missingMutex.Unlock()
} else {
// Clear the buffer if findings were made
missingMutex.Lock()
missingMessages = missingMessages[:0]
missingMutex.Unlock()
}
}
func enqueueURLs(url, list string, urlChannel chan<- string, regex string) error {
if list != "" {
return enqueueFromFile(list, urlChannel)
} else if url != "" {
enqueueSingleURL(url, urlChannel, regex)
} else {
enqueueFromStdin(urlChannel)
}
return nil
}
func enqueueFromFile(filename string, urlChannel chan<- string) error {
file, err := os.Open(filename)
if err != nil {
return fmt.Errorf("Error opening file: %w", err)
}
defer file.Close()
scanner := bufio.NewScanner(file)
for scanner.Scan() {
urlChannel <- scanner.Text()
}
return scanner.Err()
}
func enqueueSingleURL(url string, urlChannel chan<- string, regex string) {
if strings.HasPrefix(url, "http://") || strings.HasPrefix(url, "https://") {
urlChannel <- url
} else {
processJSFile(url, regex)
}
}
func enqueueFromStdin(urlChannel chan<- string) {
scanner := bufio.NewScanner(os.Stdin)
for scanner.Scan() {
urlChannel <- scanner.Text()
}
if err := scanner.Err(); err != nil {
fmt.Printf("Error reading from stdin: %v\n", err)
}
}
// isTLSCanceledError checks if an error is a TLS cancellation error (common with proxy interception)
func isTLSCanceledError(err error) bool {
if err == nil {
return false
}
errStr := strings.ToLower(err.Error())
// Check for various TLS and connection errors that can occur with proxy interception
return strings.Contains(errStr, "tls: user canceled") ||
strings.Contains(errStr, "user canceled") ||
strings.Contains(errStr, "tls: handshake failure") ||
strings.Contains(errStr, "remote error: tls") ||
strings.Contains(errStr, "connection reset") ||
err == io.EOF // EOF can occur when proxy closes connection
}
// isJavaScriptContentType checks if the Content-Type header indicates JavaScript content
func isJavaScriptContentType(contentType string) bool {
if contentType == "" {
return false
}
contentType = strings.ToLower(strings.TrimSpace(contentType))
// Remove charset and other parameters (e.g., "application/javascript; charset=utf-8")
if idx := strings.Index(contentType, ";"); idx != -1 {
contentType = contentType[:idx]
}
contentType = strings.TrimSpace(contentType)
// Common JavaScript MIME types
jsTypes := []string{
"application/javascript",
"application/x-javascript",
"text/javascript",
"text/ecmascript",
"application/ecmascript",
}
for _, jsType := range jsTypes {
if contentType == jsType {
return true
}
}
return false
}
// isValidStatusCode checks if the HTTP status code indicates a successful response
func isValidStatusCode(statusCode int) bool {
// Accept 2xx status codes (successful responses)
return statusCode >= 200 && statusCode < 300
}
// isNonJavaScriptContentType checks if Content-Type indicates non-JavaScript content that should be filtered out
func isNonJavaScriptContentType(contentType string) bool {
if contentType == "" {
return false // Unknown content type, check URL extension instead
}
contentType = strings.ToLower(strings.TrimSpace(contentType))
// Remove charset and other parameters (e.g., "text/html; charset=utf-8")
if idx := strings.Index(contentType, ";"); idx != -1 {
contentType = contentType[:idx]
}
contentType = strings.TrimSpace(contentType)
// Non-JavaScript content types to filter out
nonJSTypes := []string{
// HTML
"text/html",
"application/xhtml+xml",
// CSS
"text/css",
// Plain text
"text/plain",
// JSON (unless it's a JS file with wrong content-type)