I'm trying to edit the content of a Request in mitmproxy and pass it over, but the content of the body is encoded by gzip. I can see the structure of data which is like xml, but I cannot edit it and save it in gzip format. How can I resolve this issue? I tried different tutorials, but none of them are going into detail in that level
I was not able to get this to work using mitmproxy 0.11.1, because every time I tried to edit the response, the body would open in my text editor as the raw gzipped source. However, it did work in mitmproxy 0.11.3. Unfortunately, there appear to be no release notes for the 0.11.2 or 0.11.3 releases.
I set up an i ~bs (response body) intercept hook, and a l ~bs filter to display the intercepted message. I loaded the page in a browser, opened the request, pressed tab to view the response body, hit e to edit, and r for raw body. That opened my editor with the body response as unformatted ASCII text, not the raw gzipped encoding. After saving a one-character change and exiting the editor, I hit a to accept and send the updated message, and saw the change in the web browser developer tools.
However, on several other occasions while doing this and changing a lot of characters in the response body, mitmproxy crashed.
Related
I have a weird network request in my page, which refers to JavaScript files, which I removed from every html file earlier. Cache is cleared and there is no single reference to be found in the source html and the JavaScript files. For fixing that and also out of general curiosity I would like to know if there is a simple way to find out where a request was triggered, preferably using the chrome-devtools.
Update:
Thanks to jaredwilli I found the initator column under the network-tab. However this only shows Other. What I would like to know, is the (html or javascript) file where those Requests have been triggered.
On the Network panel, you can determine what the initiator of a request was by viewing the Initiator column. It gives you the file, line number and type of resource it was, either Script or something else.
Hi I am new on moovweb and I got stuck on a requirement to apply transformation logic on ajax response which is coming in a json format containing html, which I have to add on my page.
A sample response
{
"success":true,
"html" :"<div>This can be a big html data</div>"
}
SO basically, I need to apply transformation on that html string. I gone through docs but I did't got anything to handle this kind of scenario.
Is there any way to do it?
If I understand your question correctly then there are several steps that you need to take in order to solve this issue.
Open your Moovweb project using Google Chrome, right click your mouse and choose Inspect Element which will open your Chrome Dev Tools.
Choose the Network Tab at the top of your Chrome Dev Tools which will be the second tab from the left.
Trigger the ajax call on your site and you will see under the Network Tab the response URL of the ajax call. Most of the time it will be in a format like www.yoursite.com/ajax/rest_of_url
Once you have found the ajax response URL then open your main.ts file in your tritium script and insert the following code if your response URL is similar to the format provided above:
match($path){
with(/ajax/){ #or wherever the site files for the ajax response are contained
log("--> importing ajax.ts")
#import ajax.ts
}
}
Now created a file in for your tritium code called ajax.ts. The file will be in the same location as your html.ts and main.ts files. With the code applied above to your main.ts, every time a URL is called that contains /ajax/ then the ajax.ts file will be applied.
Now you can open your new ajax.ts file that you created and start applying your tritium functions to transform the json format containing html to way you need it.
I am new to GWT.
I want to load a large text file (50 MB) from GWT client side and output the file content in a textarea.
I tried Requestbuilder and I passed response.getText() to a string. I am able to do this for a 10-12 MB file but then it just hangs. I think it has something to do with some maximum limit of string. I can not pass the output of response.getText() to a file because then I would not be able to read that file from GWT client side as I'd need bufferreader and all.
I don't know how to make server chunk the file and send one by one responses.
Can anybody please help me with it!
Although the best option will be a server servlet to split the file so as the client could show it paginated, another option is to make the browser natively deal with the big data.
Create an iframe whose source is the url of the file in the server. If the server sends the correct headers (text/plain) the browser will show the content correctly.
Frame f = new Frame("path_to_myfile.txt");
f.setSize("600px", "400px");
RootPanel.get().add(f);
I received an email a while ago with an image attachment in it. Since then, it seems hotmail has stopped hosting the image for me as when I open the message, the image is no longer available.
However, the message source is still intact, and if I'm not wrong, the message source - in text form - also contains the image.
The problem is of course it is in text form. The part which (I believe) contains the image looks something like this: (Just the first few lines)
--Apple-Mail-2--733971985
Content-Disposition: inline; filename=photo.JPG Content-Id:
<3F8BDC26-81F3-4BA2-9071-53E78CB3DB63/photo.JPG>
Content-Type: image/jpeg; name=photo.JPG Content-Transfer-Encoding:
base64
/9j/4AAQSkZJRgABAQEASABIAAD/4gxYSUNDX1BST0ZJTEUAAQEAAAxITGlubwIQAABtbnRyUkdC
IFhZWiAHzgACAAkABgAxAABhY3NwTVNGVAAAAABJRUMgc1JHQgAAAAAAAAAAAAAAAAAA9tYAAQAA
AADTLUhQICAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABFj
cHJ0AAABUAAAADNkZXNjAAABhAAAAGx3dHB0AAAB8AAAABRia3B0AAACBAAAABRyWFlaAAACGAAA
ABRnWFlaAAACLAAAABRiWFlaAAACQAAAABRkbW5kAAACVAAAAHBkbWRkAAACxAAAAIh2dWVkAAAD
TAAAAIZ2aWV3AAAD1AAAACRsdW1pAAAD+AAAABRtZWFzAAAEDAAAACR0ZWNoAAAEMAAAAAxyVFJD
It was sent from my iPhone into Hotmail.
Is this text representing the image that I am missing? I don't believe there is a program out there that can convert this for me, so I am willing to write my own program to do it. Question is, is this even possible?
Yes, this is entirely possible, by various methods. If you have the entire message source, you could save it into a file (something like *.eml) and open it in a mail client (e.g. Mozilla Thunderbird); this should show you the entire message including the attached image.
If not, it's still possible: as you can see from the headers, the image is base64-encoded. You need to revert this transformation - either using your own code (e.g. PHP has base64_decode()), or through various base64-decoders available online (e.g. this). The part you want to decode is the block starting with /9j/4AAQSk in this case. Rename the resulting file photo.JPG (as indicated in the e-mail headers) and you're done.
Note that this requires you to verify that you have put the entire base64-encoded file through the decoder - base64 has no marker to detect the end of file.
I support a web-application that displays reports from a database. Occassionally, a report will contain an attachment (which is typically an image/document which is stored in the database as well).
We serve the attachment via a dynamic .htm resource which streams the attachment from the database, and populates the content-type based on what type of attachment it is (we support PDFs, RTFs, and various image formats)
For RTFs we've come across a problem. It seems a lot of Windows users don't defaultly have an assocation for the 'application/rtf' content-type (they do have an association for the *.rtf file extention). As a result, clicking on the link to the attachment doesn't do anything in Internet Explorer 6.
Returning 'application/msword' as the content-type seems to make the RTF viewable when clicking on the link, but only for people who have MS Office installed (some of the users won't have this installed, and will use alternate RTF readers, like OpenOffice).
This application is accessed publicly, so we don't have control of the user's machine settings.
Has anybody here solved this before? And how? Thanks!
Use application/octet-stream content-type to force download. Once it's downloaded, it should be viewable in whatever is registered to handle .rtf files.
In addition to the Content-Type header, you also need to add the following:
Content-Disposition: attachment; filename=my-document.rtf
Wordpad (which is on pretty much every Windows machine) can view RTF files. Is there an 'application/wordpad' content-type?
Alternatively, given the rarety of RTF files, your best solution might be to use a server-side component to open the RTF file, convert it to some other format (like PDF or straight HTML), and serve that to the requesting client. I don't know what language/platform you're using on the server side, so I don't know what to tell you to use for this.