Aktueller Stand kombiniert mit Änderungen von gestern

This commit is contained in:
Julian Hahn 2026-04-22 10:51:45 +02:00
parent 3794413541
commit 95f216ffe6
4 changed files with 51 additions and 33 deletions

View File

@ -10,4 +10,17 @@ Dauer des shell scripts: ca. 1h (testen mit `time ./usr/bin/lamapoll-dsgvo.sh`)
## Installation ## Installation
Nach Herunterladen und Entpacken des Repositories, einfach das install.sh ausführen als Root oder mit "sudo" und das sollte sich um den Rest kümmern. Nach Herunterladen und Entpacken des Repositories, einfach das install.sh ausführen als Root oder mit "sudo" und das sollte sich um den Rest kümmern.
1. Repository als .zip Herunterladen
2. zu finden unter: `home/vorname.nachname/Downloads/Lamapoll_DSGVO_script-main.zip`
3. unzippen `vorname.nachname@wmde-123456:~/Downloads$ unzip Lamapoll_DSGVO_script-main.zip`
4. In den neu enstandenen Ordner navigieren und das Installationsskript ausführbar machen: `vorname.nachname@wmde-123456:~/Downloads/lamapoll_dsgvo_script$ chmod +x install.sh`
5. Installationsskript ausführen: vorname.nachname@wmde-123456:~/Downloads/lamapoll_dsgvo_script$ sudo ./install.sh
## Benutzung
Im Startmenü sollte nach der Installation der Eintrag `LamapollDSGVO` findbar sein. Beim Ausführen wird automatisch ein Terminal geöffnet, welches alle Informationen abfragt bevor die Suche startet.
Nach der Suche wird automatisch ein Text Editor geöffnet, der alle Ergebnisse zusammengefasst anzeigt.
Um Daten zu schützen, wird diese Datei nach dem Schließen des Texteditors gelöscht, genauso wie alle Zwischenergebnisse.

View File

@ -1,4 +1,4 @@
#! /bin/bash #!/bin/bash
# fact checking # fact checking
PATH="$(/usr/bin/pwd)" PATH="$(/usr/bin/pwd)"
@ -16,16 +16,4 @@ echo $USER
/usr/bin/sudo -u $USER desktop-file-install --dir=/home/$USER/.local/share/applications /usr/share/applications/lamapolldsgvo.desktop /usr/bin/sudo -u $USER desktop-file-install --dir=/home/$USER/.local/share/applications /usr/share/applications/lamapolldsgvo.desktop
/usr/bin/sudo -u $USER update-desktop-database -v /home/$USER/.local/share/applications /usr/bin/sudo -u $USER update-desktop-database -v /home/$USER/.local/share/applications
echo "Installation done." echo "Installation done."
/usr/bin/rm -f /tmp/api.keys 2>&1 >/dev/null
/usr/bin/touch /tmp/api.keys
/usr/bin/chown $USER:$USER /tmp/api.keys
MORE="y"
while [ $MORE == "y" ]; do
read -p "Bitte API Key eingeben: " API
API=${API:-}
echo $API >> /tmp/api.keys
read -p "Weitere API Keys eingeben? [y/N] " MORE
MORE=${MORE:-N}
done

View File

