def add(request): package = bottle.request.POST.get('referer', None) urls = filter(lambda x: x != "", bottle.request.POST['urls'].split("\n")) if package: API.add_package(package, urls, 0) else: API.generate_and_add_packages(urls, 0) return ""
def flashgot(): if bottle.request.environ['HTTP_REFERER'] not in ("http://localhost:9666/flashgot", "http://127.0.0.1:9666/flashgot"): return bottle.HTTPError() autostart = int(bottle.request.forms.get('autostart', 0)) package = bottle.request.forms.get('package', None) urls = filter(lambda x: x != "", bottle.request.forms['urls'].split("\n")) folder = bottle.request.forms.get('dir', None) if package: API.add_package(package, urls, autostart) else: API.generate_and_add_packages(urls, autostart) return ""
def addcrypted2(): package = bottle.request.forms.get("source", None) crypted = bottle.request.forms['crypted'] jk = bottle.request.forms['jk'] crypted = base64.standard_b64decode(urllib.unquote(crypted.replace(" ", "+"))) if JS: jk = "%s f()" % jk jk = JS.eval(jk) else: try: jk = re.findall(r"return ('|\")(.+)('|\")", jk)[0][1] except Exception: # Test for some known js functions to decode if jk.find("dec") > -1 and jk.find("org") > -1: org = re.findall(r"var org = ('|\")([^\"']+)", jk)[0][1] jk = list(org) jk.reverse() jk = "".join(jk) else: print "Could not decrypt key, please install py-spidermonkey or ossp-js" try: Key = binascii.unhexlify(jk) except Exception: print "Could not decrypt key, please install py-spidermonkey or ossp-js" return "failed" IV = Key obj = Crypto.Cipher.AES.new(Key, Crypto.Cipher.AES.MODE_CBC, IV) result = obj.decrypt(crypted).replace("\x00", "").replace("\r", "").split("\n") result = filter(lambda x: x != "", result) try: if package: API.add_package(package, result, 0) else: API.generate_and_add_packages(result, 0) except Exception: return "failed can't add" else: return "success\r\n"