IAMActionHunter 项目使用教程
1、项目的目录结构及介绍
IAMActionHunter/
├── github/
│ └── workflows/
│ └── IAMActionHunter
├── tests/
│ └── flake8
├── .gitignore
├── LICENSE
├── README.md
├── dev-requirements.txt
├── poetry.lock
├── pyproject.toml
├── requirements.txt
- github/workflows/: 包含GitHub工作流的配置文件。
- tests/: 包含项目的测试文件。
- .gitignore: 指定Git版本控制系统忽略的文件和目录。
- LICENSE: 项目的许可证文件,本项目采用Apache-2.0许可证。
- README.md: 项目的介绍和使用说明。
- dev-requirements.txt: 开发环境所需的依赖包列表。
- poetry.lock: Poetry包管理工具生成的锁定文件,确保依赖包版本一致。
- pyproject.toml: 项目配置文件,包含项目元数据和依赖信息。
- requirements.txt: 生产环境所需的依赖包列表。
2、项目的启动文件介绍
项目的启动文件是iamactionhunter
,可以通过命令行调用。以下是一些常用的命令示例:
# 安装项目
pip3 install iamactionhunter
# 查看帮助信息
iamactionhunter --help
# 收集所有用户/角色的策略
iamactionhunter --collect --profile <some-aws-profile>
# 查询特定用户
iamactionhunter --account <account_number_of_profile_above> --user some_user --query iam:*
# 输出到CSV文件
iamactionhunter --account <account_number_of_profile_above> --query iam:* --csv report.csv
# 运行预设配置
iamactionhunter --account <account_number_of_profile_above> --config dangerous_iam
3、项目的配置文件介绍
项目的配置文件主要是pyproject.toml
,它包含了项目的元数据和依赖信息。以下是pyproject.toml
文件的部分内容示例:
[tool.poetry]
name = "IAMActionHunter"
version = "0.1.0"
description = "An IAM policy statement parser and query tool"
authors = ["RhinoSecurityLabs"]
license = "Apache-2.0"
[tool.poetry.dependencies]
python = "^3.6"
boto3 = "^1.17.0"
[tool.poetry.dev-dependencies]
flake8 = "^3.9.0"
[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
- [tool.poetry]: 包含项目的基本信息,如名称、版本、描述、作者和许可证。
- [tool.poetry.dependencies]: 列出项目运行所需的依赖包及其版本要求。
- [tool.poetry.dev-dependencies]: 列出开发环境所需的依赖包及其版本要求。
- [build-system]: 指定构建系统所需的依赖包和构建后端。
通过以上配置文件,可以确保项目在不同环境中的一致性和可重复性。