@ -1,12 +1,25 @@
#! /bin/bash #!/bin/bash
file_path="/tmp/api.keys" USER=$(whoami)
file_path="/home/$USER/Dokumente/api.keys"
if ! test -f $file_path; then if ! test -f $file_path; then
echo "Keine API Keys gefunden. Bitte eine 'api.keys' Datei in /tmp/ ablegen" echo "Keine API Keys gefunden. Bitte eine 'api.keys' Datei in /home/$USER/Dokumente/ ablegen"
exit 1 exit 1
fi fi
#/usr/bin/rm -f /home/$USER/Dokumente/api.keys 2>&1 >/dev/null
#/usr/bin/touch /home/$USER/Dokumente/api.keys
#/usr/bin/chown $USER:$USER /home/$USER/Dokumente/api.keys
#MORE="y"
#while [ $MORE == "y" ]; do
# read -p "Bitte API Key eingeben: " API
# API=${API:-}
# echo $API >> /tmp/api.keys
# read -p "Weitere API Keys eingeben? [y/N] " MORE
# MORE=${MORE:-N}
#done
echo "Im Folgenden werden die Daten abgefragt nach denen gesucht werden soll. Bitte mit ENTER bestätigen." echo "Im Folgenden werden die Daten abgefragt nach denen gesucht werden soll. Bitte mit ENTER bestätigen."
read -p "Vorname [wird nicht gesucht wenn leer]: " VORNAME read -p "Vorname [wird nicht gesucht wenn leer]: " VORNAME
VORNAME=${VORNAME:-} VORNAME=${VORNAME:-}
@ -25,9 +38,9 @@ for line in $(cat "$file_path"); do
## WMDE-Survey Respondents ("Adressbuch") ## WMDE-Survey Respondents ("Adressbuch")
rm -f /tmp/survey-$line-adress.json rm -f /tmp/survey-$line-adress.json
echo "[]" > /tmp/survey-$line-adress.json echo "[]" > /tmp/survey-$line-adress.json
for POLL in $(curl -s -X GET -H "Authorization: Bearer 643M34DK" https://app.lamapoll.de/api/v2/polls?limit=1000 | jq -r '.[] | .id'); do for POLL in $(curl -s -X GET -H "Authorization: Bearer $line" https://app.lamapoll.de/api/v2/polls?limit=1000 | jq -r '.[] | .id'); do
curl -s -X GET -H "Authorization: Bearer 643M34DK" https://app.lamapoll.de/api/v2/polls/${POLL}/respondents -s | jq -r '.' > /tmp/survey-$line-adress-$POLL.json curl -s -X GET -H "Authorization: Bearer $line" https://app.lamapoll.de/api/v2/polls/${POLL}/respondents -s | jq -r '.' > /tmp/survey-$line-adress-$POLL.json
jq '. += (inputs)' /tmp/survey-$line-adress.json /tmp/survey-$line-adress-$POLL.json > temp.json && mv temp.json /tmp/survey-$line-adress.json && rm /tmp/survey-$line-adress-$POLL.json ; done jq '. += (inputs)' /tmp/survey-$line-adress.json /tmp/survey-$line-adress-$POLL.json > /tmp/temp.json && mv /tmp/temp.json /tmp/survey-$line-adress.json && rm /tmp/survey-$line-adress-$POLL.json ; done
# filter surveys for values and extract id, pollId, name, email # filter surveys for values and extract id, pollId, name, email
rm -f /tmp/results-survey-$line-adress.json rm -f /tmp/results-survey-$line-adress.json
@ -36,9 +49,8 @@ for line in $(cat "$file_path"); do
for var_name in "${vars[@]}"; do for var_name in "${vars[@]}"; do
value="${!var_name}" value="${!var_name}"
if [[ -n "$value" ]]; then if [[ -n "$value" ]]; then
echo "$var_name = $value"
cat /tmp/survey-$line-adress.json | jq --arg TEST "$value" '.[] | select((.name | test($TEST; "i")) or (.email | test($TEST; "i"))) | {pollId, id, name, email}' > /tmp/survey-$line-adress-$var_name.json cat /tmp/survey-$line-adress.json | jq --arg TEST "$value" '.[] | select((.name | test($TEST; "i")) or (.email | test($TEST; "i"))) | {pollId, id, name, email}' > /tmp/survey-$line-adress-$var_name.json
jq '. += [(inputs)]' /tmp/results-survey-$line-adress.json /tmp/survey-$line-adress-$var_name.json > temp.json && mv temp.json /tmp/results-survey-$line-adress.json && rm /tmp/survey-$line-adress-$var_name.json jq '. += [(inputs)]' /tmp/results-survey-$line-adress.json /tmp/survey-$line-adress-$var_name.json > /tmp/temp.json && mv /tmp/temp.json /tmp/results-survey-$line-adress.json && rm /tmp/survey-$line-adress-$var_name.json
fi fi
done done
# filter double finds # filter double finds
@ -47,9 +59,9 @@ for line in $(cat "$file_path"); do
## WMDE-Survey Results ("Freitextsuche") ## WMDE-Survey Results ("Freitextsuche")
rm -f /tmp/survey-$line-freetext.json rm -f /tmp/survey-$line-freetext.json
echo "[]" > /tmp/survey-$line-freetext.json echo "[]" > /tmp/survey-$line-freetext.json
for POLL in $(curl -s -X GET -H "Authorization: Bearer 643M34DK" https://app.lamapoll.de/api/v2/polls?limit=1000 | jq -r '.[] | .id'); do for POLL in $(curl -s -X GET -H "Authorization: Bearer $line" https://app.lamapoll.de/api/v2/polls?limit=1000 | jq -r '.[] | .id'); do
curl -s -X GET -H "Authorization: Bearer 643M34DK" https://app.lamapoll.de/api/v2/polls/${POLL}/results -s | jq --arg POLL "${POLL}" -r '. | .pollId = $POLL' > /tmp/survey-$line-freetext-$POLL.json curl -s -X GET -H "Authorization: Bearer $line" https://app.lamapoll.de/api/v2/polls/${POLL}/results -s | jq --arg POLL "${POLL}" -r '. | .pollId = $POLL' > /tmp/survey-$line-freetext-$POLL.json
jq '. += [(inputs)]' /tmp/survey-$line-freetext.json /tmp/survey-$line-freetext-$POLL.json > temp.json && mv temp.json /tmp/survey-$line-freetext.json && rm /tmp/survey-$line-freetext-$POLL.json ; done jq '. += [(inputs)]' /tmp/survey-$line-freetext.json /tmp/survey-$line-freetext-$POLL.json > /tmp/temp.json && mv /tmp/temp.json /tmp/survey-$line-freetext.json && rm /tmp/survey-$line-freetext-$POLL.json ; done
cat /tmp/survey-$line-freetext.json | tr -cd '\11\12\40-\176' > /tmp/survey-$line-freetext-removed.json cat /tmp/survey-$line-freetext.json | tr -cd '\11\12\40-\176' > /tmp/survey-$line-freetext-removed.json
rm /tmp/survey-$line-freetext.json rm /tmp/survey-$line-freetext.json
@ -62,18 +74,23 @@ for line in $(cat "$file_path"); do
value="${!var_name}" value="${!var_name}"
if [[ -n "$value" ]]; then if [[ -n "$value" ]]; then
cat /tmp/survey-$line-freetext.json | jq --arg TEST "$value" '.[] | {name: .name, pollId: .pollId, results: .results[] | select(.groups[].labels[] | test($TEST; "i")) | {question: .question, questionId: .questionId, labels: [.groups[].labels[] | select(test($TEST; "i"))]}}' > /tmp/survey-$line-freetext-$var_name.json cat /tmp/survey-$line-freetext.json | jq --arg TEST "$value" '.[] | {name: .name, pollId: .pollId, results: .results[] | select(.groups[].labels[] | test($TEST; "i")) | {question: .question, questionId: .questionId, labels: [.groups[].labels[] | select(test($TEST; "i"))]}}' > /tmp/survey-$line-freetext-$var_name.json
jq '. += [(inputs)]' /tmp/results-survey-$line-freetext.json /tmp/survey-$line-freetext-$var_name.json > temp.json && mv temp.json /tmp/results-survey-$line-freetext.json && rm /tmp/survey-$line-freetext-$var_name.json jq '. += [(inputs)]' /tmp/results-survey-$line-freetext.json /tmp/survey-$line-freetext-$var_name.json > /tmp/temp.json && mv /tmp/temp.json /tmp/results-survey-$line-freetext.json && rm /tmp/survey-$line-freetext-$var_name.json
fi fi
done done
done done
IFS="$old_IFS" IFS="$old_IFS"
echo "Suche beendet. Ergebnisse sind:"
old_IFS="$IFS" old_IFS="$IFS"
IFS=$'\n' IFS=$'\n'
rm -f /tmp/resultfile.json 2>&1 >/dev/null
touch /tmp/resultfile.json
for line in $(cat "$file_path"); do for line in $(cat "$file_path"); do
cat /tmp/results-survey-$line-adress.json cat /tmp/results-survey-$line-adress.json >> /tmp/resultfile.json
cat /tmp/results-survey-$line-freetext.json echo "" >> /tmp/resultfile.json
cat /tmp/results-survey-$line-freetext.json >> /tmp/resultfile.json
echo "" >> /tmp/resultfile.json
done done
IFS="$old_IFS" IFS="$old_IFS"
/usr/bin/gnome-text-editor /tmp/resultfile.json
rm -f /tmp/resultfile.json
rm -f /tmp/results-survey*.json

View File

@ -1,7 +1,7 @@
[Desktop Entry] [Desktop Entry]
Name=LamapollDSGVO Name=LamapollDSGVO
Comment=Filter all Survey answers for occurences of the searched answers Comment=Filter all Survey answers for occurences of the searched answers
Exec=gnome-terminal -- "bash /usr/local/bin/lamapoll-DSGVO.sh" Exec=bash /usr/local/bin/lamapoll-DSGVO.sh
Icon=utilities-terminal Icon=utilities-terminal
Terminal=true Terminal=true
Type=Application Type=Application