-
Notifications
You must be signed in to change notification settings - Fork 821
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #498 from 0xdabbad00/find_other_privs
Find other privs
- Loading branch information
Showing
6 changed files
with
108 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,37 @@ | ||
import argparse | ||
import json | ||
|
||
from shared.common import parse_arguments | ||
from shared.iam_audit import find_admins | ||
|
||
__description__ = "Find admins in accounts" | ||
__description__ = "Find privileged users and roles in accounts" | ||
|
||
|
||
def run(arguments): | ||
_, accounts, _ = parse_arguments(arguments) | ||
admins = find_admins(accounts, findings=set()) | ||
parser = argparse.ArgumentParser() | ||
parser.add_argument( | ||
"--privs", | ||
help="The privileges to look for. Defaults to iam privileges that allow direct admin or escalation.", | ||
default=None, | ||
) | ||
parser.add_argument( | ||
"--json", | ||
help="Print the json of the issues", | ||
default=False, | ||
action="store_true", | ||
) | ||
parser.add_argument( | ||
"--include_restricted", | ||
help="Include references to these privs that may be restricted by resources or conditions", | ||
default=False, | ||
action="store_true", | ||
) | ||
args, accounts, config = parse_arguments(arguments, parser) | ||
|
||
admins = find_admins(accounts, args, findings=set()) | ||
|
||
for admin in admins: | ||
print("{}\t{}\t{}".format(admin["account"], admin["type"], admin["name"])) | ||
if args.json: | ||
print(json.dumps(admin, sort_keys=True)) | ||
else: | ||
print("{}\t{}\t{}".format(admin["account"], admin["type"], admin["name"])) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters