33import javax .swing .*;
44import java .awt .event .ActionEvent ;
55import java .awt .event .ActionListener ;
6- import java .io .PrintWriter ;
76import java .util .ArrayList ;
87import java .util .List ;
98
109
1110public class Menu implements IContextMenuFactory {
12- private IBurpExtenderCallbacks callbacks ;
13- private final IExtensionHelpers m_helpers ;
14- private PrintWriter stdout ;
15- private PrintWriter stderr ;
16-
17-
18- public Menu (IBurpExtenderCallbacks callbacks ) {
19- this .callbacks = callbacks ;
20- this .m_helpers = callbacks .getHelpers ();
21- this .stdout = new PrintWriter (callbacks .getStdout (),true );
22- this .stderr = new PrintWriter (callbacks .getStderr (),true );
23- }
24-
2511
2612 public List <JMenuItem > createMenuItems (final IContextMenuInvocation invocation ) {
2713 List <JMenuItem > menus = new ArrayList ();
@@ -44,7 +30,7 @@ public List<JMenuItem> createMenuItems(final IContextMenuInvocation invocation)
4430
4531 public void actionPerformed (ActionEvent arg0 ) {
4632 IHttpRequestResponse iReqResp = invocation .getSelectedMessages ()[0 ];
47- IRequestInfo reqInfo = m_helpers .analyzeRequest (iReqResp .getRequest ());
33+ IRequestInfo reqInfo = BurpExtender . helpers .analyzeRequest (iReqResp .getRequest ());
4834 // 不对GET请求进行编码
4935 if (!reqInfo .getMethod ().equals ("POST" )){
5036 JOptionPane .showConfirmDialog (null ,"GET requests cannot be chunked encoded!" ,"Warning" ,JOptionPane .CLOSED_OPTION ,JOptionPane .WARNING_MESSAGE );
@@ -58,12 +44,12 @@ public void actionPerformed(ActionEvent arg0) {
5844 }
5945
6046 try {
61- byte [] request = Transfer .encoding (m_helpers , iReqResp , Config .getMin_chunked_len (),Config .getMax_chunked_len (),Config .isAddComment (),Config .getMin_comment_len (),Config .getMax_comment_len ());
47+ byte [] request = Transfer .encoding (iReqResp , Config .getMin_chunked_len (),Config .getMax_chunked_len (),Config .isAddComment (),Config .getMin_comment_len (),Config .getMax_comment_len ());
6248 if (request != null ) {
6349 iReqResp .setRequest (request );
6450 }
6551 } catch (Exception e ) {
66- stderr .println (e .getMessage ());
52+ BurpExtender . stderr .println (e .getMessage ());
6753 }
6854 }
6955 });
@@ -80,12 +66,12 @@ public void actionPerformed(ActionEvent arg0) {
8066 }
8167
8268 try {
83- byte [] request = Transfer .decoding (m_helpers , iReqResp );
69+ byte [] request = Transfer .decoding (iReqResp );
8470 if (request != null ) {
8571 iReqResp .setRequest (request );
8672 }
8773 } catch (Exception e ) {
88- stderr .println (e .getMessage ());
74+ BurpExtender . stderr .println (e .getMessage ());
8975 }
9076 }
9177 });
@@ -95,10 +81,10 @@ public void actionPerformed(ActionEvent arg0) {
9581 public void actionPerformed (ActionEvent arg0 ) {
9682 try {
9783 ConfigDlg dlg = new ConfigDlg ();
98- callbacks .customizeUiComponent (dlg );
84+ BurpExtender . callbacks .customizeUiComponent (dlg );
9985 dlg .setVisible (true );
10086 }catch (Exception e ){
101- e .printStackTrace (stderr );
87+ e .printStackTrace (BurpExtender . stderr );
10288 }
10389 }
10490 });
0 commit comments