Skip to content

Commit

Permalink
Menu cleanup and sample data fix
Browse files Browse the repository at this point in the history
-Fix some sample data returing incorrectly
-Change right click menu option to appear on requests only
  • Loading branch information
egru committed Jun 5, 2015
1 parent 589cf39 commit a386448
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 26 deletions.
1 change: 0 additions & 1 deletion src/main/java/burp/BurpExtender.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
public class BurpExtender implements IBurpExtender
{

@Override
public void registerExtenderCallbacks(IBurpExtenderCallbacks callbacks)
{

Expand Down
17 changes: 10 additions & 7 deletions src/main/java/burp/Menu.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ public List<JMenuItem> createMenuItems(
final IContextMenuInvocation invocation) {
List<JMenuItem> list;
list = new ArrayList<JMenuItem>();

if (invocation.getInvocationContext() != IContextMenuInvocation.CONTEXT_MESSAGE_EDITOR_REQUEST && invocation.getInvocationContext() != IContextMenuInvocation.CONTEXT_MESSAGE_VIEWER_REQUEST){
return list;
}
JMenuItem item = new JMenuItem("Parse WSDL");

item.addMouseListener(new MouseListener() {
Expand All @@ -36,16 +40,17 @@ public void mouseClicked(MouseEvent e) {


public void mousePressed(MouseEvent e) {

}


public void mouseReleased(MouseEvent e) {
WSDLParser parser = new WSDLParser(helpers, tab);
try {
new Worker(parser,invocation, tab, callbacks).execute();
} catch (Exception e1) {
e1.printStackTrace();
}
}


public void mouseReleased(MouseEvent e) {

}

Expand All @@ -69,14 +74,14 @@ public void mouseExited(MouseEvent e) {
class Worker extends SwingWorker<Void,Void> {

private JDialog dialog = new JDialog();
private JProgressBar progressBar = new JProgressBar();
private WSDLParser parser;
private IContextMenuInvocation invocation;
private WSDLParserTab tab;
private IBurpExtenderCallbacks callbacks;
private int status;

public Worker(WSDLParser parser, IContextMenuInvocation invocation, WSDLParserTab tab, IBurpExtenderCallbacks callbacks) {
JProgressBar progressBar = new JProgressBar();
progressBar.setString("Parsing WSDL");
progressBar.setStringPainted(true);
progressBar.setIndeterminate(true);
Expand All @@ -101,9 +106,7 @@ protected Void doInBackground() throws Exception {
protected void done() {
dialog.dispose();
if (status == -1) {

JOptionPane.showMessageDialog(tab.getUiComponent().getParent(), "Error: Can't Read Response");

} else if(status == -2){
JOptionPane.showMessageDialog(tab.getUiComponent().getParent(), "Error: Not a WSDL");
} else if(status == -3){
Expand Down
3 changes: 1 addition & 2 deletions src/main/java/burp/WSDLParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ public int parseWSDL(IHttpRequestResponse requestResponse, IBurpExtenderCallback
xmlRequest = createRequest(requestResponse, builder, operation);
} catch (Exception e) {
success = false;

}
if (success) {
endpoints = builder.getServiceUrls();
Expand Down Expand Up @@ -132,7 +131,7 @@ private File createTempFile(String body) {

private byte[] createRequest(IHttpRequestResponse requestResponse, SoapBuilder builder, SoapOperation operation) {
SoapContext context = SoapContext.builder()
.alwaysBuildHeaders(true).exampleContent(false).typeComments(true).buildOptional(true).build();
.alwaysBuildHeaders(true).exampleContent(true).typeComments(true).buildOptional(true).build();
String message = builder.buildInputMessage(operation, context);
String host = getHost(builder.getServiceUrls().get(0));
String endpointURL = getEndPoint(builder.getServiceUrls().get(0), host);
Expand Down
2 changes: 0 additions & 2 deletions src/main/java/burp/WSDLParserTab.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,10 @@ public WSDLTab createTab(String request) {
return wsdltab;
}

@Override
public String getTabCaption() {
return "Wsdler";
}

@Override
public Component getUiComponent() {
return tabs;
}
Expand Down
10 changes: 0 additions & 10 deletions src/main/java/burp/WSDLTab.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,17 +49,14 @@ public void addEntry(WSDLEntry entry) {
}
}

@Override
public int getRowCount() {
return entries.size();
}

@Override
public int getColumnCount() {
return 3;
}

@Override
public String getColumnName(int columnIndex) {
switch (columnIndex) {
case 0:
Expand All @@ -73,12 +70,10 @@ public String getColumnName(int columnIndex) {
}
}

@Override
public Class getColumnClass(int columnIndex) {
return getValueAt(0, columnIndex).getClass();
}

@Override
public Object getValueAt(int rowIndex, int columnIndex) {

WSDLEntry wsdlEntry = entries.get(rowIndex);
Expand All @@ -99,17 +94,14 @@ public boolean isCellEditable(int row, int col) {
return col >= 2;
}

@Override
public byte[] getRequest() {
return currentlyDisplayedItem.getRequest();
}

@Override
public byte[] getResponse() {
return currentlyDisplayedItem.getResponse();
}

@Override
public IHttpService getHttpService() {
return currentlyDisplayedItem.getHttpService();
}
Expand All @@ -120,7 +112,6 @@ public WSDLTable(TableModel tableModel) {
super(tableModel);
}

@Override
public void changeSelection(int row, int col, boolean toggle, boolean extend) {

WSDLEntry wsdlEntry = entries.get(super.convertRowIndexToModel(row));
Expand All @@ -131,7 +122,6 @@ public void changeSelection(int row, int col, boolean toggle, boolean extend) {

private boolean painted;

@Override
public void paint(Graphics g) {
super.paint(g);

Expand Down
4 changes: 0 additions & 4 deletions src/main/java/org/reficio/ws/legacy/SampleXmlUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -205,10 +205,6 @@ private String sampleDataForSimpleType(SchemaType sType) {
}

SchemaType primitiveType = sType.getPrimitiveType();
if (primitiveType != null
&& (primitiveType.getBuiltinTypeCode() == SchemaType.BTC_BASE_64_BINARY || primitiveType
.getBuiltinTypeCode() == SchemaType.BTC_HEX_BINARY))
return "cid:" + (long) (System.currentTimeMillis() * Math.random());

// if( sType != null )
if (!exampleContent)
Expand Down

0 comments on commit a386448

Please sign in to comment.