Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix password retrieval #46

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions cashandler.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ rm -f $cookie
rm -f $header_dump

# Visit CAS and get a login form. This includes a unique ID for the form, which we will store in cas_id and attach to our form submission. jsessionid cookie will be set here
cas_id=`curl -s -k -c $cookie https://$cas_hostname/cas/login?service=$dest | grep name=.lt | sed 's/.*value..//' | sed 's/\".*//'`
cas_id=`curl -s -k -c $cookie https://$cas_hostname/cas/login?service=$dest | grep name=\"execution\" | sed 's/\"\/>.*//' | sed 's/.*value=\"//'`

if [[ "$cas_id" = "" ]]; then
printf '%s\n' "Login ticket is empty."
exit 1
fi

# Submit the login form, using the cookies saved in the cookie jar and the form submission ID just extracted. We keep the headers from this request as the return value should be a 302 including a "ticket" param which we'll need in the next request
curl -s -k --data "username=$username&password=$password&lt=$cas_id&execution=e1s1&_eventId=submit" -i -b $cookie -c $cookie https://$cas_hostname/cas/login?service=$dest -D $header_dump -o /dev/null
curl -s -k --data "username=$username&password=$password&execution=$cas_id&_eventId=submit&geolocation=&submit=LOGIN" -i -b $cookie -c $cookie https://$cas_hostname/cas/login?service=$dest -D $header_dump -o /dev/null

# Visit the URL with the ticket param to finally set the casprivacy and, more importantly, MOD_AUTH_CAS cookie. Now we've got a MOD_AUTH_CAS cookie, anything we do in this session will pass straight through CAS
curl_dest=`grep Location $header_dump | sed 's/Location: //'`
Expand Down
2 changes: 1 addition & 1 deletion config.sample
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ macchanger_enabled="$MAC_ENABLED"
macchanger_options="-e"

# Settings for passwordhandler, edit `dest` for other CAS-destination, if desired.
dest="https://wifipassword.aau.dk/oneday"
dest="http://wifipassword.aau.dk/oneday"
password_html_file="/tmp/chwifi-passwords.html"
password_file="$XDG_CONFIG_HOME/passwords"

Expand Down