AWS Security Group Mapping Tool
Project description
sgmap - AWS Security Group Mapping Tool
sgmapは、AWS のセキュリティグループの接続関係を可視化するための CLI ツールです。指定した VPC 内のセキュリティグループ間の接続関係を mermaid 記法のフローチャートまたは JSON 形式で出力します。
機能
- 指定した VPC 内のすべてのセキュリティグループの接続関係を分析
- 特定のセキュリティグループのみを分析するオプション
- mermaid 記法のフローチャートまたは JSON 形式での出力
- セキュリティグループ間の接続プロトコルとポート情報の表示
インストール
pip を使用したインストール
pip install sgmap
ソースからのインストール
git clone https://github.com/youyo/sgmap.git
cd sgmap
pip install -e .
使用方法
基本的な使用方法
# VPC内のすべてのセキュリティグループを分析し、mermaid記法で出力
sgmap --vpc-id vpc-12345678
# 特定のセキュリティグループのみを分析
sgmap --vpc-id vpc-12345678 --security-group-id sg-87654321
# JSON形式で出力
sgmap --vpc-id vpc-12345678 --json
オプション
--vpc-id,-v(必須): 分析対象の VPC ID--security-group-id,-s(オプション): 特定のセキュリティグループ ID を指定して分析--json,-j(フラグ): JSON 形式で出力(デフォルトは mermaid 記法)
出力例
mermaid 記法の出力例
flowchart LR
SG_sg_12345["Web Server\n(sg-12345)"]
SG_sg_67890["Database\n(sg-67890)"]
SG_sg_12345 -->|tcp/80| SG_sg_67890
JSON 形式の出力例
{
"sg-12345": {
"name": "Web Server",
"inbound": [],
"outbound": [
{
"id": "sg-67890",
"name": "Database",
"protocol": "tcp",
"from_port": 80,
"to_port": 80
}
]
},
"sg-67890": {
"name": "Database",
"inbound": [
{
"id": "sg-12345",
"name": "Web Server",
"protocol": "tcp",
"from_port": 80,
"to_port": 80
}
],
"outbound": []
}
}
必要条件
- Python 3.6 以上
- boto3
- click
- AWS 認証情報(環境変数、~/.aws/credentials など)
開発者向け情報
開発環境のセットアップ
git clone https://github.com/youyo/sgmap.git
cd sgmap
pip install -e ".[dev]"
リリース方法
このプロジェクトは GitHub Actions を使用して PyPI にパッケージを公開しています。以下の手順でリリースを行います:
-
バージョンタグを作成します(例:
v0.1.0)git tag -a v0.1.0 -m "Release version 0.1.0" git push origin v0.1.0
注意: タグの形式は必ず
vで始まり、その後にX.Y.Z形式のバージョン番号が続く形式(例:v0.1.0、v1.2.3)にしてください。この形式に従わないタグはリリースプロセスで問題が発生する可能性があります。 -
GitHub Actions が自動的にパッケージをビルドし、PyPI に公開します。
ローカルでのビルド
pip install -r requirements-dev.txt
python -m build
ライセンス
MIT
作者
youyo
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sgmap-0.2.1.dev0.tar.gz.
File metadata
- Download URL: sgmap-0.2.1.dev0.tar.gz
- Upload date:
- Size: 23.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
15684723659504e2a9226bd3aa4f47461239de79f62ea988ba2dd963df6343d3
|
|
| MD5 |
2e1608ea3052d0358468606b46299175
|
|
| BLAKE2b-256 |
159487f9489aecdbb25d04fbd85569652436d72e0bb6457701511ca2018638d1
|
Provenance
The following attestation bundles were made for sgmap-0.2.1.dev0.tar.gz:
Publisher:
publish.yaml on youyo/sgmap
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sgmap-0.2.1.dev0.tar.gz -
Subject digest:
15684723659504e2a9226bd3aa4f47461239de79f62ea988ba2dd963df6343d3 - Sigstore transparency entry: 184696095
- Sigstore integration time:
-
Permalink:
youyo/sgmap@6cddda5a2a29c88e658b1d3b60baca079ee64be0 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/youyo
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yaml@6cddda5a2a29c88e658b1d3b60baca079ee64be0 -
Trigger Event:
push
-
Statement type:
File details
Details for the file sgmap-0.2.1.dev0-py3-none-any.whl.
File metadata
- Download URL: sgmap-0.2.1.dev0-py3-none-any.whl
- Upload date:
- Size: 6.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
865bf8128f6bd6919779d4a9dae60dc783d2e75e2c00a4937ed16d3107560e01
|
|
| MD5 |
f9ea5806959db50c3b2d4f0d6ce923e0
|
|
| BLAKE2b-256 |
c5dca3ac4f2c63edf2ceadc80af0e47a996120f17923c35892edea8782386ec3
|
Provenance
The following attestation bundles were made for sgmap-0.2.1.dev0-py3-none-any.whl:
Publisher:
publish.yaml on youyo/sgmap
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sgmap-0.2.1.dev0-py3-none-any.whl -
Subject digest:
865bf8128f6bd6919779d4a9dae60dc783d2e75e2c00a4937ed16d3107560e01 - Sigstore transparency entry: 184696100
- Sigstore integration time:
-
Permalink:
youyo/sgmap@6cddda5a2a29c88e658b1d3b60baca079ee64be0 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/youyo
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yaml@6cddda5a2a29c88e658b1d3b60baca079ee64be0 -
Trigger Event:
push
-
Statement type: