-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsource
More file actions
119 lines (105 loc) · 3.83 KB
/
source
File metadata and controls
119 lines (105 loc) · 3.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
#!/bin/bash
if [ "$1" = "-n" ]; then
echo ""
echo -n "Register Number: "
read REGISTER
echo -n "Password: "
read -s P
echo
PASSWORD=`echo -n $P | openssl dgst -sha512`
LEN=`expr ${#PASSWORD} - 9`
PASSWORD=${PASSWORD:9:$LEN}
else
REGISTER="XXXXXX"
PASSWORD="YYYYYY"
fi
if [ "$REGISTER" = "XXXXXX" ]; then
echo "Hey, Please install properly to stop seeing this message! Execute the following Command"
echo "cd ~/ACOE-Result-Command-Line && sudo make install"
echo
echo "To check the result manually, execute the following command"
echo "auresult -n"
fi
if curl -s --connect-timeout 10 --data "user=$R&password=&p=$P" https://acoe.annauniv.edu/student/process_login.php > /dev/null; then
echo "Server is fine!"
else
echo "Server is not responding, Please try after sometime"
exit 0
fi
curl -c .c0.txt -s --data "user=$REGISTER&password=&p=$PASSWORD" https://acoe.annauniv.edu/student/process_login.php
curl -s -b .c0.txt https://acoe.annauniv.edu/student/result.php > .temp
if python -c "from bs4 import BeautifulSoup" 2> /dev/null; then
echo -n "."
else
sudo apt-get install python-pip && sudo pip install bs4
fi
if python -c "from prettytable import PrettyTable" 2> /dev/null; then
echo -n "."
else
sudo apt-get install python-pip && sudo pip install prettytable
fi
echo
echo '
from bs4 import BeautifulSoup
from prettytable import PrettyTable
import csv, sys, urllib2
grades = {"S":10.0, "A":9.0, "B":8.0, "C":7.0, "D":6.0, "E":5.0, "U":0.0, "W":0.0}
credits = {}
result_arr = {}
def get_result():
page = open("./.temp", "r").read()
soup = BeautifulSoup(page, "html.parser")
results = soup.findAll("table")
res = ["REGULAR", "ARREAR", "REVALUATION"]
i = 0
for result in results:
if result.findParent("table") is None:
print "\t\t\t\t%s" % res[i]
t = PrettyTable(["Subject Code", "Subject Name", "Grade"])
for tr in result.find_all("tr")[1:]:
tds = tr.find_all("td")
t.add_row([tds[0].text, tds[1].text, tds[2].text])
result_arr[tds[0].text] = tds[2].text
print t
print "\n"
i+=1
def credit_set():
url = urllib2.urlopen("https://gist.githubusercontent.com/prabhakaran9397/3f100b326c96aa4a60187ee82fc10e06/raw/9f01a3f5af9e436b3780b830c5204d543d5209f1/credits.txt")
content = url.read()
credits_file = BeautifulSoup(content, "html.parser").string
credits_bundle = map(str, credits_file.split("\n"))
for i in credits_bundle:
if len(i) > 0:
row = map(str, i.split())
credits.setdefault(row[0], row[1])
if __name__ == "__main__":
credit_set()
get_result()
total_credits = 0.0
total_acc = 0.0
for sub_code in result_arr:
total_credits += float(credits[sub_code])
total_acc += float(credits[sub_code])*float(grades[result_arr[sub_code]])
gpa = total_acc/total_credits
print "========================> GPA:", gpa , "<========================\n"
' > .display.py
python .display.py
echo "Enter 1 to download Regular Result; 2 to download Arrear Result; 3 to download Revaluation Result; any other to exit"
echo -n "> "
read pdfchoice
if [ "$pdfchoice" = "1" ]; then
pdfname="_Regular_Result.pdf"
curl -s -o "$REGISTER$pdfname" -b .c0.txt https://acoe.annauniv.edu/student/result_print.php
echo "Downloaded as $REGISTER$pdfname"
elif [ "$pdfchoice" = "2" ]; then
pdfname="_Arrear_Result.pdf"
curl -s -o "$REGISTER$pdfname" -b .c0.txt https://acoe.annauniv.edu/student/arr_print.php
echo "Downloaded as $REGISTER$pdfname"
elif [ "$pdfchoice" = "3" ]; then
pdfname="_Reval_Result.pdf"
curl -s -o "$REGISTER$pdfname" -b .c0.txt https://acoe.annauniv.edu/student/reval_print.php
echo "Downloaded as $REGISTER$pdfname"
else
echo 'exiting'
fi
rm .display.py .c0.txt .temp