Commit e621d534 authored by Vincent Vanlaer's avatar Vincent Vanlaer
Browse files

Use passwords instead of tokens

Tokens get invalidated from time to time. It is therefore better to use
passwords and let listunserv log itself in.

The exact parameters to send to the login form where obtained by
studying the request the login page sends.

The grep | cut | cut commands extracts the login token from the
response after the login. The token is found in the URL of a <meta>
refresh tag.
parent b997e3ff
#!/bin/sh
LIST="KULSTUD"
LOGIN_TOKEN=""
# token can be obtained from https://ls.kuleuven.be/cgi-bin/wa?INDEX
# log in and if necessary create a new password
# after login the token should be in the URL or in the URL of any link you click on (it is what comes after 'X=')
LOGIN_USER="voornaam.achternaam@student.kuleuven.be"
LOGIN_PASSWORD=""
# Login password can be changed on ls.kuleuven.be
REALNAME="Voornaam+Achternaam"
LOGIN_TOKEN=`curl -d @- -X POST https://ls.kuleuven.be/cgi-bin/wa <<< "LOGIN1=&Y=${LOGIN_USER}&p=${LOGIN_PASSWORD}&e=Log+In&X=" | grep 'X=' | cut -f 5 -d '=' | cut -f 1 -d '"'`
for item in $LIST
do
echo $item
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment