Eliminado código obsoleto
This commit is contained in:
@@ -9,7 +9,7 @@ import urllib
|
|||||||
import urlparse
|
import urlparse
|
||||||
|
|
||||||
from platformcode import logger
|
from platformcode import logger
|
||||||
from decimal import Decimal, ROUND_UP
|
from decimal import Decimal
|
||||||
|
|
||||||
class Cloudflare:
|
class Cloudflare:
|
||||||
def __init__(self, response):
|
def __init__(self, response):
|
||||||
@@ -62,18 +62,17 @@ class Cloudflare:
|
|||||||
def get_url(self):
|
def get_url(self):
|
||||||
# Metodo #1 (javascript)
|
# Metodo #1 (javascript)
|
||||||
if self.js_data.get("wait", 0):
|
if self.js_data.get("wait", 0):
|
||||||
jschl_answer = self.decode2(self.js_data["value"])
|
jschl_answer = self.decode(self.js_data["value"])
|
||||||
|
|
||||||
for op, v in self.js_data["op"]:
|
for op, v in self.js_data["op"]:
|
||||||
#jschl_answer = eval(str(jschl_answer) + op + str(self.decode2(v)))
|
|
||||||
if op == '+':
|
if op == '+':
|
||||||
jschl_answer = jschl_answer + self.decode2(v)
|
jschl_answer = jschl_answer + self.decode(v)
|
||||||
elif op == '-':
|
elif op == '-':
|
||||||
jschl_answer = jschl_answer - self.decode2(v)
|
jschl_answer = jschl_answer - self.decode(v)
|
||||||
elif op == '*':
|
elif op == '*':
|
||||||
jschl_answer = jschl_answer * self.decode2(v)
|
jschl_answer = jschl_answer * self.decode(v)
|
||||||
elif op == '/':
|
elif op == '/':
|
||||||
jschl_answer = jschl_answer / self.decode2(v)
|
jschl_answer = jschl_answer / self.decode(v)
|
||||||
|
|
||||||
self.js_data["params"]["jschl_answer"] = round(jschl_answer, 10) + len(self.domain)
|
self.js_data["params"]["jschl_answer"] = round(jschl_answer, 10) + len(self.domain)
|
||||||
|
|
||||||
@@ -93,7 +92,7 @@ class Cloudflare:
|
|||||||
|
|
||||||
return response
|
return response
|
||||||
|
|
||||||
def decode2(self, data):
|
def decode(self, data):
|
||||||
data = re.sub("\!\+\[\]", "1", data)
|
data = re.sub("\!\+\[\]", "1", data)
|
||||||
data = re.sub("\!\!\[\]", "1", data)
|
data = re.sub("\!\!\[\]", "1", data)
|
||||||
data = re.sub("\[\]", "0", data)
|
data = re.sub("\[\]", "0", data)
|
||||||
@@ -112,59 +111,4 @@ class Cloudflare:
|
|||||||
for n in aux:
|
for n in aux:
|
||||||
num2 += str(eval(n))
|
num2 += str(eval(n))
|
||||||
|
|
||||||
#return float(num1) / float(num2)
|
|
||||||
#return Decimal(Decimal(num1) / Decimal(num2)).quantize(Decimal('.0000000000000001'), rounding=ROUND_UP)
|
|
||||||
return Decimal(Decimal(num1) / Decimal(num2)).quantize(Decimal('.0000000000000001'))
|
return Decimal(Decimal(num1) / Decimal(num2)).quantize(Decimal('.0000000000000001'))
|
||||||
|
|
||||||
def decode(self, data):
|
|
||||||
t = time.time()
|
|
||||||
timeout = False
|
|
||||||
|
|
||||||
while not timeout:
|
|
||||||
data = re.sub("\[\]", "''", data)
|
|
||||||
data = re.sub("!\+''", "+1", data)
|
|
||||||
data = re.sub("!''", "0", data)
|
|
||||||
data = re.sub("!0", "1", data)
|
|
||||||
|
|
||||||
if "(" in data:
|
|
||||||
x, y = data.rfind("("), data.find(")", data.rfind("(")) + 1
|
|
||||||
part = data[x + 1:y - 1]
|
|
||||||
else:
|
|
||||||
x = 0
|
|
||||||
y = len(data)
|
|
||||||
part = data
|
|
||||||
|
|
||||||
val = ""
|
|
||||||
|
|
||||||
if not part.startswith("+"): part = "+" + part
|
|
||||||
|
|
||||||
for i, ch in enumerate(part):
|
|
||||||
if ch == "+":
|
|
||||||
if not part[i + 1] == "'":
|
|
||||||
if val == "": val = 0
|
|
||||||
if type(val) == str:
|
|
||||||
val = val + self.get_number(part, i + 1)
|
|
||||||
else:
|
|
||||||
val = val + int(self.get_number(part, i + 1))
|
|
||||||
else:
|
|
||||||
val = str(val)
|
|
||||||
val = val + self.get_number(part, i + 1) or "0"
|
|
||||||
|
|
||||||
if type(val) == str: val = "'%s'" % val
|
|
||||||
data = data[0:x] + str(val) + data[y:]
|
|
||||||
|
|
||||||
timeout = time.time() - t > self.timeout
|
|
||||||
|
|
||||||
if not "+" in data and not "(" in data and not ")" in data:
|
|
||||||
return int(self.get_number(data))
|
|
||||||
|
|
||||||
def get_number(self, str, start=0):
|
|
||||||
ret = ""
|
|
||||||
for chr in str[start:]:
|
|
||||||
try:
|
|
||||||
int(chr)
|
|
||||||
except:
|
|
||||||
if ret: break
|
|
||||||
else:
|
|
||||||
ret += chr
|
|
||||||
return ret
|
|
||||||
|
|||||||
Reference in New Issue
Block a user