1313import java .util .regex .Matcher ;
1414import java .util .regex .Pattern ;
1515
16- import javax .swing .JMenu ;
1716import javax .swing .JMenuItem ;
1817
19- import com .alibaba . fastjson . JSON ;
18+ import com .google . gson . Gson ;
2019
2120import U2C .JSONBeautifier ;
2221import U2C .U2CTab ;
2524import config .ConfigTable ;
2625import config .ConfigTableModel ;
2726import config .GUI ;
28- import hackbar .File_Payload_Menu ;
29- import hackbar .LFI_Menu ;
30- import hackbar .Reverse_Shell_Menu ;
31- import hackbar .SQL_Error ;
32- import hackbar .SQL_Menu ;
33- import hackbar .SQli_LoginBypass ;
34- import hackbar .SSTI_Menu ;
35- import hackbar .WebShell_Menu ;
36- import hackbar .XSS_Menu ;
37- import hackbar .XXE_Menu ;
3827import knife .AddHostToScopeMenu ;
3928import knife .ChunkedEncodingMenu ;
4029import knife .CookieUtils ;
30+ import knife .Custom_Payload_Menu ;
4131import knife .DismissMenu ;
42- import knife .DoActiveScanMenu ;
32+ import knife .DoPortScanMenu ;
4333import knife .HeaderEntry ;
4434import knife .InsertXSSMenu ;
4535import knife .OpenWithBrowserMenu ;
46- import knife .RunSQLMap ;
36+ import knife .RunSQLMapMenu ;
4737import knife .SetCookieMenu ;
4838import knife .SetCookieWithHistoryMenu ;
4939import knife .UpdateCookieMenu ;
@@ -80,10 +70,10 @@ public void registerExtenderCallbacks(IBurpExtenderCallbacks callbacks) {
8070
8171 String content = callbacks .loadExtensionSetting ("knifeconfig" );
8272 if (content !=null ) {
83- config = JSON . parseObject (content , Config .class );
73+ config = new Gson (). fromJson (content , Config .class );
8474 showToUI (config );
8575 }else {
86- showToUI (JSON . parseObject (initConfig (), Config .class ));
76+ showToUI (new Gson (). fromJson (initConfig (), Config .class ));
8777 }
8878 table .setupTypeColumn ();//call this function must after table data loaded !!!!
8979
@@ -132,22 +122,24 @@ public List<JMenuItem> createMenuItems(IContextMenuInvocation invocation) {
132122
133123 byte context = invocation .getInvocationContext ();
134124
135- String dismissed = this .tableModel .getConfigByKey ("DismissedHost" );
125+ String dismissed = this .tableModel .getConfigValueByKey ("DismissedHost" );
136126 if (dismissed != null ) {
137127 menu_list .add (new DismissMenu (this ));
138128 }
139129
140130 menu_list .add (new AddHostToScopeMenu (this ));
141- if (!callbacks .getBurpVersion ().toString ().startsWith ("1." )) {
142- menu_list .add (new DoActiveScanMenu (this ));
143- }
131+ // if (!callbacks.getBurpVersion().toString().startsWith("1.")) {
132+ // menu_list.add(new DoActiveScanMenu(this));
133+ // }
134+ //2.0后续版本添加了主动扫描选项,移除该菜单;2020.2版本之后
135+ menu_list .add (new DoPortScanMenu (this ));
144136 menu_list .add (new OpenWithBrowserMenu (this ));
145- menu_list .add (new RunSQLMap (this ));
137+ menu_list .add (new RunSQLMapMenu (this ));
146138 menu_list .add (new ChunkedEncodingMenu (this ));
147139
148140 if (context == IContextMenuInvocation .CONTEXT_MESSAGE_EDITOR_REQUEST ) {
149141
150- if (this .tableModel .getConfigByKey ("XSS-Payload" )!=null ){
142+ if (this .tableModel .getConfigValueByKey ("XSS-Payload" )!=null ){
151143 menu_list .add (new InsertXSSMenu (this ));
152144 }
153145
@@ -169,24 +161,7 @@ public List<JMenuItem> createMenuItems(IContextMenuInvocation invocation) {
169161 menu_list .add (new SetCookieWithHistoryMenu (this ));
170162 }
171163
172-
173- JMenu Hack_Bar_Menu = new JMenu ("^_^ Hack Bar++" );
174- Hack_Bar_Menu .add (new SQL_Menu (this ));
175- Hack_Bar_Menu .add (new SQL_Error (this ));
176- Hack_Bar_Menu .add (new SQli_LoginBypass (this ));
177-
178- Hack_Bar_Menu .add (new XSS_Menu (this ));
179- Hack_Bar_Menu .add (new XXE_Menu (this ));
180- Hack_Bar_Menu .add (new LFI_Menu (this ));//learn from this
181- Hack_Bar_Menu .add (new SSTI_Menu (this ));
182-
183- Hack_Bar_Menu .add (new WebShell_Menu (this ));
184- Hack_Bar_Menu .add (new Reverse_Shell_Menu (this ));
185-
186- Hack_Bar_Menu .add (new File_Payload_Menu (this ));
187- Hack_Bar_Menu .add (new Custom_Payload_Menu (this ));
188-
189- menu_list .add (Hack_Bar_Menu );
164+ menu_list .add (new Custom_Payload_Menu (this ));
190165 return menu_list ;
191166 }
192167
@@ -323,7 +298,7 @@ public void processHttpMessage(int toolFlag, boolean messageIsRequest, IHttpRequ
323298 }
324299
325300 if (value .toLowerCase ().contains ("%dnslogserver" )) {
326- String dnslog = tableModel .getConfigByKey ("DNSlogServer" );
301+ String dnslog = tableModel .getConfigValueByKey ("DNSlogServer" );
327302 Pattern p = Pattern .compile ("(?u)%dnslogserver" );
328303 Matcher m = p .matcher (value );
329304
@@ -348,10 +323,10 @@ public void processHttpMessage(int toolFlag, boolean messageIsRequest, IHttpRequ
348323
349324 try {
350325 boolean useComment = false ;
351- if (this .tableModel .getConfigByKey ("Chunked-UseComment" ) != null ) {
326+ if (this .tableModel .getConfigValueByKey ("Chunked-UseComment" ) != null ) {
352327 useComment = true ;
353328 }
354- String lenStr = this .tableModel .getConfigByKey ("Chunked-Length" );
329+ String lenStr = this .tableModel .getConfigValueByKey ("Chunked-Length" );
355330 int len = 10 ;
356331 if (lenStr != null ) {
357332 len = Integer .parseInt (lenStr );
@@ -366,8 +341,8 @@ public void processHttpMessage(int toolFlag, boolean messageIsRequest, IHttpRequ
366341
367342 ///proxy function should be here
368343 //reference https://support.portswigger.net/customer/portal/questions/17350102-burp-upstream-proxy-settings-and-sethttpservice
369- String proxy = this .tableModel .getConfigByKey ("Proxy-ServerList" );
370- String mode = this .tableModel .getConfigByKey ("Proxy-UseRandomMode" );
344+ String proxy = this .tableModel .getConfigValueByKey ("Proxy-ServerList" );
345+ String mode = this .tableModel .getConfigValueByKey ("Proxy-UseRandomMode" );
371346
372347 if (proxy != null ) {//if enable is false, will return null.
373348 List <String > proxyList = Arrays .asList (proxy .split (";" ));//如果字符串是以;结尾,会被自动丢弃
@@ -431,7 +406,7 @@ public List<String> GetSetCookieHeaders(String cookies){
431406 }
432407
433408 public boolean isDismissedHost (String host ){
434- String dissmissed = tableModel .getConfigByKey ("DismissedHost" );
409+ String dissmissed = tableModel .getConfigValueByKey ("DismissedHost" );
435410 if (dissmissed == null ) return false ;//表示配置被禁用了
436411 String [] dissmissedHosts = dissmissed .split ("," );
437412 Iterator <String > it = Arrays .asList (dissmissedHosts ).iterator ();
0 commit comments