diff --git a/manual_scans/aws/requirements.txt b/manual_scans/aws/requirements.txt index e3513e54..4ca555c3 100644 --- a/manual_scans/aws/requirements.txt +++ b/manual_scans/aws/requirements.txt @@ -1,4 +1,3 @@ boto3==1.35.19 dnspython==2.7.0 requests==2.32.3 -regex==2024.11.6 diff --git a/requirements-dev.txt b/requirements-dev.txt index 8ed09600..f10c902c 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -2,7 +2,6 @@ boto3==1.34.25 cloudflare==2.20.0 dnspython==2.7.0 requests==2.32.3 -regex==2024.11.6 black==24.10.0 prospector==1.13.0 pytest==8.3.4 diff --git a/requirements-tests.txt b/requirements-tests.txt index e13697cc..6fe308de 100644 --- a/requirements-tests.txt +++ b/requirements-tests.txt @@ -2,7 +2,6 @@ boto3==1.34.25 cloudflare==3.1.1 dnspython==2.7.0 requests==2.32.3 -regex==2024.11.6 black==24.10.0 prospector==1.13.0 pytest==8.3.4 diff --git a/scripts/lambda-build/create-package-for-each.sh b/scripts/lambda-build/create-package-for-each.sh index 42e78c2b..c104c1b9 100755 --- a/scripts/lambda-build/create-package-for-each.sh +++ b/scripts/lambda-build/create-package-for-each.sh @@ -35,15 +35,6 @@ do echo "Installing dependencies..." echo "From: requirements.txt file exists..." pip install -r "$FILE" - - # Install regex package... - pip install --platform $platform \ - --target $path_cwd/build/env_$i/lib/$runtime/site-packages \ - --implementation cp \ - --python-version ${runtime:6} \ - --only-binary=:all: --upgrade \ - regex - else echo "Error: requirements.txt does not exist!" fi diff --git a/scripts/lambda-build/create-package.sh b/scripts/lambda-build/create-package.sh index 2a9c9fc0..fbe75c24 100755 --- a/scripts/lambda-build/create-package.sh +++ b/scripts/lambda-build/create-package.sh @@ -31,15 +31,6 @@ if [ -f "$FILE" ]; then echo "Installing dependencies..." echo "From: requirements.txt file exists..." pip install -r "$FILE" - - # Install regex package... - pip install --platform $platform \ - --target $path_cwd/build/env_$function_name/lib/$runtime/site-packages \ - --implementation cp \ - --python-version ${runtime:6} \ - --only-binary=:all: --upgrade \ - regex - else echo "Error: requirements.txt does not exist!" fi diff --git a/utils/utils_aws_manual.py b/utils/utils_aws_manual.py index 53ca17ad..8852196c 100644 --- a/utils/utils_aws_manual.py +++ b/utils/utils_aws_manual.py @@ -1,10 +1,14 @@ +import re import warnings import boto3 -import regex import requests import urllib3 +# Compile once +BUCKET_URL_ENDPOINT = re.compile(r"^.+\.s3\.([a-z0-9-]+\.)?amazonaws\.com$") +BUCKET_WEBSITE_ENDPOINT = re.compile(r"^.+\.s3-website[-.]([a-z0-9-]+\.)?amazonaws\.com$") + def list_hosted_zones_manual_scan(): session = boto3.Session() @@ -63,12 +67,12 @@ def get_cloudfront_origin_url(domain_name): def is_s3_bucket_url(url): # bucket.s3.amazonaws.com or bucket.s3.region.amazonaws.com - return url is not None and regex.match(r"^.+\.s3.([a-z0-9-]+\.)?amazonaws.com$", url) is not None + return url and BUCKET_URL_ENDPOINT.match(url) def is_s3_website_endpoint_url(url): # bucket.s3-website-region.amazonaws.com - return url is not None and regex.match(r"^.+\.s3-website[-\.]([a-z0-9-]+\.)?amazonaws.com$", url) is not None + return url and BUCKET_WEBSITE_ENDPOINT.match(url) def vulnerable_cloudfront_s3_manual(domain_name):