UltimaScraper icon indicating copy to clipboard operation
UltimaScraper copied to clipboard

Session Lock | Please refresh the page error

Open Macmasteri opened this issue 5 years ago • 153 comments

Running the latest version and got this error;

Auth (V1) Attempt 1/10 Please refresh the page Auth (V1) Attempt 2/10 Please refresh the page Auth (V1) Attempt 3/10 Please refresh the page Auth (V1) Attempt 4/10 Please refresh the page Auth (V1) Attempt 5/10 Please refresh the page Auth (V1) Attempt 6/10 Please refresh the page Auth (V1) Attempt 7/10 Please refresh the page Auth (V1) Attempt 8/10 Please refresh the page Auth (V1) Attempt 9/10 Please refresh the page Auth (V1) Attempt 10/10 Please refresh the page

Macmasteri avatar Apr 30 '21 19:04 Macmasteri

I'm having the same problem

Whatsmyname22 avatar Apr 30 '21 19:04 Whatsmyname22

I'm having the same problem

Worked great during the day but suddenly this appeard. Tried "refresh" and a another account as well with no luck.

Macmasteri avatar Apr 30 '21 19:04 Macmasteri

Same problem here, been using the script for ~9 months and never had auth issues until now.

sonicshake avatar Apr 30 '21 19:04 sonicshake

In config.json "browser": { "auth" } seems to be undocumented but I tried changing it to false anyway in case this is a problem with forcing browser authentication. Doesn't seem to have helped though.

sonicshake avatar Apr 30 '21 19:04 sonicshake

OF changed their authentication, I'll fix it.

UltimaHoarder avatar Apr 30 '21 19:04 UltimaHoarder

Will update the script within 2 hours.

UltimaHoarder avatar Apr 30 '21 21:04 UltimaHoarder

Will update the script within 2 hours.

Thanks for the heads up and the speediness of working on it

NovaResonance avatar Apr 30 '21 21:04 NovaResonance

Reverse engineering takes awhile .-.

I'm still working on it, but I'm making good progress.

This is what I have to unravel lmao

image

UltimaHoarder avatar Apr 30 '21 23:04 UltimaHoarder

Thanks for looking into this.

oftrash avatar May 01 '21 02:05 oftrash

was just digging into it and ended up at the same code snipped in vendor.js you've posted the screenshot from.. so seems I'm on the right track.

I've worked on a similar issue with the cloudflare captchas and the best solution there was copy/extract their relevant javascript functions and execute them to get the token - instead of decoding the function. That way - if they change something - you just execute the change they made and always get the correct token. It worked like.. fetch the current js.. extract the function with regex.. execute the function and get the token.

Hope that helps :-)

btkador avatar May 01 '21 03:05 btkador

Noticed there is no auth_hash anymore in the cookie, lol.

Btw, impressive reverse engineering right there. Compared to this, Recurbate is just too easy.

zivshek avatar May 01 '21 03:05 zivshek

I gotta say very fast response on this @DIGITALCRIMINAL Much appreciated! Huge fan on onlyfans specially TS :P

Will there be a new version uploaded?

Macmasteri avatar May 01 '21 07:05 Macmasteri

how much time will it take? im stuck lol, nvm i'll try stuckporn

HEY PLS FIX IT!

it will be fixed when its fixed,.

RonnieBlaze avatar May 01 '21 12:05 RonnieBlaze

how much time will it take? im stuck lol, nvm i'll try stuckporn

HEY PLS FIX IT!

Be the change you wish to see in the world

nappyapp avatar May 01 '21 12:05 nappyapp

So is this the end? Did OF successfully block people from downloading the stuff they pay for?

hackerin0 avatar May 01 '21 13:05 hackerin0

guys, this is not a reddit thread. let DIGITALCRIMINAL work, and stop complaining.

pay him a donation for his work instead or post constructive help instead of wining.

btkador avatar May 01 '21 13:05 btkador

