Burp Suite User Forum

Create new post

Pasting dynamic generated text into an intercepted HTTP request / response

D | Last updated: Oct 29, 2016 02:22PM UTC

Hi everyone I am attempting to add a new feature to my extension. Basically I would like to add dynamic generated text (for instance plain HTML) into an intercepted HTTP request or response. Currently I am not sure what is the best (or easiest) way to achieve this. It would be nice if I am able to implement it like the following: 1. The user enables the HTTP interceptor 2. The user selects the position where he would like to inject the text by clicking into the request / response (respectively by positioning the cursor) 3. The user does a right-click and selects something like "Inject Text Here" To achieve this, I did the following: - I created a helper class that returns the mentioned text (as string or byte array) I would like to inject - Implementing the IContextMenuFactory interface allowed me to add a new item (Inject Text Here) to the context menu of the proxy tool This is where i stuck. While thinking about this issue, I came to the conclusion that this is basically just a Swing thing. I might be able to solve the problem by receiving the component via IContextMenuInvocation and then inject the text. The problem with this approach is, that the component I am receiving is not an instance of JTextArea. Does anyone have any suggestions? Is there a better way to achieve this by using the Burp API? Thank you very much!

PortSwigger Agent | Last updated: Oct 31, 2016 10:00AM UTC

The IContextMenuInvocation gives you the bounds of the user's current selection. If no text is selected, then the from/to offsets indicate the caret position within the editor. You can use the IContextMenuInvocation API to get details of the message, and you have the selection bounds, so you can modify the message in whatever way you want (to insert your data).

Burp User | Last updated: Oct 31, 2016 06:09PM UTC

Thank you very much, works like a charm.

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