mdesilva / AmazonFlexUnlimited

Automate the process of grabbing job blocks from Amazon Flex
174 stars 101 forks source link

Error code 307 #96

Open travislazzaro opened 1 year ago

travislazzaro commented 1 year ago

First time seeing this code. Anyone know how to fix?

kyleanderson84 commented 1 year ago

That code prompts the bot detection captcha. You're going to have to try and pick up a block in the app and solve it manually. Add this code to the run method in the Flexunlimited.py file under the lib folder after the "if self.status_code == 200:" and right before the "else:" line. It should pause the bot and text you to solve the Captcha in your app, then return to the bots terminal, type Y and press enter, you're good to go

elif request.statuscode == 307: #manualy complete amazon captcha if self.twilioClient is not None: self.twilioClient.messages.create(to=self.twilioToNumber, from=self.twilioFromNumber, body="Manually complete amazon flex captcha and return to bot to unpause") while(1): answer = input("Complete Captcha?:(Y/N").lower() if answer == "y": break

travislazzaro commented 1 year ago

Ok, thanks. Will I have to remove that code after I solve the captcha?

kyleanderson84 commented 1 year ago

No, it's a work around for now, leave it in. Do you have twillio set up? If not, set it up with a free trial, then it will text you when you pick up a shift or trigger the Captcha. Hopefully this doesn't end bots, lol

travislazzaro commented 1 year ago

Yeah I have twilio set up

On Fri, Mar 24, 2023 at 6:44 AM Kyle Anderson @.***> wrote:

No, it's a work around for now, leave it in. Do you have twillio set up? If not, set it up with a free trial, then it will text you when you pick up a shift or trigger the Captcha. Hopefully this doesn't end bots, lol

— Reply to this email directly, view it on GitHub https://github.com/mdesilva/AmazonFlexUnlimited/issues/96#issuecomment-1482825033, or unsubscribe https://github.com/notifications/unsubscribe-auth/A2VEIIVWUTAVZEYIEDJ3QMTW5WQNFANCNFSM6AAAAAAWGRTUOA . You are receiving this because you authored the thread.Message ID: @.***>

kyleanderson84 commented 1 year ago

Good, you should be all set, I'm going to submit that code to be added to the main source code soon. Good luck

travislazzaro commented 1 year ago

@kyleanderson84 can you tell me what line it is in FlexUnlimited.py? When I try and use the "find" feature, it doesnt seem to find if self.status_code == 200:.

travislazzaro commented 1 year ago

Is this the right code?

if request.status_code == 200: self._acceptedOffers.append(offer) if self.twilioClient is not None: self.twilioClient.messages.create( to=self.twilioToNumber, from=self.twilioFromNumber, body=offer.toString()) Log.info(f"Successfully accepted an offer.") else: Log.error(f"Unable to accept an offer. Request returned status code {request.status_code}")

kyleanderson84 commented 1 year ago

Yes, after line 409, I had to check the main source, sorry. My copy is very modified

travislazzaro commented 1 year ago

The code I posted above is accurate? Thats line 438 for me.

travislazzaro commented 1 year ago

So should it look like this?

if request.status_code == 200: self._acceptedOffers.append(offer) if self.twilioClient is not None: self.twilioClient.messages.create( to=self.twilioToNumber, from=self.twilioFromNumber, body=offer.toString()) Log.info(f"Successfully accepted an offer.") elif request.statuscode == 307: #manualy complete amazon captcha if self.twilioClient is not None: self.twilioClient.messages.create(to=self.twilioToNumber, from=self.twilioFromNumber, body="Manually complete amazon flex captcha and return to bot to unpause") while(1): answer = input("Complete Captcha?:(Y/N").lower() if answer == "y": break else: Log.error(f"Unable to accept an offer. Request returned status code {request.status_code}")

kyleanderson84 commented 1 year ago

Looks right, you might need to double check the indentation after the if statements and while statement if you get any errors about indents, but it looks great

travislazzaro commented 1 year ago

If someone is able to extract and share the Charles proxy data from the time the captcha shows up until it is solved it would be possible to make a better workaround.

It looks like the challenge url is amazon dot com/aaut/verify/flex-offers/challenge?challengeType=ARKOSE_LEVEL_1

It would be nice to see what the headers or payload would need to be?

i'll try but there are not any offers to accept at the moment

MY20-PHEV commented 1 year ago