been looking into this also. looks like OF added 3 new fields (x-bc / sign and time).

  • x-bc looks easy, its the same value for every request once you log in.
  • time we got this one, just Epoch / Unix Timestamp.
  • sign This is the one we need to figure out I bet its based on the full request / time / hash.

To help @DIGITALCRIMINAL out my sign is 3:XXXX:XXX:608c48da

I have logged into about 10 different account and it looks like the sign always starts with a 3:, 3 characters for the 3rd value and 608c48da for the last value.

oftrash avatar May 01 '21 13:05 oftrash

This scraping method is a fantastic tool and I have no idea how tough the programming skills is for this one, I only raise DIGITALCRIMINAL to the skys for sharing his wonderful stuff for us. DIGITAL CRIMINAL is probably dealing with this right now, let him do his work and stay tuned.

Macmasteri avatar May 01 '21 13:05 Macmasteri

sign is required or you'll get "please refresh" error. sign's sha1 hash is made up of:

"BcsLYSyemJCNrob8u6QWziudT5Xx4LlO\n1619875069\n/api2/v2/users/me\n0"

"BcsLYSyemJCNrob8u6QWziudT5Xx4LlO" never changes (static). "1619875069" is the time "/v2/users/me" is the url path. You also have to include the params if there are any. "0" I don't know what this is, but it's part of a "or" statement and it usually defaults to this.

"BcsLYSyemJCNrob8u6QWziudT5Xx4LlO\n1619875069\n/api2/v2/users/me\n0" gets hashed into sha1.

sha1 result: 5b0e330fcdbf9507c4391e6c2a9e4a98d3c900f2

It then becomes part of sign.

3:5b0e330fcdbf9507c4391e6c2a9e4a98d3c900f2:8bc:608c48da

3: is static 5b0e330fcdbf9507c4391e6c2a9e4a98d3c900f2: isn't static 8bc: isn't static 608c48da is static

8bc - this part seems to be the final problem and if you substitute anything for it, you'll get "please refresh" 8bc is calculated by the whole math function I posted above. the sha1 hashed is used in it's calculations which is why it will fail if you change it. ###################### x-bc is required or you'll get your session locked and reset. It's similar to "sess".

You need it to make any requests to their API. ###################### Technically, the sign function should be like this... but the "a55" part in "final_sign" is incorrect.

def create_sign(session, link, sess, user_agent, text="onlyfans"):
    # Users: 300000 | Creators: 301000
    # time2 = str(int(round(time.time() * 1000-301000)))
    session.headers["access-token"] = sess

    def btoa(specimen):
        encoded = base64.b64encode(str(specimen).encode('ascii'))
        encoded = encoded.decode("utf-8")
        return encoded
    # Create sign
    time2 = str(int(round(time.time())))
    path = urlparse(link).path
    query = urlparse(link).query
    path = path if not query else f"{path}?{query}"
    static_param = "BcsLYSyemJCNrob8u6QWziudT5Xx4LlO"
    a = [static_param, time2, path, "0"]
    msg = "\n".join(a)
    message = msg.encode("utf-8")
    hash_object = hashlib.sha1(message)
    sha_1_sign = hash_object.hexdigest()
    final_sign = f"3:{sha_1_sign}:a55:608c48da"
    # Create x-bc - You don't need to do this, infact I don't think you can create a customer token, you'll have to use it from the browser.
    t = 1e12
    encoded_time = btoa(time2)
    random_math0 = random()
    encoded_random_math0 = btoa(random_math0*t)
    random_math1 = random()
    encoded_random_math1 = btoa(random_math1*t)
    encoded_ua = btoa(user_agent)
    temp_string = f"{encoded_time}.{encoded_random_math0}.{encoded_random_math1}.{encoded_ua}"
    final_string = temp_string.encode("utf-8")
    hash_object = hashlib.sha1(final_string)
    sha_1_xbc = hash_object.hexdigest()
    # 
    session.headers["sign"] = final_sign
    session.headers["time"] = time2
    session.headers["x-bc"] = "YOUR X-BC TOKEN"
    return session

