Git Product home page Git Product logo

Comments (4)

joe-sandbox avatar joe-sandbox commented on June 15, 2024 1

What I've doing so far is that when 2FA code is present what I do is print on the terminal with emojis the code needed to verify and add a delay to wait for me to approve the code. It's a hackish workaround and not very independent but works for me since I have in another screen and when I see the red alert on the terminal it gets my attention.

I'm sharing the code in case you want to try.

On line 392 I added this:

 try:
            twofactorvalue = driver.find_element(By.XPATH, value='//*[@id="idRemoteNGC_DisplaySign"]')
            if twofactorvalue is not None:
                print(f'🚨🚨🚨🚨{bcolors.FAIL}Using 2FA waiting for approval of code {twofactorvalue.text}{bcolors.ENDC}')
                sleep(30)
                print(f'Assumming you did aprove code')
                return True
            else:
                password_field = driver.find_element(By.XPATH, value='//*[@id="i0118"]')
                WebDriverWait(driver, 10).until(
                    EC.element_to_be_clickable(password_field)
                )
                password_field.send_keys(PASSWORD)
                password_field.send_keys(Keys.ENTER)
        except:
            print(f'Unable to find password field for account {EMAIL}')
            return False

and on line 220 I added this class I got from StackOverflow :

class bcolors:
    HEADER = '\033[95m'
    OKBLUE = '\033[94m'
    OKCYAN = '\033[96m'
    OKGREEN = '\033[92m'
    WARNING = '\033[93m'
    FAIL = '\033[91m'
    ENDC = '\033[0m'
    BOLD = '\033[1m'
    UNDERLINE = '\033[4m'

I could also add a local notification pop up or send Apprise alert with the code.

Just wanted two share my 2 cents ☺️

PS: If you are interested on the approach of sending a local notification on MacOS let me know.

from bingrewards.

meghrathod avatar meghrathod commented on June 15, 2024

I don't think that would be possible when using headless, Non-headless mode, you can quickly put in your 2FA credentials to do it .

from bingrewards.

piersandro avatar piersandro commented on June 15, 2024

Thank you @joeg1307 this is a good workaround. I will try it!

This however has no impact on other accounts if the 2FA is not active, correct?

from bingrewards.

joe-sandbox avatar joe-sandbox commented on June 15, 2024

@piersandro That's correct. And if you miss the approval of the code it will continue as normal. It will run the searches without being registered to your account, but at least it doesn't stop the whole thing and you can come back an try again. What I've been doing is, on the .env on the LOGIN environment variable, at the very beginning of the string I set the account with 2FA so that's the first account to be handled.

In other words you can work also with the order of accounts set in the LOGIN environment variable to better fit to your timing needs of approving the 2FA Codes.

from bingrewards.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.