s3scan.py 文件源码

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

项目:S3Scan 作者: abhn 项目源码 文件源码
def initiator(globalBaseUrl):
    """take a url and set up s3 auth. Then call the driver"""

    global s3

    # alternate way to authenticate in else. 
    # use what you prefer
    if True:
        access_key = os.environ.get('AWS_ACCESS_KEY_ID')
        secret_key = os.environ.get('AWS_SECRET_ACCESS_KEY')

        if access_key is None or secret_key is None:
            print printWarning("""No access credentials available.
                Please export your AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY.
                Details: http://docs.aws.amazon.com/general/latest/gr/managing-aws-access-keys.html
                """)
            sys.exit(0)

        s3 = boto3.resource('s3', config=Config(signature_version='s3v4'))

    else:
        # If you prefer to supply the credentials here, 
        # make sure you flip the if condition to False
        # and subsitiute the necessary data :)
        s3 = boto3.resource('s3', 
            aws_access_key_id=ACCESS_ID, 
            aws_secret_access_key=ACCESS_KEY,
            config=Config(signature_version='s3v4')
            )

    print printScreen("[>]Initiating...", "blue") 
    print printScreen("[>]Press Ctrl+C to terminate script", "blue")

    scanner(globalBaseUrl)
    driver(globalBaseUrl)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号