예제 #1
0
 def remove_guard(self, twofactor, activeSecrets):
     #Query username and password
     self.exec_query(
         "SELECT steamuser, steampass FROM Secrets WHERE isactive ='1'")
     username, password = self.response[0][0], self.response[0][1]
     #Login like a mobile phone
     medium = wa.MobileWebAuth(username, password)
     medium.login(twofactor_code=twofactor)
     sa = SteamAuthenticator(secrets=activeSecrets, medium=medium)
     #Remove Steam Guard from the account and from the database
     sa.remove()
     self.exec_query("DELETE FROM Secrets WHERE isactive = '1'")
예제 #2
0
def cmd_authenticator_remove(args):
    account = args.account.lower().strip()
    secrets_file = UserDataFile('authenticator/{}.json'.format(account))
    secrets = secrets_file.read_json()

    if not secrets:
        print("No authenticator found for %r" % account)
        return 1  #error

    if args.force:
        secrets_file.remove()
        print("Forceful removal of %r successful" % account)
        return

    print("To remove an authenticator, first we need to login to Steam")
    print("Account name:", account)

    wa = BetterMWA(account)
    sa = SteamAuthenticator(secrets, backend=wa)

    try:
        wa.bcli_login(sa_instance=sa)
    except (KeyboardInterrupt, EOFError):
        print("Login interrupted")
        return 1  # error

    print("Login successful.")
    print("Steam Guard will be set to email, after removal.")

    while True:
        if not pmt_confirmation("Proceed with removing Steam Authenticator?"):
            break
        else:
            try:
                sa.remove()
            except SteamAuthenticatorError as exp:
                print("Removal error: %s" % exp)
                continue
            except (EOFError, KeyboardInterrupt):
                break
            else:
                secrets_file.remove()
                print("Removal successful!")
                return

    print("Removal cancelled.")