aws_test_bucket.py 文件源码

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

项目:it-security 作者: IhorKravchuk 项目源码 文件源码
def print_bucket_status(bucket, status):
# Public access exists
    if status == "S3WebSite":
        print colored("Bucket: "+ bucket, color="yellow"), " - Found index.html, most probably S3 static web hosting is enabled"
    elif status == "S3WebSite!":
        print colored("Bucket: "+ bucket, color="yellow"), " - S3 static web hosting is enabled on the bucket"
    elif status == "NoSuchKey":
        print colored("Bucket: "+ bucket, color="red"),  " - Bucket exists, publicly available and no S3 static web hosting, most probably misconfigured! "
    elif status == "AllUsersAccess" or status == "AllAuthUsersAccess":
        print colored("Bucket: "+ bucket, color="red"),  " - Bucket exists and publicly ( "+ status+ " ) "+  " available. Reason: Bucket ACL ! "
    elif "s3:" in status:
        print colored("Bucket: "+ bucket, color="red"),  " - Bucket exists and publicly ( "+ status+ " ) "+  " available. Reason: Bucket Policy ! "
# Can't check due to the access restrictions:
    elif status == "AccessDenied2ACL" or status == "AccessDenied2Policy":
        print colored("Bucket: "+ bucket, color="yellow"),  " - Bucket exists, but can't verify policy or ACL due to the: "+ status
# No public acess
    elif status == "AccessDenied" or status == "NoSuchBucketPolicy" or status == "NoPublicAccess":
        print colored("Bucket: "+ bucket, color="green"), " - No public access detected"
# No bucket - no problem
    elif status == "NoSuchBucket":
        print colored("Bucket: "+ bucket, color="green"),  " - The specified bucket does not exist"
# Can't really verify due to the API Error
    elif status == "Can'tVerify" or status == "InvalidRequest":
        print colored("Bucket: "+ bucket, color="yellow"),  "- Can't really verify due to the API Error"
    else:
        cprint("Bucket: "+ bucket+ "----"+ status, "yellow")
    return
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号