How to extract files from saz file? - extract

I exported a session from Fiddler to saz files.
This session includes only jpg files and I'm wondering - how can I extract the jpg files from saz quickly and easily?
Thanks!

The easiest way to extract the JPEG files is to use Fiddler itself. Fiddler allows you to load a SAZ file (under File/Load Archive..).
Once loaded, just right-click on the HTTP message with the JPEG and select Save/Response/Response Body....
If you want to do it the hard way, a SAZ file is just a zip file. Below is from the Fiddler FAQ page
SAZ files are simply specially formatted .ZIP files. If you rename a
.SAZ file to .ZIP, you can open it for viewing using standard ZIP
viewing tools.
According to the FAQ, the HTTP payload data is stored in a directory called raw. The JPEG data will be in one of the sessid#_s.txt files, but embedded in a HTTP response message. Strip the HTTP headers to get the JPEG (assuming there is no extra encoding in the HTTP message).
sessid#_s.txt - contains the raw server request

Fiddler now requires a password to work, and I'm not willing to register.
First, I create a folder and put the .saz file inside
Second, I change to that directory and use unzip to extract the files because a saz file is a standard archive
Third, I open _index.htm with any browser and click the links in the index file
Have fun.

Related

Import files into a directory on a HTML document

I am wondering if I can have a webpage where I can tell it to grab my file and put it in a directory, such as: "http://example.ex/folder". Meaning the file I provided is put into the "folder" folder.
Overall process:
Button says: "Import file"
I select a file, and my file is "text.txt"
It takes my file "text.txt" and adds it to the local system/directory of the website.
You can do this using JQuery File Upload and then adding a backend service that captures the file and saves it.
For example, here is a repository that has a basic Python (Flask) server integrated with JQuery File Upload that will take an uploaded file and place it on the server:
https://github.com/ngoduykhanh/flask-file-uploader
I'd put the rest of the code here, but it is a lot - and requires HTML, JavaScript and a back-end language (like Python).
Here is the documentation on JQuery File Upload: https://github.com/blueimp/jQuery-File-Upload
As a word of caution, DO NOT TRUST ANYTHING UPLOADED TO YOUR SERVER. Meaning, do not put it out on the open internet without some sort of authentication or checks in place to make sure only files you intend are uploaded. Otherwise, people will find it and upload scripts turning your device into a Bitcoin miner, spam relay, or bot host.
Instead of doing it this way, why not use SFTP to upload it to your server to host? At least that way you can lock down access.

How does Chrome determine a downloaded file's name on disk?

How does Chrome determine the name of the file being saved to disk when downloading a file?
Whenever I download a file from a particular website I am working on (as a developer), Chrome is appending an underscore to the end of the file extension. (See: Chrome on Windows adding trailing underscores to downloaded files? ). I've been playing around with various content-type and content-disposition headers, and it appears that Chrome is ignoring the filename specified in the Content-Disposition header. For example, if I make a request to download a file, and the response comes back with the following headers (among others):
Content-Disposition: attachment;filename="example.pdf"
Content-Type: application/pdf
... the name of the file saved to disk is still the original file name. In this example, the original file is named test.pdf, and rather than saving it as example.pdf (as specified in Content-Disposition), it is being saved to disk as test.pdf. This seems to hold true for any sort of file type - even something as simple as a .txt file. There doesn't appear to be any other HTTP response headers dictating the file name.
Is there something special that Chrome does to determine the name of the file being saved to disk? If so, is it possible to override this behavior?
I understand that Chrome will rename certain downloaded files that it sees as a security risk (e.g.: renaming .lnk to .download), but even in a case like this, it is still ignoring my Content-Disposition headers for safe file types.

Is it possible to retrieve a list of files in a JSON format from a URL that lists the contents of a folder

I have a NFS location that is not managed by me and it's contents can be accessed by browsing to it, i.d. the server is serving up the folder as a HTML page.
something like https://ftp.mozilla.org/pub/firefox/releases/52.0/
Is it possible to get the list of files in a JSON format response directly in the request response? Without changing anything on the NFS server and without having to write code to parse the HTML?
e.g., Maybe I can send the request to the URL with different headers.
To clarify:
When you access the address with a browser, curl or wget, you get a HTML page.
My motivation is that I don't want to mount the NFS location. I want to access the files by downloading them from the URL.
I don't know the type of server that is holding the shared folder.
Thanks.
In short, the answer is NO.
Not without tweaking the settings on the webserver that is serving the folder contents.
Here are some examples of how to tweak Apache to serve JSON formatted files listing for the folder.
Apache directory listing as JSON using PHP
Apache directory listing as json
Apache External Module mod_jsonindex - May not be the recommended way
http://1h.com/opensource/mod_jsonindex.html

Convert .html files to .mhtml using Java API

I have some generated .html reports in a folder and want to convert multiple .html, .css, .js and image files into one report.mhtml file so that single file can be accessed as a web service.
Is there any Java API to convert the folder of .html files to a single .mhtml file?
I was investigating the reverse (unpacking an MHTML/EML to files) and while there didn't seem to be a simple Java-based utility to do this, I found the Apache Mime4J libraries to be very useful (and easier than JavaMail).
You can find the code I shared here: How to read or parse MHTML (.mht) files in java
For your case, to build an MHTML, if you can't find anything simpler, approach could be:
Create a Message object which has a Multipart body.
Read all files in a folder using Streams, append these as BodyParts of the Multipart with their mime-type (Mime4j includes a Base64 stream encoder/decoder).
Ensure the references in the html page point to the necessary body parts (may be able to embed their original filename as reference?).
Write the Message object to mht file or a response stream.

Load local image, modify it and save back to same file

File input allows user to access a local file from browser. Is it possible to load a local file given by file input, modify it and save it back to same local file? I know that HTML5 allows creating writeable filesystem, but basically it seems to be abstract directory.
For security reasons, I don't think the browser can overwrite the local file. Using the File-System API you could only copy the contents of the local file to the sandboxed File-System API directory(found under various obfuscated file names). All manipulation/saving would be done in AppData.
Perhaps displaying the modified image on the screen, right click, save-as to the given file location would also be suitable? (other than that I think you have to upload the image to a server and download it back again)