-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
156 lines (117 loc) · 3.57 KB
/
main.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
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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
import requests
import threading
url = "https://result.dghs.gov.bd/mbbs/"
# controller
flag = -1
def search(roll):
session = requests.Session()
payload = 'roll='+roll+'&Result='
headers = {
'Connection': "keep-alive",
'Cache-Control': "max-age=0",
'Origin': "https://result.dghs.gov.bd",
'Upgrade-Insecure-Requests': "1",
'Content-Type': "application/x-www-form-urlencoded",
'Sec-Fetch-User': "?1",
'Accept': "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9",
'Sec-Fetch-Site': "same-origin",
'Sec-Fetch-Mode': "navigate",
'Referer': "https://result.dghs.gov.bd/mbbs/",
'Accept-Encoding': "gzip, deflate, br",
'Accept-Language': "en-US,en;q=0.9",
'Host': "result.dghs.gov.bd",
'Content-Length': "19",
'cache-control': "no-cache"
}
response = session.post(url, data=payload, headers=headers)
webpage = str(response.text)
# whom result you looking for (name)
if (webpage.find('<name>') == -1):
return -1
else:
return roll
# ____________________ MAIN METHOD ____________________ #
def from_start1():
global flag
for n in range(199999, 110001, -1):
roll = str(n)
print("Now trying: ", roll)
# check the current code is satisfying or not
result = search(roll)
if result != -1:
print("Success with code: ", code)
print(result)
flag = 0
if flag != -1:
break
def from_start2():
global flag
for n in range(220000, 200001, -1):
roll = str(n)
print("Now trying: ", roll)
# check the current code is satisfying or not
result = search(roll)
if result != -1:
print("Success with code: ", code)
print(result)
flag = 0
if flag != -1:
break
def from_start3():
global flag
for n in range(220001, 260000):
roll = str(n)
print("Now trying: ", roll)
# check the current code is satisfying or not
result = search(roll)
if result != -1:
print("Success with code: ", code)
print(result)
flag = 0
if flag != -1:
break
def from_start4():
global flag
for n in range(280000, 260001, -1):
roll = str(n)
print("Now trying: ", roll)
# check the current code is satisfying or not
result = search(roll)
if result != -1:
print("Success with code: ", code)
print(result)
flag = 0
if flag != -1:
break
def from_end():
global flag
for n in range(2800001, 300000):
roll = str(n)
print("Now trying: ", roll)
# check the current code is satisfying or not
result = search(roll)
if result != -1:
print("Success with code: ", code)
print(result)
flag = 0
if flag != -1:
break
#threading
thread1 = threading.Thread(target=from_start1)
thread2 = threading.Thread(target=from_start2)
thread3 = threading.Thread(target=from_start3)
thread4 = threading.Thread(target=from_start4)
thread5 = threading.Thread(target=from_end)
# Brute force
thread1.start()
thread2.start()
thread3.start()
thread4.start()
thread5.start()
# wait until all threads finish
thread1.join()
thread2.join()
thread3.join()
thread4.join()
thread5.join()
print("finish")