Closed doko-desuka closed 5 years ago
Here are some variants of the CF challenge:
I don't see where jsunfuck
is imported from in your code?
nm its a dirty hash comment.
@pro-src
its an old module and does not work with the CF, with the "atob" pharse. sadly it does not work :-(
how to fix the atob section is a riddle....
@ebs111222 hahah what? no it isn't
atob is just a base64 decode binary function...
heres a working drop in replacement for Anorov's project https://github.com/VeNoMouS/cloudflare-scrape-js2py ... i use js2py not node..
i now i am not talking about the atob itself but the new section that was added @VeNoMouS
It's not my code, it was written by an anonymous coder (credits to him/her).
@VeNoMouS there's no import of jsunfuck, it's done inline in function parseJSString(), it replaces the jsfuck units with stringified numbers then eval() that code (the syntax is the same, becomes like "(1+1+3+10)/(27)") etc.
or you could just #215
We worked it out all yesterday
solving it with js2py is probebly working but very slow....
and i tried what you published and it does not work :-( @VeNoMouS
The extra JS code just takes the char of a string. They change the index, but the string is always the same (for the moment)
yes but what does it mean for the end float result? @doko-desuka
@ebs111222 what website?
http://www3.hd.today/ @VeNoMouS
but fixing the code published here will be much better for it will be much faster
LRMNXbf.lhKSaUnuNk*=function(p){var p = eval(eval(atob("ZG9jdW1l")+(undefined+"")[1]+(true+"")[0]+(+(+!+[]+[+!+[]]+(!![]+[])[!+[]+!+[]+!+[]]+[!+[]+!+[]]+[+[]])+[])[+!+[]]+(false+[0]+String)[20]+(true+"")[3]+(true+"")[0]+"Element"+(+[]+Boolean)[10]+(NaN+[Infinity])[10]+"Id("+(+(20))["to"+String["name"]](21)+")."+atob("aW5uZXJIVE1M"))); return +(p)}();
@ebs111222 one of the functions in the modern code, it evals the jsfuck inside a \<div> and multiplies in the float result. That whole part can be replaced by multiply by (eval the contents of <div> "cf-dn-QUHGdMIAqr")
Anyway, someone just needs to take the time to reorder the code, include these new instructions. It's not that difficult, just takes time
@ebs111222
_cloudFlare() requested URL - http://www3.hd.today/, encounted CloudFlare DDOS Protection.. Bypassing.
test() CloudFlare DDOS Protection.. Bypassed successfully.
b'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"\r\n "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\r\n<html xmlns="http://www.w3.org/1999/xhtml">\r\n <head>\r\n\t<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />\r\n\t<title>HDToday - Watch FULL HD 1080p Movies Online For Free & TV Series</title>\r\n\t<meta name="description" content="HDToday - You can enjoy all kind of movies like TV Series, Asian Dramas, Anime and Cartoons discover more than ninety thousands movies online for free." />\r\n\t<meta name="keywords" content="hdtoday, hd movies, watch movies online free, watch series online, watch free movies online" />\r\n\t<meta name="robots" content="index, follow" />\r\n\t<link href="http://hd.today/images/favicon.ico" rel="shortcut icon" type="image/x-icon" />\r\n\t<script type="text/javascript" src="http://hd.today/js/base64.js"></script>\r\n </head>\r\n <body>\r\n <script type="text/javascript" src="http://hd.today/js/load.js"></script>\r\n <script language="javascript" type="text/javascript" src="http://hd.today/js/tooltips.js"></script>\r\n<link rel="stylesheet" href="http://hd.today/themes/movies/css/style.css" type="text/css" />\r\n<link rel="stylesheet" href="http://hd.today/themes/movies/css/reset.css" type="text/css" />\r\n<link rel="stylesheet" href="http://hd.today/themes/movies/css/styles_v80.css" type="text/css" />\r\n<link rel="stylesheet" href="http://hd.today/themes/movies/css/app_v9.css" type="text/css" />\r\n<link rel="stylesheet" href="http://hd.today/themes/movies/css/bootstrap.min.css" type="text/css" />\r\n<link rel="stylesheet" href="http://hd.today/themes/movies/css/main.css?v=4.0" type="text/css" />\r\n<link rel="stylesheet" href="http://hd.today/themes/movies/css/jquery.cluetip.css" type="text/css" />\r\n<link rel="stylesheet" href="http://hd.today/themes/movies/css/jquery.qtip.min.css" type="text/css" />\r\n<link rel="stylesheet" href="http://hd.today/themes/movies/css/custom.css?v=1.1" type="text/css" />\r\n<link rel="stylesheet" href="http://hd.today/themes/movies/css/slide.css" type="text/css" />\r\n<link rel="stylesheet" href="http://hd.today/themes/movies/css/psbar.css" type="text/css" />\r\n<link rel="stylesheet" href="http://hd.today/themes/movies/css/cursor.css" type="text/css" />\r\n<script type="text/javascript" src="http://hd.today/js/jquery-1.11.1.min.js"></script>\r\n<script type="text/javascript" src="http://hd.today/js/wow.min.js"></script>\r\n<script type="text/javascript" src="http://hd.today/js/jquery.bxslider.min.js"></script>\r\n<script type="text/javascript" src="http://hd.today/js/jquery.mCustomScrollbar.concat.min.js"></script>\r\n<script type="text/javascript" src="http://hd.today/js/lazyload.js"></script>\r\n<script type="text/javascript" src="http://hd.today/js/slider_v04.js"></script>\r\n<script type="text/javascript" src="http://hd.today/js/movies.min.js?v=1.6"></script>\r\n<script type="text/javascript" src="http://hd.today/js/app_v31.js"></script>\r\n<script type="text/javascript">\r\nvar host = "http://hd.today";\r\nvar host_static = "http://hd.today/";\r\n</script>\r\n \r\n<!--header-->\r\n<header>\r\n <div class="container">\r\n <div class="header-logo">\r\n\r\n <a title="HDTODAY - Watch FREE Movies Online in HD." href="http://www3.hd.today/" id="logo"></a>\r\n\r\n </div>\r\n <div class="mobile-menu"><i class="fa fa-reorder"></i></div>\r\n <div class="mobile-search"><i class="fa fa-search"></i></div>\r\n <div id="menu">\r\n <ul class="top-menu">\r\n <li>\r\n <a href="http://www3.hd.today/" title="Home">HOME</a>\r\n </li>\r\n <li>\r\n <a href="#" title="Browse">BROWSE</a>\r\n\r\n <div class="sub-container" style="display: none">\r\n <ul class="sub-menu">\r\n <li>\r\n <a href="http://www3.hd.today/cinema-movies.html">Cinema Movies</a>\r\n </li>\r\n <li>\r\n <a href="http://www3.hd.today/recently-added.html">Recently Added</a>\r\n </li>\r\n <li>\r\n <a href="http://www3.hd.today/search-movies/2018.html">New Released</a>\r\n </li>\r\n </ul>\r\n <div class="clearfix"></div>\r\n </div>\r\n </li>\r\n <li>\r\n <a href="http://www3.hd.today/genres.html" title="Genres">GENRES</a>\r\n\r\n <div class="sub-container" style="display: none">\r\n <ul class="sub-menu">\r\n <li>\r\n <a href="http://hd.today/movies-genres/action.html">Action</a>\r\n </li>\r\n <li>\r\n <a href="http://hd.today/movies-genres/adventure.html">Adventure</a>\r\n </li>\r\n <li>\r\n <a href="http://hd.today/movies-genres/sport.html">Sport</a>\r\n </li>\r\n <li>\r\n <a href="http://hd.today/movies-genres/sci-fi.html">Sci-Fi</a>\r\n </li>\r\n <li>\r\n <a href="http://hd.today/movies-genres/horror.html">Horror</a>\r\n </li>\r\n <li>\r\n <a href="http://hd.today/movies-genres/thriller.html">Thriller</a>\r\n </li>\r\n <li>\r\n <a href="http://hd.today/movies-genres/comedy.html">Comedy</a>\r\n </li>\r\n <li>\r\n <a href="http://hd.today/movies-genres/crime.html">Crime</a>\r\n </li>\r\n <li>\r\n <a href="http://hd.today/movies-genres/western.html">Western</a>\r\n </li>\r\n <li>\r\n <a href="http://hd.today/movies-genres/anime.html">Anime</a>\r\n </li>\r\n <li>\r\n <a href="http://hd.today/movies-genres/animation.html">Animation</a>\r\n </li>\r\n <li>\r\n <a href="http://hd.today/movies-genres/music.html">Music</a>\r\n </li>\r\n ````
@VeNoMouS using js2py?
yup.. under my repo..
https://github.com/VeNoMouS/cloudflare-scrape-js2py
#!/usr/bin/python2
from lib import cfscrape
import requests
from pprint import pprint
import os
import sys
import re
from base64 import b64decode
class Test():
def __init__(self):
self.session = requests.session()
self.funcName = lambda n=0: sys._getframe(n + 1).f_code.co_name + "()"
def _cloudFlare(self, response):
cf = cfscrape.create_scraper(sess=self.session)
if cf.is_cloudflare_challenge(response):
print("{} requested URL - {}, encounted CloudFlare DDOS Protection.. Bypassing.".format(self.funcName(), response.url))
response = cf.get('http://www3.hd.today/', timeout=30)
if not cf.is_cloudflare_challenge(response):
return (True, True)
return (True, False)
return (False, True)
def test(self):
ret = self.session.get('http://www3.hd.today/', timeout=30)
if (True, True) == self._cloudFlare(ret):
print("{} CloudFlare DDOS Protection.. Bypassed successfully.".format(self.funcName()))
ret = self.session.get('http://www3.hd.today/', timeout=30)
print(ret.content)
Test().test()
thats great but sooo slooowww.... why not fix that code? @VeNoMouS
because node is a piece of shit... and why would i want to sub process stuff off when i want inline code?
no not node of course . i mean to fix the PURE CF in python
Also how's it slow?
you are aware, that you CF makes you wait 4+ seconds before sending the response... right?
try the code published here an try js2py you see @VeNoMouS
well for starters... it doesnt even check the response payload...
File "./test.py", line 39, in <module>
Test().test()
File "./test.py", line 33, in test
if (True, True) == self._cloudFlare(ret):
File "./test.py", line 18, in _cloudFlare
if cf.is_cloudflare_challenge(response):
AttributeError: 'CloudflareScraper' object has no attribute 'is_cloudflare_challenge'
@doko-desuka can you fix the code? or guide me what to fix please?
@VeNoMouS when you solve one with js2py it fast and ok but for 50 threads thats very slow
It broke.. doesn't work...
root@tvz0r:/tmp/q# ./test.py
ERROR:root:[!] float() argument must be a string or a number Unable to parse Cloudflare anti-bots page. Try upgrading cloudflare-scrape, or submit a bug report if you are running the latest version. Please read https://github.com/Anorov/cloudflare-scrape#updates before submitting a bug report.
Traceback (most recent call last):
File "./test.py", line 37, in <module>
Test().test()
File "./test.py", line 31, in test
if (True, True) == self._cloudFlare(ret):
File "./test.py", line 18, in _cloudFlare
cf.solve_cf_challenge(response)
File "/tmp/q/lib/cfscrape/__init__.py", line 91, in solve_cf_challenge
line_val = self.parseJSString(subsecs[0]) / float(self.parseJSString(subsecs[1]))
TypeError: float() argument must be a string or a number
root@tvz0r:/tmp/q#
@ebs111222 WHAT? you use the same session, by doing so you have the cookie in there? why on earth would you need to be doing 50 threads?
to scrape many sites
you do realise ... the existing project forks node on a command line yes???
https://github.com/Anorov/cloudflare-scrape/blob/master/cfscrape/__init__.py#L138
@VeNoMouS i tested the code and broken part is the "atob" section
@doko-desuka
LRMNXbf.lhKSaUnuNk*=function(p){var p = eval(eval(atob("ZG9jdW1l")+(undefined+"")[1]+(true+"")[0]+(+(+!+[]+[+!+[]]+(!![]+[])[!+[]+!+[]+!+[]]+[!+[]+!+[]]+[+[]])+[])[+!+[]]+(false+[0]+String)[20]+(true+"")[3]+(true+"")[0]+"Element"+(+[]+Boolean)[10]+(NaN+[Infinity])[10]+"Id("+(+(20))["to"+String["name"]](21)+")."+atob("aW5uZXJIVE1M"))); return +(p)}();
@ebs111222 one of the functions in the modern code, it evals the jsfuck inside a <div> and multiplies in the float result. That whole part can be replaced by multiply by (eval the contents of <div> "cf-dn-QUHGdMIAqr")
LOL... you do know that isn't just numbers right?
I mean ... look at the jsfuck mapping..
https://github.com/j4ckstraw/jsfuck-py/blob/master/jsfuck3.py
or even.. https://en.wikipedia.org/wiki/JSFuck
i tested the code and broken part is the "atob" section
@ebs111222 can't have tested my code... mine doesn't break on atob.
you prob have old cfscape still installed
@VeNoMouS yours is OK but slow , the code here is very fast in fact i used asimiler one before the change.
@VeNoMouS
@doko-desuka
LRMNXbf.lhKSaUnuNk*=function(p){var p = eval(eval(atob("ZG9jdW1l")+(undefined+"")[1]+(true+"")[0]+(+(+!+[]+[+!+[]]+(!![]+[])[!+[]+!+[]+!+[]]+[!+[]+!+[]]+[+[]])+[])[+!+[]]+(false+[0]+String)[20]+(true+"")[3]+(true+"")[0]+"Element"+(+[]+Boolean)[10]+(NaN+[Infinity])[10]+"Id("+(+(20))["to"+String["name"]](21)+")."+atob("aW5uZXJIVE1M"))); return +(p)}(); @ebs111222 one of the functions in the modern code, it evals the jsfuck inside a <div> and multiplies in the float result. That whole part can be replaced by multiply by (eval the contents of <div> "cf-dn-QUHGdMIAqr")
LOL... you do know that isn't just numbers right?
do you know how to solve that?
i found this in one of the comments here: atob("ZG9jdW1l")+(undefined+"")[1]+(true+"")[0] = document +(+(+!+[]+[+!+[]]+(!![]+[])[!+[]+!+[]+!+[]]+[!+[]+!+[]]+[+[]])+[])[+!+[]]+(false+[0]+String)[20]+(true+"")[3]+(true+"")[0]+"Element"+(+[]+Boolean)[10]+(NaN+[Infinity])[10]+"Id("+(+(20))"to"+String["name"]+")." = .getElementById(k). +atob("aW5uZXJIVE1M") = innerHTML document.getElementById(k).innerHTML
but what does it means in the aregmetic i dont know :-(
@VeNoMouS any idea why am i getting: "ExpressionStatement() got an unexpected keyword argument 'comments'" in your code? its from js2py
@ebs111222 please take problems with other methods to another Issue thread, not this one.
@doko-desuka its not other i want to try and fix the code in this thread but to do that i wanted to see how @VeNoMouS works
EDIT: I updated it myself after all, see this comment.
ORIGINAL POST: The logic inside the challenge is grounded, it uses JSFuck plus some arithmetic. There's this project called UniversalScrapers (from the non-official, underground XBMC scene) where I first saw this, it's based on Anorov's but does the solving entirely in inline Python (no node.js or js2py needed). It is broken now after these latest updates to the CF challenge, but it's a nice reference.
I wish we could work on updates for this as it's more lightweight than the proposed alternatives.
OLD CODE (needs fixes):