sameerbanchhor-work/RollAnalysis-v2 / probe_sem3_and_ug.py
sameerbanchhor-work's picture
download
raw
6.34 kB
import requests
from bs4 import BeautifulSoup
import json
AJAX_URL = "https://durg.ucanapply.com/get-result-details"
REGULAR_BATCHES_FILE = "regular_private_batches.json"
with open(REGULAR_BATCHES_FILE, 'r', encoding='utf-8') as f:
batches = json.load(f)
batch_map = {b['tt_value']: b for b in batches}
def get_session(url):
s = requests.Session()
s.headers.update({
'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) Chrome/120.0.0.0 Safari/537.36'
})
r = s.get(url, timeout=15)
soup = BeautifulSoup(r.text, 'html.parser')
token = soup.find('input', {'name': '_token'})['value']
payload = {
'COURSECD': soup.find('input', {'name': 'COURSECD'})['value'],
'SEMCODE': soup.find('input', {'name': 'SEMCODE'})['value'],
'RESULTTYPE': soup.find('input', {'name': 'RESULTTYPE'})['value'],
'session': soup.find('input', {'name': 'session'})['value'],
'tcc': soup.find('input', {'name': 'tcc'})['value'],
'p1': '', 'all': ''
}
return s, payload, token
def test_roll(session, payload, token, url, roll):
headers = {
'X-Requested-With': 'XMLHttpRequest',
'X-CSRF-TOKEN': token,
'Referer': url,
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'
}
data = payload.copy()
data['EXAMROLLNUMBER'] = str(roll)
data['_token'] = token
try:
r = session.post(AJAX_URL, data=data, headers=headers, timeout=4)
if r.status_code == 200:
rj = r.json()
if 'html' in rj and len(rj['html']) > 200 and 'No Record Found' not in rj['html']:
return True
except Exception:
pass
return False
# Target 1: B.Ed Sem 3 (TR00000008)
def probe_tr8():
tr = "TR00000008"
b = batch_map[tr]
session, payload, token = get_session(b['link'])
colls = ["335", "341", "351", "352", "358", "366", "369", "374", "305", "307", "333", "334", "338", "339", "340", "370"]
hits = []
print("Probing TR00000008 (B.Ed Sem 3)...")
for c in colls:
for s in range(1, 51):
candidates = [
f"{c}17029{s:03d}", f"17{c}029{s:03d}", f"{c}17023{s:03d}", f"17{c}023{s:03d}",
f"{c}16029{s:03d}", f"{c}18029{s:03d}", f"{c}17029{s:04d}"
]
for r in candidates:
if test_roll(session, payload, token, b['link'], r):
print(f" [HIT] {r}")
hits.append(r)
return hits
# Target 2: M.Sc Bio Tech Sem 3 (TR00000010)
def probe_tr10():
tr = "TR00000010"
b = batch_map[tr]
session, payload, token = get_session(b['link'])
colls = ["333", "334", "335", "337", "338", "341", "331", "339"]
hits = []
print("Probing TR00000010 (M.Sc BioTech Sem 3)...")
for c in colls:
for s in range(1, 31):
candidates = [
f"{c}17089{s:03d}", f"17{c}089{s:03d}", f"{c}16089{s:03d}", f"{c}18089{s:03d}",
f"{c}17089{s:04d}", f"17{c}089{s:04d}"
]
for r in candidates:
if test_roll(session, payload, token, b['link'], r):
print(f" [HIT] {r}")
hits.append(r)
return hits
# Target 3: MSW Sem 1 (TR00000004) & Sem 3 (TR00000005)
def probe_msw():
tr4 = "TR00000004"
tr5 = "TR00000005"
colls = ["303", "304", "305", "307", "331", "332", "333", "334", "335", "337", "338", "339", "340", "341", "351", "352", "501", "101", "102"]
codes = ["125", "074", "126", "045", "046", "124", "075", "127"]
print("Probing MSW Sem 1 (TR00000004)...")
b4 = batch_map[tr4]
s4, p4, t4 = get_session(b4['link'])
hits4 = []
for c in colls:
for cd in codes:
for s in range(1, 15):
for r in [f"{c}18{cd}{s:03d}", f"18{c}{cd}{s:03d}", f"{c}18{cd}{s:04d}"]:
if test_roll(s4, p4, t4, b4['link'], r):
print(f" [HIT Sem1] {r}")
hits4.append(r)
print("Probing MSW Sem 3 (TR00000005)...")
b5 = batch_map[tr5]
s5, p5, t5 = get_session(b5['link'])
hits5 = []
for c in colls:
for cd in codes:
for s in range(1, 15):
for r in [f"{c}17{cd}{s:03d}", f"17{c}{cd}{s:03d}", f"{c}17{cd}{s:04d}"]:
if test_roll(s5, p5, t5, b5['link'], r):
print(f" [HIT Sem3] {r}")
hits5.append(r)
return hits4, hits5
# Target 4: Integrated B.A.-B.Ed (TR00000001) & B.Sc.-B.Ed (TR00000002)
def probe_integrated():
tr1 = "TR00000001"
tr2 = "TR00000002"
colls = ["369", "370", "374", "358", "335", "341", "351", "337"]
print("Probing B.A.-B.Ed Part I (TR00000001)...")
b1 = batch_map[tr1]
s1, p1, t1 = get_session(b1['link'])
hits1 = []
for c in colls:
for s in range(1, 25):
candidates = [
f"9{c}144{s:03d}", f"18{c}144{s:03d}", f"{c}18144{s:03d}", f"9{c}144{s:04d}",
f"19{c}144{s:03d}", f"9{c}001{s:04d}", f"9{c}003{s:04d}", f"{c}18001{s:04d}"
]
for r in candidates:
if test_roll(s1, p1, t1, b1['link'], r):
print(f" [HIT BA-BEd] {r}")
hits1.append(r)
print("Probing B.Sc.-B.Ed Part I (TR00000002)...")
b2 = batch_map[tr2]
s2, p2, t2 = get_session(b2['link'])
hits2 = []
for c in colls:
for s in range(1, 25):
candidates = [
f"9{c}137{s:03d}", f"18{c}137{s:03d}", f"{c}18137{s:03d}", f"9{c}137{s:04d}",
f"19{c}137{s:03d}", f"9{c}007{s:04d}", f"9{c}009{s:04d}", f"{c}18007{s:04d}"
]
for r in candidates:
if test_roll(s2, p2, t2, b2['link'], r):
print(f" [HIT BSc-BEd] {r}")
hits2.append(r)
return hits1, hits2
if __name__ == "__main__":
hits_tr8 = probe_tr8()
print(f"TR8 Total Hits: {len(hits_tr8)}")
hits_tr10 = probe_tr10()
print(f"TR10 Total Hits: {len(hits_tr10)}")
hits4, hits5 = probe_msw()
print(f"TR4 Total Hits: {len(hits4)}, TR5 Total Hits: {len(hits5)}")
hits1, hits2 = probe_integrated()
print(f"TR1 Total Hits: {len(hits1)}, TR2 Total Hits: {len(hits2)}")

Xet Storage Details

Size:
6.34 kB
·
Xet hash:
a37ab3b4fd96c6746425e3dbf89327c05d7a3177422616fb010b654f10648256

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.