-
Notifications
You must be signed in to change notification settings - Fork 139
/
Copy pathGAP.py
5549 lines (4956 loc) · 274 KB
/
GAP.py
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
"""
GAP by /XNL-h4ck3r (@xnl_h4ck3r)
Respect and thanks go to @HolyBugx for help with the original versions ideas, testing and patience!
Also, thanks to so many people who have made suggestions, reported issues, and helped me test each version I release!
Get full instructions at https://github.com/xnl-h4ck3r/GAP-Burp-Extension/blob/main/GAP%20Help.md or press the Help button on the GAP tab
Good luck and good hunting! If you really love the tool (or any others), or they helped you find an awesome bounty, consider BUYING ME A COFFEE! (https://ko-fi.com/xnlh4ck3r) (I could use the caffeine!)
"""
VERSION="5.4"
_debug = False
from burp import IBurpExtender, IContextMenuFactory, IScopeChangeListener, ITab, IScanIssue, IHttpRequestResponse, IExtensionHelpers
from javax.swing import (
JFrame,
JMenuItem,
GroupLayout,
JPanel,
JCheckBox,
JTextField,
JLabel,
JButton,
JScrollPane,
JTextArea,
ScrollPaneConstants,
JFileChooser,
BorderFactory,
JEditorPane,
ImageIcon,
JProgressBar,
JDialog,
JPopupMenu
)
from java.util import ArrayList
from urlparse import urlparse
from java.io import PrintWriter, File
from java.awt import Color, Font, Image, Cursor, Desktop, BorderLayout, GridLayout, FlowLayout, Toolkit
from java.awt.event import KeyListener, MouseListener, ItemListener, MouseEvent
from java.net import URL, URI
from java.lang import System
from javax.imageio import ImageIO
from java.awt.datatransfer import StringSelection, Clipboard
from java.util.concurrent import Executors, TimeUnit
import os
import re
import pickle
import threading
import time
import urllib
from datetime import datetime
from array import array
try:
import profile
import pstats
except:
pass
WORDLIST_IMPORT_ERROR = ""
try:
import warnings
from bs4 import BeautifulSoup, Comment
warnings.filterwarnings("ignore", category=UserWarning, module='bs4')
except Exception as e:
if str(e).startswith("No module named"):
WORDLIST_IMPORT_ERROR = "The following installation instructions NEED TO BE FOLLOWED EXACTLY to be able to use Words mode (as mentioned in https://github.com/xnl-h4ck3r/GAP-Burp-Extension#installation). NOTE: Links and Parameters mode will still work without this.\n\n1. Visit https://www.jython.org/download, and download the latest stand alone JAR file, e.g. jython-standalone-2.7.3.jar.\n2. Open Burp, go to Extensions -> Extension Settings -> Python Environment, set the Location of Jython standalone JAR file and Folder for loading modules to the directory where the Jython JAR file was saved.\n3. On a command line, go to the directory where the jar file is and run \"java -jar jython-standalone-2.7.3.jar -m ensurepip\".\n4. Download the GAP.py and requirements.txt from this project and place in the same directory.\n5. Install Jython modules by running \"java -jar jython-standalone-2.7.3.jar -m pip install -r requirements.txt\".\n6. Go to the Extensions -> Installed and click Add under Burp Extensions.\n7. Select Extension type of Python and select the GAP.py file (this file can be placed in any directory)."
else:
WORDLIST_IMPORT_ERROR = "The following error occurred when importing beauttifulsoup4: " + str(e) + "\nPlease make sure you have followed the installation instructions on https://github.com/xnl-h4ck3r/GAP-Burp-Extension#installation\n"
print("WARNING: Could not import beauttifulsoup4 for word mode: " + str(e))
# Try to import html5lib as a parser for beautifulsoup4 because it's more accurate than the default html.parser
try:
html5libInstalled = True
import html5lib
except Exception as e:
html5libInstalled = False
# Sus Parameters from @jhaddix and @G0LDEN_infosec
SUS_CMDI = ['execute','dir','daemon','cli','log','cmd','download','ip','upload']
SUS_DEBUG = ['test','reset','config','shell','admin','exec','load','cfg','dbg','edit','root','create','access','disable','alter','make','grant','adm','toggle','execute','clone','delete','enable','rename','debug','modify']
SUS_FILEINC = ['root','directory','path','style','folder','default-language','url','platform','textdomain','document','template','pg','php_path','doc','type','lang','token','name','pdf','file','etc','api','app','resource-type']
SUS_IDOR = ['count','key','user','id','extended_data','uid2','group','team_id','data-id','no','username','email','account','doc','uuid','profile','number','user_id','edit','report','order']
SUS_OPENREDIRECT = ['u','redirect_uri','failed','r','referer','return_url','redirect_url','prejoin_data','continue','redir','return_to','origin','redirect_to','next']
SUS_SQLI = ['process','string','id','referer','password','pwd','field','view','sleep','column','log','token','sel','select','sort','from','search','update','pub_group_id','row','results','role','table','multi_layer_map_list','order','filter','params','user','fetch','limit','keyword','email','query','c','name','where','number','phone_number','delete','report']
SUS_SSRF = ['sector_identifier_uri', 'request_uris', 'logo_uri', 'jwks_uri', 'start','path','domain','source','url','site','view','template','page','show','val','dest','metadata','out','feed','navigation','image_host','uri','next','continue','host','window','dir','reference','filename','html','to','return','open','port','stop','validate','resturl','callback','name','data','ip','redirect']
SUS_SSTI = ['preview','activity','id','name','content','view','template','redirect']
SUS_XSS = ['path','admin','class','atb','redirect_uri','other','utm_source','currency','dir','title','endpoint','return_url','users','cookie','state','callback','militarybranch','e','referer','password','author','body','status','utm_campaign','value','text','search','flaw','vote','pathname','params','user','t','utm_medium','q','email','what','file','data-original','description','subject','action','u','nickname','color','language_id','auth','samlresponse','return','readyfunction','where','tags','cvo_sid1','target','format','back','term','r','id','url','view','username','sequel','type','city','src','p','label','ctx','style','html','ad_type','s','issues','query','c','shop','redirect']
# Additional Sus Parameters
SUS_MASSASSIGNMENT = ['user','profile','role','settings','data','attributes','post','comment','order','product','form_fields','request']
# A comma separated list of Link exclusions used when no options have been saved, or when the "Restore defaults" button is pressed
# Links are NOT displayed if they contain these strings. This just applies to the links found in endpoints, not the origin link in which it was found
DEFAULT_EXCLUSIONS = ".css,.jpg,.jpeg,.png,.svg,.img,.gif,.mp4,.flv,.ogv,.webm,.webp,.mov,.mp3,.m4a,.m4p,.scss,.tif,.tiff,.ttf,.otf,.woff,.woff2,.bmp,.ico,.eot,.htc,.rtf,.swf,.image,w3.org,doubleclick.net,youtube.com,.vue,jquery,bootstrap,font,jsdelivr.net,vimeo.com,pinterest.com,facebook,linkedin,twitter,instagram,google,mozilla.org,jibe.com,schema.org,schemas.microsoft.com,wordpress.org,w.org,wix.com,parastorage.com,whatwg.org,polyfill,typekit.net,schemas.openxmlformats.org,openweathermap.org,openoffice.org,reactjs.org,angularjs.org,java.com,purl.org,/image,/img,/css,/wp-json,/wp-content,/wp-includes,/theme,/audio,/captcha,/font,node_modules,.wav,.gltf,.pict,.svgz,.eps,.midi,.mid,.avif,.jfi,.jfif,.jfif-tbnl,.jif,.jpe,.pjpg"
# A comma separated list of Content-Type exclusions used to determine what requests are checked for potential links
# These content types will NOT be checked
CONTENTTYPE_EXCLUSIONS = "text/css,image/jpeg,image/jpg,image/png,image/svg+xml,image/gif,image/tiff,image/webp,image/bmp,image/x-icon,image/vnd.microsoft.icon,font/ttf,font/woff,font/woff2,font/x-woff2,font/x-woff,font/otf,audio/mpeg,audio/wav,audio/webm,audio/aac,audio/ogg,audio/wav,audio/webm,video/mp4,video/mpeg,video/webm,video/ogg,video/mp2t,video/webm,video/x-msvideo,application/font-woff,application/font-woff2,application/vnd.android.package-archive,binary/octet-stream,application/octet-stream,application/pdf,application/x-font-ttf,application/x-font-otf,application/x-font-woff,application/vnd.ms-fontobject,image/avif,application/zip,application/x-zip-compressed,application/x-msdownload,application/x-apple-diskimage,application/x-rpm,application/vnd.debian.binary-package,application/x-font-truetype,font/opentype,image/pjpeg,application/x-troff-man,application/font-otf,application/x-ms-application,application/x-msdownload,video/x-ms-wmv,image/x-png,video/quicktime,image/x-ms-bmp,font/opentype,application/x-font-opentype,application/x-woff,audio/aiff,image/jp2,video/x-m4v"
# A comma separated list of file extension exclusions used when the content-type isn't available. Files with these extensions will NOT be checked
FILEEXT_EXCLUSIONS = ".zip,.dmg,.rpm,.deb,.gz,.tar,.jpg,.jpeg,.png,.svg,.img,.gif,.mp4,.flv,.ogv,.webm,.webp,.mov,.mp3,.m4a,.m4p,.scss,.tif,.tiff,.ttf,.otf,.woff,.woff2,.bmp,.ico,.eot,.htc,.rtf,.swf,.image,.wav,.gltf,.pict,.svgz,.eps,.midi,.mid,.pdf,.jfi,.jfif,.jfif-tbnl,.jif,.jpe,.pjpg"
# The default value (used until options are saved, or when the "Restore defaults" button is pressed) for the generated query string of all parameters.
DEFAULT_QSV = "XNLV"
# A list of files used in the Link Finding Regex. These are used in the 5th capturing group that aren't obvious links, but could be files
LINK_REGEX_FILES = "php|php3|php5|asp|aspx|ashx|cfm|cgi|pl|jsp|jspx|json|js|action|html|xhtml|htm|bak|do|txt|wsdl|wadl|xml|xls|xlsx|bin|conf|config|bz2|bzip2|gzip|tar\.gz|tgz|log|src|zip|js\.map"
# Default content types where to look for Words
DEFAULT_WORDS_CONTENT_TYPES = "text/html,application/xml,application/json,text/plain,application/xhtml+xml,application/ld+json,text/xml"
# Default english "stop word" list
DEFAULT_STOP_WORDS = "a,aboard,about,above,across,after,afterwards,again,against,all,almost,alone,along,already,also,although,always,am,amid,among,amongst,an,and,another,any,anyhow,anyone,anything,anyway,anywhere,are,around,as,at,back,be,became,because,become,becomes,becoming,been,before,beforehand,behind,being,below,beneath,beside,besides,between,beyond,both,bottom,but,by,can,cannot,cant,con,concerning,considering,could,couldnt,cry,de,describe,despite,do,done,down,due,during,each,eg,eight,either,eleven,else,elsewhere,empty,enough,etc,even,ever,every,everyone,everything,everywhere,except,few,fifteen,fifty,fill,find,fire,first,five,for,former,formerly,forty,found,four,from,full,further,get,give,go,had,has,hasnt,have,he,hence,her,here,hereafter,hereby,herein,hereupon,hers,herself,him,himself,his,how,however,hundred,i,ie,if,in,inc,indeed,inside,interest,into,is,it,its,itself,keep,last,latter,latterly,least,less,like,ltd,made,many,may,me,meanwhile,might,mill,mine,more,moreover,most,mostly,move,much,must,my,myself,name,namely,near,neither,never,nevertheless,next,nine,no,nobody,none,noone,nor,not,nothing,now,nowhere,of,off,often,on,once,one,only,onto,or,other,others,otherwise,our,ours,ourselves,out,outside,over,own,part,past,per,perhaps,please,put,rather,re,regarding,round,same,see,seem,seemed,seeming,seems,serious,several,she,should,show,side,since,sincere,six,sixty,so,some,somehow,someone,something,sometime,sometimes,somewhere,still,such,take,ten,than,that,the,their,them,themselves,then,thence,there,thereafter,thereby,therefore,therein,thereupon,these,they,thick,thin,third,this,those,though,three,through,throughout,thru,thus,to,together,too,top,toward,towards,twelve,twenty,two,un,under,underneath,until,unto,up,upon,us,very,via,want,was,wasnt,we,well,went,were,weve,what,whatever,when,whence,whenever,where,whereafter,whereas,whereby,wherein,whereupon,wherever,whether,which,while,whilst,whither,whoever,whole,whom,whose,why,will,with,within,without,would,yet,you,youll,your,youre,yours,yourself,yourselves,youve"
# The GAP Help file and 404 message if unavailable
GAP_HELP_URL = "https://github.com/xnl-h4ck3r/GAP-Burp-Extension/blob/main/GAP%20Help.md"
GAP_HELP_URL_BUTTON = (
"https://raw.githubusercontent.com/xnl-h4ck3r/GAP-Burp-Extension/main/GAP%20Help.md"
)
GAP_HELP_404 = (
"<h1>Oops... mind the GAP!</h1><p>Sorry, this should be displaying the content of the following page:<p><a href="
+ GAP_HELP_URL
+ ">"
+ GAP_HELP_URL
+ "</a><p>However, there seems to be a problem connecting to that resource.<p>Please try again later. If the problem persists, please raise an issue on Github."
)
# URLs for icons used
HELP_ICON = (
"https://cdn0.iconfinder.com/data/icons/simply-orange-1/128/questionssvg-512.png"
)
DIR_ICON = "https://cdn0.iconfinder.com/data/icons/simply-orange-1/128/currency_copysvg-512.png"
# Enumeration of request parameter types identified by Burp
PARAM_URL = 0
PARAM_BODY = 1
PARAM_COOKIE = 2
PARAM_XML = 3
PARAM_XML_ATTR = 4
PARAM_MULTIPART_ATTR = 5
PARAM_JSON = 6
# The default maximum length of words to add
DEFAULT_MAX_WORD_LEN = "40"
# The default value for Link Prefix
DEFAULT_LINK_PREFIX = "https://www.CHANGE.THIS"
# Get the GAP logo from the Github page
URL_GAP_LOGO = "https://github.com/xnl-h4ck3r/GAP-Burp-Extension/raw/main/GAP/images/banner.png"
# KoFi links for buying me a coffee
URL_KOFI = "https://ko-fi.com/B0B3CZKR5"
URL_KOFI_BUTTON = "https://storage.ko-fi.com/cdn/kofi2.png?v=3"
# My Github URL
URL_GITHUB = "https://github.com/xnl-h4ck3r"
# Set the colour for Burp Orange
COLOR_BURP_ORANGE = Color(0xE36B1E)
# Global variable used for Scope Execution dialog
LAST_RUN_CONTEXT = None
LAST_RUN_DATE = None
ALL_ROOTS = {}
IS_RUNNING = False
# Default warning if context is Site Map tree and no results are returned
DEFAULT_WARNING_NO_CONTENT = '\n\nMaybe scope isn\'t set?\nIt needs to be set to call GAP from the Site Map tree.\nIgnore this if there are results for other modes.'
class BurpExtender(IBurpExtender, IContextMenuFactory, ITab):
def registerExtenderCallbacks(self, callbacks):
"""
Registers the extension and initializes
"""
self._callbacks = callbacks
self._helpers = callbacks.getHelpers()
self._stderr = PrintWriter(callbacks.getStderr(), True)
self.context = None
self.isBurpCommunity = False # We will assume False until we try to create an Issue
self.roots = set()
self.currentReqResp = None # Object to hold the current request/response being processed
self.currentContentTypeInclude = False
self.allScopePrefixes = set()
self.param_list = set()
self.paramUrl_list = set()
self.paramSus_list = set()
self.paramSusUrl_list = set()
self.susParamText = set()
self.susParamIssue = set()
self.raisedIssues = set()
self.txtParamQuery = ""
self.txtParamQuerySus = ""
self.countParam = 0
self.countParamUnique = 0
self.countParamSus = 0
self.countParamSusUnique = 0
self.link_list = set()
self.linkInScope_list = set()
self.linkUrl_list = set()
self.linkUrlInScope_list = set()
self.countLinkUnique = 0
self.word_list = set()
self.wordUrl_list = set()
self.countWordUnique = 0
self.lstStopWords = {}
callbacks.setExtensionName("GAP")
callbacks.registerContextMenuFactory(self)
callbacks.registerScopeChangeListener(self.scopeChanged)
self.dictCheckedLinks = {}
self.flagCANCEL = False
self.parentTabbedPane = None
self.tabDefaultColor = None
self.linkPrefixColor = None
# Take the LINK_REGEX_FILES values and build a string of any values over 4 characters or has a number in it
# This is used in the 4th capturing group Link Finding regex
lstFileExt = LINK_REGEX_FILES.split("|")
self.LINK_REGEX_NONSTANDARD_FILES = ""
for ext in lstFileExt:
if len(ext) > 4 or any(chr.isdigit() for chr in ext):
if self.LINK_REGEX_NONSTANDARD_FILES == "":
self.LINK_REGEX_NONSTANDARD_FILES = ext
else:
self.LINK_REGEX_NONSTANDARD_FILES = (
self.LINK_REGEX_NONSTANDARD_FILES + "|" + ext
)
# Compile the link regex
self.REGEX_LINKS = re.compile(r"(?:^|\"|'|\\n|\\r|\n|\r|\s)(((?:[a-zA-Z]{1,10}:\/\/|\/\/)([^\"'\/\s]{1,255}\.[a-zA-Z]{2,24}|localhost)[^\"'\n\s]{0,255})|((?:\/|\.\.\/|\.\/)[^\"'><,;| *()(%%$^\/\\\[\]][^\"'><,;|()\s]{1,255})|([a-zA-Z0-9_\-\/]{1,}\/[a-zA-Z0-9_\-\/\.]{1,255}\.(?:[a-zA-Z]{1,4}" + self.LINK_REGEX_NONSTANDARD_FILES + ")(?:[\?|\/][^\"|']{0,}|))|([a-zA-Z0-9_\-\.]{1,255}\.(?:" + LINK_REGEX_FILES + ")(?:\?[^\"|^']{0,255}|)))(?:\"|'|\\n|\\r|\n|\r|\s|$)|(?<=^Disallow:\s)[^\$\n]*|(?<=^Allow:\s)[^\$\n]*|(?<= Domain\=)[^\";']*|(?<=\<)https?:\/\/[^>\n]*|(\"|\')([A-Za-z0-9_-]+\/)+[A-Za-z0-9_-]+(\.[A-Za-z0-9]{2,}|\/?(\?|\#)[A-Za-z0-9_\-&=\[\]]*)(\"|\')", re.IGNORECASE)
# Regex for checking Burp url when checking if in scope
self.REGEX_BURPURL = re.compile(r"^(https?:)?\/\/([-a-zA-Z0-9_]+\.)?[-a-zA-Z0-9_]+\.[-a-zA-Z0-9_\.\?\#\&\=]+$", re.IGNORECASE)
# Regex for JSON keys
self.REGEX_JSONKEYS = re.compile(r'"([a-zA-Z0-9$_\.-]*?)":')
# Regex for XML attributes
self.REGEX_XMLATTR = re.compile(r"<([a-zA-Z0-9$_\.-]*?)>")
# Regex for HTML input fields
self.REGEX_HTMLINP = re.compile(r"<input(.*?)>", re.IGNORECASE)
self.REGEX_HTMLINP_NAME = re.compile(r"(?<=\sname)[\s]*\=[\s]*(\"|')(.*?)(?=(\"|\'))", re.IGNORECASE)
self.REGEX_HTMLINP_ID = re.compile(r"(?<=\sid)[\s]*\=[\s]*(\"|')(.*?)(?=(\"|'))", re.IGNORECASE)
# Regex for Sourcemap
self.REGEX_SOURCEMAP = re.compile(r"(?<=SourceMap\:\s).*?(?=\n)", re.IGNORECASE)
# Regex for Potential Words
self.REGEX_WORDS = re.compile(r"(?<![\/])\b\w{3,}\b(?![\/])")
self.REGEX_WORDSUB = re.compile(r'\"|%22|<|%3c|>|%3e|\(|%28|\)|%29|\s|%20', re.IGNORECASE)
# Regex for standard port
self.REGEX_PORT80 = re.compile(r":80[^0-9]")
self.REGEX_PORT443 = re.compile(r":443[^0-9]")
self.REGEX_PORTSUB = re.compile(r":80[^0-9]|:443[^0-9]")
self.REGEX_PORTSUB80 = re.compile(r":80")
self.REGEX_PORTSUB443 = re.compile(r":443")
# Regex for valid parameter
self.REGEX_PARAM = re.compile(r"[0-9a-zA-Z_]")
# Regex for param keys
self.REGEX_PARAMKEYS = re.compile(r"(?<=\?|&)[^\=\&\n].*?(?=\=|&|\n)")
# Regex for parameters
self.REGEX_PARAMSPOSSIBLE = re.compile(r"(?<=[^\&|%26|\&|\&?#0?38;|\u0026|\\u0026|\\\\u0026|\\x26|\x26])(\?|%3f|\&?#0?63;|\u003f|\\u003f|\\\\u003f|\&|%26|\&|\&?#0?38;|\u0026|\\u0026|\\\\u0026|\\x26|%3d|\&?#0?61;|\u003d|\\u003d|\\\\u003d|\\x3d|\"|\&?#0?34;|\u0022|\\u0022|\\\\u0022|\�?39;)[a-z0-9_\-]{3,}(\=|%3d|\&?#0?61;|\u003d|\\u003d|\\\\u003d|\x3d|\\x3d)(?=[^\=|%3d|\&?#0?61;|\u003d|\\u003d|\\\\u003d|\x3d|\\x3d])", re.IGNORECASE)
self.REGEX_PARAMSSUB = re.compile(r"\?|%3f|\&?#0?63;|\u003f|\\u003f|\\\\u003f|\=|%3d|\&?#0?61;|\u003d|\\u003d|\\\\u003d|\\x3d|\x3d|%26|\&|\&?#0?38;|\u0026|\\u0026|\\\\u0026|\\x26|\x26|\"|\&?#0?34;|\u0022|\\u0022|\\\\u0022|\\x22|\x22|\&?#0?39;", re.IGNORECASE)
self.REGEX_JSLET = re.compile(r"(?<=let[\s])[\s]*[a-zA-Z$_][a-zA-Z0-9$_]*[\s]*(?=(\=|;|\n|\r))")
self.REGEX_JSVAR = re.compile(r"(?<=var\s)[\s]*[a-zA-Z$_][a-zA-Z0-9$_]*?(?=(\s|=|,|;|\n))")
self.REGEX_JSCONSTS = re.compile(r"(?<=const\s)[\s]*[a-zA-Z$_][a-zA-Z0-9$_]*?(?=(\s|=|,|;|\n))")
self.REGEX_JSNESTED = re.compile(r"(?s)(^|\s?)(JSON\.stringify\(|dataLayer\.push\(|(var|let|const)\s+[\$A-Za-z0-9-_\[\]]+\s*=)\s*\{")
self.REGEX_JSNESTEDPARAM = re.compile(r"\s*('|\"|\[])?[A-Za-z0-9-_\.]+('|\"|\])?\s*\:")
# Regex for Request parameters
self.REGEX_PARAMSJSON = re.compile(r"{\"[^\}]+}")
self.REGEX_PARAMSJSONPARAMS = re.compile(r"(?<=\")[^\"\:]+(?=\":)")
# Regex for links
self.REGEX_LINKSSLASH = re.compile(r"(\/|\�?2f|%2f|\u002f|\\u002f|\\/)", re.IGNORECASE)
self.REGEX_LINKSCOLON = re.compile(r"(\:|\�?3a|%3a|\u003a|\\u003a)", re.IGNORECASE)
self.REGEX_LINKSAND = re.compile(r"%26|\&|\�?38;|\u0026|u0026|x26|\x26", re.IGNORECASE)
self.REGEX_LINKSEQUAL = re.compile(r"%3d|\=|\�?61;|\u003d|u003d|x3d|\x3d", re.IGNORECASE)
self.REGEX_LINKBRACKET = re.compile(r"\(.*\)")
self.REGEX_LINKBRACES = re.compile(r"\{.*\}")
self.REGEX_LINKSEARCH1 = re.compile(r"^((?:[^\(\)]|\([^\)]*\))*)\)[^\(]*$")
self.REGEX_LINKSEARCH2 = re.compile(r"^((?:[^\[\]]|\[[^\]]*\])*)\][^\[]*$")
self.REGEX_LINKSEARCH3 = re.compile(r"^((?:[^\{\}]|\{[^\}]*\})*)\}[^\{]*$")
self.REGEX_LINKSEARCH4 = re.compile(r"<\/")
self.REGEX_VALIDHOST = re.compile(r"^([A-Za-z0-9_-]+\.)+[A-Za-z0-9_-]{2,}$")
# Regex for sus params
self.REGEX_SUSPARAM = re.compile("^[A-Za-z0-9_-]+$")
# Make the Stop Word list and make all lower case
try:
self.lstStopWords = DEFAULT_STOP_WORDS.split(",")
self.lstStopWords = list(map(str.lower,self.lstStopWords))
except Exception as e:
self._stderr.println("registerExtenderCallbacks 1")
self._stderr.println(e)
# Create the UI part of GAP
self._createUI()
# Display welcome message
print("GAP - Version " + VERSION)
print("by @xnl_h4ck3r\n")
print(
"The full Help documentation can be found at "
+ GAP_HELP_URL
+ " or from the Help icon on the GAP tab\n"
)
if _debug:
print("DEBUG MODE ON\n")
print("If you ever see anything in the Errors tab, please raise an issue on Github so I can fix it!")
print("Want to buy me a coffee?! - " + URL_KOFI + "\n")
try:
if not html5libInstalled:
print("WARNING: Could not import html5lib for more accurate parsing of words by beatifulsoup4 library.")
except:
pass
def setContextHelp(self, enable):
if enable:
self.lblRequestParams.setToolTipText("These are identified by Burp itself through the API IParameter interface.")
self.cbParamUrl.setToolTipText("A parameter within the URL query string, identified by Burp itself.")
self.cbParamBody.setToolTipText("A parameter within the request body, identified by Burp itself.")
self.cbParamMultiPart.setToolTipText("The value of a parameter attribute within a multi-part message body (such as the name of an uploaded file), identified by Burp itself.")
self.cbParamJson.setToolTipText("An item of data within a JSON structure, identified by Burp itself.")
self.cbParamCookie.setToolTipText("An HTTP cookie name, identified by Burp itself.")
self.cbParamXml.setToolTipText("Items of data in XML structure, identified by Burp itself.")
self.cbParamXmlAttr.setToolTipText("Value of tag attributes in XML structure, identified by Burp itself.")
self.lblResponseParams.setToolTipText("These are identified by GAP, mainly with regular expressions.")
self.cbParamJSONResponse.setToolTipText("If the response has a MIME type of JSON then the Key names will be retrieved.")
self.cbParamXMLResponse.setToolTipText("If the response has a MIME type of XML then the XML attributes are retrieved.")
self.cbParamInputField.setToolTipText("If the response has a MIME type of HTML then the value of the NAME and ID attributes of any INPUT tags are retrieved.")
self.cbParamJSVars.setToolTipText("Javascript variables set with 'var', 'let' or 'const' are retrieved.")
self.cbParamFromLinks.setToolTipText("Any URL query string parameters in potential Links found will be retrieved, only if they are clearly in scope,\nor there is just a path and no way of determining if it is in scope.")
self.cbReportSusParams.setToolTipText("If a 'sus' parameter is identified, a Burp custom Issue will be raised (unavailable in Burp Community Edition).\nThere will be no markers in the Request/Response of the Issue showing where the named parameter can be found because including this functionality\nseriously increases the time GAP can take to run, so this is not a feature at the moment.\nFor Burp Community Edition, the details of the parameter will be written to the extension output.")
self.cbIncludeTentative.setToolTipText("If 'sus' parameters are being reported, this determines if 'Tentative' findings are raised or ingnored.")
self.cbWordLower.setToolTipText("Any word found that contains an uppercase letter will also be added as an all lowercase word.")
self.cbWordPlurals.setToolTipText("If checked, then for each word found, a suitable singular or plural version will also be added to the output.")
self.cbWordPaths.setToolTipText("Any path words in selected links will be added as words.")
self.cbWordParams.setToolTipText("If the Parameters Mode is enabled, all potential params will also be added to the word list.")
self.cbWordComments.setToolTipText("If checked, all words within HTML comments will be considered.")
self.cbWordImgAlt.setToolTipText("If checked, all words with the ALT attribute of IMG tags will be considered.")
self.cbWordDigits.setToolTipText("If un-checked, then any words with numeric digits will be excluded from output.")
self.lblWordsMaxLen.setToolTipText("The maximum length of words that will be output (this excludes plurals of minimum length words).\nThis can be a minimum of 3.")
self.inWordsMaxlen.setToolTipText("The maximum length of words that will be output (this excludes plurals of minimum length words).\nThis can be a minimum of 3.")
self.cbToolTips.setToolTipText("Turn contextual help on or off.")
self.cbIncludePathWords.setToolTipText("The words in the response URL path are included as potential parameters if the URL is in scope.")
self.cbSiteMapEndpoints.setToolTipText("This will include endpoints from the Burp Site map (what was selected) in the potential Link list, if they are in scope.")
self.cbRelativeLinks.setToolTipText("If checked, links found that start with ./ or ../ will be included in the results.")
self.cbLinkPrefix.setToolTipText("If checked, the value(s) in the text field will be prefixed to any links found that do not have a domain, e.g. /api/user/1.\nMultiple domains can be provided, separated by a semicolon, e.g. http://example.com;https://sub.example.com")
self.inLinkPrefix.setToolTipText("You can provide multiple links by separating with a semicolon, e.g. https://example.com;https://example.co.uk")
self.cbLinkPrefixScope.setToolTipText("If checked, the root of each target selected in the Site Map will be prefixed to any links found that do not have a domain, e.g. /api/user/1")
self.cbUnPrefixed.setToolTipText("If the 'Prefix with selected target(s)' or 'Prefix with link(s)' option is checked then this option can be checked to include\nthe original un-prefixed link in addition to the prefixed link.")
self.cbSaveFile.setToolTipText("If this option is checked then when GAP completes a run, a file will be created with the potential parameters, with potential links, and target specific wordlist.\nThese files will be created in the specified directory.\nIf the directory is invalid then the users home directory will be used.")
self.inSaveDir.setToolTipText("The directory where a file will be created with the potential parameters, with potential links, and target specific wordlist.")
self.btnChooseDir.setToolTipText("Choose the directory where output files will be saved.")
self.cbShowSusParams.setToolTipText("If this feature is ticked, only potential parameters that are 'sus' are shown followed by the associated vulnerability type(s).")
self.cbShowQueryString.setToolTipText("This checkbox can be used to switch between the list of parameters and a concatenated\nquery string with all parameters with a value given in the following text box.")
self.inQueryStringVal.setToolTipText("This is a value that is used to create the concatenated query string, with each parameter given this value followed by a unique number of the parameter.\nThis query string can be used to manually append to a URL and check for reflections.")
self.btnRestoreDefaults.setToolTipText("If for any reason you want to revert to the default configuration options, you can click this button.")
self.btnSave.setToolTipText("Any changes made to the configuration settings of GAP can be saved for future use by clicking this button.")
self.progBar.setToolTipText("Click to see execution scope. When running, this shows what request is being processed out of the total number of requests for current target.")
self.progStage.setToolTipText("What Site Map target is being processed out of the total number of targets selected.")
self.cbShowParamOrigin.setToolTipText("If this is ticked, the potential parameter will be followed by the HTTP request endpoint (in square brackets) that the parameter was found in.\nA parameter could have been found in more than one request, so this view can show duplicate links, one per origin endpoint.")
self.cbShowLinkOrigin.setToolTipText("If this feature is ticked, the potential link will be followed by the HTTP request endpoint (in square brackets) that the link was found in.\nA link could have been found in more than one request, so this view can show duplicate links, one per origin endpoint.")
self.cbInScopeOnly.setToolTipText("If this feature is ticked, and the potential links contain a host, then this link will be checked against the Burp Target Scope.\nIf it is not in scope then the link will be removed from the output.\nNOTE: This does not take any Burp 'Exclude from scope' entries into account.\nAlso, if it is not possible to determine the scope (e.g. it may just be a path without a host) then it will be included as in scope to avoid omitting anything potentially useful.")
self.lblLinkFilter.setToolTipText("Any value entered in the Filter input field followed by ENTER or pressing 'Apply filter' will determine which links will be displayed.\nThis can depend on the values of the other two options.")
self.cbLinkFilterNeg.setToolTipText("If selected, any link containing the Filter text will NOT be displayed.\nIf unselected, then only links containing the filter will be displayed.")
self.cbLinkCaseSens.setToolTipText("If selected, the value is the Filter input field will be case sensitive when determining which Links to display.")
self.inLinkFilter.setToolTipText("Any value entered in the Filter input field followed by ENTER or pressing 'Apply filter' will determine which links will be displayed.\nThis can depend on the values of the other two options.")
self.cbShowWordOrigin.setToolTipText("If this feature is ticked, the words will be followed by the HTTP request endpoint (in square brackets) that the word was found in.\nA word could have been found in more than one request, so this view can show duplicate links, one per origin endpoint.\nIf the word was generated by GAP (e.g. a plural or singular version) then it will be followed by [GAP] instead of an origin endpoint.")
self.lblStopWords.setToolTipText("The term 'stop words' comes from Natural Language Processing where they are common words that will be excluded from content.\nIf a word exists in this list before running, then it will be excluded from output.")
self.inStopWords.setToolTipText("The term 'stop words' comes from Natural Language Processing where they are common words that will be excluded from content.\nIf a word exists in this list before running, then it will be excluded from output.")
self.cbExclusions.setToolTipText("If the option is selected it will be applied when run.\nThe text field contains a comma separated list of values.\nIf any of these values exists in a potential link found, then it will be excluded from the final list.\nThere is a initial default list determined by the DEFAULT_EXCLUSIONS constant, but you can change this and save your settings.\nIf the option is not selected, all links will be returned.")
self.inExclusions.setToolTipText("If the option is selected it will be applied when run. The text field contains a comma separated list of values.\nIf any of these values exists in a potential link found, then it will be excluded from the final list.\nThere is a initial default list determined by the DEFAULT_EXCLUSIONS constant, but you can change this and save your settings.\nIf the option is not selected, all links will be returned.")
else:
self.lblRequestParams.setToolTipText("")
self.cbParamUrl.setToolTipText("")
self.cbParamBody.setToolTipText("")
self.cbParamMultiPart.setToolTipText("")
self.cbParamJson.setToolTipText("")
self.cbParamCookie.setToolTipText("")
self.cbParamXml.setToolTipText("")
self.cbParamXmlAttr.setToolTipText("")
self.lblResponseParams.setToolTipText("")
self.cbParamJSONResponse.setToolTipText("")
self.cbParamXMLResponse.setToolTipText("")
self.cbParamInputField.setToolTipText("")
self.cbParamJSVars.setToolTipText("")
self.cbParamFromLinks.setToolTipText("")
self.cbReportSusParams.setToolTipText("")
self.cbIncludeTentative.setToolTipText("")
self.cbWordLower.setToolTipText("")
self.cbWordPlurals.setToolTipText("")
self.cbWordPaths.setToolTipText("")
self.cbWordParams.setToolTipText("")
self.cbWordComments.setToolTipText("")
self.cbWordImgAlt.setToolTipText("")
self.cbWordDigits.setToolTipText("")
self.lblWordsMaxLen.setToolTipText("")
self.inWordsMaxlen.setToolTipText("")
self.cbToolTips.setToolTipText("")
self.cbIncludePathWords.setToolTipText("")
self.cbSiteMapEndpoints.setToolTipText("")
self.cbRelativeLinks.setToolTipText("")
self.cbLinkPrefix.setToolTipText("")
self.inLinkPrefix.setToolTipText("")
self.cbLinkPrefixScope.setToolTipText("")
self.cbUnPrefixed.setToolTipText("")
self.cbSaveFile.setToolTipText("")
self.inSaveDir.setToolTipText("")
self.btnChooseDir.setToolTipText("")
self.cbShowSusParams.setToolTipText("")
self.cbShowQueryString.setToolTipText("")
self.inQueryStringVal.setToolTipText("")
self.btnRestoreDefaults.setToolTipText("")
self.btnSave.setToolTipText("")
self.progBar.setToolTipText("")
self.progStage.setToolTipText("")
self.cbShowParamOrigin.setToolTipText("")
self.cbShowLinkOrigin.setToolTipText("")
self.cbInScopeOnly.setToolTipText("")
self.lblLinkFilter.setToolTipText("")
self.cbLinkFilterNeg.setToolTipText("")
self.cbLinkCaseSens.setToolTipText("")
self.inLinkFilter.setToolTipText("")
self.cbShowWordOrigin.setToolTipText("")
self.lblStopWords.setToolTipText("")
self.inStopWords.setToolTipText("")
self.cbExclusions.setToolTipText("")
self.inExclusions.setToolTipText("")
def cbToolTips_clicked(self ,e=None):
self.setContextHelp(self.cbToolTips.isSelected())
def _createUI(self):
"""
Creates the Java Swing UI for GAP
"""
# Derive the default font and size
test = JLabel()
FONT_FAMILY = test.getFont().getFamily()
FONT_SIZE = test.getFont().getSize()
# Create a font for headers and other non standard stuff
FONT_HEADER = Font(FONT_FAMILY, Font.BOLD, FONT_SIZE + 2)
FONT_HELP = Font(FONT_FAMILY, Font.BOLD, FONT_SIZE)
FONT_GAP_MODE = Font(FONT_FAMILY, Font.BOLD, FONT_SIZE)
FONT_OPTIONS = Font(FONT_FAMILY, Font.BOLD, FONT_SIZE - 2)
# Links section
self.lblLinkOptions = JLabel("Links mode options:")
self.lblLinkOptions.setFont(FONT_HEADER)
self.lblLinkOptions.setForeground(COLOR_BURP_ORANGE)
# Parameter sections
self.lblWhichParams = JLabel("Parameters mode options:")
self.lblWhichParams.setFont(FONT_HEADER)
self.lblWhichParams.setForeground(COLOR_BURP_ORANGE)
# Request parameter section
self.lblRequestParams = JLabel("REQUEST PARAMETERS")
fnt = self.lblRequestParams.getFont()
self.lblRequestParams.setFont(fnt.deriveFont(fnt.getStyle() | Font.BOLD))
self.cbParamUrl = self.defineCheckBox("Query string params")
self.cbParamBody = self.defineCheckBox("Message body params")
self.cbParamMultiPart = self.defineCheckBox("Param attribute in multi-part message body")
self.cbParamJson = self.defineCheckBox("JSON params")
self.cbParamCookie = self.defineCheckBox("Cookie names", False)
self.cbParamXml = self.defineCheckBox("Items of data in XML structure", False)
self.cbParamXmlAttr = self.defineCheckBox("Value of tag attributes in XML structure", False)
# Response parameter section
self.lblResponseParams = JLabel("RESPONSE PARAMETERS")
fnt = self.lblResponseParams.getFont()
self.lblResponseParams.setFont(fnt.deriveFont(fnt.getStyle() | Font.BOLD))
self.cbParamJSONResponse = self.defineCheckBox("JSON params", False)
self.cbParamXMLResponse = self.defineCheckBox("Value of tag attributes in XML structure", False)
self.cbParamInputField = self.defineCheckBox("Name and Id attributes of HTML input fields", False)
self.cbParamJSVars = self.defineCheckBox("Javascript variables and constants", False)
self.cbParamFromLinks = self.defineCheckBox("Params from links found", False)
self.cbParamsEnabled = self.defineCheckBox("Parameters", True)
self.cbParamsEnabled.addItemListener(self.cbParamsEnabled_clicked)
self.cbLinksEnabled = self.defineCheckBox("Links", True)
self.cbLinksEnabled.addItemListener(self.cbLinksEnabled_clicked)
self.cbWordsEnabled = self.defineCheckBox("Words", True)
self.cbWordsEnabled.addItemListener(self.cbWordsEnabled_clicked)
# Words sections
self.lblWhichWords = JLabel("Words mode options:")
self.lblWhichWords.setFont(FONT_HEADER)
self.lblWhichWords.setForeground(COLOR_BURP_ORANGE)
# Request words section
self.cbWordPlurals = self.defineCheckBox("Create singular/plural word?")
self.cbWordPaths = self.defineCheckBox("Include URL path words?")
self.cbWordParams = self.defineCheckBox("Include potential params?")
self.cbWordComments = self.defineCheckBox("Include HTML comments?")
self.cbWordImgAlt = self.defineCheckBox("Include IMG ALT attribute?")
self.cbWordDigits = self.defineCheckBox("Include words with digits?")
self.cbWordLower = self.defineCheckBox("Create lowercase words?")
self.lblWordsMaxLen = JLabel("Maximum length of words")
self.lblWordsMaxLen2 = JLabel("(min. 3 - excludes plurals)")
self.inWordsMaxlen = JTextField("", 2 ,actionPerformed=self.checkMaxWordsLen)
# Set the Help button as an icon
# NOTE: This has been commented out because I could not get it to display correctly at different font size settings
"""
imageUrl = URL(HELP_ICON)
img = ImageIO.read(imageUrl)
resizedImg = img.getScaledInstance(37, 37, Image.SCALE_DEFAULT)
imgIcon = ImageIcon(resizedImg)
self.btnHelp = JButton(imgIcon, actionPerformed=self.btnHelp_clicked)
self.btnHelp.setContentAreaFilled(False)
self.btnHelp.setBorderPainted(False)
"""
# If can't set as an icon, set as a normal button
self.lblHelp = JLabel("Click for help -->")
self.lblHelp.setFont(FONT_GAP_MODE)
self.lblHelp.setForeground(COLOR_BURP_ORANGE)
self.btnHelp = JButton("?", actionPerformed=self.btnHelp_clicked)
self.btnHelp.setFont(FONT_HELP)
self.btnHelp.setForeground(Color.WHITE)
self.btnHelp.setBorder(
BorderFactory.createLineBorder(COLOR_BURP_ORANGE, 2, True)
)
self.btnHelp.setContentAreaFilled(True)
self.btnHelp.setBackground(COLOR_BURP_ORANGE)
self.btnHelp.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR))
self.grpHelp = JPanel()
self.grpHelp.setBorder(
BorderFactory.createLineBorder(COLOR_BURP_ORANGE, 2, True)
)
self.grpHelp.add(self.lblHelp)
self.grpHelp.add(self.btnHelp)
self.btnHelp.setToolTipText("Click me for help!")
# Set KoFi button
try:
initialImg = ImageIO.read(URL(URL_KOFI_BUTTON))
width = int(round(self.grpHelp.getPreferredSize().width * 0.8))
height = int(round(self.grpHelp.getPreferredSize().height * 0.85))
scaledImg = initialImg.getScaledInstance(width, height, Image.SCALE_SMOOTH)
self.grpKoFi = JButton(ImageIcon(scaledImg),actionPerformed=self.btnKoFi_clicked)
self.grpKoFi.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR))
self.grpKoFi.setToolTipText("Buy Me a Coffee!")
self.grpKoFi.setBorderPainted(False)
self.grpKoFi.setContentAreaFilled(False)
except:
self.btnKoFi = JButton("Buy Me a Coffee!",actionPerformed=self.btnKoFi_clicked)
self.btnKoFi.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR))
self.btnKoFi.setFont(FONT_HELP)
self.btnKoFi.setForeground(Color.WHITE)
self.btnKoFi.setBorder(
BorderFactory.createLineBorder(COLOR_BURP_ORANGE, 2, True)
)
self.btnKoFi.setContentAreaFilled(True)
self.btnKoFi.setBackground(COLOR_BURP_ORANGE)
self.grpKoFi = JPanel()
self.grpKoFi.setBorder(
BorderFactory.createLineBorder(COLOR_BURP_ORANGE, 2, True)
)
self.grpKoFi.add(self.btnKoFi)
# Set the GAP logo
try:
initialImg = ImageIO.read(URL(URL_GAP_LOGO))
width = 300
height = 30
scaledImg = initialImg.getScaledInstance(width, height, Image.SCALE_SMOOTH)
self.btnLogo = JButton(ImageIcon(scaledImg),actionPerformed=self.btnLogo_clicked)
self.btnLogo.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR))
self.btnLogo.setToolTipText("Check out my Github page")
self.btnLogo.setBorder(BorderFactory.createEmptyBorder())
except:
self.btnLogo = JButton()
self.btnLogo.setVisible(False)
# GAP Mode group
self.lblMode = JLabel("GAP Mode: ")
self.lblMode.setFont(FONT_GAP_MODE)
self.lblMode.setForeground(COLOR_BURP_ORANGE)
self.grpMode = JPanel()
self.grpMode.setBorder(
BorderFactory.createLineBorder(COLOR_BURP_ORANGE, 2, True)
)
self.grpMode.add(self.btnLogo)
self.grpMode.add(self.lblMode)
self.grpMode.add(self.cbParamsEnabled)
self.grpMode.add(self.cbLinksEnabled)
self.grpMode.add(self.cbWordsEnabled)
# Output options section
self.lblOutputOptions = JLabel("Other options:")
self.lblOutputOptions.setFont(FONT_HEADER)
self.lblOutputOptions.setForeground(COLOR_BURP_ORANGE)
self.cbToolTips = self.defineCheckBox("Show contextual help", True)
self.cbToolTips.addItemListener(self.cbToolTips_clicked)
self.cbToolTips.setForeground(COLOR_BURP_ORANGE)
self.cbReportSusParams = self.defineCheckBox("Report \"sus\" params?", True)
self.cbReportSusParams.addItemListener(self.cbReportSusParams_clicked)
self.cbIncludeTentative = self.defineCheckBox("Inc. Tentative?", True)
self.cbIncludePathWords = self.defineCheckBox("Include URL path words?", False)
self.cbSiteMapEndpoints = self.defineCheckBox("Include site map endpoints?", False)
self.cbRelativeLinks = self.defineCheckBox("Include relative links?")
self.cbLinkPrefix = self.defineCheckBox("Prefix with link(s):")
self.cbLinkPrefix.addItemListener(self.cbLinkPrefix_clicked)
self.inLinkPrefix = JTextField(30,actionPerformed=self.checkLinkPrefix)
self.cbLinkPrefixScope = self.defineCheckBox("Prefix with selected Target(s)")
self.cbLinkPrefixScope.addItemListener(self.cbLinkPrefixScope_clicked)
self.cbLinkPrefixScope.setSelected(False)
self.cbUnPrefixed = self.defineCheckBox("Also include un-prefixed links?")
self.cbSaveFile = self.defineCheckBox("Auto save output to directory")
self.cbSaveFile.addItemListener(self.cbSaveFile_clicked)
self.inSaveDir = JTextField(30)
self.inSaveDir.setEditable(False)
self.btnChooseDir = JButton("Choose...", actionPerformed=self.btnChooseDir_clicked)
self.cbShowSusParams = self.defineCheckBox("Show \"sus\"")
self.cbShowSusParams.setEnabled(False)
self.cbShowSusParams.addItemListener(self.changeParamDisplay)
self.cbShowQueryString = self.defineCheckBox("Show query string with value", False)
self.cbShowQueryString.setEnabled(False)
self.cbShowQueryString.addItemListener(self.cbShowQueryString_clicked)
self.inQueryStringVal = JTextField(5)
# The Restore/Save section
self.btnSave = JButton("Save options", actionPerformed=self.btnSave_clicked)
self.btnRestoreDefaults = JButton("Restore defaults", actionPerformed=self.btnRestoreDefaults_clicked)
self.btnCancel = JButton(" COMPLETED ", actionPerformed=self.btnCancel_clicked)
self.btnCancel.setBackground(COLOR_BURP_ORANGE)
self.btnCancel.setForeground(Color.WHITE)
self.btnCancel.setFont(self.btnCancel.getFont().deriveFont(Font.BOLD))
self.btnCancel.setVisible(False)
# Create progress bar
self.progBar = JProgressBar()
self.progBar.addMouseListener(ProgressBarMouseListener())
self.progBar.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR))
self.progBar.setValue(0)
self.progBar.setStringPainted(True)
self.progBar.setVisible(False)
self.progStage = JLabel()
self.progStage.setVisible(False)
self.progStage.setFont(FONT_HEADER)
self.progStage.setForeground(COLOR_BURP_ORANGE)
self.grpConfig = JPanel()
self.grpConfig.add(self.btnRestoreDefaults)
self.grpConfig.add(self.btnSave)
self.grpConfig.add(JLabel(" "))
self.grpConfig.add(self.btnCancel)
self.grpConfig.add(self.progBar)
self.grpConfig.add(self.progStage)
# Potential parameters found section
self.lblParamList = JLabel("Potential params found:")
self.lblParamList.setFont(FONT_HEADER)
self.lblParamList.setForeground(COLOR_BURP_ORANGE)
self.outParamList = JTextArea(30, 100)
self.outParamList.setLineWrap(False)
self.outParamList.setEditable(False)
self.scroll_outParamList = JScrollPane(self.outParamList)
self.scroll_outParamList.setVerticalScrollBarPolicy(
ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED
)
self.scroll_outParamList.setHorizontalScrollBarPolicy(
ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED
)
self.cbShowParamOrigin = self.defineCheckBox("Show origin", False)
self.cbShowParamOrigin.setFont(FONT_OPTIONS)
self.cbShowParamOrigin.setVisible(True)
self.cbShowParamOrigin.setEnabled(False)
self.cbShowParamOrigin.addItemListener(self.changeParamDisplay)
self.outParamSus = JTextArea(30, 100)
self.outParamSus.setLineWrap(True)
self.outParamSus.setEditable(False)
self.outParamQuery = JTextArea(30, 100)
self.outParamQuery.setLineWrap(True)
self.outParamQuery.setEditable(False)
# Potential links found section
self.lblLinkList = JLabel("Potential links found:")
self.lblLinkList.setFont(FONT_HEADER)
self.lblLinkList.setForeground(COLOR_BURP_ORANGE)
self.outLinkList = JTextArea(30, 100)
self.outLinkList.setLineWrap(False)
self.outLinkList.setEditable(False)
self.scroll_outLinkList = JScrollPane(self.outLinkList)
self.scroll_outLinkList.setVerticalScrollBarPolicy(
ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED
)
self.scroll_outLinkList.setHorizontalScrollBarPolicy(
ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED
)
self.cbShowLinkOrigin = self.defineCheckBox("Show origin endpoint", False)
self.cbShowLinkOrigin.setFont(FONT_OPTIONS)
self.cbShowLinkOrigin.setVisible(True)
self.cbShowLinkOrigin.setEnabled(False)
self.cbShowLinkOrigin.addItemListener(self.changeLinkDisplay)
self.cbInScopeOnly = self.defineCheckBox("In scope only", False)
self.cbInScopeOnly.setFont(FONT_OPTIONS)
self.cbInScopeOnly.setVisible(True)
self.cbInScopeOnly.setEnabled(False)
self.cbInScopeOnly.addItemListener(self.changeLinkDisplay)
self.lblLinkFilter = JLabel("Link filter:")
self.lblLinkFilter.setEnabled(False)
self.btnFilter = JButton("Apply filter", actionPerformed=self.btnFilter_clicked)
self.btnFilter.setEnabled(False)
self.cbLinkFilterNeg = self.defineCheckBox("Negative match", False)
self.cbLinkFilterNeg.setEnabled(False)
self.cbLinkCaseSens = self.defineCheckBox("Case sensitive", False)
self.cbLinkCaseSens.setEnabled(False)
self.inLinkFilter = JTextField(10)
self.keyListen = CustomKeyListener(self.btnFilter)
self.inLinkFilter.addKeyListener(self.keyListen)
self.inLinkFilter.setEnabled(False)
self.grpLinkFilter = JPanel()
self.grpLinkFilter.add(self.lblLinkFilter)
self.grpLinkFilter.add(self.inLinkFilter)
self.grpLinkFilter.add(self.cbLinkFilterNeg)
self.grpLinkFilter.add(self.cbLinkCaseSens)
self.grpLinkFilter.add(self.btnFilter)
# Potential words found section
if WORDLIST_IMPORT_ERROR != "":
self.lblWordList = JLabel("Words found - UNAVAILABLE:")
else:
self.lblWordList = JLabel("Words found:")
self.lblWordList.setFont(FONT_HEADER)
self.lblWordList.setForeground(COLOR_BURP_ORANGE)
self.cbShowWordOrigin = self.defineCheckBox("Show origin", False)
self.cbShowWordOrigin.setFont(FONT_OPTIONS)
self.cbShowWordOrigin.setVisible(True)
self.cbShowWordOrigin.setEnabled(False)
self.cbShowWordOrigin.addItemListener(self.changeWordDisplay)
self.outWordList = JTextArea(30, 100)
if WORDLIST_IMPORT_ERROR != "":
self.outWordList.setWrapStyleWord(True)
self.outWordList.setLineWrap(True)
else:
self.outWordList.setLineWrap(False)
self.outWordList.setEditable(False)
if WORDLIST_IMPORT_ERROR != "":
self.outWordList.text = WORDLIST_IMPORT_ERROR
self.scroll_outWordList = JScrollPane(self.outWordList)
self.scroll_outWordList.setVerticalScrollBarPolicy(
ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED
)
self.scroll_outWordList.setHorizontalScrollBarPolicy(
ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED
)
self.lblStopWords = JLabel("Stop words:")
self.inStopWords = JTextField(30)
# Initialise text fields to hold variations of outLinkList JTextArea
self.txtLinksWithURL = ""
self.txtLinksOnly = ""
self.txtLinksWithURLInScopeOnly = ""
self.txtLinksOnlyInScopeOnly = ""
self.txtLinksFiltered = ""
# Initialise text fields to hold variations of outParamList JTextArea
self.txtParamsWithURL = ""
self.txtParamsOnly = ""
self.txtParamsSusWithURL = ""
self.txtParamsSusOnly = ""
self.txtParamsQuery = ""
# Initialise text fields to hold variations of outWordList JTextArea
self.txtWordsWithURL = ""
self.txtWordsOnly = ""
# Definition of config tab
self.tab = JPanel()
layout = GroupLayout(self.tab)
self.tab.setLayout(layout)
layout.setAutoCreateGaps(True)
layout.setAutoCreateContainerGaps(True)
# Set up a field for comma separated exclusion strings
#self.lblExclusions = JLabel(" Link exclusions:")
self.cbExclusions = self.defineCheckBox("Link exclusions:", True)
self.cbExclusions.setFont(FONT_OPTIONS)
self.cbExclusions.setVisible(True)
self.cbExclusions.setEnabled(False)
self.cbExclusions.addItemListener(self.changeLinkExclusions)
self.inExclusions = JTextField(300)
# Debug info
self.txtDebug = JTextArea(85, 1)
self.txtDebug.setVisible(False)
self.txtDebug.setLineWrap(True)
self.txtDebug.setEditable(False)
self.txtDebugDetail = JTextArea(85, 1)
self.txtDebugDetail.setVisible(False)
self.txtDebugDetail.setLineWrap(True)
self.txtDebugDetail.setEditable(False)
self.logContentType = False
# Restore saved config settings
self.restoreSavedConfig()
# After settings have been restored, we can set the mouse liseteners
self.outLinkList.addMouseListener(OutputMouseListener(self.outLinkList,"Links",self._callbacks,self._helpers,self.cbShowLinkOrigin,self.cbInScopeOnly))
self.outParamList.addMouseListener(OutputMouseListener(self.outParamList,"Param"))
self.outParamSus.addMouseListener(OutputMouseListener(self.outParamSus,"Param"))
self.outParamQuery.addMouseListener(OutputMouseListener(self.outParamQuery,"ParamQuery"))
self.outWordList.addMouseListener(OutputMouseListener(self.outWordList,"Words"))
# Determine whether to "show context help"
self.setContextHelp(self.cbToolTips.isSelected())
# Set UI layout
layout.setHorizontalGroup(
layout.createParallelGroup()
.addGroup(
layout.createSequentialGroup()
.addGroup(
layout.createParallelGroup()
.addComponent(
self.grpMode,
GroupLayout.PREFERRED_SIZE,
GroupLayout.PREFERRED_SIZE,
GroupLayout.PREFERRED_SIZE,
)
.addComponent(self.lblWhichParams)
.addGroup(
layout.createSequentialGroup()
.addGroup(
layout.createParallelGroup()
.addComponent(self.cbIncludePathWords)
.addComponent(self.lblRequestParams)
.addComponent(self.cbParamUrl)
.addComponent(self.cbParamBody)
.addComponent(self.cbParamMultiPart)
.addComponent(self.cbParamJson)
.addComponent(self.cbParamCookie)
.addComponent(self.cbParamXml)
.addComponent(self.cbParamXmlAttr)
)
.addGroup(
layout.createParallelGroup()
.addGroup(
layout.createSequentialGroup()
.addComponent(self.cbReportSusParams)
.addComponent(self.cbIncludeTentative)
)
.addComponent(self.lblResponseParams)
.addComponent(self.cbParamJSONResponse)
.addComponent(self.cbParamXMLResponse)
.addComponent(self.cbParamInputField)
.addComponent(self.cbParamJSVars)
.addComponent(self.cbParamFromLinks)
.addGroup(
layout.createSequentialGroup()
.addComponent(
self.grpHelp,
GroupLayout.PREFERRED_SIZE,
GroupLayout.PREFERRED_SIZE,
GroupLayout.PREFERRED_SIZE,
)
.addComponent(self.grpKoFi,
GroupLayout.PREFERRED_SIZE,
GroupLayout.PREFERRED_SIZE,
GroupLayout.PREFERRED_SIZE,)
)
)
)
.addComponent(self.lblLinkOptions)
.addGroup(
layout.createSequentialGroup()
.addComponent(self.cbLinkPrefixScope)
.addComponent(self.cbLinkPrefix)
.addComponent(self.inLinkPrefix)
)
.addGroup(
layout.createSequentialGroup()
.addComponent(self.cbUnPrefixed)
.addComponent(self.cbSiteMapEndpoints)
.addComponent(self.cbRelativeLinks)
)
.addComponent(self.lblWhichWords)
.addGroup(
layout.createSequentialGroup()
.addGroup(
layout.createParallelGroup()
.addComponent(self.cbWordLower)
.addComponent(self.cbWordPlurals)
.addGroup(
layout.createSequentialGroup()
.addComponent(self.lblWordsMaxLen)
.addComponent(
self.inWordsMaxlen,
GroupLayout.PREFERRED_SIZE,
GroupLayout.PREFERRED_SIZE,
GroupLayout.PREFERRED_SIZE,
)
)
)
.addGroup(
layout.createParallelGroup()
.addComponent(self.cbWordComments)
.addComponent(self.cbWordImgAlt)
.addComponent(self.lblWordsMaxLen2)
)
.addGroup(
layout.createParallelGroup()
.addComponent(self.cbWordDigits)
.addComponent(self.cbWordPaths)
.addComponent(self.cbWordParams)
)
)
.addGroup(
layout.createSequentialGroup()
.addComponent(self.lblOutputOptions)
.addComponent(self.cbToolTips)
)
.addGroup(
layout.createSequentialGroup()
.addComponent(self.cbSaveFile)
.addComponent(self.inSaveDir)
.addComponent(self.btnChooseDir)
)
.addComponent(
self.grpConfig,
GroupLayout.PREFERRED_SIZE,
GroupLayout.PREFERRED_SIZE,
GroupLayout.PREFERRED_SIZE,
)
.addComponent(self.txtDebug,
GroupLayout.DEFAULT_SIZE,
GroupLayout.DEFAULT_SIZE,
GroupLayout.DEFAULT_SIZE,
)
.addComponent(self.txtDebugDetail,
GroupLayout.DEFAULT_SIZE,
GroupLayout.DEFAULT_SIZE,
GroupLayout.DEFAULT_SIZE,
)
)
.addGroup(
layout.createParallelGroup()
.addGroup(
layout.createSequentialGroup()
.addGroup(
layout.createParallelGroup()
.addGroup(
layout.createSequentialGroup()
.addComponent(self.lblParamList)
.addComponent(self.cbShowParamOrigin)
)
.addComponent(self.scroll_outParamList)
.addGroup(
layout.createSequentialGroup()
.addComponent(self.cbShowSusParams)
.addComponent(self.cbShowQueryString)
.addComponent(
self.inQueryStringVal,
GroupLayout.PREFERRED_SIZE,
GroupLayout.PREFERRED_SIZE,
GroupLayout.PREFERRED_SIZE,
)
)
)
.addGroup(
layout.createParallelGroup()
.addGroup(
layout.createSequentialGroup()
.addComponent(self.lblWordList)
.addComponent(self.cbShowWordOrigin)
)
.addComponent(self.scroll_outWordList)
.addGroup(
layout.createSequentialGroup()
.addComponent(self.lblStopWords)
.addComponent(self.inStopWords)
)
)
)
.addGroup(
layout.createSequentialGroup()
.addComponent(self.lblLinkList)
.addComponent(self.cbShowLinkOrigin)
.addComponent(self.cbInScopeOnly)
)
.addComponent(self.scroll_outLinkList)
.addComponent(
self.grpLinkFilter,
GroupLayout.PREFERRED_SIZE,
GroupLayout.PREFERRED_SIZE,