Remove code to extract reports

dmarc-report-converter already does this
This commit is contained in:
Andreas Zweili 2024-03-11 10:17:30 +01:00
parent 80963bad95
commit 82fd375392
2 changed files with 0 additions and 28 deletions

View File

@ -19,9 +19,7 @@
name = "reports";
runtimeInputs = [
pkgs.dmarc-report-converter
pkgs.gnutar
pkgs.python3
pkgs.unzip
];
text = (builtins.readFile ./reports.sh);
};

View File

@ -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"