bambi7-service-catchbox

Simple Web-based file storage A/D service for BambiCTF7 in 2022
git clone https://git.sinitax.com/sinitax/bambi7-service-catchbox
Log | Files | Refs | README | sfeed.txt

cleaner (625B)


      1#!/bin/bash
      2
      3while IFS= read -r row; do
      4	path=$(realpath "/service/files/$row")
      5	if [[ "$(dirname "$path")" -ef "/service/files" ]]; then
      6		rm -rf "$path"
      7	fi
      8done < <(sqlite3 /service/db.sqlite \
      9	"SELECT dir FROM files WHERE delet < strftime('%s', 'now')")
     10
     11while IFS= read -r row; do
     12	path=$(realpath "/service/reports/$row")
     13	if [ "$(dirname "$path")" -ef "/service/reports" ]; then
     14		rm -rf "$path"
     15	fi
     16done < <(sqlite3 /service/db.sqlite \
     17	"SELECT file FROM reports WHERE delet < strftime('%s', 'now')")
     18
     19sqlite3 /service/db.sqlite "PRAGMA foreign_keys = ON; \
     20	DELETE FROM users WHERE delet < strftime('%s', 'now')"
     21