From 3203dc6198b714adeea6ba3ca5a4d7384330983a Mon Sep 17 00:00:00 2001 From: "Toerd@archlinux" Date: Wed, 29 Jul 2020 12:53:51 +0200 Subject: [PATCH] new: fetch grades from primuss --- higherlowergame.com.js | 1 + noten.sh | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 higherlowergame.com.js create mode 100755 noten.sh diff --git a/higherlowergame.com.js b/higherlowergame.com.js new file mode 100644 index 0000000..d03e915 --- /dev/null +++ b/higherlowergame.com.js @@ -0,0 +1 @@ +temp1.forEach( e => { if (e.keyword === document.getElementsByClassName("term-keyword__keyword")[1].innerText.slice(1,-1) ) console.log(e.searchVolume)}) \ No newline at end of file diff --git a/noten.sh b/noten.sh new file mode 100755 index 0000000..d660a8d --- /dev/null +++ b/noten.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# author: phga +# date: 2020-07-28 +# desc: Script to fetch grades from primuss...Not more, not less + +DEST="https://www3.primuss.de/cgi-bin/login/index.pl?FH=fhin" +NOTEN="https://www3.primuss.de/cgi-bin/pg_Notenbekanntgabe/index.pl" +SHIBBLE="https://www3.primuss.de/Shibboleth.sso/SAML2/POST" +FU="https://www3.primuss.de/cgi-bin/pg_Notenbekanntgabe/showajax.pl" + +USERNAME=phg0107 +PASSWORD=lelelele + +COOKIES=.cookies +HEADERS=.headers +rm $COOKIES +rm $HEADERS + +curl -s -L -c $COOKIES -D $HEADERS "$DEST" > /dev/null +LOGIN=$(cat $HEADERS | rg -o -e "Location: (.*)" -r '$1' | tail -1 | sed 's/\;.*?/?/') +# Remove trailing \r +LOGIN=${LOGIN%$'\r'} +# This was quite helpful to look at the POST data and headers sent by client +# --trace-ascii stdout +# The param format and -d option were super crucial for this shit to work +VALS=($(curl -s -b $COOKIES -c $COOKIES -d "j_username=$USERNAME&j_password=$PASSWORD&_eventId_proceed=" $LOGIN | rg -o -e 'value="(.*)"' -r '$1')) +RELAYSTATE=$(echo ${VALS[0]} | sed 's/:/%3A/g') +# OIDDDAAAA die Plus-Zeichen eyyyy >:( +SAMLRESP=$(echo ${VALS[1]} | sed 's/=/%3D/g' | sed 's/+/%2B/g') +SESSION=$(curl -L -s -b $COOKIES -c $COOKIES -d "RelayState=$RELAYSTATE&SAMLResponse=$SAMLRESP" $SHIBBLE | rg -o -e 'name="Session" value="(.*)"' -r '$1' | head -1) +AJAXDATA=$(curl -s -b $COOKIES -c $COOKIES -d "User=$USERNAME&Session=$SESSION&Language=de&FH=fhin&Portal=1" $NOTEN | rg -o -e 'data: *"(.*)"' -r '$1' | head -1) +# Finally... +curl -s -b $COOKIES -c $COOKIES -d $AJAXDATA $FU | awk 'f{ if (/<\/tbody>/){printf "%s", buf; f=0; buf=""} else buf = buf $0 ORS}; //{f=1}' | rg -o -e '(.*)' -r '$1' +# Pipe output to file and if require perform futher formatting