UltimaScraper icon indicating copy to clipboard operation
UltimaScraper copied to clipboard

Auth Failures (echo chamber)

Open LP560 opened this issue 6 years ago • 112 comments

it seems OF has removed auth_hash when you inspect. is there any other way to find it? Or login

LP560 avatar Jul 26 '20 13:07 LP560

Yeah, scrapper has started to fail Auth Attempt, went to recheck the cookie information to see if everything was in order, and couldn't find auth_hash either. Not sure if anything else changed as well.

WellSomething avatar Jul 26 '20 13:07 WellSomething

Getting failed auth attempts here too. Using chrome, I still see auth hash but mine has changed along with sess. Updated everything and still getting failed auths.

artyom2035 avatar Jul 26 '20 14:07 artyom2035

I still see the auth_hash cookie, but I think it's because it's old. When I open an icognito window, I dont' see it anymore. However I see a cookie named "sc_is_visitor_unique" that I do not see in a normal window...

image

jeremfg avatar Jul 26 '20 14:07 jeremfg

I believe Onlyfans is adding two header values using XHR called "sign" and "time". If the request header doesn't contain these two you will get an error. It isn't a cookie error. They're both generated using javascript too.

Hashirama avatar Jul 26 '20 16:07 Hashirama

I've been seeing this issue as well. As mentioned above one of the cookies is missing on new sessions but older ones still use it.

shinji257 avatar Jul 26 '20 16:07 shinji257

They implemented this https://docs.aws.amazon.com/general/latest/gr/signing_aws_api_requests.html

UltimaHoarder avatar Jul 26 '20 18:07 UltimaHoarder

They implemented this https://docs.aws.amazon.com/general/latest/gr/signing_aws_api_requests.html

Is that a bad thing?

BoxFit3 avatar Jul 26 '20 18:07 BoxFit3

Depends, but we have to reverse engineer the hash methods. I'm somewhat making progress, but I don't know if it will work.

UltimaHoarder avatar Jul 26 '20 18:07 UltimaHoarder

Depends, but we have to reverse engineer the encryption methods. I'm somewhat making progress, but I don't know if it will work.

Damn, good luck bro, you the goat fr fr

BoxFit3 avatar Jul 26 '20 19:07 BoxFit3

@jumoog, yee it is. I didn't want to say anything yet because I didn't want them changing anything lmao. They're probably watching this thread.

UltimaHoarder avatar Jul 26 '20 23:07 UltimaHoarder

@jumoog have you tried sending a request with the signing and time?

UltimaHoarder avatar Jul 26 '20 23:07 UltimaHoarder

I tried sending a request with sign and time (and the usual stuff) and it seems to work for that specific endpoint, even multiple times, for quite a long time. I'm gonna do some more tests this weekend.

mileyvirus avatar Jul 26 '20 23:07 mileyvirus

Since it's a SPA and I see a CSRF in the cookies, the AWS keys to generate the signature are probably sloppily obfuscated in vendor.js.

mileyvirus avatar Jul 26 '20 23:07 mileyvirus

@jumoog, yee it is. I didn't want to say anything yet because I didn't want them changing anything lmao. They're probably watching this thread.

lol... It's not like the code source isn't available anyway 😉. And they'll known it was "figured out" if the project is still active.

jeremfg avatar Jul 27 '20 00:07 jeremfg

@jumoog, yee it is. I didn't want to say anything yet because I didn't want them changing anything lmao. They're probably watching this thread.

lol... It's not like the code source isn't available anyway 😉. And they'll known it was "figured out" if the project is still active.

Yeah, I know, but I'd hate for them to change something whilst we're trying to figure it out.

UltimaHoarder avatar Jul 27 '20 03:07 UltimaHoarder

Yay image

UltimaHoarder avatar Jul 27 '20 03:07 UltimaHoarder

Alright so basically...

No 2FA = no auth_hash 2FA = auth_hash and auth_uniqu

You don't need the CSRF from what I can see. Sess still needs to be passed.

Regarding the new auth headers You can pass any string for "sign" You can pass any int for "time"

As @jumoog said (which was deleted) the signing is made up of the following things

sess_token epoch timestamp URL path (queries included) user_agent "onlyfans"

an69hkjp7kj169o691ugaiaqpj
3496797795845
/api2/v2/init?app-token=33d57ade8c02dbc5a333db99ff9ae26a
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.89 Safari/537.36
onlyfans

You need to encode those values into sha1 encryption https://emn178.github.io/online-tools/sha1.html

I'll make the script recreate the correct signing token since OF will know if you're using an invalid token. They're probably allowing requests with the invalid sign and time values as a way to track users lmao, so I'll try my best to make it as anon as possible...

UltimaHoarder avatar Jul 27 '20 03:07 UltimaHoarder

def create_sign(session, link, sess, user_agent, text="onlyfans"):
    time = str(int(round(time2.time() * 1000-300000)))
    path = urlparse(link).path
    query = urlparse(link).query
    path = path+"?"+query
    a = [sess, time, path, user_agent, text]
    msg = "\n".join(a)
    message = msg.encode("utf-8")
    hash_object = hashlib.sha1(message)
    sha_1 = hash_object.hexdigest()
    session.headers["sign"] = sha_1
    session.headers["time"] = time
    return session

Created this function if anyone else wants to use it. It'll create the signed token and add it to the session's header. Luckily the script only uses one session so I only have to call this function once.

UltimaHoarder avatar Jul 27 '20 06:07 UltimaHoarder

@DIGITALCRIMINAL i think there is a bug in the most recent push to master. I'm getting

Type: Stories
Scraping [photo]. Should take less than a minute.
Scraping [video | stream | gif]. Should take less than a minute.
Type: Highlights
Scraping [photo]. Should take less than a minute.
Scraping [video | stream | gif]. Should take less than a minute.
Type: Posts
Scraping [photo]. Should take less than a minute.
Scraping [video | stream | gif]. Should take less than a minute.
2020-07-27 02:37:26,573 ERROR errors invalid literal for int() with base 10: ''
Traceback (most recent call last):
  File "Z:\github-folders\OnlyFans\datascraper\main_datascraper.py", line 221, in start_datascraper
    result = x.start_datascraper(
  File "Z:\github-folders\OnlyFans\modules\onlyfans.py", line 92, in start_datascraper
    results = prepare_scraper(
  File "Z:\github-folders\OnlyFans\modules\onlyfans.py", line 519, in prepare_scraper
    export_archive(metadata_set, archive_directory, json_settings)
  File "Z:\github-folders\OnlyFans\helpers\main_helper.py", line 104, in export_archive
    datas2 = ofrenamer.start(archive_path, json_settings)
  File "Z:\github-folders\OnlyFans\extras\OFRenamer\start.py", line 90, in start
    metadata.valid = fix_metadata(
  File "Z:\github-folders\OnlyFans\extras\OFRenamer\start.py", line 50, in fix_metadata
    reformat = prepare_reformat(model2)
  File "Z:\github-folders\OnlyFans\extras\OFRenamer\start.py", line 47, in __init__
    self.maximum_length = int(text_length)
ValueError: invalid literal for int() with base 10: ''

ghost avatar Jul 27 '20 07:07 ghost

a new issue, please...

UltimaHoarder avatar Jul 27 '20 07:07 UltimaHoarder