This is the old sign function that I made. https://github.com/DIGITALCRIMINAL/OnlyFans/blob/b0cf772a83ebe9adaa232a683036ea8b8cd288a7/apis/onlyfans/onlyfans.py#L19

UltimaHoarder avatar May 01 '21 14:05 UltimaHoarder

sign is required or you'll get "please refresh" error. sign's sha1 hash is made up of:

"BcsLYSyemJCNrob8u6QWziudT5Xx4LlO\n1619875069\n/api2/v2/users/me\n0"

"BcsLYSyemJCNrob8u6QWziudT5Xx4LlO" never changes (static). "1619875069" is the time "/v2/users/me" is the url path. You also have to include the params if there are any. "0" I don't know what this is, but it's part of a "or" statement and it usually defaults to this.

"BcsLYSyemJCNrob8u6QWziudT5Xx4LlO\n1619875069\n/api2/v2/users/me\n0" gets hashed into sha1.

sha1 result: 5b0e330fcdbf9507c4391e6c2a9e4a98d3c900f2

It then becomes part of sign.

3:5b0e330fcdbf9507c4391e6c2a9e4a98d3c900f2:8bc:608c48da

3: is static 5b0e330fcdbf9507c4391e6c2a9e4a98d3c900f2: isn't static 8bc: isn't static 608c48da is static

8bc - this part seems to be the final problem and if you substitute anything for it, you'll get "please refresh" 8bc is calculated by the whole math function I posted above. the sha1 hashed is used in it's calculations which is why it will fail if you change it. ###################### x-bc is required or you'll get your session locked and reset. It's similar to "sess".

You need it to make any requests to their API. ###################### Technically, the sign function should be like this... but the "a55" part in "final_sign" is incorrect.

def create_sign(session, link, sess, user_agent, text="onlyfans"):
    # Users: 300000 | Creators: 301000
    # time2 = str(int(round(time.time() * 1000-301000)))
    session.headers["access-token"] = sess

    def btoa(specimen):
        encoded = base64.b64encode(str(specimen).encode('ascii'))
        encoded = encoded.decode("utf-8")
        return encoded
    # Create sign
    time2 = str(int(round(time.time())))
    path = urlparse(link).path
    query = urlparse(link).query
    path = path if not query else f"{path}?{query}"
    static_param = "BcsLYSyemJCNrob8u6QWziudT5Xx4LlO"
    a = [static_param, time2, path, "0"]
    msg = "\n".join(a)
    message = msg.encode("utf-8")
    hash_object = hashlib.sha1(message)
    sha_1_sign = hash_object.hexdigest()
    final_sign = f"3:{sha_1_sign}:a55:608c48da"
    # Create x-bc - You don't need to do this, infact I don't think you can create a customer token, you'll have to use it from the browser.
    t = 1e12
    encoded_time = btoa(time2)
    random_math0 = random()
    encoded_random_math0 = btoa(random_math0*t)
    random_math1 = random()
    encoded_random_math1 = btoa(random_math1*t)
    encoded_ua = btoa(user_agent)
    temp_string = f"{encoded_time}.{encoded_random_math0}.{encoded_random_math1}.{encoded_ua}"
    final_string = temp_string.encode("utf-8")
    hash_object = hashlib.sha1(final_string)
    sha_1_xbc = hash_object.hexdigest()
    # 
    session.headers["sign"] = final_sign
    session.headers["time"] = time2
    session.headers["x-bc"] = "YOUR X-BC TOKEN"
    return session

This is the old sign function that I made. https://github.com/DIGITALCRIMINAL/OnlyFans/blob/b0cf772a83ebe9adaa232a683036ea8b8cd288a7/apis/onlyfans/onlyfans.py#L19

So for a total rookie in this. Is there a way around it to get the scraper running again? :)

Macmasteri avatar May 01 '21 14:05 Macmasteri