{"id":13539250,"url":"https://github.com/nccgroup/pmapper","last_synced_at":"2025-05-15T03:03:03.142Z","repository":{"id":33711359,"uuid":"134493334","full_name":"nccgroup/PMapper","owner":"nccgroup","description":"A tool for quickly evaluating IAM permissions in AWS.","archived":false,"fork":false,"pushed_at":"2024-08-02T15:38:29.000Z","size":1096,"stargazers_count":1470,"open_issues_count":33,"forks_count":178,"subscribers_count":25,"default_branch":"master","last_synced_at":"2025-04-03T10:07:18.629Z","etag":null,"topics":["aws","botocore","cloudsecurity","iam","python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nccgroup.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-05-23T01:04:19.000Z","updated_at":"2025-04-01T22:50:58.000Z","dependencies_parsed_at":"2023-01-15T02:10:15.247Z","dependency_job_id":"a585adea-f2ca-4f22-a44d-33701fb90069","html_url":"https://github.com/nccgroup/PMapper","commit_stats":{"total_commits":77,"total_committers":5,"mean_commits":15.4,"dds":"0.33766233766233766","last_synced_commit":"91d2e60102bdadf346d77b60d90ddaa4a678f037"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nccgroup%2FPMapper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nccgroup%2FPMapper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nccgroup%2FPMapper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nccgroup%2FPMapper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nccgroup","download_url":"https://codeload.github.com/nccgroup/PMapper/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248368397,"owners_count":21092351,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aws","botocore","cloudsecurity","iam","python"],"created_at":"2024-08-01T09:01:22.423Z","updated_at":"2025-04-11T09:33:54.345Z","avatar_url":"https://github.com/nccgroup.png","language":"Python","readme":"# Principal Mapper\n\nPrincipal Mapper (PMapper) is a script and library for identifying risks in the configuration of AWS Identity and \nAccess Management (IAM) for an AWS account or an AWS organization. It models the different IAM Users and Roles in an \naccount as a directed graph, which enables checks for privilege escalation and for alternate paths an attacker could \ntake to gain access to a resource or action in AWS.\n\nPMapper includes a querying mechanism that uses a local simulation of AWS's authorization behavior. \nWhen running a query to determine if a principal has access to a certain action/resource, PMapper also checks if the \nuser or role could access other users or roles that have access to that action/resource. This catches scenarios such as \nwhen a user doesn't have permission to read an S3 object, but could launch an EC2 instance that can read the S3 object.\n\nAdditional information can be found in [the project wiki](https://github.com/nccgroup/PMapper/wiki).\n\n# Installation\n\n## Requirements\n\nPrincipal Mapper is built using the `botocore` library and Python 3.5+. Principal Mapper \nalso requires `pydot` (available on `pip`), and `graphviz` (available on Windows, macOS, and Linux from \nhttps://graphviz.org/ ).\n\n## Installation from Pip\n\n~~~bash\npip install principalmapper\n~~~\n\n## Installation From Source Code\n\nClone the repository:\n\n~~~bash\ngit clone git@github.com:nccgroup/PMapper.git\n~~~\n\nThen install with Pip:\n\n~~~bash\ncd PMapper\npip install .\n~~~\n\n## Using Docker\n\n_(After cloning from source)_\n\n~~~bash\ncd PMapper\ndocker build -t $TAG .\ndocker run -it $TAG\n~~~\n\nYou can use `-e|--env` or `--env-file` to pass the `AWS_*` environment variables for credentials when calling\n`docker run ...`, or use `-v` to mount your `~/.aws/` directory and use the `AWS_CONFIG_FILE` and `AWS_SHARED_CREDENTIALS_FILE` environment variables.\nThe current Dockerfile should put you into a shell with `pmapper -h` ready to go as well as \n`graphviz` already installed. \n\n# Usage\n\nSee the [Getting Started Page](https://github.com/nccgroup/PMapper/wiki/Getting-Started) in the wiki for more information \non how to use PMapper via command-line. There are also pages with full details on all command-line functions and \nthe library code. \n\nHere's a quick example:\n\n```bash\n# Create a graph for the account, accessed through AWS CLI profile \"skywalker\"\npmapper --profile skywalker graph create\n# [... graph-creation output goes here ...]\n\n# Run a query to see who can make IAM Users\n$ pmapper --profile skywalker query 'who can do iam:CreateUser'\n# [... query output goes here ...]\n\n# Run a query to see who can launch a big expensive EC2 instance, aside from \"admin\" users\n$ pmapper --account 000000000000 argquery -s --action 'ec2:RunInstances' --condition 'ec2:InstanceType=c6gd.16xlarge'\n# [... query output goes here ...]\n\n# Run the privilege escalation preset query, skip reporting current \"admin\" users\n$ pmapper --account 000000000000 query -s 'preset privesc *'\n# [... privesc report goes here ...]\n\n# Create an SVG representation of the admins/privescs/inter-principal access\n$ pmapper --account 000000000000 visualize --filetype svg\n# [... information output goes here, file created ...]\n```\n\nNote the use of `--profile`, which should behave the same as the AWS CLI. Also, later calls with \n`query`/`argquery`/`visualize` use an `--account` arg which just shortcuts around checking which account to work \nwith (otherwise PMapper makes an API call to determine that).\n\nHere's an example of the visualization:\n\n![](examples/example-viz.png)\n\nAnd again when using `--only-privesc`:\n\n![](examples/example-privesc-only-viz.svg)\n\n# Contributions\n\n100% welcome and appreciated. Please coordinate through [issues](https://github.com/nccgroup/PMapper/issues) before \nstarting and target pull-requests at the current development branch (typically of the form `vX.Y.Z-dev`).\n\n# License\n\n    Copyright (c) NCC Group and Erik Steringer 2019. This file is part of Principal Mapper.\n\n      Principal Mapper is free software: you can redistribute it and/or modify\n      it under the terms of the GNU Affero General Public License as published by\n      the Free Software Foundation, either version 3 of the License, or\n      (at your option) any later version.\n\n      Principal Mapper is distributed in the hope that it will be useful,\n      but WITHOUT ANY WARRANTY; without even the implied warranty of\n      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n      GNU Affero General Public License for more details.\n\n      You should have received a copy of the GNU Affero General Public License\n      along with Principal Mapper.  If not, see \u003chttps://www.gnu.org/licenses/\u003e.","funding_links":[],"categories":["\u003ca id=\"7e840ca27f1ff222fd25bc61a79b07ba\"\u003e\u003c/a\u003e特定目标","\u003ca id=\"c71ad1932bbf9c908af83917fe1fd5da\"\u003e\u003c/a\u003eAWS"],"sub_categories":["\u003ca id=\"c71ad1932bbf9c908af83917fe1fd5da\"\u003e\u003c/a\u003eAWS","\u003ca id=\"0476f6b97e87176da0a0d7328f8747e7\"\u003e\u003c/a\u003eblog"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnccgroup%2Fpmapper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnccgroup%2Fpmapper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnccgroup%2Fpmapper/lists"}