sensepost / gowitness

🔍 gowitness - a golang, web screenshot utility using Chrome Headless
GNU General Public License v3.0
2.79k stars 322 forks source link

Snap-Chromium eating disk space #200

Open bouncingcandle opened 9 months ago

bouncingcandle commented 9 months ago

Describe the bug As Snap Chromium is used for GoWitness, it will fill up the '/tmp' directory until is has either finished or disk usage is at 100%.

To Reproduce Steps to reproduce the behaviour:

  1. Have a list of subdomains 9190 lines long
  2. Have 9GB of disk space free
  3. Run GoWitness
  4. Wait for Subdomain on line ~4713 to be reached
  5. See process has hung and disk usage is 100%

Expected behaviour Disk not the be filled up and clutter to be automatically removed.

Version Information:

Additional context I have a list of 9190 subdomains. My tmp folder was empty, as I had just recently restarted my server. Upon checking back a day later, I noticed it had hung and when checking my disk usage, I was a 100% with 6.9GB '/tmp' folder, 6.9GB of which being '/tmp/snap-private-tmp/snap.chromium'. I checked what line the last subdomain was at, and it only made it to line 4713 before reaching 100% disk usage.

bouncingcandle commented 9 months ago

I should also add that in '/tmp/snap-private-tmp/snap.chromium/tmp' I have 2756 folders of 'chromedp-runner' profiles.

bouncingcandle commented 9 months ago

I just want to add my workaround just in case anyone faces the same issue, it may not be desirable but it works: DISCLAIMER: Only do this is you're ONLY using Snap Chromium for GoWitness. This will delete any profiles or runners you have setup for your headless Chromium or other tools/scripts.

Add user ALL=(ALL:ALL) NOPASSWD: /bin/rm -rf /tmp/snap-private-tmp/snap.chromium to the bottom of /etc/sudoers

Before running GoWitness:

mkdir "https-split" && cd "$_"
split -l 500 "../https.txt"
cd ..

Then run GoWitness with:

for file in https-split/*; do
  gowitness file -X 2560 -Y 1440 -F -f "$file" -t 1
  sudo rm -rf /tmp/snap-private-tmp/snap.chromium*
done