mitmdump: temporarily running out of diskspace corrupts dumpfile
See original GitHub issueProblem Description
ofcourse the world would be a better place if everybody always responsibly managed their filesystem space, but we have to face that fact that mitmdump, as a non-interactive dumping tool, is often going to be the program that fills up the last available block on a filesystem.
currently it deals with that situation very badly:
- it keeps running, and keeps trying to write to the file
- which in part is good, because it will resume saving data when space becomes available again
- the last flow it tried to write is left in the file half-written and truncated, which due to the length-prefixed data format leads to the file being corrupt and not loadable with the provided tools.
due to this situation i already learned more about the file format than i ever wanted to 😉 the key to recovering data in such a corrupted file is:
grep -oE --binary-files=text --byte-offset '[0-9]+:7:version;'
(and i wrote a script that automates the process)
but it would be better to fix this in mitmdump itself. suggestions:
- on a failed write, truncate the file back to it’s previous length
- on a failed write, exit with an error
- maybe provide a tool to recover data from corrupted files
Steps to reproduce the behavior:
log more data than is good for you
System Information
any version i ever used
Issue Analytics
- State:
- Created 3 years ago
- Comments:12 (7 by maintainers)
Top Results From Across the Web
mitmdump memory usage is always constantly growing #4456
i use mitmdump for interactive browsing a lot. that is, i run an mitmdump instance continuously, and use it from multiple browsers on...
Read more >Examples - mitmproxy docs
shutdown.py — A simple way of shutting down the mitmproxy instance to stop everything. http-stream-modify.py — Modify a streamed response. io-write-flow-file.py ...
Read more >Source - GitHub
02 November 2022: mitmproxy 9.0.1 * The precompiled binaries now ship with ... @pauloromeira) * Add example addon to dump contents to files...
Read more >2.5 PDF - Scrapy Documentation
which demands significantly more disk space than Anaconda. 1. Download and execute ... --output or -o: dump scraped items to a file.
Read more >Cuckoo Sandbox Book - Read the Docs
With the new Cuckoo structure in-place all storage is now, by default, ... Double-check your configuration files with an eye out for ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
mitmproxy now at least exits on a full disk. Truncating the file back to its previous length isn’t trivial unfortunately, calling
f.truncate(pos)
on a full disk just raises anotherdisk full
error. Not sure what’s the best way to approach this as we can’t easily reopen from within FlowWriter. 🙃the baseline should be to not ignore the error, and exit. creating a warning in advance could be nice to have on top, as also pointed out by mhils: