Skip to content

Commit

Permalink
Merge pull request #5 from riddhi-shree/master
Browse files Browse the repository at this point in the history
Modified code to work with both Python 3 and Python 2
  • Loading branch information
andresriancho authored Sep 10, 2019
2 parents 1366347 + 5c67f23 commit 56f1288
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
10 changes: 6 additions & 4 deletions enumerate_iam/generate_bruteforce_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import os
import json


OUTPUT_FMT = 'BRUTEFORCE_TESTS = %s'
OUTPUT_FILE = 'bruteforce_tests.py'

Expand Down Expand Up @@ -64,7 +63,9 @@ def is_dangerous(operation_name):
def extract_operations(api_json):
operations = []

for operation_name, operation_data in api_json['operations'].iteritems():
items = api_json['operations'].items()

for operation_name, operation_data in items:
operation_name = to_underscore(operation_name)

if is_dangerous(operation_name):
Expand Down Expand Up @@ -103,7 +104,8 @@ def main():
if not filename.endswith('.min.json'):
continue

api_json_data = file(os.path.join(API_DEFINITIONS, filename)).read()
api_json_data = open(os.path.join(API_DEFINITIONS, filename)).read()

api_json = json.loads(api_json_data)

service_name = extract_service_name(filename, api_json)
Expand All @@ -126,7 +128,7 @@ def main():
indent=4,
sort_keys=True)

file(OUTPUT_FILE, 'w').write(output)
open(OUTPUT_FILE, 'w').write(output)


if __name__ == '__main__':
Expand Down
5 changes: 3 additions & 2 deletions enumerate_iam/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
from enumerate_iam.utils.json_utils import json_encoder
from enumerate_iam.bruteforce_tests import BRUTEFORCE_TESTS


MAX_THREADS = 25
CLIENT_POOL = {}

Expand Down Expand Up @@ -87,7 +86,9 @@ def enumerate_using_bruteforce(access_key, secret_key, session_token, region):


def generate_args(access_key, secret_key, session_token, region):
service_names = BRUTEFORCE_TESTS.keys()

service_names = list(BRUTEFORCE_TESTS.keys())

random.shuffle(service_names)

for service_name in service_names:
Expand Down

0 comments on commit 56f1288

Please sign in to comment.