-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdetect.py
171 lines (153 loc) · 5.42 KB
/
detect.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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
import requests
import re
import os
from PIL import Image
from io import BytesIO
from CAPTCHA_object_detection import *
import time
from colorama import Fore
from colorama import init
from time import process_time
try:
import pkg_resources.py2_warn
except ImportError:
pass
init()
ip = ""
proxyList = []
target = input("target == ")
session_id = input("session id == ")
proxy = input("proxy? y/n == ")
index = 0
def chomp(x):
if x.endswith("\r\n"):
return x[:-2]
if x.endswith("\n") or x.endswith("\r") or x.endswith(" "):
return x[:-1]
return x
if ("y" in proxy):
infile = open('proxylist.txt','r')
ip = infile.readlines()
proxyList = []
for line in (ip):
print(line)
proxyList.append(chomp(line))
infile.close()
if ("tor" in proxy):
proxies = {
"http": "socks5://127.0.0.1:9150",
}
def getPicture(data):
imageurl = ("http://playserver.co/index.php/VoteGetImage/"+str(data))
print(imageurl)
headers = {
"Accept": "image/webp,image/apng,image/*,*/*;q=0.8",
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.61 Safari/537.36",
"Referer": "http://playserver.in.th/index.php/Vote/prokud/MC-Surviver-19921",
"Accept-Encoding": "gzip, deflate",
"Accept-Language": "en-US,en;q=0.9",
"Cookie":"__utma=123569098.25167225.1590924307.1590924307.1590924307.1; __utmz=123569098.1590924307.1.1.utmcsr=google|utmccn=(organic)|utmcmd=organic|utmctr=(not%20provided)",
"Connection": "close"
}
if ("n" in proxy):
rsp = requests.get(imageurl,headers=headers)
else:
rsp = requests.get(imageurl,headers=headers,proxies=proxies,verify=False)
#rsp = requests.get(imageurl,headers=headers)
#rsp.raise_for_status()
content_type_received = rsp.headers['Content-Type']
binarycontent = BytesIO(rsp.content)
if content_type_received.startswith('image'):
i = Image.open(binarycontent)
outfilename = os.path.join('myimg'+str(session_id)+'.jpg')
with open(outfilename, 'wb') as f:
print("write")
f.write(rsp.content)
rsp.close()
def getPostPIC():
picID = ""
headers = {
"Accept": "*/*",
"Content-Length": "0",
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.61 Safari/537.36",
"Origin": "http://playserver.in.th",
"Referer": "http://playserver.in.th/index.php/Vote/prokud/MC-Surviver-19921",
"Accept-Encoding": "gzip, deflate",
"Accept-Language": "en-US,en;q=0.9",
"Connection": "close"
}
url = "http://playserver.co/index.php/Vote/ajax_getpic/MC-Surviver-19921"
if ("n" in proxy):
r = requests.post(url, headers=headers)
else:
r = requests.post(url, headers=headers, proxies=proxies)
checksum = r.text
print(checksum)
m = re.search('"checksum":"(.+?)"',checksum)
if m:
picID = m.group(1)
return picID
def preSubmit():
print("preSubmit...")
picID = getPostPIC()
getPicture(picID)
text = Captcha_detection("myimg"+str(session_id)+".jpg")
print("Result: "+str(text))
data = ("server_id=19921&captcha="+text+"&gameid=xxxEAGLE-VOTE&checksum="+picID)
return data
def submit(data1):
print("submit")
headers = {
"Accept": "*/*",
"Content-Length": "64",
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.61 Safari/537.36",
"Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
"Origin": "http://playserver.in.th",
"Referer": "http://playserver.in.th/index.php/Vote/prokud/MC-Surviver-19921",
"Accept-Encoding": "gzip, deflate",
"Accept-Language": "en-US,en;q=0.9",
"Connection": "close"
}
url = "http://playserver.co/index.php/Vote/ajax_submitpic/MC-Surviver-19921"
if ("n" in proxy):
r = requests.post(url, headers=headers, data=data1)
else:
r = requests.post(url, headers=headers, data=data1 ,proxies=proxies)
print(r.text)
newFile = open('logSUBMIT.txt','w')
newFile.write(r.text)
return (r.text)
success = 0
attemp = 0
for x in range(int(target)):
if ("y" in proxy):
proxies = {
"http": "http://"+proxyList[index],
}
print(proxyList[index])
start2 = process_time()
attemp += 1
try:
firstData = preSubmit()
if len(firstData)>3:
checksum = submit(firstData)
else :
print ("firstDATA ERROR")
except Exception as e:
print("ERROR : "+str(e))
index += 1
continue
f = re.search('"success":false',checksum)
s = re.search('"success":true',checksum)
if f:
x = int(success)-1
print(Fore.RED+" failed"+Fore.WHITE)
if s:
success += 1
print(Fore.GREEN+" success"+Fore.WHITE)
end2 = process_time()
timer2 = int(end2)-int(start2)
print(timer2)
sleepTime = 60-int(timer2/2)
print(str(session_id)+" sleeping..."+str(sleepTime)+"sec -> "+Fore.MAGENTA+" success: "+str(success)+" attemp: "+str(attemp)+Fore.WHITE)
index += 1