Skip to content

Commit

Permalink
Merge pull request #179 from domain-protect/chore/remove-regex-module
Browse files Browse the repository at this point in the history
chore: replace regex with re
  • Loading branch information
paulschwarzenberger authored Jan 5, 2025
2 parents 6d87aba + 7a8b1ec commit 69f7fec
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 24 deletions.
1 change: 0 additions & 1 deletion manual_scans/aws/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
boto3==1.35.19
dnspython==2.7.0
requests==2.32.3
regex==2024.11.6
1 change: 0 additions & 1 deletion requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion requirements-tests.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 0 additions & 9 deletions scripts/lambda-build/create-package-for-each.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 0 additions & 9 deletions scripts/lambda-build/create-package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 7 additions & 3 deletions utils/utils_aws_manual.py
Original file line number Diff line number Diff line change
@@ -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()
Expand Down Expand Up @@ -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):
Expand Down

0 comments on commit 69f7fec

Please sign in to comment.