Skip to content

Instantly share code, notes, and snippets.

@basham basham/README.md
Last active Aug 29, 2015

Embed
What would you like to do?
Static KRAD Sample App

Instructions

Start KRAD Sample App. Then run the following shell script.

bash static-krad-sampleapp.sh
#!/bin/sh
#
# http://www.gnu.org/software/wget/manual/wget.html
#
# -m --mirror
# -p --page-requisites (page dependencies)
# -k --convert-links (change references)
# -E --adjust-extension (add .html, etc)
# -O --output-document=file
# -P --directory-prefix=prefix
# -a --append-output=logfile
# -o --output-file=logfile (overwrite log)
# Download the login page.
#wget -O login.html http://localhost:8080/krad-dev/
wget --save-cookies cookies.txt --keep-session-cookies -O login.html http://localhost:8080/krad-dev/
# Extract the hidden form data and transform them into URL parameters.
hiddenData=`grep value < login.html | grep -v script | grep -v login_user | tr '=' ' ' | awk '{print $5"="$7}' | sed s/\"//g | tr '\n' '&'`
# Remove the login page.
rm login.html
# Add the login credentials.
postData=login_user=admin'&'${hiddenData}
# Send the post data, login, and mirror the site.
wget --load-cookies cookies.txt --save-cookies cookies.txt --keep-session-cookies -m -p -k -E --post-data ${postData} http://localhost:8080/krad-dev/kr-login/login
echo $postData
@basham

This comment has been minimized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.