diff --git a/flake.nix b/flake.nix index dfca189..d08e135 100644 --- a/flake.nix +++ b/flake.nix @@ -19,9 +19,7 @@ name = "reports"; runtimeInputs = [ pkgs.dmarc-report-converter - pkgs.gnutar pkgs.python3 - pkgs.unzip ]; text = (builtins.readFile ./reports.sh); }; diff --git a/reports.sh b/reports.sh index a19abf5..eb8b6e1 100644 --- a/reports.sh +++ b/reports.sh @@ -3,32 +3,6 @@ PORT=8080 mkdir -p "$WORKDIR"/xml mkdir -p "$WORKDIR"/html -extract-zips() { - echo "extracting zipped reports" - for i in "$WORKDIR"/xml/*.zip; do - unzip "$i" -d "$WORKDIR/xml" && rm -r "$i" - done -} -extract-tars() { - echo "extracting tarred reports" - for i in "$WORKDIR"/xml/*.tar.gz; do - tar xzvf "$i" -C "$WORKDIR/xml" && rm -r "$i" - done -} - -# extract zips if they exist -# count_zips=$(ls -1 "$WORKDIR"/xml/*.zip 2>/dev/null | wc -l) -mapfile -t count_zips < <(find "$WORKDIR"/xml/ -maxdepth 1 -name "*.zip" -type f) -if [ "${#count_zips[@]}" -gt 0 ]; then - extract-zips -fi -# extract tars if they exist -# count_tars=$(ls -1 "$WORKDIR"/xml/*.tar.gz 2>/dev/null | wc -l) -mapfile -t count_tars < <(find "$WORKDIR"/xml/ -maxdepth 1 -name "*.tar.gz" -type f) -if [ "${#count_tars[@]}" -gt 0 ]; then - extract-tars -fi - echo "converting reports to html" dmarc-report-converter echo "open filewall port"