I can't believe the api doesn't care that we are sending unsigned headers ? I thought that would be way they are catching us. When you look at the Charles proxy data from the actual flex app, it is sending a signature that is generated using some AWS standards. I tried to figure it out but ran out of talent :(

kyleanderson84 commented 1 year ago

I don't think they care all that much, bots or no bots they're will always be people who only take large surges

MY20-PHEV commented 1 year ago

But you can't talk to any other AWS api's without signing your headers ? why would they leave flex out ? I can only think to get a list of all the bot use

travislazzaro commented 1 year ago

@kyleanderson84 how do i fix the indentation? i am getting an error about it when i try running the script

travislazzaro commented 1 year ago

Traceback (most recent call last): File "C:\AmazonFlexUnlimited\app.py", line 2, in from lib.FlexUnlimited import FlexUnlimited File "C:\AmazonFlexUnlimited\lib\FlexUnlimited.py", line 446 elif request.status_code == 307: #manualy complete amazon captcha TabError: inconsistent use of tabs and spaces in indentation

ghost commented 1 year ago

I doubt there will be an offline solution to the Captcha, unless someone discovers a loophole to completely bypass it without solving it. I did some research on FunCaptcha and took a look at the javascript behind the scenes.. it's doing some crazy stuff, not just looking for the correct answer. It's tracking your device width, height, any proxies, user agent, whether your device has a touch screen, whether your device can run javascript and draw hidden html elements, and a whole lot more. Way above my skill level to even attempt to write something that could fool that code. Apparently there's some sites that offer manual captcha solving services, I suspect the commercial bots are using those.

travislazzaro commented 1 year ago

I am getting this error. Here is the code:

if request.status_code == 200:
  self.__acceptedOffers.append(offer)

  if self.twilioClient is not None:
    self.twilioClient.messages.create(
      to=self.twilioToNumber,
      from_=self.twilioFromNumber,
      body=offer.toString())
  Log.info(f"Successfully accepted an offer.")

  elif.request.status_code == 307:
      if self.twilioClient is not None:
          self.twilioClient.messages.create(
          to=self.twilioToNumber,
          from=self.twilioFromNumber,
          body="Manually complete amazon flex captcha and return to the bot to unpause")
          while(1):
              answer= input("Complete Captcha?:(Y/N").lower()
              if answer == "y":
                  break
else:
  Log.error(f"Unable to accept an offer. Request returned status code {request.status_code}")

Here is the error:

elif.request.status_code == 307:
^^^^

SyntaxError: invalid syntax

travislazzaro commented 1 year ago

@ssmusic19 what do you think about the fix for manually completing captcha when an offer is caught? @kyleanderson84 says its worked for him.

MY20-PHEV commented 1 year ago

I am getting this error. Here is the code:

if request.status_code == 200:
  self.__acceptedOffers.append(offer)

  if self.twilioClient is not None:
    self.twilioClient.messages.create(
      to=self.twilioToNumber,
      from_=self.twilioFromNumber,
      body=offer.toString())
  Log.info(f"Successfully accepted an offer.")

  elif.request.status_code == 307:
    if self.twilioClient is not None:
        self.twilioClient.messages.create(
        to=self.twilioToNumber,
        from=self.twilioFromNumber,
        body="Manually complete amazon flex captcha and return to the bot to unpause")
        while(1):
            answer= input("Complete Captcha?:(Y/N").lower()
            if answer == "y":
                break
else:
  Log.error(f"Unable to accept an offer. Request returned status code {request.status_code}")

Here is the error:

elif.request.status_code == 307:
^^^^

SyntaxError: invalid syntax

Its hard to tell on here, looks like your spacing is all wrong, looks like you've used a combination of spaces and tabs. Try to use just tabs and make sure they line up

MY20-PHEV commented 1 year ago

also, use VSCODE with a python extension to help you with the correct indents

kyleanderson84 commented 1 year ago
if request.status_code == 200:
  self.__acceptedOffers.append(offer)

  if self.twilioClient is not None:
    self.twilioClient.messages.create(
      to=self.twilioToNumber,
      from_=self.twilioFromNumber,
      body=offer.toString())
  Log.info(f"Successfully accepted an offer.")

elif request.status_code == 307:
      if self.twilioClient is not None:
          self.twilioClient.messages.create(
          to=self.twilioToNumber,
          from=self.twilioFromNumber,
          body="Manually complete amazon flex captcha and return to the bot to unpause")
          while(1):
              answer= input("Complete Captcha?:(Y/N").lower()
              if answer == "y":
                  break
else:
  Log.error(f"Unable to accept an offer.

Should look like this, it's the period after the elif statement that's causing trouble, should be a space

MY20-PHEV commented 1 year ago
if request.status_code == 200:
  self.__acceptedOffers.append(offer)

  if self.twilioClient is not None:
    self.twilioClient.messages.create(
      to=self.twilioToNumber,
      from_=self.twilioFromNumber,
      body=offer.toString())
  Log.info(f"Successfully accepted an offer.")

elif request.status_code == 307:
    if self.twilioClient is not None:
        self.twilioClient.messages.create(
        to=self.twilioToNumber,
        from=self.twilioFromNumber,
        body="Manually complete amazon flex captcha and return to the bot to unpause")
        while(1):
            answer= input("Complete Captcha?:(Y/N").lower()
            if answer == "y":
                break
else:
  Log.error(f"Unable to accept an offer.

Should look like this, it's the period after the elif statement that's causing trouble, should be a space

Good spot :)

kyleanderson84 commented 1 year ago

@ssmusic19 yeah, that's why I think manually completing it on your usual device is probably best. Hopefully I don't get flagged!

MY20-PHEV commented 1 year ago

theres a ) missing at the end of the last log statement

MY20-PHEV commented 1 year ago

and a "

kyleanderson84 commented 1 year ago

@MY20-PHEV I copied and pasted it and the spacing was fine, I think it's just how GitHub word wraps

MY20-PHEV commented 1 year ago

@kyleanderson84 I know what you mean, I straightened it up in VSCODE and pasted a reply back to you and it stripped out all the tabs I had just put in !!!!!!!!!

travislazzaro commented 1 year ago

Code:

if request.status_code == 200: self.__acceptedOffers.append(offer)

if self.twilioClient is not None: self.twilioClient.messages.create( to=self.twilioToNumber, from_=self.twilioFromNumber, body=offer.toString()) Log.info(f"Successfully accepted an offer.")

elif request.statuscode == 307: if self.twilioClient is not None: self.twilioClient.messages.create( to=self.twilioToNumber, from=self.twilioFromNumber, body="Manually complete amazon flex captcha and return to the bot to unpause") while(1): answer= input("Complete Captcha?:(Y/N").lower() if answer == "y": break else: Log.error(f"Unable to accept an offer. Request returned status code {request.status_code}")

error:

Traceback (most recent call last): File "C:\AmazonFlexUnlimited\app.py", line 2, in from lib.FlexUnlimited import FlexUnlimited File "C:\AmazonFlexUnlimited\lib\FlexUnlimited.py", line 468 else: ^ IndentationError: unindent does not match any outer indentation level

travislazzaro commented 1 year ago

@MY20-PHEV why cant i copy paste the code into VSCODE with proper indentation? lol do I have to manually type it all out?

MY20-PHEV commented 1 year ago

you can copy and paste but the indentation will need tweaking manually

travislazzaro commented 1 year ago

@kyleanderson84 dude.. can you send me your FlexUnlimited.py file? I have no clue how to add the code without errors and its driving me nuts.

travislazzaro@gmail.com

travislazzaro commented 1 year ago

nvm, i finally got it. lol.

kyleanderson84 commented 1 year ago

@travislazzaro sorry, totally forgot, had children to feed

travislazzaro commented 1 year ago

@kyleanderson84 no worries!

travislazzaro commented 1 year ago

@kyleanderson84 so i just got an offer. I pressed y and hit enter. opened my app and didnt see a captcha. The script then resumed...

300 requests attempted

350 requests attempted

Complete Captcha?:(Y/Ny 400 requests attempted

kyleanderson84 commented 1 year ago

You have to accept a random block to get to the Captcha

travislazzaro commented 1 year ago

ok I have to manually accept a block, complete captcha, and then the code you posted should work?

travislazzaro commented 1 year ago

@kyleanderson84 i did the captcha for a random block. The script then caught a reserved block, but the script still said "complete captcha y/n?". So it caught the block but I'm wondering if there's a way to allow the script to keep running if it doesn't get a 307 error code.

Edit: just got a notification for another reserved block in my parameters and the script didn't catch it at all. Not sure why. This is after the previous one it did catch, which I then input "y" to resume the script.

iFrostCakes commented 1 year ago

No, it's a work around for now, leave it in. Do you have twillio set up? If not, set it up with a free trial, then it will text you when you pick up a shift or trigger the Captcha. Hopefully this doesn't end bots, lol

Sorry to hijack the thread to ask what I’m sure is a dumb question, but what format do you enter phone numbers for Twilio? I’ve gone through the set up of the service and successfully tested a notification, but the script isn’t sending me a text when it catches offers.

I’m pretty sure it is just the way I am entering the phone number because I haven’t messed with any files other than the configuration file.

I entered them this way:

“twilioFromNumber”: “+15555555555”,

travislazzaro commented 1 year ago

No, it's a work around for now, leave it in. Do you have twillio set up? If not, set it up with a free trial, then it will text you when you pick up a shift or trigger the Captcha. Hopefully this doesn't end bots, lol

Sorry to hijack the thread to ask what I’m sure is a dumb question, but what format do you enter phone numbers for Twilio? I’ve gone through the set up of the service and successfully tested a notification, but the script isn’t sending me a text when it catches offers.

I’m pretty sure it is just the way I am entering the phone number because I haven’t messed with any files other than the configuration file.

I entered them this way:

“twilioFromNumber”: “+15555555555”,

take out the + and the 1. thats how mine looks. "1112223333"