ForceUserMFA.py 文件源码

python
阅读 24 收藏 0 点赞 0 评论 0

项目:aws-security-automation 作者: awslabs 项目源码 文件源码
def deleteUser(userName, SN):
    try:
        response = client.deactivate_mfa_device(
            UserName=userName,
            SerialNumber=SN
        )
        print("MFA device deactivated, trying to delete device.")
    except:
        print("Unable to deactivate MFA token. Could be that it's not created.")
    try:
        response = client.delete_virtual_mfa_device(
            SerialNumber=SN
        )
        print("MFA device deleted, trying to delete new user.")
    except:
        print("Unable to delete MFA token. Could be that it's not created.")
    try:
        response = client.delete_user(
            UserName=userName
        )
        print("User deleted")
    except:
        print("Unable to delete user: " + userName)
    return True
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号