Burp Suite User Forum

Create new post

IHttpRequestResponse - setRequest(byte[] message)

NazarMedeiros | Last updated: Oct 13, 2016 12:50PM UTC

I am currently working on writing my own extension for burp suite: I get an exception when using the "setRequest(byte[] message)"from the IHttpRequestResponse interface, which looks like: java.lang.UnsupportedOperationException: Data is read only at burp.wgf.setRequest(Unknown Source) at burp.BurpExtender.sendRequest(BurpExtender.java:408) at burp.BurpExtender$1$1.actionPerformed(BurpExtender.java:99) at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022) at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2348) at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402) at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259) at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252) at java.awt.Component.processMouseEvent(Component.java:6533) at javax.swing.JComponent.processMouseEvent(JComponent.java:3324) at java.awt.Component.processEvent(Component.java:6298) at java.awt.Container.processEvent(Container.java:2236) at java.awt.Component.dispatchEventImpl(Component.java:4889) at java.awt.Container.dispatchEventImpl(Container.java:2294) at java.awt.Component.dispatchEvent(Component.java:4711) at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4888) at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4525) at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4466) at java.awt.Container.dispatchEventImpl(Container.java:2280) at java.awt.Window.dispatchEventImpl(Window.java:2746) at java.awt.Component.dispatchEvent(Component.java:4711) at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758) at java.awt.EventQueue.access$500(EventQueue.java:97) at java.awt.EventQueue$3.run(EventQueue.java:709) at java.awt.EventQueue$3.run(EventQueue.java:703) This is the code where the exception is thrown: public void sendRequest() { byte[] byteData = requestInformationArea.getText().getBytes(); currentlyDisplayedItem.setRequest(byteData); // problem here String request = new String(currentlyDisplayedItem.getRequest()); responseInformationArea.setText(request); } requestInformationArea is a JTextArea class which contains a http request with its full information. currentlyDisplayedItem is an instance of IHttpRequestResponse . I want to update the request and assign it to currentDisplayedItem. After that I convert the updated ".getRequest()" output to a string and display the content. But the compiler does not reach the converting process. I get an exception before... I tested this code piece also in another method: @Override public void performAction(IHttpRequestResponse currentRequest, IHttpRequestResponse[] macroItems) { currentRequest.setRequest(null); // no exception here, but no further execution either String _request = new String(currentlyDisplayedItem.getRequest()); System.out.println(_request); replaceId(request); } This time, I do not get an exception. But the rest of the code is not beeing executed either. Please help! Best regards, Nazar Medeiros

PortSwigger Agent | Last updated: Oct 14, 2016 09:59AM UTC

If you get the message "Data is read only" when you call setRequest() then this indicates that the message you are trying to set is a read-only one. For example, it might be an item in the site map or proxy history, where the request has already been issued. You can only update the request on messages that haven't been sent yet.

Burp User | Last updated: Oct 14, 2016 06:19PM UTC

ok, thank you very much. How can I update a request which has been sent, then? What I want to do is to make something like the "Repeater". Which information do I have to change in the request that it will no be recognized as "already have been sent"? Thanks in advance! Best regards, Nazar Medeiros

PortSwigger Agent | Last updated: Oct 17, 2016 09:03AM UTC

Burp does not let you modify requests in e.g. the Proxy history that have already been sent, because this would just be a pointless and misleading thing to do. If you want to implement Repeater-like functionality, and modify and reissue a request that has already been issued, then just take a copy of the issued request, modify it in any way you want, and then reissue it.

You must be an existing, logged-in customer to reply to a thread. Please email us for additional support.