runbooks 0.2.5__py3-none-any.whl → 0.6.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- conftest.py +26 -0
- jupyter-agent/.env.template +2 -0
- jupyter-agent/.gitattributes +35 -0
- jupyter-agent/README.md +16 -0
- jupyter-agent/app.py +256 -0
- jupyter-agent/cloudops-agent.png +0 -0
- jupyter-agent/ds-system-prompt.txt +154 -0
- jupyter-agent/jupyter-agent.png +0 -0
- jupyter-agent/llama3_template.jinja +123 -0
- jupyter-agent/requirements.txt +9 -0
- jupyter-agent/utils.py +409 -0
- runbooks/__init__.py +71 -3
- runbooks/__main__.py +13 -0
- runbooks/aws/ec2_describe_instances.py +1 -1
- runbooks/aws/ec2_run_instances.py +8 -2
- runbooks/aws/ec2_start_stop_instances.py +17 -4
- runbooks/aws/ec2_unused_volumes.py +5 -1
- runbooks/aws/s3_create_bucket.py +4 -2
- runbooks/aws/s3_list_objects.py +6 -1
- runbooks/aws/tagging_lambda_handler.py +13 -2
- runbooks/aws/tags.json +12 -0
- runbooks/base.py +353 -0
- runbooks/cfat/README.md +49 -0
- runbooks/cfat/__init__.py +74 -0
- runbooks/cfat/app.ts +644 -0
- runbooks/cfat/assessment/__init__.py +40 -0
- runbooks/cfat/assessment/asana-import.csv +39 -0
- runbooks/cfat/assessment/cfat-checks.csv +31 -0
- runbooks/cfat/assessment/cfat.txt +520 -0
- runbooks/cfat/assessment/collectors.py +200 -0
- runbooks/cfat/assessment/jira-import.csv +39 -0
- runbooks/cfat/assessment/runner.py +387 -0
- runbooks/cfat/assessment/validators.py +290 -0
- runbooks/cfat/cli.py +103 -0
- runbooks/cfat/docs/asana-import.csv +24 -0
- runbooks/cfat/docs/cfat-checks.csv +31 -0
- runbooks/cfat/docs/cfat.txt +335 -0
- runbooks/cfat/docs/checks-output.png +0 -0
- runbooks/cfat/docs/cloudshell-console-run.png +0 -0
- runbooks/cfat/docs/cloudshell-download.png +0 -0
- runbooks/cfat/docs/cloudshell-output.png +0 -0
- runbooks/cfat/docs/downloadfile.png +0 -0
- runbooks/cfat/docs/jira-import.csv +24 -0
- runbooks/cfat/docs/open-cloudshell.png +0 -0
- runbooks/cfat/docs/report-header.png +0 -0
- runbooks/cfat/models.py +1026 -0
- runbooks/cfat/package-lock.json +5116 -0
- runbooks/cfat/package.json +38 -0
- runbooks/cfat/report.py +496 -0
- runbooks/cfat/reporting/__init__.py +46 -0
- runbooks/cfat/reporting/exporters.py +337 -0
- runbooks/cfat/reporting/formatters.py +496 -0
- runbooks/cfat/reporting/templates.py +135 -0
- runbooks/cfat/run-assessment.sh +23 -0
- runbooks/cfat/runner.py +69 -0
- runbooks/cfat/src/actions/check-cloudtrail-existence.ts +43 -0
- runbooks/cfat/src/actions/check-config-existence.ts +37 -0
- runbooks/cfat/src/actions/check-control-tower.ts +37 -0
- runbooks/cfat/src/actions/check-ec2-existence.ts +46 -0
- runbooks/cfat/src/actions/check-iam-users.ts +50 -0
- runbooks/cfat/src/actions/check-legacy-cur.ts +30 -0
- runbooks/cfat/src/actions/check-org-cloudformation.ts +30 -0
- runbooks/cfat/src/actions/check-vpc-existence.ts +43 -0
- runbooks/cfat/src/actions/create-asanaimport.ts +14 -0
- runbooks/cfat/src/actions/create-backlog.ts +372 -0
- runbooks/cfat/src/actions/create-jiraimport.ts +15 -0
- runbooks/cfat/src/actions/create-report.ts +616 -0
- runbooks/cfat/src/actions/define-account-type.ts +51 -0
- runbooks/cfat/src/actions/get-enabled-org-policy-types.ts +40 -0
- runbooks/cfat/src/actions/get-enabled-org-services.ts +26 -0
- runbooks/cfat/src/actions/get-idc-info.ts +34 -0
- runbooks/cfat/src/actions/get-org-da-accounts.ts +34 -0
- runbooks/cfat/src/actions/get-org-details.ts +35 -0
- runbooks/cfat/src/actions/get-org-member-accounts.ts +44 -0
- runbooks/cfat/src/actions/get-org-ous.ts +35 -0
- runbooks/cfat/src/actions/get-regions.ts +22 -0
- runbooks/cfat/src/actions/zip-assessment.ts +27 -0
- runbooks/cfat/src/types/index.d.ts +147 -0
- runbooks/cfat/tests/__init__.py +141 -0
- runbooks/cfat/tests/test_cli.py +340 -0
- runbooks/cfat/tests/test_integration.py +290 -0
- runbooks/cfat/tests/test_models.py +505 -0
- runbooks/cfat/tests/test_reporting.py +354 -0
- runbooks/cfat/tsconfig.json +16 -0
- runbooks/cfat/webpack.config.cjs +27 -0
- runbooks/config.py +260 -0
- runbooks/finops/__init__.py +88 -0
- runbooks/finops/aws_client.py +245 -0
- runbooks/finops/cli.py +151 -0
- runbooks/finops/cost_processor.py +410 -0
- runbooks/finops/dashboard_runner.py +448 -0
- runbooks/finops/helpers.py +355 -0
- runbooks/finops/main.py +14 -0
- runbooks/finops/profile_processor.py +174 -0
- runbooks/finops/types.py +66 -0
- runbooks/finops/visualisations.py +80 -0
- runbooks/inventory/.gitignore +354 -0
- runbooks/inventory/ArgumentsClass.py +261 -0
- runbooks/inventory/Inventory_Modules.py +6130 -0
- runbooks/inventory/LandingZone/delete_lz.py +1075 -0
- runbooks/inventory/README.md +1320 -0
- runbooks/inventory/__init__.py +62 -0
- runbooks/inventory/account_class.py +532 -0
- runbooks/inventory/all_my_instances_wrapper.py +123 -0
- runbooks/inventory/aws_decorators.py +201 -0
- runbooks/inventory/cfn_move_stack_instances.py +1526 -0
- runbooks/inventory/check_cloudtrail_compliance.py +614 -0
- runbooks/inventory/check_controltower_readiness.py +1107 -0
- runbooks/inventory/check_landingzone_readiness.py +711 -0
- runbooks/inventory/cloudtrail.md +727 -0
- runbooks/inventory/collectors/__init__.py +20 -0
- runbooks/inventory/collectors/aws_compute.py +518 -0
- runbooks/inventory/collectors/aws_networking.py +275 -0
- runbooks/inventory/collectors/base.py +222 -0
- runbooks/inventory/core/__init__.py +19 -0
- runbooks/inventory/core/collector.py +303 -0
- runbooks/inventory/core/formatter.py +296 -0
- runbooks/inventory/delete_s3_buckets_objects.py +169 -0
- runbooks/inventory/discovery.md +81 -0
- runbooks/inventory/draw_org_structure.py +748 -0
- runbooks/inventory/ec2_vpc_utils.py +341 -0
- runbooks/inventory/find_cfn_drift_detection.py +272 -0
- runbooks/inventory/find_cfn_orphaned_stacks.py +719 -0
- runbooks/inventory/find_cfn_stackset_drift.py +733 -0
- runbooks/inventory/find_ec2_security_groups.py +669 -0
- runbooks/inventory/find_landingzone_versions.py +201 -0
- runbooks/inventory/find_vpc_flow_logs.py +1221 -0
- runbooks/inventory/inventory.sh +659 -0
- runbooks/inventory/list_cfn_stacks.py +558 -0
- runbooks/inventory/list_cfn_stackset_operation_results.py +252 -0
- runbooks/inventory/list_cfn_stackset_operations.py +734 -0
- runbooks/inventory/list_cfn_stacksets.py +453 -0
- runbooks/inventory/list_config_recorders_delivery_channels.py +681 -0
- runbooks/inventory/list_ds_directories.py +354 -0
- runbooks/inventory/list_ec2_availability_zones.py +286 -0
- runbooks/inventory/list_ec2_ebs_volumes.py +244 -0
- runbooks/inventory/list_ec2_instances.py +425 -0
- runbooks/inventory/list_ecs_clusters_and_tasks.py +562 -0
- runbooks/inventory/list_elbs_load_balancers.py +411 -0
- runbooks/inventory/list_enis_network_interfaces.py +526 -0
- runbooks/inventory/list_guardduty_detectors.py +568 -0
- runbooks/inventory/list_iam_policies.py +404 -0
- runbooks/inventory/list_iam_roles.py +518 -0
- runbooks/inventory/list_iam_saml_providers.py +359 -0
- runbooks/inventory/list_lambda_functions.py +882 -0
- runbooks/inventory/list_org_accounts.py +446 -0
- runbooks/inventory/list_org_accounts_users.py +354 -0
- runbooks/inventory/list_rds_db_instances.py +406 -0
- runbooks/inventory/list_route53_hosted_zones.py +318 -0
- runbooks/inventory/list_servicecatalog_provisioned_products.py +575 -0
- runbooks/inventory/list_sns_topics.py +360 -0
- runbooks/inventory/list_ssm_parameters.py +402 -0
- runbooks/inventory/list_vpc_subnets.py +433 -0
- runbooks/inventory/list_vpcs.py +422 -0
- runbooks/inventory/lockdown_cfn_stackset_role.py +224 -0
- runbooks/inventory/models/__init__.py +24 -0
- runbooks/inventory/models/account.py +192 -0
- runbooks/inventory/models/inventory.py +309 -0
- runbooks/inventory/models/resource.py +247 -0
- runbooks/inventory/recover_cfn_stack_ids.py +205 -0
- runbooks/inventory/requirements.txt +12 -0
- runbooks/inventory/run_on_multi_accounts.py +211 -0
- runbooks/inventory/tests/common_test_data.py +3661 -0
- runbooks/inventory/tests/common_test_functions.py +204 -0
- runbooks/inventory/tests/script_test_data.py +0 -0
- runbooks/inventory/tests/setup.py +24 -0
- runbooks/inventory/tests/src.py +18 -0
- runbooks/inventory/tests/test_cfn_describe_stacks.py +208 -0
- runbooks/inventory/tests/test_ec2_describe_instances.py +162 -0
- runbooks/inventory/tests/test_inventory_modules.py +55 -0
- runbooks/inventory/tests/test_lambda_list_functions.py +86 -0
- runbooks/inventory/tests/test_moto_integration_example.py +273 -0
- runbooks/inventory/tests/test_org_list_accounts.py +49 -0
- runbooks/inventory/update_aws_actions.py +173 -0
- runbooks/inventory/update_cfn_stacksets.py +1215 -0
- runbooks/inventory/update_cloudwatch_logs_retention_policy.py +294 -0
- runbooks/inventory/update_iam_roles_cross_accounts.py +478 -0
- runbooks/inventory/update_s3_public_access_block.py +539 -0
- runbooks/inventory/utils/__init__.py +23 -0
- runbooks/inventory/utils/aws_helpers.py +510 -0
- runbooks/inventory/utils/threading_utils.py +493 -0
- runbooks/inventory/utils/validation.py +682 -0
- runbooks/inventory/verify_ec2_security_groups.py +1430 -0
- runbooks/main.py +785 -0
- runbooks/organizations/__init__.py +12 -0
- runbooks/organizations/manager.py +374 -0
- runbooks/security_baseline/README.md +324 -0
- runbooks/security_baseline/checklist/alternate_contacts.py +8 -1
- runbooks/security_baseline/checklist/bucket_public_access.py +4 -1
- runbooks/security_baseline/checklist/cloudwatch_alarm_configuration.py +9 -2
- runbooks/security_baseline/checklist/guardduty_enabled.py +9 -2
- runbooks/security_baseline/checklist/multi_region_instance_usage.py +5 -1
- runbooks/security_baseline/checklist/root_access_key.py +6 -1
- runbooks/security_baseline/config-origin.json +1 -1
- runbooks/security_baseline/config.json +1 -1
- runbooks/security_baseline/permission.json +1 -1
- runbooks/security_baseline/report_generator.py +10 -2
- runbooks/security_baseline/report_template_en.html +7 -7
- runbooks/security_baseline/report_template_jp.html +7 -7
- runbooks/security_baseline/report_template_kr.html +12 -12
- runbooks/security_baseline/report_template_vn.html +7 -7
- runbooks/security_baseline/requirements.txt +7 -0
- runbooks/security_baseline/run_script.py +8 -2
- runbooks/security_baseline/security_baseline_tester.py +10 -2
- runbooks/security_baseline/utils/common.py +5 -1
- runbooks/utils/__init__.py +204 -0
- runbooks-0.6.1.dist-info/METADATA +373 -0
- runbooks-0.6.1.dist-info/RECORD +237 -0
- {runbooks-0.2.5.dist-info → runbooks-0.6.1.dist-info}/WHEEL +1 -1
- runbooks-0.6.1.dist-info/entry_points.txt +7 -0
- runbooks-0.6.1.dist-info/licenses/LICENSE +201 -0
- runbooks-0.6.1.dist-info/top_level.txt +3 -0
- runbooks/python101/calculator.py +0 -34
- runbooks/python101/config.py +0 -1
- runbooks/python101/exceptions.py +0 -16
- runbooks/python101/file_manager.py +0 -218
- runbooks/python101/toolkit.py +0 -153
- runbooks-0.2.5.dist-info/METADATA +0 -439
- runbooks-0.2.5.dist-info/RECORD +0 -61
- runbooks-0.2.5.dist-info/entry_points.txt +0 -3
- runbooks-0.2.5.dist-info/top_level.txt +0 -1
@@ -0,0 +1,354 @@
|
|
1
|
+
# Exclude *.pyc files
|
2
|
+
*.pyc
|
3
|
+
|
4
|
+
# Ootput files for tool tests
|
5
|
+
test_output_*.txt
|
6
|
+
SmallestCFNEver.yaml
|
7
|
+
*.png
|
8
|
+
|
9
|
+
# Created by https://www.gitignore.io/api/osx,node,linux,python,windows,visualstudiocode
|
10
|
+
# Edit at https://www.gitignore.io/?templates=osx,node,linux,python,windows,visualstudiocode
|
11
|
+
|
12
|
+
### Linux ###
|
13
|
+
*~
|
14
|
+
|
15
|
+
# temporary files which can be created if a process still has a handle open of a deleted file
|
16
|
+
.fuse_hidden*
|
17
|
+
|
18
|
+
# KDE directory preferences
|
19
|
+
.directory
|
20
|
+
|
21
|
+
# Linux trash folder which might appear on any partition or disk
|
22
|
+
.Trash-*
|
23
|
+
|
24
|
+
# .nfs files are created when an open file is removed but is still being accessed
|
25
|
+
.nfs*
|
26
|
+
|
27
|
+
### Node ###
|
28
|
+
# Logs
|
29
|
+
logs
|
30
|
+
*.log
|
31
|
+
npm-debug.log*
|
32
|
+
yarn-debug.log*
|
33
|
+
yarn-error.log*
|
34
|
+
lerna-debug.log*
|
35
|
+
|
36
|
+
# Diagnostic reports (https://nodejs.org/api/report.html)
|
37
|
+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
|
38
|
+
|
39
|
+
# Runtime data
|
40
|
+
pids
|
41
|
+
*.pid
|
42
|
+
*.seed
|
43
|
+
*.pid.lock
|
44
|
+
|
45
|
+
# Directory for instrumented libs generated by jscoverage/JSCover
|
46
|
+
lib-cov
|
47
|
+
|
48
|
+
# Coverage directory used by tools like istanbul
|
49
|
+
coverage
|
50
|
+
*.lcov
|
51
|
+
|
52
|
+
# nyc test12 coverage
|
53
|
+
.nyc_output
|
54
|
+
|
55
|
+
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
|
56
|
+
.grunt
|
57
|
+
|
58
|
+
# Bower dependency directory (https://bower.io/)
|
59
|
+
bower_components
|
60
|
+
|
61
|
+
# node-waf configuration
|
62
|
+
.lock-wscript
|
63
|
+
|
64
|
+
# Compiled binary addons (https://nodejs.org/api/addons.html)
|
65
|
+
build/Release
|
66
|
+
|
67
|
+
# Dependency directories
|
68
|
+
node_modules/
|
69
|
+
jspm_packages/
|
70
|
+
|
71
|
+
# TypeScript v1 declaration files
|
72
|
+
typings/
|
73
|
+
|
74
|
+
# TypeScript cache
|
75
|
+
*.tsbuildinfo
|
76
|
+
|
77
|
+
# Optional npm cache directory
|
78
|
+
.npm
|
79
|
+
|
80
|
+
# Optional eslint cache
|
81
|
+
.eslintcache
|
82
|
+
|
83
|
+
# Optional REPL history
|
84
|
+
.node_repl_history
|
85
|
+
|
86
|
+
# Output of 'npm pack'
|
87
|
+
*.tgz
|
88
|
+
|
89
|
+
# Yarn Integrity file
|
90
|
+
.yarn-integrity
|
91
|
+
|
92
|
+
# dotenv environment variables file
|
93
|
+
.env
|
94
|
+
.env.test
|
95
|
+
|
96
|
+
# parcel-bundler cache (https://parceljs.org/)
|
97
|
+
.cache
|
98
|
+
|
99
|
+
# next.js build output
|
100
|
+
.next
|
101
|
+
|
102
|
+
# nuxt.js build output
|
103
|
+
.nuxt
|
104
|
+
|
105
|
+
# vuepress build output
|
106
|
+
.vuepress/dist
|
107
|
+
|
108
|
+
# Serverless directories
|
109
|
+
.serverless/
|
110
|
+
|
111
|
+
# FuseBox cache
|
112
|
+
.fusebox/
|
113
|
+
|
114
|
+
# DynamoDB Local files
|
115
|
+
.dynamodb/
|
116
|
+
|
117
|
+
### OSX ###
|
118
|
+
# General
|
119
|
+
.DS_Store
|
120
|
+
.AppleDouble
|
121
|
+
.LSOverride
|
122
|
+
|
123
|
+
# Icon must end with two \r
|
124
|
+
Icon
|
125
|
+
|
126
|
+
# Thumbnails
|
127
|
+
._*
|
128
|
+
|
129
|
+
# Files that might appear in the root of a volume
|
130
|
+
.DocumentRevisions-V100
|
131
|
+
.fseventsd
|
132
|
+
.Spotlight-V100
|
133
|
+
.TemporaryItems
|
134
|
+
.Trashes
|
135
|
+
.VolumeIcon.icns
|
136
|
+
.com.apple.timemachine.donotpresent
|
137
|
+
|
138
|
+
# Directories potentially created on remote AFP share
|
139
|
+
.AppleDB
|
140
|
+
.AppleDesktop
|
141
|
+
Network Trash Folder
|
142
|
+
Temporary Items
|
143
|
+
.apdisk
|
144
|
+
|
145
|
+
### Python ###
|
146
|
+
# Byte-compiled / optimized / DLL files
|
147
|
+
__pycache__/
|
148
|
+
*.py[cod]
|
149
|
+
*$py.class
|
150
|
+
|
151
|
+
# C extensions
|
152
|
+
*.so
|
153
|
+
|
154
|
+
# Distribution / packaging
|
155
|
+
.Python
|
156
|
+
build/
|
157
|
+
develop-eggs/
|
158
|
+
dist/
|
159
|
+
downloads/
|
160
|
+
eggs/
|
161
|
+
.eggs/
|
162
|
+
lib/
|
163
|
+
lib64/
|
164
|
+
parts/
|
165
|
+
sdist/
|
166
|
+
var/
|
167
|
+
wheels/
|
168
|
+
pip-wheel-metadata/
|
169
|
+
share/python-wheels/
|
170
|
+
*.egg-info/
|
171
|
+
.installed.cfg
|
172
|
+
*.egg
|
173
|
+
MANIFEST
|
174
|
+
|
175
|
+
# PyInstaller
|
176
|
+
# Usually these files are written by a python script from a template
|
177
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
178
|
+
*.manifest
|
179
|
+
*.spec
|
180
|
+
|
181
|
+
# Installer logs
|
182
|
+
pip-log.txt
|
183
|
+
pip-delete-this-directory.txt
|
184
|
+
|
185
|
+
# Unit test12 / coverage reports
|
186
|
+
htmlcov/
|
187
|
+
.tox/
|
188
|
+
.nox/
|
189
|
+
.coverage
|
190
|
+
.coverage.*
|
191
|
+
nosetests.xml
|
192
|
+
coverage.xml
|
193
|
+
*.cover
|
194
|
+
.hypothesis/
|
195
|
+
.pytest_cache/
|
196
|
+
|
197
|
+
# Translations
|
198
|
+
*.mo
|
199
|
+
*.pot
|
200
|
+
|
201
|
+
# Django stuff:
|
202
|
+
local_settings.py
|
203
|
+
db.sqlite3
|
204
|
+
db.sqlite3-journal
|
205
|
+
|
206
|
+
# Flask stuff:
|
207
|
+
instance/
|
208
|
+
.webassets-cache
|
209
|
+
|
210
|
+
# Scrapy stuff:
|
211
|
+
.scrapy
|
212
|
+
|
213
|
+
# Sphinx documentation
|
214
|
+
docs/_build/
|
215
|
+
|
216
|
+
# PyBuilder
|
217
|
+
target/
|
218
|
+
|
219
|
+
# Jupyter Notebook
|
220
|
+
.ipynb_checkpoints
|
221
|
+
|
222
|
+
# IPython
|
223
|
+
profile_default/
|
224
|
+
ipython_config.py
|
225
|
+
|
226
|
+
# pyenv
|
227
|
+
.python-version
|
228
|
+
|
229
|
+
# pipenv
|
230
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
231
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
232
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
233
|
+
# install all needed dependencies.
|
234
|
+
Pipfile.lock
|
235
|
+
|
236
|
+
# celery beat schedule file
|
237
|
+
celerybeat-schedule
|
238
|
+
|
239
|
+
# SageMath parsed files
|
240
|
+
*.sage.py
|
241
|
+
|
242
|
+
# Environments
|
243
|
+
.venv
|
244
|
+
env/
|
245
|
+
venv/
|
246
|
+
ENV/
|
247
|
+
env.bak/
|
248
|
+
venv.bak/
|
249
|
+
|
250
|
+
# Spyder project settings
|
251
|
+
.spyderproject
|
252
|
+
.spyproject
|
253
|
+
|
254
|
+
# Rope project settings
|
255
|
+
.ropeproject
|
256
|
+
|
257
|
+
# mkdocs documentation
|
258
|
+
/site
|
259
|
+
|
260
|
+
# mypy
|
261
|
+
.mypy_cache/
|
262
|
+
.dmypy.json
|
263
|
+
dmypy.json
|
264
|
+
|
265
|
+
# Pyre type checker
|
266
|
+
.pyre/
|
267
|
+
|
268
|
+
### VisualStudioCode ###
|
269
|
+
.vscode/*
|
270
|
+
# !.vscode/settings.json
|
271
|
+
!.vscode/tasks.json
|
272
|
+
!.vscode/launch.json
|
273
|
+
|
274
|
+
### VisualStudioCode Patch ###
|
275
|
+
# Ignore all local history of files
|
276
|
+
.history
|
277
|
+
|
278
|
+
### Windows ###
|
279
|
+
# Windows thumbnail cache files
|
280
|
+
Thumbs.db
|
281
|
+
Thumbs.db:encryptable
|
282
|
+
ehthumbs.db
|
283
|
+
ehthumbs_vista.db
|
284
|
+
|
285
|
+
# Dump file
|
286
|
+
*.stackdump
|
287
|
+
|
288
|
+
# Folder config file
|
289
|
+
[Dd]esktop.ini
|
290
|
+
|
291
|
+
# Recycle Bin used on file shares
|
292
|
+
$RECYCLE.BIN/
|
293
|
+
|
294
|
+
# Windows Installer files
|
295
|
+
*.cab
|
296
|
+
*.msi
|
297
|
+
*.msix
|
298
|
+
*.msm
|
299
|
+
*.msp
|
300
|
+
|
301
|
+
# Windows shortcuts
|
302
|
+
*.lnk
|
303
|
+
|
304
|
+
# End of https://www.gitignore.io/api/osx,node,linux,python,windows,visualstudiocode
|
305
|
+
|
306
|
+
## Custom
|
307
|
+
|
308
|
+
# Loyalty transpiled JS
|
309
|
+
src/backend/loyalty/src/**/*.js
|
310
|
+
|
311
|
+
# local env files
|
312
|
+
.env.local
|
313
|
+
.env.*.local
|
314
|
+
|
315
|
+
# Custom
|
316
|
+
TEMPORARY/
|
317
|
+
codebuild_build.sh
|
318
|
+
Dockerfile
|
319
|
+
packaged.yaml
|
320
|
+
*.aws-sam/
|
321
|
+
artifacts/
|
322
|
+
datasources.json
|
323
|
+
test_report/
|
324
|
+
src/frontend/graphql
|
325
|
+
|
326
|
+
# Cypress videos and screenshots
|
327
|
+
src/e2e-tests/ui/**/cypress/videos
|
328
|
+
src/e2e-tests/ui/**/cypress/screenshots
|
329
|
+
|
330
|
+
|
331
|
+
# Created by https://www.gitignore.io/api/node,linux,macos,python,windows,visualstudiocode
|
332
|
+
# Edit at https://www.gitignore.io/?templates=node,linux,macos,python,windows,visualstudiocode
|
333
|
+
|
334
|
+
#amplify
|
335
|
+
amplify/\#current-cloud-backend
|
336
|
+
amplify/.config/local-*
|
337
|
+
amplify/backend/amplify-meta.json
|
338
|
+
amplify/backend/awscloudformation
|
339
|
+
aws-exports.js
|
340
|
+
awsconfiguration.json
|
341
|
+
amplifyconfiguration.json
|
342
|
+
amplify-gradle-config.json
|
343
|
+
amplifyxc.config
|
344
|
+
|
345
|
+
# Code packaging working directory
|
346
|
+
src/.package
|
347
|
+
#src/securityhub_enabler.zip
|
348
|
+
|
349
|
+
.idea/
|
350
|
+
/venv3.7.9/
|
351
|
+
.idea/*
|
352
|
+
|
353
|
+
my_venv/
|
354
|
+
/stackoverflow_test/
|
@@ -0,0 +1,261 @@
|
|
1
|
+
# Write Python3 code here
|
2
|
+
"""
|
3
|
+
How to use:
|
4
|
+
from ArgumentsClass import CommonArguments
|
5
|
+
parser = CommonArguments()
|
6
|
+
parser.extendedargs()
|
7
|
+
parser.my_parser.add_argument(...
|
8
|
+
< ... >
|
9
|
+
< Add more arguments as you would like >
|
10
|
+
< ... >
|
11
|
+
args = parser.my_parser.parse_args()
|
12
|
+
|
13
|
+
pProfile = args.Profile
|
14
|
+
pRegionList = args.Regions
|
15
|
+
verbose = args.loglevel
|
16
|
+
|
17
|
+
"""
|
18
|
+
|
19
|
+
__version__ = "2024.09.24"
|
20
|
+
|
21
|
+
import os
|
22
|
+
|
23
|
+
|
24
|
+
class CommonArguments:
|
25
|
+
"""
|
26
|
+
Class is created on the argparse class, and extends it for my purposes.
|
27
|
+
"""
|
28
|
+
|
29
|
+
def __init__(self):
|
30
|
+
import argparse
|
31
|
+
|
32
|
+
self.my_parser = argparse.ArgumentParser(
|
33
|
+
description="Accept common arguments to the Inventory Scripts", allow_abbrev=True, prefix_chars="-+"
|
34
|
+
)
|
35
|
+
|
36
|
+
def version(self, script_version):
|
37
|
+
self.my_parser.add_argument(
|
38
|
+
"--version", help="Version #", action="version", version=f"Version: {script_version}"
|
39
|
+
)
|
40
|
+
|
41
|
+
def rootOnly(self):
|
42
|
+
self.my_parser.add_argument(
|
43
|
+
"--rootonly",
|
44
|
+
dest="RootOnly",
|
45
|
+
action="store_true", # Defaults to False, so the script would continue to run
|
46
|
+
help="Only run this code for the root account, not the children",
|
47
|
+
)
|
48
|
+
|
49
|
+
def roletouse(self):
|
50
|
+
self.my_parser.add_argument(
|
51
|
+
"--access_rolename",
|
52
|
+
dest="AccessRole",
|
53
|
+
default=None,
|
54
|
+
metavar="role to use for access to child accounts",
|
55
|
+
help="This parameter specifies the single role that will allow this script to have access to the children accounts.",
|
56
|
+
)
|
57
|
+
|
58
|
+
def rolestouse(self):
|
59
|
+
self.my_parser.add_argument(
|
60
|
+
"--access_rolename",
|
61
|
+
dest="AccessRoles",
|
62
|
+
nargs="*",
|
63
|
+
default=None,
|
64
|
+
metavar="roles to use for access to child accounts",
|
65
|
+
help="This parameter specifies the list of roles that will allow this script to have access to the children accounts.",
|
66
|
+
)
|
67
|
+
|
68
|
+
def deletion(self):
|
69
|
+
# self.my_parser.add_argument(
|
70
|
+
# "+forreal",
|
71
|
+
# help="By default, we report results without changing anything. If you want to remediate or change your environment - include this parameter",
|
72
|
+
# action="store_false",
|
73
|
+
# dest="DryRun") # Default to Dry Run (no changes)
|
74
|
+
self.my_parser.add_argument(
|
75
|
+
"+force", help="To force a change - despite indications to the contrary", action="store_true", dest="Force"
|
76
|
+
) # Default to Dry Run (no changes)
|
77
|
+
|
78
|
+
def confirm(self):
|
79
|
+
self.my_parser.add_argument(
|
80
|
+
"+confirm", help="To skip confirmation of a change", action="store_true", dest="Confirm"
|
81
|
+
) # Default to Dry Run (no changes)
|
82
|
+
|
83
|
+
def fix(self):
|
84
|
+
self.my_parser.add_argument(
|
85
|
+
"+fix", help="To intrusively fix something in your accounts", action="store_true", dest="Fix"
|
86
|
+
)
|
87
|
+
|
88
|
+
def verbosity(self):
|
89
|
+
import logging
|
90
|
+
|
91
|
+
self.my_parser.add_argument(
|
92
|
+
"-v",
|
93
|
+
help="Be verbose (Error Statements)",
|
94
|
+
action="store_const",
|
95
|
+
dest="loglevel",
|
96
|
+
const=logging.ERROR, # args.loglevel = 40
|
97
|
+
default=logging.CRITICAL,
|
98
|
+
) # args.loglevel = 50
|
99
|
+
self.my_parser.add_argument(
|
100
|
+
"-vv",
|
101
|
+
"--verbose",
|
102
|
+
help="Be MORE verbose (Warning statements)",
|
103
|
+
action="store_const",
|
104
|
+
dest="loglevel",
|
105
|
+
const=logging.WARNING, # args.loglevel = 30
|
106
|
+
default=logging.CRITICAL,
|
107
|
+
) # args.loglevel = 50
|
108
|
+
self.my_parser.add_argument(
|
109
|
+
"-vvv",
|
110
|
+
help="Print INFO statements",
|
111
|
+
action="store_const",
|
112
|
+
dest="loglevel",
|
113
|
+
const=logging.INFO, # args.loglevel = 20
|
114
|
+
default=logging.CRITICAL,
|
115
|
+
) # args.loglevel = 50
|
116
|
+
self.my_parser.add_argument(
|
117
|
+
"-d",
|
118
|
+
"--debug",
|
119
|
+
help="Print debugging statements",
|
120
|
+
action="store_const",
|
121
|
+
dest="loglevel",
|
122
|
+
const=logging.DEBUG, # args.loglevel = 10
|
123
|
+
default=logging.CRITICAL,
|
124
|
+
) # args.loglevel = 50
|
125
|
+
|
126
|
+
def extendedargs(self):
|
127
|
+
self.my_parser.add_argument(
|
128
|
+
"-k",
|
129
|
+
"-ka",
|
130
|
+
"--skip",
|
131
|
+
"--skipaccount",
|
132
|
+
"--skipaccounts",
|
133
|
+
dest="SkipAccounts",
|
134
|
+
nargs="*",
|
135
|
+
metavar="Accounts to leave alone",
|
136
|
+
default=None,
|
137
|
+
help="These are the account numbers you don't want to screw with. Likely the core accounts.",
|
138
|
+
)
|
139
|
+
self.my_parser.add_argument(
|
140
|
+
"-kp",
|
141
|
+
"--skipprofile",
|
142
|
+
"--skipprofiles",
|
143
|
+
dest="SkipProfiles",
|
144
|
+
nargs="*",
|
145
|
+
metavar="Profile names",
|
146
|
+
default=None,
|
147
|
+
help="These are the profiles you don't want to examine. You can specify 'skipplus' to skip over all profiles using a plus in them.",
|
148
|
+
)
|
149
|
+
self.my_parser.add_argument(
|
150
|
+
"-a",
|
151
|
+
"--account",
|
152
|
+
dest="Accounts",
|
153
|
+
default=None,
|
154
|
+
nargs="*",
|
155
|
+
metavar="Account",
|
156
|
+
help="Just the accounts you want to check",
|
157
|
+
)
|
158
|
+
|
159
|
+
def timing(self):
|
160
|
+
self.my_parser.add_argument(
|
161
|
+
"--timing",
|
162
|
+
"--time",
|
163
|
+
dest="Time",
|
164
|
+
action="store_true",
|
165
|
+
help="Use this parameter to add a timing for the scripts",
|
166
|
+
)
|
167
|
+
|
168
|
+
def fragment(self):
|
169
|
+
self.my_parser.add_argument(
|
170
|
+
"-f",
|
171
|
+
"--fragment",
|
172
|
+
dest="Fragments",
|
173
|
+
nargs="*",
|
174
|
+
metavar="string fragment",
|
175
|
+
default=["all"],
|
176
|
+
help="List of fragments of the string(s) you want to check for.",
|
177
|
+
)
|
178
|
+
self.my_parser.add_argument(
|
179
|
+
"-e",
|
180
|
+
"--exact",
|
181
|
+
dest="Exact",
|
182
|
+
action="store_true",
|
183
|
+
help="Use this flag to make sure that ONLY the string you specified will be identified",
|
184
|
+
)
|
185
|
+
|
186
|
+
def singleprofile(self):
|
187
|
+
self.my_parser.add_argument(
|
188
|
+
"-p",
|
189
|
+
"--profile",
|
190
|
+
dest="Profile",
|
191
|
+
metavar="Profile",
|
192
|
+
default=None, # Default to boto3 defaults
|
193
|
+
help="Which *single* profile do you want to run against?",
|
194
|
+
)
|
195
|
+
|
196
|
+
def multiprofile(self):
|
197
|
+
self.my_parser.add_argument(
|
198
|
+
"-p",
|
199
|
+
"-ps",
|
200
|
+
"--profiles",
|
201
|
+
dest="Profiles",
|
202
|
+
nargs="*",
|
203
|
+
metavar="Profiles",
|
204
|
+
default=None, # Defaults to default profile, but can support multiple profiles
|
205
|
+
help="Which profiles do you want to run against?",
|
206
|
+
)
|
207
|
+
|
208
|
+
def multiregion(self):
|
209
|
+
self.my_parser.add_argument(
|
210
|
+
"-rs",
|
211
|
+
"--regions",
|
212
|
+
"-r",
|
213
|
+
nargs="*",
|
214
|
+
dest="Regions",
|
215
|
+
metavar="region name string",
|
216
|
+
# default=["us-east-1"],
|
217
|
+
default=[os.getenv("AWS_DEFAULT_REGION", "us-east-1")],
|
218
|
+
help="String fragment of the region(s) you want to check for resources. You can supply multiple fragments.\n"
|
219
|
+
"Use 'all' for everything you've opted into, and 'global' for everything, regardless of opted-in status",
|
220
|
+
)
|
221
|
+
|
222
|
+
def multiregion_nodefault(self):
|
223
|
+
self.my_parser.add_argument(
|
224
|
+
"-r",
|
225
|
+
"-rs",
|
226
|
+
"--regions",
|
227
|
+
nargs="*",
|
228
|
+
dest="Regions",
|
229
|
+
metavar="region name string",
|
230
|
+
default=None,
|
231
|
+
help="String fragment of the region(s) you want to check for resources. You can supply multiple fragments.",
|
232
|
+
)
|
233
|
+
|
234
|
+
def singleregion(self):
|
235
|
+
self.my_parser.add_argument(
|
236
|
+
"-r",
|
237
|
+
"--region",
|
238
|
+
dest="Region",
|
239
|
+
metavar="region name string",
|
240
|
+
default="us-east-1",
|
241
|
+
help="Name of the *single* region you want to check for resources.",
|
242
|
+
)
|
243
|
+
|
244
|
+
def singleregion_nodefault(self):
|
245
|
+
self.my_parser.add_argument(
|
246
|
+
"-r",
|
247
|
+
"--region",
|
248
|
+
dest="Region",
|
249
|
+
metavar="region name string",
|
250
|
+
default=None,
|
251
|
+
help="Name of the *single* region you want to check for resources.",
|
252
|
+
)
|
253
|
+
|
254
|
+
def save_to_file(self):
|
255
|
+
self.my_parser.add_argument(
|
256
|
+
"--filename",
|
257
|
+
dest="Filename",
|
258
|
+
metavar="filename",
|
259
|
+
default=None,
|
260
|
+
help="Name of the filename you want to save results to.",
|
261
|
+
)
|