├── CloudConsoleCartographer.psd1 ├── CloudConsoleCartographer.psm1 ├── Code ├── AddLabel.ps1 ├── AddSignal.ps1 ├── NewSignal.ps1 └── SignalDefinitions.ps1 ├── Demo └── InputEvents.json ├── Images ├── CLI_ASCII_Art.png ├── Cloud-Console-Cartographer.svg ├── IAM_Users_Screenshot.png ├── Show-EventSummary_Screenshot.png ├── Show-SessionSummaryUI_Screenshot.png └── Show-SessionSummary_Screenshot.png ├── LICENSE ├── README.md ├── Tests ├── Add-Signal.Tests.ps1 ├── Helper.ps1 └── Sessions │ ├── 01b11411976e0d80d2528881b018fc020d44a2620b901f89c31f65f506e94e44 │ ├── ExpectedSignals.json │ └── InputEvents.json │ ├── 05a71330a1dea36bac1f1e2ee421c7500821f6b791b8a73ecbc52677b14e1bff │ ├── ExpectedSignals.json │ └── InputEvents.json │ ├── 078ddd9d58c4691c16b0af6b1bd3a0873a93dde865bac129a90836e3f631ca85 │ ├── ExpectedSignals.json │ └── InputEvents.json │ ├── 0a94aa63bc6919e5cf3a61b81727b5c5e7912c084b561f27a819606b34dc20ce │ ├── ExpectedSignals.json │ └── InputEvents.json │ ├── 0eb952205448a64b895fb436e8f2b6da94eaa532fc5511e6c5a02dafe5565321 │ ├── ExpectedSignals.json │ └── InputEvents.json │ ├── 1c71969337331794709d42dc41a3afbf221dc096610a4447ef11fdd67b33a061 │ ├── ExpectedSignals.json │ └── InputEvents.json │ ├── 28a37129c4bb77371c227736c499bf3d2705ae14960727063fda14679ad421cb │ ├── ExpectedSignals.json │ └── InputEvents.json │ ├── 2f8e56ccc788aeca0a5ab70c319e7cbf991d54353811d365b07762724af7748f │ ├── ExpectedSignals.json │ └── InputEvents.json │ ├── 36183de174d0f85bf7790212e14a1b45fb1dbe0ea347fb9d33c112bc01b70ce8 │ ├── ExpectedSignals.json │ └── InputEvents.json │ ├── 4ff42ecac2253c4f2fe09b5bc4b73f546003ca8bb44cf1423c53389234e1fcd3 │ ├── ExpectedSignals.json │ └── InputEvents.json │ ├── 5721e3dc46e0ffc9dcbf3eb552803f33127f19cb26df930be43628664716aa18 │ ├── ExpectedSignals.json │ └── InputEvents.json │ ├── 6044720ac78d5b458dfce300ca7826a2b84f3a0657885724ea5240e71c8f43f2 │ ├── ExpectedSignals.json │ └── InputEvents.json │ ├── 631f0603e287c7837479b7d3752f57094dcf66f3d0963e6837508466cf623169 │ ├── ExpectedSignals.json │ └── InputEvents.json │ ├── 83679c6b5adb1d110d743fcf5752dd75448c7522c278275882c4d417ea46de2e │ ├── ExpectedSignals.json │ └── InputEvents.json │ ├── 8bf8ccf47400001eacc3a094065581499f90ef967a086ce9dcd698fc34d264a3 │ ├── ExpectedSignals.json │ └── InputEvents.json │ ├── 96db9634834704ac9e2c1be410bbf9a7819449043eaf6a47edd76a925515c666 │ ├── ExpectedSignals.json │ └── InputEvents.json │ ├── 9900a55b6f829da1bc274cdb5364077f7e891a0c18822f7a85e50200564ee3e7 │ ├── ExpectedSignals.json │ └── InputEvents.json │ ├── 9e6c8696028d6ae62847284ec6e08e64b8a45acbab8a4150aa935f38b7f882a2 │ ├── ExpectedSignals.json │ └── InputEvents.json │ ├── 9f92e6bb9db1a66c4d9fde42707f159003b4b98bae56ace2f549470bfeecdca6 │ ├── ExpectedSignals.json │ └── InputEvents.json │ ├── a7845cfbc0019b2952427d23e13029a44689be65c2b0d5d0bb1c2e95a8bca1f6 │ ├── ExpectedSignals.json │ └── InputEvents.json │ ├── a8ed8c07b55ec691085047113b46f8bb0d7df5ef0520c15bfa0dac6bf8d5c194 │ ├── ExpectedSignals.json │ └── InputEvents.json │ ├── ae2b9f7130a83a9fdf2777bedee79407192d6f553b8f1aca95c7c1ce521532d0 │ ├── ExpectedSignals.json │ └── InputEvents.json │ ├── b5ff7b31f75daacfaee79a7408f223aea9bd37c7a62eab70b5dcf01287637849 │ ├── ExpectedSignals.json │ └── InputEvents.json │ ├── b6dfc3920e8873205b90184ca56f688688aa45e569316f630c9411ed07ba0ed4 │ ├── ExpectedSignals.json │ └── InputEvents.json │ ├── d00fd5833fa969fc9077e36470f2b0fc31103c9a13db1de9a5d22d18d409cb01 │ ├── ExpectedSignals.json │ └── InputEvents.json │ ├── e07a7754efb98dd4ce5a142020b0eb92cacaba8e8e85b5dd5866f323c1a4ce1b │ ├── ExpectedSignals.json │ └── InputEvents.json │ ├── e0d74f6e9c4707b65d3f4d90aced5635b689fbaf748e77b3f3239f639c965363 │ ├── ExpectedSignals.json │ └── InputEvents.json │ ├── f41ce257ad0b02c6e5ba2724631129231ad751bb48dd849090341f4fee15310f │ ├── ExpectedSignals.json │ └── InputEvents.json │ ├── f8556c6519f734a9fee65a032fa633ee611a097d12adcb15c2a60f6fe683e7b2 │ ├── ExpectedSignals.json │ └── InputEvents.json │ ├── f8ec0c8c7115fd360af9fac968c77097a121f2263bb7dd084256352e94f9ed64 │ ├── ExpectedSignals.json │ └── InputEvents.json │ └── fd15aac507ed4a233baa1d0bec52b06548eea50fa340fb910b970e554ade28df │ ├── ExpectedSignals.json │ └── InputEvents.json └── UI └── Code ├── assets ├── banner.svg └── permiso_logo.svg ├── requirements.txt └── visualizer.py /CloudConsoleCartographer.psd1: -------------------------------------------------------------------------------- 1 | # This file is part of Cloud Console Cartographer. 2 | # 3 | # Copyright 2024 Permiso Security 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | 18 | 19 | # 20 | # Module manifest for module 'Cloud Console Cartographer' 21 | # 22 | # Generated by: Andi Ahmeti (@SecEagleAnd1) & Daniel Bohannon, aka DBO (@danielhbohannon) 23 | # 24 | # Generated on: 2024-04-18 25 | # 26 | 27 | 28 | 29 | @{ 30 | 31 | # Script module or binary module file associated with this manifest. 32 | RootModule = 'CloudConsoleCartographer.psm1' 33 | 34 | # Version number of this module. 35 | ModuleVersion = '1.1' 36 | 37 | # ID used to uniquely identify this module 38 | GUID = 'db014773-abcd-1234-5678-133337c0ffee' 39 | 40 | # Author of this module 41 | Author = 'Andi Ahmeti (@SecEagleAnd1) & Daniel Bohannon, aka DBO (@danielhbohannon)' 42 | 43 | # Company or vendor of this module 44 | CompanyName = 'Permiso Security' 45 | 46 | # Copyright statement for this module 47 | Copyright = 'Apache License, Version 2.0' 48 | 49 | # Description of the functionality provided by this module 50 | Description = 'PowerShell module file for importing all required modules for the Cloud Console Cartographer framework.' 51 | 52 | # Minimum version of the PowerShell engine required by this module 53 | PowerShellVersion = '6.0.0' 54 | 55 | # Name of the PowerShell host required by this module 56 | # PowerShellHostName = '' 57 | 58 | # Minimum version of the PowerShell host required by this module 59 | # PowerShellHostVersion = '' 60 | 61 | # Minimum version of Microsoft .NET Framework required by this module. This prerequisite is valid for the PowerShell Desktop edition only. 62 | # DotNetFrameworkVersion = '' 63 | 64 | # Minimum version of the common language runtime (CLR) required by this module. This prerequisite is valid for the PowerShell Desktop edition only. 65 | # CLRVersion = '' 66 | 67 | # Processor architecture (None, X86, Amd64) required by this module 68 | # ProcessorArchitecture = '' 69 | 70 | # Modules that must be imported into the global environment prior to importing this module 71 | # RequiredModules = @() 72 | 73 | # Assemblies that must be loaded prior to importing this module 74 | # RequiredAssemblies = @() 75 | 76 | # Script files (.ps1) that are run in the caller's environment prior to importing this module. 77 | # ScriptsToProcess = @() 78 | 79 | # Type files (.ps1xml) to be loaded when importing this module 80 | # TypesToProcess = @() 81 | 82 | # Format files (.ps1xml) to be loaded when importing this module 83 | # FormatsToProcess = @() 84 | 85 | # Modules to import as nested modules of the module specified in RootModule/ModuleToProcess 86 | # NestedModules = @() 87 | 88 | # Functions to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no functions to export. 89 | FunctionsToExport = @('Add-Signal','Out-SessionSummary','Out-SessionStats','Show-AsciiArt','Show-EventSummary','Show-SessionSummary','Show-SessionSummaryUI','Out-SortedHashtable','Get-StringHash','Out-SignalSummary','Out-MinimizedEvent','New-UnitTest') 90 | 91 | # Cmdlets to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no cmdlets to export. 92 | CmdletsToExport = @() 93 | 94 | # Variables to export from this module 95 | VariablesToExport = '*' 96 | 97 | # Aliases to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no aliases to export. 98 | AliasesToExport = @() 99 | 100 | # DSC resources to export from this module 101 | # DscResourcesToExport = @() 102 | 103 | # List of all modules packaged with this module 104 | # ModuleList = @() 105 | 106 | # List of all files packaged with this module 107 | # FileList = @() 108 | 109 | # Private data to pass to the module specified in RootModule/ModuleToProcess. This may also contain a PSData hashtable with additional module metadata used by PowerShell. 110 | PrivateData = @{ 111 | 112 | PSData = @{ 113 | 114 | # Tags applied to this module. These help with module discovery in online galleries. 115 | # Tags = @() 116 | 117 | # A URL to the license for this module. 118 | # LicenseUri = '' 119 | 120 | # A URL to the main website for this project. 121 | # ProjectUri = '' 122 | 123 | # A URL to an icon representing this module. 124 | # IconUri = '' 125 | 126 | # ReleaseNotes of this module 127 | # ReleaseNotes = '' 128 | 129 | # Prerelease string of this module 130 | # Prerelease = '' 131 | 132 | # Flag to indicate whether the module requires explicit user acceptance for install/update/save 133 | # RequireLicenseAcceptance = $false 134 | 135 | # External dependent modules of this module 136 | # ExternalModuleDependencies = @() 137 | 138 | } # End of PSData hashtable 139 | 140 | } # End of PrivateData hashtable 141 | 142 | # HelpInfo URI of this module 143 | # HelpInfoURI = '' 144 | 145 | # Default prefix for commands exported from this module. Override the default prefix using Import-Module -Prefix. 146 | # DefaultCommandPrefix = '' 147 | 148 | } -------------------------------------------------------------------------------- /Images/CLI_ASCII_Art.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Permiso-io-tools/CloudConsoleCartographer/10156353fc3f693781bbfb93b923544ac2897deb/Images/CLI_ASCII_Art.png -------------------------------------------------------------------------------- /Images/IAM_Users_Screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Permiso-io-tools/CloudConsoleCartographer/10156353fc3f693781bbfb93b923544ac2897deb/Images/IAM_Users_Screenshot.png -------------------------------------------------------------------------------- /Images/Show-EventSummary_Screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Permiso-io-tools/CloudConsoleCartographer/10156353fc3f693781bbfb93b923544ac2897deb/Images/Show-EventSummary_Screenshot.png -------------------------------------------------------------------------------- /Images/Show-SessionSummaryUI_Screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Permiso-io-tools/CloudConsoleCartographer/10156353fc3f693781bbfb93b923544ac2897deb/Images/Show-SessionSummaryUI_Screenshot.png -------------------------------------------------------------------------------- /Images/Show-SessionSummary_Screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Permiso-io-tools/CloudConsoleCartographer/10156353fc3f693781bbfb93b923544ac2897deb/Images/Show-SessionSummary_Screenshot.png -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ![CloudConsoleCartographer](https://github.com/Permiso-io-tools/CloudConsoleCartographer/blob/main/Images/Cloud-Console-Cartographer.svg "Cloud Console Cartographer Logo") 2 | 3 | # Cloud Console Cartographer 4 | **Permiso:** https://permiso.io 5 | **Read our release blog:** https://permiso.io/blog/introducing-cloud-console-cartographer-an-open-source-tool-to-help-security-team-easily-understand-log-events-generated-by-aws-console-use 6 | 7 | Released at Black Hat Asia on April 18, 2024, Cloud Console Cartographer is a framework for condensing groupings of cloud events (e.g. CloudTrail logs) and mapping them to the original user input actions in the management console UI for simplified analysis and explainability. This is extremely beneficial for defenders since numerous input actions in management console sessions can generate 10's and even many 100's of events originating from a single interactive click by the end user. 8 | 9 | An additional capability that Cloud Console Cartographer provides defenders is the parsing of relevant data from all events related to each mapping. For example, when a user clicks on IAM->Users in the AWS Management Console and 100+ events are generated, this framework parses these logs and extracts all IAM users and long-lived access keys that were active at the time the logs were generated. This leads to point-in-time context of the environment and increased levels of visibility into what the user was seeing in the UI at the time of their activity. 10 | 11 | An example of this IAM->Users scenario is shown below: 12 | ![CloudConsoleCartographer](https://github.com/Permiso-io-tools/CloudConsoleCartographer/blob/main/Images/IAM_Users_Screenshot.png "IAM Users Screenshot") 13 | 14 | Lastly, what framework would be complete without some ASCII art: 15 | ![CloudConsoleCartographer](https://github.com/Permiso-io-tools/CloudConsoleCartographer/blob/main/Images/CLI_ASCII_Art.png "Cloud Console Cartographer ASCII Art") 16 | 17 | ## Installation 18 | 19 | >```PowerShell 20 | >Import-Module ./CloudConsoleCartographer.psd1 21 | >``` 22 | 23 | ## Requirements (main functionality) 24 | 25 | >```bash 26 | >pwsh 6+ 27 | >``` 28 | 29 | ## Requirements (UI Visualizer) 30 | 31 | >```bash 32 | >python3.11 33 | >python3 -m pip install -r ./UI/Code/requirements.txt 34 | >``` 35 | 36 | ## Usage 37 | 38 | This tool offers a CLI (Command Line Interface) for processing cloud logs and simple displaying of results on the command line. More interactive analysis is better served using the Python UI Visualizer. Let's review its most common use cases: 39 | 40 | ## Example 1 - Running the tool with local CloudTrail logs and event-level CLI summary 41 | 42 | Use the demo CloudTrail session stored in ./Demo to quickly see the power of the framework's aggregation and enhanced explainability, though as later examples will show logs can be piped into this framework's functions without requiring anything being written to disk. 43 | 44 | ### Note 45 | 46 | First invoke `Add-Signal` to apply Labels and to perform Signal/mapping evaluation. Then pass these results to one of many output functions. 47 | 48 | Run command: 49 | 50 | ```dir ./Demo/InputEvents.json | Add-Signal -Verbose | Show-EventSummary -Detail signal``` 51 | 52 | ![CloudConsoleCartographer](https://github.com/Permiso-io-tools/CloudConsoleCartographer/blob/main/Images/Show-EventSummary_Screenshot.png "Show-EventSummary Screenshot") 53 | 54 | ## Example 2 - Running the tool with CloudTrail logs queried directly from CloudTrail API and session-level CLI summary 55 | 56 | ```aws cloudtrail lookup-events --lookup-attributes AttributeKey=AccessKeyId,AttributeValue=ASIAPERSHENDETJEMIQ1 | Add-Signal | Show-SessionSummary``` 57 | 58 | ![CloudConsoleCartographer](https://github.com/Permiso-io-tools/CloudConsoleCartographer/blob/main/Images/Show-SessionSummary_Screenshot.png "Show-EventSummary Screenshot") 59 | 60 | ## Example 3 - Using Python-based UI Visualizer 61 | 62 | ```cat ./Demo/InputEvents.json | Add-Signal | Show-SessionSummaryUI``` 63 | 64 | ![CloudConsoleCartographer](https://github.com/Permiso-io-tools/CloudConsoleCartographer/blob/main/Images/Show-SessionSummaryUI_Screenshot.png "Show-SessionSummaryUI Screenshot") 65 | 66 | ### Contributing to this project 67 | 68 | To contribute to this project a new Signal definition must be added to `./Code/SignalDefinitions.ps1` (both `LabelType` enum and `Signal` class constructor) and corresponding Labels added to `./Code/AddLabel.ps1`. If Signal metadata requires substitutions (e.g. Summary property being updated with dynamic values extracted from mapped events) then this logic must be defined in `./Code/NewSignal.ps1`. Less common Signal overrides are defined in `./Code/AddSignal.ps1`. 69 | 70 | New unit tests are required for new Signals or modifications to existing Signals. See below for more information. 71 | 72 | ### Unit tests 73 | 74 | New unit tests can be generated using `New-UnitTest` function (e.g. `dir ./Demo/InputEvents.json | New-UnitTest -Verbose`). 75 | 76 | Testing against existing unit tests requires the [Pester](https://pester.dev/docs/introduction/installation/) unit testing framework and can be executed using `Invoke-Pester -TagFilter FullEvent`. -------------------------------------------------------------------------------- /Tests/Add-Signal.Tests.ps1: -------------------------------------------------------------------------------- 1 | BeforeAll { 2 | Import-Module ./CloudConsoleCartographer.psd1 3 | } 4 | 5 | Describe 'Add-Signal' { 6 | # Retrieve current directory of script location (regardless of CWD during execution) and define Sessions directory. 7 | $scriptDir = Split-Path -Parent $PSCommandPath 8 | $sessionDir = Join-Path -Path $scriptDir -ChildPath 'Sessions' 9 | 10 | # Extract sessionId values from directory names to be filterable via user input -TagFilter value(s). 11 | $testSessionObjArr = (Get-ChildItem $sessionDir).Where( { $_.Name -cmatch '^[a-f0-9]{64}$' } ).ForEach( 12 | { 13 | $sessionId = $_.Name 14 | @{ 15 | SessionId = $sessionId 16 | CurSessionPath = Join-Path -Path $sessionDir -ChildPath $sessionId 17 | } 18 | } ) 19 | 20 | # Iterate over each test session. 21 | Context 'SessionId=' -ForEach $testSessionObjArr -Tag $_.SessionId { 22 | # Perform Signal evaluation for input raw events. 23 | $eventObjArr = Get-ChildItem -Path (Join-Path -Path $_.CurSessionPath -ChildPath 'InputEvents.json') | Add-Signal 24 | 25 | # Convert all Signals into a single Dictionary containing summaries of each Signal along with all potential contributing events. 26 | # Perform JSON conversion as Hashtable to match key ordering of expected Signal results. 27 | $signalObjDict = Out-SignalSummary -Event $eventObjArr | ConvertTo-Json -Depth 25 | ConvertFrom-Json -Depth 25 -AsHashtable 28 | 29 | # Import expected Signal results. 30 | $expectedSignalObjHashtable = Get-Content -Path (Join-Path -Path $_.CurSessionPath -ChildPath 'ExpectedSignals.json') | ConvertFrom-Json -Depth 25 -AsHashtable 31 | 32 | # Retrieve time-sorted array of CorrelationId values from expected Signal results. 33 | $expectedCorrelationIdArr = ($expectedSignalObjHashtable.Values | Sort-Object FirstEventTime).CorrelationId 34 | 35 | # Generate array of test case objects from expected Signal results for below Context's -ForEach parameter. 36 | $testCaseObjArr = $expectedCorrelationIdArr.ForEach( { @{ CorrelationId = $_; Label = $expectedSignalObjHashtable.$_.Label } } ) 37 | 38 | Context 'CorrelationId= Label=