diff --git a/.github/workflows/gh-pages.yml b/.github/workflows/gh-pages.yml index cf62b22..8db8ffb 100644 --- a/.github/workflows/gh-pages.yml +++ b/.github/workflows/gh-pages.yml @@ -50,6 +50,10 @@ jobs: run: | { echo -n '\'; go run ./cmd/main.go rules; } > ./docs/static/rules.txt + - name: Create types.txt file + run: | + { echo -n '\'; go run ./cmd/main.go types; } > ./docs/static/types.txt + - name: Setup Node uses: actions/setup-node@v3 with: diff --git a/README.md b/README.md index cf96e0f..86ddb2c 100644 --- a/README.md +++ b/README.md @@ -42,81 +42,84 @@ The output generated by **Azure Quick Review (azqr)** is written by default to a **Azure Quick Review (azqr)** currently supports the following Azure services: -* Microsoft.AVS/privateClouds -* Microsoft.AnalysisServices/servers -* Microsoft.ApiManagement/service -* Microsoft.App/containerApps -* Microsoft.App/managedenvironments -* Microsoft.AppConfiguration/configurationStores -* Microsoft.Automation/automationAccounts -* Microsoft.Batch/batchAccounts -* Microsoft.Cache/Redis -* Microsoft.Cdn/profiles -* Microsoft.CognitiveServices/accounts -* Microsoft.Compute/galleries -* Microsoft.Compute/virtualMachineScaleSets -* Microsoft.Compute/virtualMachines -* Microsoft.ContainerInstance/containerGroups -* Microsoft.ContainerRegistry/registries -* Microsoft.ContainerService/managedClusters -* Microsoft.DBforMariaDB/servers -* Microsoft.DBforMariaDB/servers/databases -* Microsoft.DBforMySQL/flexibleServers -* Microsoft.DBforMySQL/servers -* Microsoft.DBforPostgreSQL/flexibleServers -* Microsoft.DBforPostgreSQL/servers -* Microsoft.Dashboard/grafana -* Microsoft.DataFactory/factories -* Microsoft.Databricks/workspaces -* Microsoft.DesktopVirtualization/hostPools -* Microsoft.DesktopVirtualization/scalingPlans -* Microsoft.DesktopVirtualization/workspaces -* Microsoft.Devices/IotHubs -* Microsoft.DocumentDB/databaseAccounts -* Microsoft.EventGrid/domains -* Microsoft.EventHub/namespaces -* Microsoft.Insights/activityLogAlerts -* Microsoft.Insights/components -* Microsoft.KeyVault/vaults -* Microsoft.Kusto/clusters -* Microsoft.Logic/workflows -* Microsoft.NetApp/netAppAccounts -* Microsoft.Network/ExpressRoutePorts -* Microsoft.Network/applicationGateways -* Microsoft.Network/azureFirewalls -* Microsoft.Network/connections -* Microsoft.Network/expressRouteCircuits -* Microsoft.Network/frontdoorWebApplicationFirewallPolicies -* Microsoft.Network/loadBalancers -* Microsoft.Network/natGateways -* Microsoft.Network/networkSecurityGroups -* Microsoft.Network/networkWatcherScanners -* Microsoft.Network/privateDnsZones -* Microsoft.Network/privateEndpoints -* Microsoft.Network/publicIPAddresses -* Microsoft.Network/routeTables -* Microsoft.Network/trafficManagerProfiles -* Microsoft.Network/virtualNetworkGateways -* Microsoft.Network/virtualNetworks -* Microsoft.OperationalInsights/workspaces -* Microsoft.RecoveryServices/vaults -* Microsoft.ServiceBus/namespaces -* Microsoft.SignalRService/SignalR -* Microsoft.SignalRService/webPubSub -* Microsoft.Sql/servers -* Microsoft.Sql/servers/databases -* Microsoft.Sql/servers/elasticPools -* Microsoft.Storage/storageAccounts -* Microsoft.Synapse workspaces/bigDataPools -* Microsoft.Synapse/workspaces -* Microsoft.Synapse/workspaces/sqlPools -* Microsoft.VirtualMachineImages/imageTemplates -* Microsoft.Web/serverFarms -* Microsoft.Web/sites -* Specialized.Workload/AVD -* Specialized.Workload/AVS -* Specialized.Workload/HPC -* Specialized.Workload/SAP +Abbreviation | Resource Type +---|--- +aa | Microsoft.Automation/automationAccounts +adf | Microsoft.DataFactory/factories +afd | Microsoft.Cdn/profiles +afw | Microsoft.Network/azureFirewalls +agw | Microsoft.Network/applicationGateways +aks | Microsoft.ContainerService/managedClusters +amg | Microsoft.Dashboard/grafana +apim | Microsoft.ApiManagement/service +appcs | Microsoft.AppConfiguration/configurationStores +appi | Microsoft.Insights/components +appi | Microsoft.Insights/activityLogAlerts +as | Microsoft.AnalysisServices/servers +asp | Microsoft.Web/serverFarms +asp | Microsoft.Web/sites +avd | Specialized.Workload/AVD +avs | Microsoft.AVS/privateClouds +avs | Specialized.Workload/AVS +ba | Microsoft.Batch/batchAccounts +ca | Microsoft.App/containerApps +cae | Microsoft.App/managedenvironments +ci | Microsoft.ContainerInstance/containerGroups +cog | Microsoft.CognitiveServices/accounts +con | Microsoft.Network/connections +cosmos | Microsoft.DocumentDB/databaseAccounts +cr | Microsoft.ContainerRegistry/registries +dbw | Microsoft.Databricks/workspaces +dec | Microsoft.Kusto/clusters +disk | Microsoft.Compute/disks +erc | Microsoft.Network/expressRouteCircuits +erc | Microsoft.Network/ExpressRoutePorts +evgd | Microsoft.EventGrid/domains +evh | Microsoft.EventHub/namespaces +fdfp | Microsoft.Network/frontdoorWebApplicationFirewallPolicies +gal | Microsoft.Compute/galleries +hpc | Specialized.Workload/HPC +iot | Microsoft.Devices/IotHubs +it | Microsoft.VirtualMachineImages/imageTemplates +kv | Microsoft.KeyVault/vaults +lb | Microsoft.Network/loadBalancers +log | Microsoft.OperationalInsights/workspaces +logic | Microsoft.Logic/workflows +maria | Microsoft.DBforMariaDB/servers +maria | Microsoft.DBforMariaDB/servers/databases +mysql | Microsoft.DBforMySQL/flexibleServers +mysql | Microsoft.DBforMySQL/servers +netapp | Microsoft.NetApp/netAppAccounts +ng | Microsoft.Network/natGateways +nsg | Microsoft.Network/networkSecurityGroups +nw | Microsoft.Network/networkWatchers +pdnsz | Microsoft.Network/privateDnsZones +pep | Microsoft.Network/privateEndpoints +pip | Microsoft.Network/publicIPAddresses +psql | Microsoft.DBforPostgreSQL/flexibleServers +psql | Microsoft.DBforPostgreSQL/servers +redis | Microsoft.Cache/Redis +rsv | Microsoft.RecoveryServices/vaults +rt | Microsoft.Network/routeTables +sap | Specialized.Workload/SAP +sb | Microsoft.ServiceBus/namespaces +sigr | Microsoft.SignalRService/SignalR +sql | Microsoft.Sql/servers +sql | Microsoft.Sql/servers/databases +sql | Microsoft.Sql/servers/elasticPools +st | Microsoft.Storage/storageAccounts +synw | Microsoft.Synapse/workspaces +synw | Microsoft.Synapse workspaces/bigDataPools +synw | Microsoft.Synapse/workspaces/sqlPools +traf | Microsoft.Network/trafficManagerProfiles +vdpool | Microsoft.DesktopVirtualization/hostPools +vdpool | Microsoft.DesktopVirtualization/scalingPlans +vdpool | Microsoft.DesktopVirtualization/workspaces +vgw | Microsoft.Network/virtualNetworkGateways +vm | Microsoft.Compute/virtualMachines +vmss | Microsoft.Compute/virtualMachineScaleSets +vnet | Microsoft.Network/virtualNetworks +wps | Microsoft.SignalRService/webPubSub ## Usage @@ -207,6 +210,8 @@ azqr: - # format: resourceGroups: - # format: /subscriptions//resourceGroups/ + resourceTypes: + - # format: Abbreviation of the resource type. For example: "vm" for "Microsoft.Compute/virtualMachines" exclude: subscriptions: - # format: diff --git a/cmd/azqr/aa.go b/cmd/azqr/aa.go index 7bd90dc..212b86a 100644 --- a/cmd/azqr/aa.go +++ b/cmd/azqr/aa.go @@ -4,8 +4,7 @@ package azqr import ( - "github.com/Azure/azqr/internal/azqr" - "github.com/Azure/azqr/internal/scanners/aa" + "github.com/Azure/azqr/internal/scanners" "github.com/spf13/cobra" ) @@ -19,10 +18,6 @@ var aaCmd = &cobra.Command{ Long: "Scan Azure Automation Account", Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - serviceScanners := []azqr.IAzureScanner{ - &aa.AutomationAccountScanner{}, - } - - scan(cmd, serviceScanners) + scan(cmd, scanners.ScannerList["aa"]) }, } diff --git a/cmd/azqr/adf.go b/cmd/azqr/adf.go index f21e61d..ef6be06 100644 --- a/cmd/azqr/adf.go +++ b/cmd/azqr/adf.go @@ -4,8 +4,7 @@ package azqr import ( - "github.com/Azure/azqr/internal/azqr" - "github.com/Azure/azqr/internal/scanners/adf" + "github.com/Azure/azqr/internal/scanners" "github.com/spf13/cobra" ) @@ -19,10 +18,6 @@ var adfCmd = &cobra.Command{ Long: "Scan Azure Data Factory", Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - serviceScanners := []azqr.IAzureScanner{ - &adf.DataFactoryScanner{}, - } - - scan(cmd, serviceScanners) + scan(cmd, scanners.ScannerList["adf"]) }, } diff --git a/cmd/azqr/afd.go b/cmd/azqr/afd.go index c8adf24..45e6db4 100644 --- a/cmd/azqr/afd.go +++ b/cmd/azqr/afd.go @@ -4,8 +4,7 @@ package azqr import ( - "github.com/Azure/azqr/internal/azqr" - "github.com/Azure/azqr/internal/scanners/afd" + "github.com/Azure/azqr/internal/scanners" "github.com/spf13/cobra" ) @@ -19,10 +18,6 @@ var afdCmd = &cobra.Command{ Long: "Scan Azure Front Door", Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - serviceScanners := []azqr.IAzureScanner{ - &afd.FrontDoorScanner{}, - } - - scan(cmd, serviceScanners) + scan(cmd, scanners.ScannerList["afd"]) }, } diff --git a/cmd/azqr/afw.go b/cmd/azqr/afw.go index 337aa03..1e7f272 100644 --- a/cmd/azqr/afw.go +++ b/cmd/azqr/afw.go @@ -4,8 +4,7 @@ package azqr import ( - "github.com/Azure/azqr/internal/azqr" - "github.com/Azure/azqr/internal/scanners/afw" + "github.com/Azure/azqr/internal/scanners" "github.com/spf13/cobra" ) @@ -19,10 +18,6 @@ var afwCmd = &cobra.Command{ Long: "Scan Azure Firewall", Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - serviceScanners := []azqr.IAzureScanner{ - &afw.FirewallScanner{}, - } - - scan(cmd, serviceScanners) + scan(cmd, scanners.ScannerList["afw"]) }, } diff --git a/cmd/azqr/agw.go b/cmd/azqr/agw.go index d56fb4b..bc0c755 100644 --- a/cmd/azqr/agw.go +++ b/cmd/azqr/agw.go @@ -4,8 +4,7 @@ package azqr import ( - "github.com/Azure/azqr/internal/azqr" - "github.com/Azure/azqr/internal/scanners/agw" + "github.com/Azure/azqr/internal/scanners" "github.com/spf13/cobra" ) @@ -19,10 +18,6 @@ var agwCmd = &cobra.Command{ Long: "Scan Azure Application Gateway", Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - serviceScanners := []azqr.IAzureScanner{ - &agw.ApplicationGatewayScanner{}, - } - - scan(cmd, serviceScanners) + scan(cmd, scanners.ScannerList["agw"]) }, } diff --git a/cmd/azqr/aks.go b/cmd/azqr/aks.go index 15b0287..eb76527 100644 --- a/cmd/azqr/aks.go +++ b/cmd/azqr/aks.go @@ -4,8 +4,7 @@ package azqr import ( - "github.com/Azure/azqr/internal/azqr" - "github.com/Azure/azqr/internal/scanners/aks" + "github.com/Azure/azqr/internal/scanners" "github.com/spf13/cobra" ) @@ -19,10 +18,6 @@ var aksCmd = &cobra.Command{ Long: "Scan Azure Kubernetes Service", Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - serviceScanners := []azqr.IAzureScanner{ - &aks.AKSScanner{}, - } - - scan(cmd, serviceScanners) + scan(cmd, scanners.ScannerList["aks"]) }, } diff --git a/cmd/azqr/amg.go b/cmd/azqr/amg.go index 9d553fa..282cf59 100644 --- a/cmd/azqr/amg.go +++ b/cmd/azqr/amg.go @@ -4,8 +4,7 @@ package azqr import ( - "github.com/Azure/azqr/internal/azqr" - "github.com/Azure/azqr/internal/scanners/amg" + "github.com/Azure/azqr/internal/scanners" "github.com/spf13/cobra" ) @@ -19,10 +18,6 @@ var amgCmd = &cobra.Command{ Long: "Scan Azure Managed Grafana", Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - serviceScanners := []azqr.IAzureScanner{ - &amg.ManagedGrafanaScanner{}, - } - - scan(cmd, serviceScanners) + scan(cmd, scanners.ScannerList["amg"]) }, } diff --git a/cmd/azqr/apim.go b/cmd/azqr/apim.go index 1c59cf6..dac571c 100644 --- a/cmd/azqr/apim.go +++ b/cmd/azqr/apim.go @@ -4,8 +4,7 @@ package azqr import ( - "github.com/Azure/azqr/internal/azqr" - "github.com/Azure/azqr/internal/scanners/apim" + "github.com/Azure/azqr/internal/scanners" "github.com/spf13/cobra" ) @@ -19,10 +18,6 @@ var apimCmd = &cobra.Command{ Long: "Scan Azure API Management", Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - serviceScanners := []azqr.IAzureScanner{ - &apim.APIManagementScanner{}, - } - - scan(cmd, serviceScanners) + scan(cmd, scanners.ScannerList["apim"]) }, } diff --git a/cmd/azqr/appcs.go b/cmd/azqr/appcs.go index e19a88f..83ad3ad 100644 --- a/cmd/azqr/appcs.go +++ b/cmd/azqr/appcs.go @@ -4,8 +4,7 @@ package azqr import ( - "github.com/Azure/azqr/internal/azqr" - "github.com/Azure/azqr/internal/scanners/appcs" + "github.com/Azure/azqr/internal/scanners" "github.com/spf13/cobra" ) @@ -19,10 +18,6 @@ var appcsCmd = &cobra.Command{ Long: "Scan Azure App Configuration", Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - serviceScanners := []azqr.IAzureScanner{ - &appcs.AppConfigurationScanner{}, - } - - scan(cmd, serviceScanners) + scan(cmd, scanners.ScannerList["appcs"]) }, } diff --git a/cmd/azqr/appi.go b/cmd/azqr/appi.go index c439aa5..f833ce3 100644 --- a/cmd/azqr/appi.go +++ b/cmd/azqr/appi.go @@ -4,8 +4,7 @@ package azqr import ( - "github.com/Azure/azqr/internal/azqr" - "github.com/Azure/azqr/internal/scanners/appi" + "github.com/Azure/azqr/internal/scanners" "github.com/spf13/cobra" ) @@ -19,10 +18,6 @@ var appiCmd = &cobra.Command{ Long: "Scan Azure Application Insights", Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - serviceScanners := []azqr.IAzureScanner{ - &appi.AppInsightsScanner{}, - } - - scan(cmd, serviceScanners) + scan(cmd, scanners.ScannerList["appi"]) }, } diff --git a/cmd/azqr/as.go b/cmd/azqr/as.go index bbaef91..ac9fbb9 100644 --- a/cmd/azqr/as.go +++ b/cmd/azqr/as.go @@ -4,8 +4,7 @@ package azqr import ( - "github.com/Azure/azqr/internal/azqr" - "github.com/Azure/azqr/internal/scanners/as" + "github.com/Azure/azqr/internal/scanners" "github.com/spf13/cobra" ) @@ -19,10 +18,6 @@ var asCmd = &cobra.Command{ Long: "Scan Azure Analysis Service", Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - serviceScanners := []azqr.IAzureScanner{ - &as.AnalysisServicesScanner{}, - } - - scan(cmd, serviceScanners) + scan(cmd, scanners.ScannerList["as"]) }, } diff --git a/cmd/azqr/asp.go b/cmd/azqr/asp.go index c65d5d5..fc829dc 100644 --- a/cmd/azqr/asp.go +++ b/cmd/azqr/asp.go @@ -4,8 +4,7 @@ package azqr import ( - "github.com/Azure/azqr/internal/azqr" - "github.com/Azure/azqr/internal/scanners/asp" + "github.com/Azure/azqr/internal/scanners" "github.com/spf13/cobra" ) @@ -19,10 +18,6 @@ var planCmd = &cobra.Command{ Long: "Scan Azure App Service", Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - serviceScanners := []azqr.IAzureScanner{ - &asp.AppServiceScanner{}, - } - - scan(cmd, serviceScanners) + scan(cmd, scanners.ScannerList["asp"]) }, } diff --git a/cmd/azqr/avd.go b/cmd/azqr/avd.go index 402107a..c0a5f7e 100644 --- a/cmd/azqr/avd.go +++ b/cmd/azqr/avd.go @@ -4,8 +4,7 @@ package azqr import ( - "github.com/Azure/azqr/internal/azqr" - "github.com/Azure/azqr/internal/scanners/avd" + "github.com/Azure/azqr/internal/scanners" "github.com/spf13/cobra" ) @@ -19,10 +18,6 @@ var avdCmd = &cobra.Command{ Long: "Scan Azure Virtual Desktop", Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - serviceScanners := []azqr.IAzureScanner{ - &avd.AzureVirtualDesktopScanner{}, - } - - scan(cmd, serviceScanners) + scan(cmd, scanners.ScannerList["avd"]) }, } diff --git a/cmd/azqr/avs.go b/cmd/azqr/avs.go index a248a6c..bc2e5ea 100644 --- a/cmd/azqr/avs.go +++ b/cmd/azqr/avs.go @@ -4,8 +4,7 @@ package azqr import ( - "github.com/Azure/azqr/internal/azqr" - "github.com/Azure/azqr/internal/scanners/avs" + "github.com/Azure/azqr/internal/scanners" "github.com/spf13/cobra" ) @@ -19,10 +18,6 @@ var avsCmd = &cobra.Command{ Long: "Scan Azure VMware Solution", Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - serviceScanners := []azqr.IAzureScanner{ - &avs.AVSScanner{}, - } - - scan(cmd, serviceScanners) + scan(cmd, scanners.ScannerList["avs"]) }, } diff --git a/cmd/azqr/ba.go b/cmd/azqr/ba.go index 1aa61ee..3e6d356 100644 --- a/cmd/azqr/ba.go +++ b/cmd/azqr/ba.go @@ -4,8 +4,7 @@ package azqr import ( - "github.com/Azure/azqr/internal/azqr" - "github.com/Azure/azqr/internal/scanners/ba" + "github.com/Azure/azqr/internal/scanners" "github.com/spf13/cobra" ) @@ -19,10 +18,6 @@ var baCmd = &cobra.Command{ Long: "Scan Azure Batch Account", Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - serviceScanners := []azqr.IAzureScanner{ - &ba.BatchAccountScanner{}, - } - - scan(cmd, serviceScanners) + scan(cmd, scanners.ScannerList["ba"]) }, } diff --git a/cmd/azqr/ca.go b/cmd/azqr/ca.go index 6d43f7d..3bcb931 100644 --- a/cmd/azqr/ca.go +++ b/cmd/azqr/ca.go @@ -4,8 +4,7 @@ package azqr import ( - "github.com/Azure/azqr/internal/azqr" - "github.com/Azure/azqr/internal/scanners/ca" + "github.com/Azure/azqr/internal/scanners" "github.com/spf13/cobra" ) @@ -19,10 +18,6 @@ var caCmd = &cobra.Command{ Long: "Scan Azure Container Apps", Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - serviceScanners := []azqr.IAzureScanner{ - &ca.ContainerAppsScanner{}, - } - - scan(cmd, serviceScanners) + scan(cmd, scanners.ScannerList["ca"]) }, } diff --git a/cmd/azqr/cae.go b/cmd/azqr/cae.go index a856068..d8389de 100644 --- a/cmd/azqr/cae.go +++ b/cmd/azqr/cae.go @@ -4,8 +4,7 @@ package azqr import ( - "github.com/Azure/azqr/internal/azqr" - "github.com/Azure/azqr/internal/scanners/cae" + "github.com/Azure/azqr/internal/scanners" "github.com/spf13/cobra" ) @@ -19,10 +18,6 @@ var caeCmd = &cobra.Command{ Long: "Scan Azure Container Apps Environment", Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - serviceScanners := []azqr.IAzureScanner{ - &cae.ContainerAppsEnvironmentScanner{}, - } - - scan(cmd, serviceScanners) + scan(cmd, scanners.ScannerList["cae"]) }, } diff --git a/cmd/azqr/ci.go b/cmd/azqr/ci.go index 1585ab3..1244dab 100644 --- a/cmd/azqr/ci.go +++ b/cmd/azqr/ci.go @@ -4,8 +4,7 @@ package azqr import ( - "github.com/Azure/azqr/internal/azqr" - "github.com/Azure/azqr/internal/scanners/ci" + "github.com/Azure/azqr/internal/scanners" "github.com/spf13/cobra" ) @@ -19,10 +18,6 @@ var ciCmd = &cobra.Command{ Long: "Scan Azure Container Instances", Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - serviceScanners := []azqr.IAzureScanner{ - &ci.ContainerInstanceScanner{}, - } - - scan(cmd, serviceScanners) + scan(cmd, scanners.ScannerList["ci"]) }, } diff --git a/cmd/azqr/cog.go b/cmd/azqr/cog.go index 6750611..05b2566 100644 --- a/cmd/azqr/cog.go +++ b/cmd/azqr/cog.go @@ -4,8 +4,7 @@ package azqr import ( - "github.com/Azure/azqr/internal/azqr" - "github.com/Azure/azqr/internal/scanners/cog" + "github.com/Azure/azqr/internal/scanners" "github.com/spf13/cobra" ) @@ -19,10 +18,6 @@ var cogCmd = &cobra.Command{ Long: "Scan Azure Cognitive Service Accounts", Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - serviceScanners := []azqr.IAzureScanner{ - &cog.CognitiveScanner{}, - } - - scan(cmd, serviceScanners) + scan(cmd, scanners.ScannerList["cog"]) }, } diff --git a/cmd/azqr/conn.go b/cmd/azqr/conn.go index 7e49c10..0838ce5 100644 --- a/cmd/azqr/conn.go +++ b/cmd/azqr/conn.go @@ -4,8 +4,7 @@ package azqr import ( - "github.com/Azure/azqr/internal/azqr" - "github.com/Azure/azqr/internal/scanners/conn" + "github.com/Azure/azqr/internal/scanners" "github.com/spf13/cobra" ) @@ -14,15 +13,11 @@ func init() { } var conCmd = &cobra.Command{ - Use: "com", + Use: "con", Short: "Scan Connection", Long: "Scan Connection", Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - serviceScanners := []azqr.IAzureScanner{ - &conn.ConnectionScanner{}, - } - - scan(cmd, serviceScanners) + scan(cmd, scanners.ScannerList["con"]) }, } diff --git a/cmd/azqr/cosmos.go b/cmd/azqr/cosmos.go index 94f1bc0..cddd957 100644 --- a/cmd/azqr/cosmos.go +++ b/cmd/azqr/cosmos.go @@ -4,8 +4,7 @@ package azqr import ( - "github.com/Azure/azqr/internal/azqr" - "github.com/Azure/azqr/internal/scanners/cosmos" + "github.com/Azure/azqr/internal/scanners" "github.com/spf13/cobra" ) @@ -19,10 +18,6 @@ var cosmosCmd = &cobra.Command{ Long: "Scan Azure Cosmos DB", Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - serviceScanners := []azqr.IAzureScanner{ - &cosmos.CosmosDBScanner{}, - } - - scan(cmd, serviceScanners) + scan(cmd, scanners.ScannerList["cosmos"]) }, } diff --git a/cmd/azqr/cr.go b/cmd/azqr/cr.go index 578225e..f4f6c47 100644 --- a/cmd/azqr/cr.go +++ b/cmd/azqr/cr.go @@ -4,8 +4,7 @@ package azqr import ( - "github.com/Azure/azqr/internal/azqr" - "github.com/Azure/azqr/internal/scanners/cr" + "github.com/Azure/azqr/internal/scanners" "github.com/spf13/cobra" ) @@ -19,10 +18,6 @@ var crCmd = &cobra.Command{ Long: "Scan Azure Container Registries", Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - serviceScanners := []azqr.IAzureScanner{ - &cr.ContainerRegistryScanner{}, - } - - scan(cmd, serviceScanners) + scan(cmd, scanners.ScannerList["cr"]) }, } diff --git a/cmd/azqr/dbw.go b/cmd/azqr/dbw.go index beb5bd2..4f06525 100644 --- a/cmd/azqr/dbw.go +++ b/cmd/azqr/dbw.go @@ -4,8 +4,7 @@ package azqr import ( - "github.com/Azure/azqr/internal/azqr" - "github.com/Azure/azqr/internal/scanners/dbw" + "github.com/Azure/azqr/internal/scanners" "github.com/spf13/cobra" ) @@ -19,10 +18,6 @@ var dbwCmd = &cobra.Command{ Long: "Scan Azure Databricks", Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - serviceScanners := []azqr.IAzureScanner{ - &dbw.DatabricksScanner{}, - } - - scan(cmd, serviceScanners) + scan(cmd, scanners.ScannerList["dbw"]) }, } diff --git a/cmd/azqr/dec.go b/cmd/azqr/dec.go index 2aba635..a34b61a 100644 --- a/cmd/azqr/dec.go +++ b/cmd/azqr/dec.go @@ -4,8 +4,7 @@ package azqr import ( - "github.com/Azure/azqr/internal/azqr" - "github.com/Azure/azqr/internal/scanners/dec" + "github.com/Azure/azqr/internal/scanners" "github.com/spf13/cobra" ) @@ -19,10 +18,6 @@ var decCmd = &cobra.Command{ Long: "Scan Azure Data Explorer", Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - serviceScanners := []azqr.IAzureScanner{ - &dec.DataExplorerScanner{}, - } - - scan(cmd, serviceScanners) + scan(cmd, scanners.ScannerList["dec"]) }, } diff --git a/cmd/azqr/disk.go b/cmd/azqr/disk.go index 6d7fee1..eebd861 100644 --- a/cmd/azqr/disk.go +++ b/cmd/azqr/disk.go @@ -4,8 +4,7 @@ package azqr import ( - "github.com/Azure/azqr/internal/azqr" - iot "github.com/Azure/azqr/internal/scanners/disk" + "github.com/Azure/azqr/internal/scanners" "github.com/spf13/cobra" ) @@ -19,10 +18,6 @@ var diskCmd = &cobra.Command{ Long: "Scan Disk", Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - serviceScanners := []azqr.IAzureScanner{ - &iot.DiskScanner{}, - } - - scan(cmd, serviceScanners) + scan(cmd, scanners.ScannerList["disk"]) }, } diff --git a/cmd/azqr/erc.go b/cmd/azqr/erc.go index 90a4f9d..d61ba04 100644 --- a/cmd/azqr/erc.go +++ b/cmd/azqr/erc.go @@ -4,8 +4,7 @@ package azqr import ( - "github.com/Azure/azqr/internal/azqr" - "github.com/Azure/azqr/internal/scanners/erc" + "github.com/Azure/azqr/internal/scanners" "github.com/spf13/cobra" ) @@ -19,10 +18,6 @@ var ercCmd = &cobra.Command{ Long: "Scan Express Route Circuits", Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - serviceScanners := []azqr.IAzureScanner{ - &erc.ExpressRouteScanner{}, - } - - scan(cmd, serviceScanners) + scan(cmd, scanners.ScannerList["erc"]) }, } diff --git a/cmd/azqr/evgd.go b/cmd/azqr/evgd.go index 6cee8d5..3e4c6bc 100644 --- a/cmd/azqr/evgd.go +++ b/cmd/azqr/evgd.go @@ -4,8 +4,7 @@ package azqr import ( - "github.com/Azure/azqr/internal/azqr" - "github.com/Azure/azqr/internal/scanners/evgd" + "github.com/Azure/azqr/internal/scanners" "github.com/spf13/cobra" ) @@ -19,10 +18,6 @@ var evgdCmd = &cobra.Command{ Long: "Scan Azure Event Grid Domains", Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - serviceScanners := []azqr.IAzureScanner{ - &evgd.EventGridScanner{}, - } - - scan(cmd, serviceScanners) + scan(cmd, scanners.ScannerList["evgd"]) }, } diff --git a/cmd/azqr/evh.go b/cmd/azqr/evh.go index f202468..58869df 100644 --- a/cmd/azqr/evh.go +++ b/cmd/azqr/evh.go @@ -4,8 +4,7 @@ package azqr import ( - "github.com/Azure/azqr/internal/azqr" - "github.com/Azure/azqr/internal/scanners/evh" + "github.com/Azure/azqr/internal/scanners" "github.com/spf13/cobra" ) @@ -19,10 +18,6 @@ var evhCmd = &cobra.Command{ Long: "Scan Azure Event Hubs", Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - serviceScanners := []azqr.IAzureScanner{ - &evh.EventHubScanner{}, - } - - scan(cmd, serviceScanners) + scan(cmd, scanners.ScannerList["evh"]) }, } diff --git a/cmd/azqr/fdfp.go b/cmd/azqr/fdfp.go index 1a32585..6789267 100644 --- a/cmd/azqr/fdfp.go +++ b/cmd/azqr/fdfp.go @@ -4,8 +4,7 @@ package azqr import ( - "github.com/Azure/azqr/internal/azqr" - "github.com/Azure/azqr/internal/scanners/fdfp" + "github.com/Azure/azqr/internal/scanners" "github.com/spf13/cobra" ) @@ -19,10 +18,6 @@ var fdfpCmd = &cobra.Command{ Long: "Scan Front Door Web Application Policy", Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - serviceScanners := []azqr.IAzureScanner{ - &fdfp.FrontDoorWAFPolicyScanner{}, - } - - scan(cmd, serviceScanners) + scan(cmd, scanners.ScannerList["fdfp"]) }, } diff --git a/cmd/azqr/gal.go b/cmd/azqr/gal.go index 9b2ef96..09a6b6b 100644 --- a/cmd/azqr/gal.go +++ b/cmd/azqr/gal.go @@ -4,8 +4,7 @@ package azqr import ( - "github.com/Azure/azqr/internal/azqr" - "github.com/Azure/azqr/internal/scanners/gal" + "github.com/Azure/azqr/internal/scanners" "github.com/spf13/cobra" ) @@ -19,10 +18,6 @@ var galCmd = &cobra.Command{ Long: "Scan Azure Galleries", Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - serviceScanners := []azqr.IAzureScanner{ - &gal.GalleryScanner{}, - } - - scan(cmd, serviceScanners) + scan(cmd, scanners.ScannerList["gal"]) }, } diff --git a/cmd/azqr/hpc.go b/cmd/azqr/hpc.go index fc193d0..7c5edd8 100644 --- a/cmd/azqr/hpc.go +++ b/cmd/azqr/hpc.go @@ -4,8 +4,7 @@ package azqr import ( - "github.com/Azure/azqr/internal/azqr" - "github.com/Azure/azqr/internal/scanners/hpc" + "github.com/Azure/azqr/internal/scanners" "github.com/spf13/cobra" ) @@ -19,10 +18,6 @@ var hpcCmd = &cobra.Command{ Long: "Scan HPC", Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - serviceScanners := []azqr.IAzureScanner{ - &hpc.HighPerformanceComputingScanner{}, - } - - scan(cmd, serviceScanners) + scan(cmd, scanners.ScannerList["hpc"]) }, } diff --git a/cmd/azqr/iot.go b/cmd/azqr/iot.go index 63a1b5b..fce38d8 100644 --- a/cmd/azqr/iot.go +++ b/cmd/azqr/iot.go @@ -4,8 +4,7 @@ package azqr import ( - "github.com/Azure/azqr/internal/azqr" - "github.com/Azure/azqr/internal/scanners/iot" + "github.com/Azure/azqr/internal/scanners" "github.com/spf13/cobra" ) @@ -19,10 +18,6 @@ var iotCmd = &cobra.Command{ Long: "Scan Azure IoT Hub", Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - serviceScanners := []azqr.IAzureScanner{ - &iot.IoTHubScanner{}, - } - - scan(cmd, serviceScanners) + scan(cmd, scanners.ScannerList["iot"]) }, } diff --git a/cmd/azqr/it.go b/cmd/azqr/it.go index 2f0e2d1..f371568 100644 --- a/cmd/azqr/it.go +++ b/cmd/azqr/it.go @@ -4,8 +4,7 @@ package azqr import ( - "github.com/Azure/azqr/internal/azqr" - "github.com/Azure/azqr/internal/scanners/it" + "github.com/Azure/azqr/internal/scanners" "github.com/spf13/cobra" ) @@ -19,10 +18,6 @@ var itCmd = &cobra.Command{ Long: "Scan Image Template", Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - serviceScanners := []azqr.IAzureScanner{ - &it.ImageTemplateScanner{}, - } - - scan(cmd, serviceScanners) + scan(cmd, scanners.ScannerList["it"]) }, } diff --git a/cmd/azqr/kv.go b/cmd/azqr/kv.go index ffb67b8..051189d 100644 --- a/cmd/azqr/kv.go +++ b/cmd/azqr/kv.go @@ -4,8 +4,7 @@ package azqr import ( - "github.com/Azure/azqr/internal/azqr" - "github.com/Azure/azqr/internal/scanners/kv" + "github.com/Azure/azqr/internal/scanners" "github.com/spf13/cobra" ) @@ -19,10 +18,6 @@ var kvCmd = &cobra.Command{ Long: "Scan Azure Key Vault", Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - serviceScanners := []azqr.IAzureScanner{ - &kv.KeyVaultScanner{}, - } - - scan(cmd, serviceScanners) + scan(cmd, scanners.ScannerList["kv"]) }, } diff --git a/cmd/azqr/lb.go b/cmd/azqr/lb.go index 272ee9e..68125b1 100644 --- a/cmd/azqr/lb.go +++ b/cmd/azqr/lb.go @@ -4,8 +4,7 @@ package azqr import ( - "github.com/Azure/azqr/internal/azqr" - "github.com/Azure/azqr/internal/scanners/lb" + "github.com/Azure/azqr/internal/scanners" "github.com/spf13/cobra" ) @@ -19,10 +18,6 @@ var lbCmd = &cobra.Command{ Long: "Scan Azure Load Balancer", Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - serviceScanners := []azqr.IAzureScanner{ - &lb.LoadBalancerScanner{}, - } - - scan(cmd, serviceScanners) + scan(cmd, scanners.ScannerList["lb"]) }, } diff --git a/cmd/azqr/log.go b/cmd/azqr/log.go index e30a4bc..4e0c0e9 100644 --- a/cmd/azqr/log.go +++ b/cmd/azqr/log.go @@ -4,8 +4,7 @@ package azqr import ( - "github.com/Azure/azqr/internal/azqr" - "github.com/Azure/azqr/internal/scanners/log" + "github.com/Azure/azqr/internal/scanners" "github.com/spf13/cobra" ) @@ -19,10 +18,6 @@ var logCmd = &cobra.Command{ Long: "Scan Log Analytics workspace", Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - serviceScanners := []azqr.IAzureScanner{ - &log.LogAnalyticsScanner{}, - } - - scan(cmd, serviceScanners) + scan(cmd, scanners.ScannerList["log"]) }, } diff --git a/cmd/azqr/logic.go b/cmd/azqr/logic.go index b517401..22ea955 100644 --- a/cmd/azqr/logic.go +++ b/cmd/azqr/logic.go @@ -4,8 +4,7 @@ package azqr import ( - "github.com/Azure/azqr/internal/azqr" - "github.com/Azure/azqr/internal/scanners/logic" + "github.com/Azure/azqr/internal/scanners" "github.com/spf13/cobra" ) @@ -19,10 +18,6 @@ var logicCmd = &cobra.Command{ Long: "Scan Azure Logic Apps", Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - serviceScanners := []azqr.IAzureScanner{ - &logic.LogicAppScanner{}, - } - - scan(cmd, serviceScanners) + scan(cmd, scanners.ScannerList["logic"]) }, } diff --git a/cmd/azqr/maria.go b/cmd/azqr/maria.go index 86ff99c..f91639a 100644 --- a/cmd/azqr/maria.go +++ b/cmd/azqr/maria.go @@ -4,8 +4,7 @@ package azqr import ( - "github.com/Azure/azqr/internal/azqr" - "github.com/Azure/azqr/internal/scanners/maria" + "github.com/Azure/azqr/internal/scanners" "github.com/spf13/cobra" ) @@ -19,10 +18,6 @@ var mariaCmd = &cobra.Command{ Long: "Scan Azure Database for MariaDB", Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - serviceScanners := []azqr.IAzureScanner{ - &maria.MariaScanner{}, - } - - scan(cmd, serviceScanners) + scan(cmd, scanners.ScannerList["maria"]) }, } diff --git a/cmd/azqr/mysql.go b/cmd/azqr/mysql.go index eb73ce2..4523e61 100644 --- a/cmd/azqr/mysql.go +++ b/cmd/azqr/mysql.go @@ -4,8 +4,7 @@ package azqr import ( - "github.com/Azure/azqr/internal/azqr" - "github.com/Azure/azqr/internal/scanners/mysql" + "github.com/Azure/azqr/internal/scanners" "github.com/spf13/cobra" ) @@ -19,11 +18,6 @@ var mysqlCmd = &cobra.Command{ Long: "Scan Azure Database for MySQL", Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - serviceScanners := []azqr.IAzureScanner{ - &mysql.MySQLScanner{}, - &mysql.MySQLFlexibleScanner{}, - } - - scan(cmd, serviceScanners) + scan(cmd, scanners.ScannerList["mysql"]) }, } diff --git a/cmd/azqr/netapp.go b/cmd/azqr/netapp.go index bcb5aca..2981929 100644 --- a/cmd/azqr/netapp.go +++ b/cmd/azqr/netapp.go @@ -4,8 +4,7 @@ package azqr import ( - "github.com/Azure/azqr/internal/azqr" - "github.com/Azure/azqr/internal/scanners/netapp" + "github.com/Azure/azqr/internal/scanners" "github.com/spf13/cobra" ) @@ -19,10 +18,6 @@ var netappCmd = &cobra.Command{ Long: "Scan NetApp", Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - serviceScanners := []azqr.IAzureScanner{ - &netapp.NetAppScanner{}, - } - - scan(cmd, serviceScanners) + scan(cmd, scanners.ScannerList["netapp"]) }, } diff --git a/cmd/azqr/ng.go b/cmd/azqr/ng.go index b3107b2..8736e64 100644 --- a/cmd/azqr/ng.go +++ b/cmd/azqr/ng.go @@ -4,8 +4,7 @@ package azqr import ( - "github.com/Azure/azqr/internal/azqr" - "github.com/Azure/azqr/internal/scanners/ng" + "github.com/Azure/azqr/internal/scanners" "github.com/spf13/cobra" ) @@ -19,10 +18,6 @@ var ngCmd = &cobra.Command{ Long: "Scan Azure NAT Gateway", Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - serviceScanners := []azqr.IAzureScanner{ - &ng.NatGatewayScanner{}, - } - - scan(cmd, serviceScanners) + scan(cmd, scanners.ScannerList["ng"]) }, } diff --git a/cmd/azqr/nsg.go b/cmd/azqr/nsg.go index 8a865d4..5290cf0 100644 --- a/cmd/azqr/nsg.go +++ b/cmd/azqr/nsg.go @@ -4,8 +4,7 @@ package azqr import ( - "github.com/Azure/azqr/internal/azqr" - "github.com/Azure/azqr/internal/scanners/nsg" + "github.com/Azure/azqr/internal/scanners" "github.com/spf13/cobra" ) @@ -19,10 +18,6 @@ var nsgCmd = &cobra.Command{ Long: "Scan NSG", Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - serviceScanners := []azqr.IAzureScanner{ - &nsg.NSGScanner{}, - } - - scan(cmd, serviceScanners) + scan(cmd, scanners.ScannerList["nsg"]) }, } diff --git a/cmd/azqr/nw.go b/cmd/azqr/nw.go index b1e5591..6c08608 100644 --- a/cmd/azqr/nw.go +++ b/cmd/azqr/nw.go @@ -4,8 +4,7 @@ package azqr import ( - "github.com/Azure/azqr/internal/azqr" - "github.com/Azure/azqr/internal/scanners/nw" + "github.com/Azure/azqr/internal/scanners" "github.com/spf13/cobra" ) @@ -19,10 +18,6 @@ var nwCmd = &cobra.Command{ Long: "Scan Network Watcher", Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - serviceScanners := []azqr.IAzureScanner{ - &nw.NetworkWatcherScanner{}, - } - - scan(cmd, serviceScanners) + scan(cmd, scanners.ScannerList["nw"]) }, } diff --git a/cmd/azqr/pdnsz.go b/cmd/azqr/pdnsz.go index eb7e02c..618f2a0 100644 --- a/cmd/azqr/pdnsz.go +++ b/cmd/azqr/pdnsz.go @@ -4,8 +4,7 @@ package azqr import ( - "github.com/Azure/azqr/internal/azqr" - "github.com/Azure/azqr/internal/scanners/pdnsz" + "github.com/Azure/azqr/internal/scanners" "github.com/spf13/cobra" ) @@ -19,10 +18,6 @@ var pdnszCmd = &cobra.Command{ Long: "Scan Private DNS Zone", Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - serviceScanners := []azqr.IAzureScanner{ - &pdnsz.PrivateDNSZoneScanner{}, - } - - scan(cmd, serviceScanners) + scan(cmd, scanners.ScannerList["pdnsz"]) }, } diff --git a/cmd/azqr/pep.go b/cmd/azqr/pep.go index 135f50c..65e9e19 100644 --- a/cmd/azqr/pep.go +++ b/cmd/azqr/pep.go @@ -4,8 +4,7 @@ package azqr import ( - "github.com/Azure/azqr/internal/azqr" - "github.com/Azure/azqr/internal/scanners/pep" + "github.com/Azure/azqr/internal/scanners" "github.com/spf13/cobra" ) @@ -19,10 +18,6 @@ var pepCmd = &cobra.Command{ Long: "Scan Private Endpoint", Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - serviceScanners := []azqr.IAzureScanner{ - &pep.PrivateEndpointScanner{}, - } - - scan(cmd, serviceScanners) + scan(cmd, scanners.ScannerList["pep"]) }, } diff --git a/cmd/azqr/pip.go b/cmd/azqr/pip.go index 98f87ce..78c48d3 100644 --- a/cmd/azqr/pip.go +++ b/cmd/azqr/pip.go @@ -4,8 +4,7 @@ package azqr import ( - "github.com/Azure/azqr/internal/azqr" - "github.com/Azure/azqr/internal/scanners/pip" + "github.com/Azure/azqr/internal/scanners" "github.com/spf13/cobra" ) @@ -19,10 +18,6 @@ var pipCmd = &cobra.Command{ Long: "Scan Public IP", Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - serviceScanners := []azqr.IAzureScanner{ - &pip.PublicIPScanner{}, - } - - scan(cmd, serviceScanners) + scan(cmd, scanners.ScannerList["pip"]) }, } diff --git a/cmd/azqr/psql.go b/cmd/azqr/psql.go index 76adb45..d492b99 100644 --- a/cmd/azqr/psql.go +++ b/cmd/azqr/psql.go @@ -4,8 +4,7 @@ package azqr import ( - "github.com/Azure/azqr/internal/azqr" - "github.com/Azure/azqr/internal/scanners/psql" + "github.com/Azure/azqr/internal/scanners" "github.com/spf13/cobra" ) @@ -19,11 +18,6 @@ var psqlCmd = &cobra.Command{ Long: "Scan Azure Database for psql", Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - serviceScanners := []azqr.IAzureScanner{ - &psql.PostgreScanner{}, - &psql.PostgreFlexibleScanner{}, - } - - scan(cmd, serviceScanners) + scan(cmd, scanners.ScannerList["psql"]) }, } diff --git a/cmd/azqr/redis.go b/cmd/azqr/redis.go index c978883..9cf6c97 100644 --- a/cmd/azqr/redis.go +++ b/cmd/azqr/redis.go @@ -4,8 +4,7 @@ package azqr import ( - "github.com/Azure/azqr/internal/azqr" - "github.com/Azure/azqr/internal/scanners/redis" + "github.com/Azure/azqr/internal/scanners" "github.com/spf13/cobra" ) @@ -19,10 +18,6 @@ var redisCmd = &cobra.Command{ Long: "Scan Azure Cache for Redis", Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - serviceScanners := []azqr.IAzureScanner{ - &redis.RedisScanner{}, - } - - scan(cmd, serviceScanners) + scan(cmd, scanners.ScannerList["redis"]) }, } diff --git a/cmd/azqr/rsv.go b/cmd/azqr/rsv.go index a794d11..781dc73 100644 --- a/cmd/azqr/rsv.go +++ b/cmd/azqr/rsv.go @@ -4,8 +4,7 @@ package azqr import ( - "github.com/Azure/azqr/internal/azqr" - "github.com/Azure/azqr/internal/scanners/rsv" + "github.com/Azure/azqr/internal/scanners" "github.com/spf13/cobra" ) @@ -19,10 +18,6 @@ var rsvCmd = &cobra.Command{ Long: "Scan Recovery Service", Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - serviceScanners := []azqr.IAzureScanner{ - &rsv.RecoveryServiceScanner{}, - } - - scan(cmd, serviceScanners) + scan(cmd, scanners.ScannerList["rsv"]) }, } diff --git a/cmd/azqr/rt.go b/cmd/azqr/rt.go index fbb207b..7f1ed56 100644 --- a/cmd/azqr/rt.go +++ b/cmd/azqr/rt.go @@ -4,8 +4,7 @@ package azqr import ( - "github.com/Azure/azqr/internal/azqr" - "github.com/Azure/azqr/internal/scanners/rt" + "github.com/Azure/azqr/internal/scanners" "github.com/spf13/cobra" ) @@ -19,10 +18,6 @@ var rtCmd = &cobra.Command{ Long: "Scan Route Table", Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - serviceScanners := []azqr.IAzureScanner{ - &rt.RouteTableScanner{}, - } - - scan(cmd, serviceScanners) + scan(cmd, scanners.ScannerList["rt"]) }, } diff --git a/cmd/azqr/sap.go b/cmd/azqr/sap.go index eda96c3..fc883c6 100644 --- a/cmd/azqr/sap.go +++ b/cmd/azqr/sap.go @@ -4,8 +4,7 @@ package azqr import ( - "github.com/Azure/azqr/internal/azqr" - "github.com/Azure/azqr/internal/scanners/sap" + "github.com/Azure/azqr/internal/scanners" "github.com/spf13/cobra" ) @@ -19,10 +18,6 @@ var sapCmd = &cobra.Command{ Long: "Scan SAP", Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - serviceScanners := []azqr.IAzureScanner{ - &sap.SAPScanner{}, - } - - scan(cmd, serviceScanners) + scan(cmd, scanners.ScannerList["sap"]) }, } diff --git a/cmd/azqr/sb.go b/cmd/azqr/sb.go index 4d2b7f0..55e19ec 100644 --- a/cmd/azqr/sb.go +++ b/cmd/azqr/sb.go @@ -4,8 +4,7 @@ package azqr import ( - "github.com/Azure/azqr/internal/azqr" - "github.com/Azure/azqr/internal/scanners/sb" + "github.com/Azure/azqr/internal/scanners" "github.com/spf13/cobra" ) @@ -19,10 +18,6 @@ var sbCmd = &cobra.Command{ Long: "Scan Azure Service Bus", Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - serviceScanners := []azqr.IAzureScanner{ - &sb.ServiceBusScanner{}, - } - - scan(cmd, serviceScanners) + scan(cmd, scanners.ScannerList["sb"]) }, } diff --git a/cmd/azqr/sigr.go b/cmd/azqr/sigr.go index d5249fc..f59a7e4 100644 --- a/cmd/azqr/sigr.go +++ b/cmd/azqr/sigr.go @@ -4,8 +4,7 @@ package azqr import ( - "github.com/Azure/azqr/internal/azqr" - "github.com/Azure/azqr/internal/scanners/sigr" + "github.com/Azure/azqr/internal/scanners" "github.com/spf13/cobra" ) @@ -19,10 +18,6 @@ var sigrCmd = &cobra.Command{ Long: "Scan Azure SignalR", Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - serviceScanners := []azqr.IAzureScanner{ - &sigr.SignalRScanner{}, - } - - scan(cmd, serviceScanners) + scan(cmd, scanners.ScannerList["sigr"]) }, } diff --git a/cmd/azqr/sql.go b/cmd/azqr/sql.go index 149a1f9..60003d4 100644 --- a/cmd/azqr/sql.go +++ b/cmd/azqr/sql.go @@ -4,8 +4,7 @@ package azqr import ( - "github.com/Azure/azqr/internal/azqr" - "github.com/Azure/azqr/internal/scanners/sql" + "github.com/Azure/azqr/internal/scanners" "github.com/spf13/cobra" ) @@ -19,10 +18,6 @@ var sqlCmd = &cobra.Command{ Long: "Scan Azure SQL Database", Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - serviceScanners := []azqr.IAzureScanner{ - &sql.SQLScanner{}, - } - - scan(cmd, serviceScanners) + scan(cmd, scanners.ScannerList["sql"]) }, } diff --git a/cmd/azqr/st.go b/cmd/azqr/st.go index 2b0eeeb..acd6249 100644 --- a/cmd/azqr/st.go +++ b/cmd/azqr/st.go @@ -4,8 +4,7 @@ package azqr import ( - "github.com/Azure/azqr/internal/azqr" - "github.com/Azure/azqr/internal/scanners/st" + "github.com/Azure/azqr/internal/scanners" "github.com/spf13/cobra" ) @@ -19,10 +18,6 @@ var stCmd = &cobra.Command{ Long: "Scan Azure Storage", Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - serviceScanners := []azqr.IAzureScanner{ - &st.StorageScanner{}, - } - - scan(cmd, serviceScanners) + scan(cmd, scanners.ScannerList["st"]) }, } diff --git a/cmd/azqr/synw.go b/cmd/azqr/synw.go index 8dd6df2..fcda0ef 100644 --- a/cmd/azqr/synw.go +++ b/cmd/azqr/synw.go @@ -4,8 +4,7 @@ package azqr import ( - "github.com/Azure/azqr/internal/azqr" - "github.com/Azure/azqr/internal/scanners/synw" + "github.com/Azure/azqr/internal/scanners" "github.com/spf13/cobra" ) @@ -19,10 +18,6 @@ var synwCmd = &cobra.Command{ Long: "Scan Azure Synapse Workspace", Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - serviceScanners := []azqr.IAzureScanner{ - &synw.SynapseWorkspaceScanner{}, - } - - scan(cmd, serviceScanners) + scan(cmd, scanners.ScannerList["synw"]) }, } diff --git a/cmd/azqr/traf.go b/cmd/azqr/traf.go index b27b1a3..454acb5 100644 --- a/cmd/azqr/traf.go +++ b/cmd/azqr/traf.go @@ -4,8 +4,7 @@ package azqr import ( - "github.com/Azure/azqr/internal/azqr" - "github.com/Azure/azqr/internal/scanners/traf" + "github.com/Azure/azqr/internal/scanners" "github.com/spf13/cobra" ) @@ -19,10 +18,6 @@ var trafCmd = &cobra.Command{ Long: "Scan Azure Traffic Manager", Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - serviceScanners := []azqr.IAzureScanner{ - &traf.TrafficManagerScanner{}, - } - - scan(cmd, serviceScanners) + scan(cmd, scanners.ScannerList["traf"]) }, } diff --git a/cmd/azqr/types.go b/cmd/azqr/types.go index 1a6760f..1bc7751 100644 --- a/cmd/azqr/types.go +++ b/cmd/azqr/types.go @@ -5,7 +5,7 @@ package azqr import ( "fmt" - "slices" + "sort" "github.com/Azure/azqr/internal/scanners" "github.com/spf13/cobra" @@ -21,19 +21,20 @@ var typesCmd = &cobra.Command{ Long: "Print all supported azure resource types", Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - serviceScanners := scanners.GetScanners() - - strs := []string{} - - for _, scanner := range serviceScanners { - strs = append(strs, scanner.ResourceTypes()...) + fmt.Println("Abbreviation | Resource Type ") + fmt.Println("---|---") + keys := make([]string, 0, len(scanners.ScannerList)) + for key := range scanners.ScannerList { + keys = append(keys, key) } - slices.Sort(strs) - - for _, t := range strs { - fmt.Printf("* %s", t) - fmt.Println() + sort.Strings(keys) + for _, key := range keys { + for _, t := range scanners.ScannerList[key] { + for _, rt := range t.ResourceTypes() { + fmt.Printf("%s | %s", key, rt) + fmt.Println() + } + } } - }, } diff --git a/cmd/azqr/vdpool.go b/cmd/azqr/vdpool.go index df423f9..144092a 100644 --- a/cmd/azqr/vdpool.go +++ b/cmd/azqr/vdpool.go @@ -4,8 +4,7 @@ package azqr import ( - "github.com/Azure/azqr/internal/azqr" - "github.com/Azure/azqr/internal/scanners/vdpool" + "github.com/Azure/azqr/internal/scanners" "github.com/spf13/cobra" ) @@ -19,10 +18,6 @@ var vdPoolCmd = &cobra.Command{ Long: "Scan Azure Virtual Desktop", Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - serviceScanners := []azqr.IAzureScanner{ - &vdpool.VirtualDesktopScanner{}, - } - - scan(cmd, serviceScanners) + scan(cmd, scanners.ScannerList["vdpool"]) }, } diff --git a/cmd/azqr/vgw.go b/cmd/azqr/vgw.go index 2738484..aedd817 100644 --- a/cmd/azqr/vgw.go +++ b/cmd/azqr/vgw.go @@ -4,8 +4,7 @@ package azqr import ( - "github.com/Azure/azqr/internal/azqr" - "github.com/Azure/azqr/internal/scanners/vgw" + "github.com/Azure/azqr/internal/scanners" "github.com/spf13/cobra" ) @@ -19,10 +18,6 @@ var vgwCmd = &cobra.Command{ Long: "Scan Virtual Network Gateway", Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - serviceScanners := []azqr.IAzureScanner{ - &vgw.VirtualNetworkGatewayScanner{}, - } - - scan(cmd, serviceScanners) + scan(cmd, scanners.ScannerList["vgw"]) }, } diff --git a/cmd/azqr/vm.go b/cmd/azqr/vm.go index 9edb964..c20ade3 100644 --- a/cmd/azqr/vm.go +++ b/cmd/azqr/vm.go @@ -4,8 +4,7 @@ package azqr import ( - "github.com/Azure/azqr/internal/azqr" - "github.com/Azure/azqr/internal/scanners/vm" + "github.com/Azure/azqr/internal/scanners" "github.com/spf13/cobra" ) @@ -19,10 +18,6 @@ var vmCmd = &cobra.Command{ Long: "Scan Virtual Machine", Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - serviceScanners := []azqr.IAzureScanner{ - &vm.VirtualMachineScanner{}, - } - - scan(cmd, serviceScanners) + scan(cmd, scanners.ScannerList["vm"]) }, } diff --git a/cmd/azqr/vmss.go b/cmd/azqr/vmss.go index 76b65f6..a5b0046 100644 --- a/cmd/azqr/vmss.go +++ b/cmd/azqr/vmss.go @@ -4,8 +4,7 @@ package azqr import ( - "github.com/Azure/azqr/internal/azqr" - "github.com/Azure/azqr/internal/scanners/vmss" + "github.com/Azure/azqr/internal/scanners" "github.com/spf13/cobra" ) @@ -19,10 +18,6 @@ var vmssCmd = &cobra.Command{ Long: "Scan Virtual Machine Scale Set", Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - serviceScanners := []azqr.IAzureScanner{ - &vmss.VirtualMachineScaleSetScanner{}, - } - - scan(cmd, serviceScanners) + scan(cmd, scanners.ScannerList["vmss"]) }, } diff --git a/cmd/azqr/vnet.go b/cmd/azqr/vnet.go index 268e0e8..982dfb7 100644 --- a/cmd/azqr/vnet.go +++ b/cmd/azqr/vnet.go @@ -4,8 +4,7 @@ package azqr import ( - "github.com/Azure/azqr/internal/azqr" - "github.com/Azure/azqr/internal/scanners/vnet" + "github.com/Azure/azqr/internal/scanners" "github.com/spf13/cobra" ) @@ -19,10 +18,6 @@ var vnetCmd = &cobra.Command{ Long: "Scan Azure Virtual Network", Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - serviceScanners := []azqr.IAzureScanner{ - &vnet.VirtualNetworkScanner{}, - } - - scan(cmd, serviceScanners) + scan(cmd, scanners.ScannerList["vnet"]) }, } diff --git a/cmd/azqr/vwan.go b/cmd/azqr/vwan.go index 0ea59fe..e48914d 100644 --- a/cmd/azqr/vwan.go +++ b/cmd/azqr/vwan.go @@ -4,8 +4,7 @@ package azqr import ( - "github.com/Azure/azqr/internal/azqr" - "github.com/Azure/azqr/internal/scanners/vwan" + "github.com/Azure/azqr/internal/scanners" "github.com/spf13/cobra" ) @@ -19,10 +18,6 @@ var vwanCmd = &cobra.Command{ Long: "Scan Azure Virtual WAN", Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - serviceScanners := []azqr.IAzureScanner{ - &vwan.VirtualWanScanner{}, - } - - scan(cmd, serviceScanners) + scan(cmd, scanners.ScannerList["vwan"]) }, } diff --git a/cmd/azqr/wps.go b/cmd/azqr/wps.go index fea5ef2..a8bfd5b 100644 --- a/cmd/azqr/wps.go +++ b/cmd/azqr/wps.go @@ -4,8 +4,7 @@ package azqr import ( - "github.com/Azure/azqr/internal/azqr" - "github.com/Azure/azqr/internal/scanners/wps" + "github.com/Azure/azqr/internal/scanners" "github.com/spf13/cobra" ) @@ -19,10 +18,6 @@ var wpsCmd = &cobra.Command{ Long: "Scan Azure Web PubSub", Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - serviceScanners := []azqr.IAzureScanner{ - &wps.WebPubSubScanner{}, - } - - scan(cmd, serviceScanners) + scan(cmd, scanners.ScannerList["wps"]) }, } diff --git a/docs/content/en/docs/Overview/_index.md b/docs/content/en/docs/Overview/_index.md index 94f6d2d..bc2301b 100644 --- a/docs/content/en/docs/Overview/_index.md +++ b/docs/content/en/docs/Overview/_index.md @@ -38,81 +38,7 @@ The output generated by **Azure Quick Review (azqr)** is written by default to a **Azure Quick Review (azqr)** currently supports the following Azure services: -* Microsoft.AVS/privateClouds -* Microsoft.AnalysisServices/servers -* Microsoft.ApiManagement/service -* Microsoft.App/containerApps -* Microsoft.App/managedenvironments -* Microsoft.AppConfiguration/configurationStores -* Microsoft.Automation/automationAccounts -* Microsoft.Batch/batchAccounts -* Microsoft.Cache/Redis -* Microsoft.Cdn/profiles -* Microsoft.CognitiveServices/accounts -* Microsoft.Compute/galleries -* Microsoft.Compute/virtualMachineScaleSets -* Microsoft.Compute/virtualMachines -* Microsoft.ContainerInstance/containerGroups -* Microsoft.ContainerRegistry/registries -* Microsoft.ContainerService/managedClusters -* Microsoft.DBforMariaDB/servers -* Microsoft.DBforMariaDB/servers/databases -* Microsoft.DBforMySQL/flexibleServers -* Microsoft.DBforMySQL/servers -* Microsoft.DBforPostgreSQL/flexibleServers -* Microsoft.DBforPostgreSQL/servers -* Microsoft.Dashboard/grafana -* Microsoft.DataFactory/factories -* Microsoft.Databricks/workspaces -* Microsoft.DesktopVirtualization/hostPools -* Microsoft.DesktopVirtualization/scalingPlans -* Microsoft.DesktopVirtualization/workspaces -* Microsoft.Devices/IotHubs -* Microsoft.DocumentDB/databaseAccounts -* Microsoft.EventGrid/domains -* Microsoft.EventHub/namespaces -* Microsoft.Insights/activityLogAlerts -* Microsoft.Insights/components -* Microsoft.KeyVault/vaults -* Microsoft.Kusto/clusters -* Microsoft.Logic/workflows -* Microsoft.NetApp/netAppAccounts -* Microsoft.Network/ExpressRoutePorts -* Microsoft.Network/applicationGateways -* Microsoft.Network/azureFirewalls -* Microsoft.Network/connections -* Microsoft.Network/expressRouteCircuits -* Microsoft.Network/frontdoorWebApplicationFirewallPolicies -* Microsoft.Network/loadBalancers -* Microsoft.Network/natGateways -* Microsoft.Network/networkSecurityGroups -* Microsoft.Network/networkWatcherScanners -* Microsoft.Network/privateDnsZones -* Microsoft.Network/privateEndpoints -* Microsoft.Network/publicIPAddresses -* Microsoft.Network/routeTables -* Microsoft.Network/trafficManagerProfiles -* Microsoft.Network/virtualNetworkGateways -* Microsoft.Network/virtualNetworks -* Microsoft.OperationalInsights/workspaces -* Microsoft.RecoveryServices/vaults -* Microsoft.ServiceBus/namespaces -* Microsoft.SignalRService/SignalR -* Microsoft.SignalRService/webPubSub -* Microsoft.Sql/servers -* Microsoft.Sql/servers/databases -* Microsoft.Sql/servers/elasticPools -* Microsoft.Storage/storageAccounts -* Microsoft.Synapse workspaces/bigDataPools -* Microsoft.Synapse/workspaces -* Microsoft.Synapse/workspaces/sqlPools -* Microsoft.VirtualMachineImages/imageTemplates -* Microsoft.Web/serverFarms -* Microsoft.Web/sites -* Specialized.Workload/AVD -* Specialized.Workload/AVS -* Specialized.Workload/HPC -* Specialized.Workload/SAP +{{% include "./static/types.txt" %}} ## Code of Conduct diff --git a/docs/content/en/docs/Usage/_index.md b/docs/content/en/docs/Usage/_index.md index 66f5ef7..56abbbd 100644 --- a/docs/content/en/docs/Usage/_index.md +++ b/docs/content/en/docs/Usage/_index.md @@ -58,6 +58,8 @@ azqr: - # format: resourceGroups: - # format: /subscriptions//resourceGroups/ + resourceTypes: + - # format: Abbreviation of the resource type. For example: "vm" for "Microsoft.Compute/virtualMachines" exclude: subscriptions: - # format: diff --git a/internal/azqr/filters.go b/internal/azqr/filters.go index b5c5fe3..00ab873 100644 --- a/internal/azqr/filters.go +++ b/internal/azqr/filters.go @@ -38,6 +38,7 @@ type ( IncludeFilter struct { Subscriptions []string `yaml:"subscriptions,flow"` ResourceGroups []string `yaml:"resourceGroups,flow"` + ResourceTypes []string `yaml:"resourceTypes,flow"` } ) @@ -89,11 +90,13 @@ func LoadFilters(filterFile string) *Filters { Include: &IncludeFilter{ Subscriptions: []string{}, ResourceGroups: []string{}, + ResourceTypes: []string{}, }, Exclude: &ExcludeFilter{ - Subscriptions: []string{}, - ResourceGroups: []string{}, - Services: []string{}, + Subscriptions: []string{}, + ResourceGroups: []string{}, + Services: []string{}, + Recommendations: []string{}, }, }, } diff --git a/internal/scanner.go b/internal/scanner.go index 9f0c73d..560d213 100644 --- a/internal/scanner.go +++ b/internal/scanner.go @@ -73,6 +73,11 @@ func (sc Scanner) Scan(params *ScanParams) { filters.Azqr.AddResourceGroup(fmt.Sprintf("/subscriptions/%s/resourceGroups/%s", params.SubscriptionID, params.ResourceGroup)) } + serviceScanners := params.ServiceScanners + if len(params.ServiceScanners) > 1 && len(filters.Azqr.Include.ResourceTypes) > 0 { + serviceScanners = scanners.GetScannerByKeys(filters.Azqr.Include.ResourceTypes) + } + // create Azure credentials cred := sc.newAzureCredential(params.ForceAzureCliCredential) @@ -109,14 +114,14 @@ func (sc Scanner) Scan(params *ScanParams) { // get the APRL scan results aprlScanner := AprlScanner{} - reportData.Recomendations, reportData.AprlData = aprlScanner.Scan(ctx, cred, params.ServiceScanners, filters, subscriptions) + reportData.Recomendations, reportData.AprlData = aprlScanner.Scan(ctx, cred, serviceScanners, filters, subscriptions) resourceScanner := scanners.ResourceScanner{} reportData.Resources = resourceScanner.GetAllResources(ctx, cred, subscriptions, filters) // For each service scanner, get the recommendations list if params.UseAzqrRecommendations { - for _, s := range params.ServiceScanners { + for _, s := range serviceScanners { for i, r := range s.GetRecommendations() { if filters.Azqr.IsRecommendationExcluded(r.RecommendationID) { continue @@ -169,9 +174,9 @@ func (sc Scanner) Scan(params *ScanParams) { } // scan each resource group - ch := make(chan []azqr.AzqrServiceResult, len(params.ServiceScanners)) + ch := make(chan []azqr.AzqrServiceResult, len(serviceScanners)) - for _, s := range params.ServiceScanners { + for _, s := range serviceScanners { err := s.Init(config) if err != nil { log.Fatal().Err(err).Msg("Failed to initialize scanner") @@ -187,7 +192,7 @@ func (sc Scanner) Scan(params *ScanParams) { }(s) } - for i := 0; i < len(params.ServiceScanners); i++ { + for i := 0; i < len(serviceScanners); i++ { res := <-ch for _, r := range res { // check if the resource is excluded diff --git a/internal/scanners/scanners_list.go b/internal/scanners/scanners_list.go index 8ce3f01..75fe195 100644 --- a/internal/scanners/scanners_list.go +++ b/internal/scanners/scanners_list.go @@ -4,6 +4,8 @@ package scanners import ( + "sort" + "github.com/Azure/azqr/internal/azqr" "github.com/Azure/azqr/internal/scanners/aa" "github.com/Azure/azqr/internal/scanners/adf" @@ -70,73 +72,94 @@ import ( "github.com/Azure/azqr/internal/scanners/wps" ) -// GetScanners returns a list of all scanners +// ScannerList is a map of service abbreviation to scanner +var ScannerList = map[string][]azqr.IAzureScanner{ + "aa": {&aa.AutomationAccountScanner{}}, + "adf": {&adf.DataFactoryScanner{}}, + "afd": {&afd.FrontDoorScanner{}}, + "afw": {&afw.FirewallScanner{}}, + "agw": {&agw.ApplicationGatewayScanner{}}, + "aks": {&aks.AKSScanner{}}, + "amg": {&amg.ManagedGrafanaScanner{}}, + "apim": {&apim.APIManagementScanner{}}, + "appcs": {&appcs.AppConfigurationScanner{}}, + "appi": {&appi.AppInsightsScanner{}}, + "as": {&as.AnalysisServicesScanner{}}, + "asp": {&asp.AppServiceScanner{}}, + "avd": {&avd.AzureVirtualDesktopScanner{}}, + "avs": {&avs.AVSScanner{}}, + "ba": {&ba.BatchAccountScanner{}}, + "ca": {&ca.ContainerAppsScanner{}}, + "cae": {&cae.ContainerAppsEnvironmentScanner{}}, + "ci": {&ci.ContainerInstanceScanner{}}, + "cog": {&cog.CognitiveScanner{}}, + "con": {&conn.ConnectionScanner{}}, + "cosmos": {&cosmos.CosmosDBScanner{}}, + "cr": {&cr.ContainerRegistryScanner{}}, + "dbw": {&dbw.DatabricksScanner{}}, + "dec": {&dec.DataExplorerScanner{}}, + "disk": {&disk.DiskScanner{}}, + "erc": {&erc.ExpressRouteScanner{}}, + "evgd": {&evgd.EventGridScanner{}}, + "evh": {&evh.EventHubScanner{}}, + "fdfp": {&fdfp.FrontDoorWAFPolicyScanner{}}, + "gal": {&gal.GalleryScanner{}}, + "hpc": {&hpc.HighPerformanceComputingScanner{}}, + "iot": {&iot.IoTHubScanner{}}, + "it": {&it.ImageTemplateScanner{}}, + "kv": {&kv.KeyVaultScanner{}}, + "lb": {&lb.LoadBalancerScanner{}}, + "log": {&log.LogAnalyticsScanner{}}, + "logic": {&logic.LogicAppScanner{}}, + "maria": {&maria.MariaScanner{}}, + "mysql": {&mysql.MySQLFlexibleScanner{}, &mysql.MySQLScanner{}}, + "netapp": {&netapp.NetAppScanner{}}, + "ng": {&ng.NatGatewayScanner{}}, + "nsg": {&nsg.NSGScanner{}}, + "nw": {&nw.NetworkWatcherScanner{}}, + "pdnsz": {&pdnsz.PrivateDNSZoneScanner{}}, + "pep": {&pep.PrivateEndpointScanner{}}, + "pip": {&pip.PublicIPScanner{}}, + "psql": {&psql.PostgreFlexibleScanner{}, &psql.PostgreScanner{}}, + "redis": {&redis.RedisScanner{}}, + "rsv": {&rsv.RecoveryServiceScanner{}}, + "rt": {&rt.RouteTableScanner{}}, + "sap": {&sap.SAPScanner{}}, + "sb": {&sb.ServiceBusScanner{}}, + "sigr": {&sigr.SignalRScanner{}}, + "sql": {&sql.SQLScanner{}}, + "st": {&st.StorageScanner{}}, + "synw": {&synw.SynapseWorkspaceScanner{}}, + "traf": {&traf.TrafficManagerScanner{}}, + "vdpool": {&vdpool.VirtualDesktopScanner{}}, + "vgw": {&vgw.VirtualNetworkGatewayScanner{}}, + "vm": {&vm.VirtualMachineScanner{}}, + "vmss": {&vmss.VirtualMachineScaleSetScanner{}}, + "vnet": {&vnet.VirtualNetworkScanner{}}, + "wps": {&wps.WebPubSubScanner{}}, +} + +// GetScanners returns a list of all scanners in ScannerList func GetScanners() []azqr.IAzureScanner { - return []azqr.IAzureScanner{ - &aa.AutomationAccountScanner{}, - &dbw.DatabricksScanner{}, - &adf.DataFactoryScanner{}, - &afd.FrontDoorScanner{}, - &afw.FirewallScanner{}, - &agw.ApplicationGatewayScanner{}, - &aks.AKSScanner{}, - &amg.ManagedGrafanaScanner{}, - &apim.APIManagementScanner{}, - &appcs.AppConfigurationScanner{}, - &appi.AppInsightsScanner{}, - &as.AnalysisServicesScanner{}, - &avs.AVSScanner{}, - &avd.AzureVirtualDesktopScanner{}, - &ba.BatchAccountScanner{}, - &cae.ContainerAppsEnvironmentScanner{}, - &ca.ContainerAppsScanner{}, - &ci.ContainerInstanceScanner{}, - &cog.CognitiveScanner{}, - &conn.ConnectionScanner{}, - &cosmos.CosmosDBScanner{}, - &cr.ContainerRegistryScanner{}, - &dec.DataExplorerScanner{}, - &disk.DiskScanner{}, - &erc.ExpressRouteScanner{}, - &evgd.EventGridScanner{}, - &evh.EventHubScanner{}, - &fdfp.FrontDoorWAFPolicyScanner{}, - &hpc.HighPerformanceComputingScanner{}, - &it.ImageTemplateScanner{}, - &iot.IoTHubScanner{}, - &gal.GalleryScanner{}, - &kv.KeyVaultScanner{}, - &lb.LoadBalancerScanner{}, - &log.LogAnalyticsScanner{}, - &logic.LogicAppScanner{}, - &maria.MariaScanner{}, - &mysql.MySQLFlexibleScanner{}, - &mysql.MySQLScanner{}, - &ng.NatGatewayScanner{}, - &netapp.NetAppScanner{}, - &nsg.NSGScanner{}, - &nw.NetworkWatcherScanner{}, - &asp.AppServiceScanner{}, - &pep.PrivateEndpointScanner{}, - &pip.PublicIPScanner{}, - &pdnsz.PrivateDNSZoneScanner{}, - &psql.PostgreFlexibleScanner{}, - &psql.PostgreScanner{}, - &rt.RouteTableScanner{}, - &rsv.RecoveryServiceScanner{}, - &redis.RedisScanner{}, - &sap.SAPScanner{}, - &sb.ServiceBusScanner{}, - &sigr.SignalRScanner{}, - &sql.SQLScanner{}, - &synw.SynapseWorkspaceScanner{}, - &traf.TrafficManagerScanner{}, - &st.StorageScanner{}, - &vdpool.VirtualDesktopScanner{}, - &vm.VirtualMachineScanner{}, - &vmss.VirtualMachineScaleSetScanner{}, - &vnet.VirtualNetworkScanner{}, - &vgw.VirtualNetworkGatewayScanner{}, - &wps.WebPubSubScanner{}, + var scanners []azqr.IAzureScanner + keys := make([]string, 0, len(ScannerList)) + for key := range ScannerList { + keys = append(keys, key) + } + sort.Strings(keys) + for _, key := range keys { + scanners = append(scanners, ScannerList[key]...) + } + return scanners +} + +// GetScannerByKeys returns a list of scanners for the given keys +func GetScannerByKeys(keys []string) []azqr.IAzureScanner { + var scanners []azqr.IAzureScanner + for _, key := range keys { + if scannerList, exists := ScannerList[key]; exists { + scanners = append(scanners, scannerList...) + } } + return scanners }