Last active
September 11, 2016 15:48
-
-
Save vgmoose/8533207 to your computer and use it in GitHub Desktop.
spire thing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
USER='USERNAME' # edit this | |
PASS='PASSWORD' # edit this | |
rm cookies.txt | |
COOKIES='cookies.txt' | |
USER_AGENT='Firefox/3.5' | |
curl --silent -X GET 'https://spire.umass.edu' --user-agent $USER_AGENT --cookie $COOKIES --cookie-jar $COOKIES --location >/dev/null | |
curl --silent -X POST 'https://www.spire.umass.edu/psp/heproda/' --user-agent $USER_AGENT --data-urlencode "userid=${USER}" --data-urlencode "pwd=${PASS}" --data-urlencode "languageCd=ENG" --data-urlencode "timezoneOffset=0" --data-urlencode "Submit=Go" --data-urlencode "cmd=login" --cookie $COOKIES --cookie-jar $COOKIES >/dev/null | |
curl --silent -X GET 'https://www.spire.umass.edu/psp/heproda/EMPLOYEE/HRMS/c/SA_LEARNER_SERVICES.SSS_STUDENT_CENTER.GBL?FolderPath=PORTAL_ROOT_OBJECT.HCCC_ACADEMIC_RECORDS.HC_SSS_STUDENT_CENTER&IsFolder=false&IgnoreParamTempl=FolderPath%2cIsFolder' --user-agent $USER_AGENT --cookie $COOKIES --cookie-jar $COOKIES > /dev/null |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import subprocess, sys | |
# sychonrously run shell command | |
def understand(input): | |
try: | |
a = subprocess.check_output(input+" 2> .error", shell=True) | |
except Exception as e: | |
return str(subprocess.check_output("cat .error", shell=True)[:-1]) | |
return a | |
def say(s): | |
print(s) | |
a = understand("./check_cart.sh") | |
while (a.find("Moved Temporarily") >0 or a.find("thoriz") > 0): | |
understand("./auth.sh"); | |
a = understand("./check_cart.sh") | |
if (understand("echo \""+a+"\" | wc -l").lstrip(" ").rstrip("\n") == "3"): | |
say("Quickly, the class is open! http://spire.umass.edu"); | |
elif (a == ""): | |
say("The discussion is closed, you need to change it! http://spire.umass.edu"); | |
elif (understand("echo \""+a+"\" | wc -l").lstrip(" ").rstrip("\n") != "2"): | |
say(understand("echo \""+a+"\" | wc -l").lstrip(" ") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
IFRAME='https://www.spire.umass.edu/psc/heproda/EMPLOYEE/HRMS/c/SA_LEARNER_SERVICES_2.SSR_SSENRL_CART.GBL?FolderPath=PORTAL_ROOT_OBJECT.HCCC_ENROLLMENT.HC_SSR_SSENRL_CART_GBL2&IsFolder=false&IgnoreParamTempl=FolderPath%2cIsFolder' | |
# Enter the following in the address bar: | |
# javascript:alert(document.getElementById("ptifrmtgtframe").src); | |
COOKIES='cookies.txt' | |
USER_AGENT='Firefox/3.5' | |
curl --silent -X GET $IFRAME --user-agent $USER_AGENT --cookie $COOKIES --cookie-jar $COOKIES > result.html | |
cat result.html | grep "\"Open\"\|Moved\|thoriz" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment