Skip to content

Commit

Permalink
[sc-25981] Fix some logging, Add region cli option
Browse files Browse the repository at this point in the history
  • Loading branch information
drunkenplatypus committed Jul 4, 2024
1 parent 0e54b48 commit 197f0f7
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 14 deletions.
3 changes: 3 additions & 0 deletions cloud_enum.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@ def parse_arguments():

parser.add_argument('-qs', '--quickscan', action='store_true',
help='Disable all mutations and second-level scans')

parser.add_argument('-r', '--region', type=str, action='store',
help='Region to use for checks')

args = parser.parse_args()

Expand Down
2 changes: 1 addition & 1 deletion enum_tools/aws_checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def print_s3_response(reply):
return 'breakout'
else:
print(f" Unknown status codes being received from {reply.url}:\n"
" {reply.status_code}: {reply.reason}")
f" {reply.status_code}: {reply.reason}")

return None

Expand Down
12 changes: 8 additions & 4 deletions enum_tools/azure_checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ def print_container_response(reply):
pass
else:
print(f" Unknown status codes being received from {reply.url}:\n"
" {reply.status_code}: {reply.reason}")
f" {reply.status_code}: {reply.reason}")

return None

Expand Down Expand Up @@ -478,7 +478,7 @@ def print_vm_response(hostname):
utils.fmt_output(data)


def check_azure_vms(names, nameserver, threads, nameserverfile=False):
def check_azure_vms(names, nameserver, threads, nameserverfile=False, region=None):
"""
Checks for Azure Virtual Machines
"""
Expand All @@ -490,7 +490,11 @@ def check_azure_vms(names, nameserver, threads, nameserverfile=False):
# Pull the regions from a config file
regions = azure_regions.REGIONS

print(f"[*] Testing across {len(regions)} regions defined in the config file")
# If a region is specified, use that instead
if region:
regions = [region]

print(f"[*] Testing across {len(regions)} regions defined in the config file or command line")

for region in regions:

Expand Down Expand Up @@ -526,4 +530,4 @@ def run_all(names, args):

check_azure_websites(names, args.nameserver, args.threads, args.nameserverfile)
check_azure_databases(names, args.nameserver, args.threads, args.nameserverfile)
check_azure_vms(names, args.nameserver, args.threads, args.nameserverfile)
check_azure_vms(names, args.nameserver, args.threads, args.nameserverfile, args.region)
22 changes: 13 additions & 9 deletions enum_tools/gcp_checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def print_bucket_response(reply):
utils.fmt_output(data)
else:
print(f" Unknown status codes being received from {reply.url}:\n"
" {reply.status_code}: {reply.reason}")
f" {reply.status_code}: {reply.reason}")


def check_gcp_buckets(names, threads):
Expand Down Expand Up @@ -109,7 +109,7 @@ def print_fbrtdb_response(reply):
utils.fmt_output(data)
else:
print(f" Unknown status codes being received from {reply.url}:\n"
" {reply.status_code}: {reply.reason}")
f" {reply.status_code}: {reply.reason}")


def check_fbrtdb(names, threads):
Expand Down Expand Up @@ -159,7 +159,7 @@ def print_fbapp_response(reply):
utils.fmt_output(data)
else:
print(f" Unknown status codes being received from {reply.url}:\n"
" {reply.status_code}: {reply.reason}")
f" {reply.status_code}: {reply.reason}")

def check_fbapp(names, threads):
"""
Expand Down Expand Up @@ -218,7 +218,7 @@ def print_appspot_response(reply):
utils.fmt_output(data)
else:
print(f" Unknown status codes being received from {reply.url}:\n"
" {reply.status_code}: {reply.reason}")
f" {reply.status_code}: {reply.reason}")


def check_appspot(names, threads):
Expand Down Expand Up @@ -268,7 +268,7 @@ def print_functions_response1(reply):
HAS_FUNCS.append(reply.url)
else:
print(f" Unknown status codes being received from {reply.url}:\n"
" {reply.status_code}: {reply.reason}")
f" {reply.status_code}: {reply.reason}")


def print_functions_response2(reply):
Expand Down Expand Up @@ -299,10 +299,10 @@ def print_functions_response2(reply):
utils.fmt_output(data)
else:
print(f" Unknown status codes being received from {reply.url}:\n"
" {reply.status_code}: {reply.reason}")
f" {reply.status_code}: {reply.reason}")


def check_functions(names, brute_list, quickscan, threads):
def check_functions(names, brute_list, quickscan, threads, region=None):
"""
Checks for Google Cloud Functions running on cloudfunctions.net
Expand All @@ -328,7 +328,11 @@ def check_functions(names, brute_list, quickscan, threads):
# Pull the regions from a config file
regions = gcp_regions.REGIONS

print(f"[*] Testing across {len(regions)} regions defined in the config file")
# If a region is specified, use that instead
if region:
regions = [region]

print(f"[*] Testing across {len(regions)} regions defined in the config file or command line")

# Take each mutated keyword craft a url with the correct format
for region in regions:
Expand Down Expand Up @@ -387,4 +391,4 @@ def run_all(names, args):
check_gcp_buckets(names, args.threads)
check_fbrtdb(names, args.threads)
check_appspot(names, args.threads)
check_functions(names, args.brute, args.quickscan, args.threads)
check_functions(names, args.brute, args.quickscan, args.threads, args.region)

0 comments on commit 197f0f7

Please sign in to comment.