Skip to content

Commit f20ae7d

Browse files
authored
Kommentare hinzugefügt
1 parent e8fa2e5 commit f20ae7d

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

invote_bot.sh

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,28 @@
11
#!/usr/bin/env bash
22

33
umfrageid=$1
4+
5+
# Zufallszahl erzeugen, damit jeden Antwort einzigartig ist
46
start=$(echo $RANDOM)
57

8+
# Seite abspeichern
69
link=$(echo "https://tud.invote.de/$umfrageid")
710
curl $link >> seite.txt
811

12+
# wichtige Elemente der Seite aus dem HTML-Quelltext ausschneiden mit hxselect
913
ueberschrift=$(cat seite.txt | ~/bin/hxselect -s "\n" h2 | head -n 1 | ~/bin/hxselect -c h2)
10-
1114
frage=$(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-
1315
curl $link | ~/bin/hxselect -s "\n" -c p.antwort.mc >> antworten.txt
16+
17+
# Anzahl der Antworten bestimmen
1418
anzahl=$(cat antworten.txt | wc -l | tr -d '[:space:]')
19+
20+
# Arrays für die Antworten und zugehörige Infos erstellen
1521
declare -a antwortbuchstabe
1622
declare -a antwortArray
1723
declare -a values
24+
25+
# Antworten und Infos in die Arrays füllen
1826
for (( 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

4654
echo "Es wird für ${antwortbuchstabe[$spamZahl]}: ${antwort[$spamZahl]} $spamAnzahl mal gestimmt."
4755

56+
# Antworten erstellen und abschicken
4857
for (( 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."
5160
done
5261

53-
54-
62+
# nicht mehr benötigte Dateien löschen
5563
rm antworten.txt
5664
rm seite.txt

0 commit comments

Comments
 (0)