def analyze(account): """Analyze ACCOUNT for possible hack leftovers. """ acc = Account(account.replace("@", "")) if acc['last_owner_update'] not in time_unset: days = (addTzInfo(datetime.utcnow()) - \ acc['last_owner_update']).days last_update = "%s (%d days ago)" % (acc['last_owner_update'], days) else: last_update = "never" logger.info("Last owner update: %s" % (last_update)) logger.info("Recovery account: @%s" % (acc['recovery_account'])) # check if the account is currently powering down if acc['next_vesting_withdrawal'] not in time_unset: vests = acc['vesting_withdraw_rate'] sp = acc.blockchain.vests_to_sp(vests.amount) logger.warning("Account is currently powering down:") logger.warning("Next vesting withdrawal: %s (~%.3f %s) at %s" % (vests, sp, acc.blockchain.token_symbol, acc['next_vesting_withdrawal'])) else: logger.info("Account is not powering down.") # check for active withdraw vesting routes routes = acc.get_withdraw_routes() if len(routes): tbl = PrettyTable(['From', 'To', 'Percent', 'Auto-vest']) for route in routes: tbl.add_row([ route['from_account'], route['to_account'], int(route['percent']) / STEEM_1_PERCENT, route['auto_vest'] ]) logger.warning("Account has withdraw routes set:\n" + str(tbl)) else: logger.info("Account has no withdraw routes set") bc = Blockchain() requests = bc.find_change_recovery_account_requests([account]) if len(requests): logger.warning( "Request to change the recovery account to " "@%s, will be effective on: %s" % (requests[0]['recovery_account'], requests[0]['effective_on'])) else: logger.info("No pending requests to change the recovery account")
def cancel_recovery_account_change(account): """ Cancel a pending recovery account change request for ACCOUNT. """ acc = Account(account) bc = Blockchain(steem_instance=acc.steem) req = bc.find_change_recovery_account_requests(acc['name']) if len(req) == 0: logger.warning("Could not find a pending recovery account change " "request, nothing to cancel.") return logger.info("Found recovery account change request:") logger.info(req[0]) pwd = getpass("Enter master password or owner key for @%s: " % (acc['name'])) pk = passwordkey_to_key(pwd, acc['name'], role="owner", prefix=acc.steem.prefix) acc.steem.wallet.setKeys([pk]) acc.change_recovery_account(acc['recovery_account'])
def cancel_recovery_account_change(account): """ Cancel a pending recovery account change request for ACCOUNT. """ acc = Account(account.replace("@", "")) bc = Blockchain(blockchain_instance=acc.blockchain) req = bc.find_change_recovery_account_requests(acc['name']) if len(req) == 0: logger.error("Could not find a pending recovery account change " "request, nothing to cancel.") return logger.info("Found recovery account change request to @%s" % (req[0]['recovery_account'])) pwd = getpass("Enter master password or owner key for @%s: " % (acc['name'])) pk = passwordkey_to_key(pwd, acc['name'], role="owner", prefix=acc.blockchain.prefix) acc.blockchain.wallet.setKeys([pk]) tx = acc.change_recovery_account(acc['recovery_account']) logger.debug(tx) logger.info("Canceled the recovery account change request.")