File tree Expand file tree Collapse file tree 1 file changed +12
-4
lines changed
Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Original file line number Diff line number Diff line change 11#! /usr/bin/env bash
22
33umfrageid=$1
4+
5+ # Zufallszahl erzeugen, damit jeden Antwort einzigartig ist
46start=$( echo $RANDOM )
57
8+ # Seite abspeichern
69link=$( echo " https://tud.invote.de/$umfrageid " )
710curl $link >> seite.txt
811
12+ # wichtige Elemente der Seite aus dem HTML-Quelltext ausschneiden mit hxselect
913ueberschrift=$( cat seite.txt | ~ /bin/hxselect -s " \n" h2 | head -n 1 | ~ /bin/hxselect -c h2)
10-
1114frage=$( cat seite.txt | ~ /bin/hxselect -s " \n" -c p.mc | ~ /bin/hxselect -c strong | head -n 2 | tail -n 1 | sed -e ' s/^[[:space:]]*//' )
12-
1315curl $link | ~ /bin/hxselect -s " \n" -c p.antwort.mc >> antworten.txt
16+
17+ # Anzahl der Antworten bestimmen
1418anzahl=$( cat antworten.txt | wc -l | tr -d ' [:space:]' )
19+
20+ # Arrays für die Antworten und zugehörige Infos erstellen
1521declare -a antwortbuchstabe
1622declare -a antwortArray
1723declare -a values
24+
25+ # Antworten und Infos in die Arrays füllen
1826for (( i = 1 ; i <= $anzahl ; i++ )) ; do
1927 antwortbuchstabe[$i ]=$( cat antworten.txt | head -n $i | tail -n 1 | ~ /bin/hxselect -c strong)
2028 values[$i ]=$( cat antworten.txt | head -n $i | tail -n 1 | grep " antwort" | awk -F" \" " ' {print $6}' )
@@ -45,12 +53,12 @@ antwort=$(echo ${values[$spamZahl]})
4553
4654echo " Es wird für ${antwortbuchstabe[$spamZahl]} : ${antwort[$spamZahl]} $spamAnzahl mal gestimmt."
4755
56+ # Antworten erstellen und abschicken
4857for (( i = $start ; i < $start + $spamAnzahl ; i++ )) ; do
4958 curl --data " antwort=$antwort " --data " antwortort+senden" https://tud.invote.de/$umfrageid -H " Cookie: invoteSession=$i ;invote=$i " -s -o /dev/null
5059 echo " Fake-Antwort Nummer $(( $i - $start + 1 )) abgegeben."
5160done
5261
53-
54-
62+ # nicht mehr benötigte Dateien löschen
5563rm antworten.txt
5664rm seite.txt
You can’t perform that action at this time.
0 commit comments