mirror of
https://github.com/ghndrx/prowler.git
synced 2026-02-10 06:45:08 +00:00
feat(azure_service): New parent class (#2642)
This commit is contained in:
0
prowler/providers/azure/lib/service/__init__.py
Normal file
0
prowler/providers/azure/lib/service/__init__.py
Normal file
8
prowler/providers/azure/lib/service/service.py
Normal file
8
prowler/providers/azure/lib/service/service.py
Normal file
@@ -0,0 +1,8 @@
|
||||
class AzureService:
|
||||
def __init__(self, service, audit_info):
|
||||
# We receive the service using __class__.__name__ or the service name in lowercase
|
||||
# e.g.: Storage --> we need a lowercase string, so service.lower()
|
||||
self.service = service.lower() if not service.islower() else service
|
||||
|
||||
self.credentials = audit_info.credentials
|
||||
self.subscriptions = audit_info.identity.subscriptions
|
||||
@@ -4,14 +4,14 @@ from azure.mgmt.security import SecurityCenter
|
||||
from pydantic import BaseModel
|
||||
|
||||
from prowler.lib.logger import logger
|
||||
from prowler.providers.azure.lib.service.service import AzureService
|
||||
|
||||
|
||||
########################## Defender
|
||||
class Defender:
|
||||
class Defender(AzureService):
|
||||
def __init__(self, audit_info):
|
||||
self.service = "defender"
|
||||
self.credentials = audit_info.credentials
|
||||
self.subscriptions = audit_info.identity.subscriptions
|
||||
super().__init__(__class__.__name__, audit_info)
|
||||
|
||||
self.clients = self.__set_clients__(
|
||||
audit_info.identity.subscriptions, audit_info.credentials
|
||||
)
|
||||
|
||||
@@ -4,14 +4,13 @@ from azure.mgmt.authorization import AuthorizationManagementClient
|
||||
from azure.mgmt.authorization.v2022_04_01.models import Permission
|
||||
|
||||
from prowler.lib.logger import logger
|
||||
from prowler.providers.azure.lib.service.service import AzureService
|
||||
|
||||
|
||||
########################## IAM
|
||||
class IAM:
|
||||
class IAM(AzureService):
|
||||
def __init__(self, audit_info):
|
||||
self.service = "iam"
|
||||
self.credentials = audit_info.credentials
|
||||
self.subscriptions = audit_info.identity.subscriptions
|
||||
super().__init__(__class__.__name__, audit_info)
|
||||
self.clients = self.__set_clients__(
|
||||
audit_info.identity.subscriptions, audit_info.credentials
|
||||
)
|
||||
|
||||
@@ -4,14 +4,13 @@ from azure.mgmt.storage import StorageManagementClient
|
||||
from azure.mgmt.storage.v2022_09_01.models import NetworkRuleSet
|
||||
|
||||
from prowler.lib.logger import logger
|
||||
from prowler.providers.azure.lib.service.service import AzureService
|
||||
|
||||
|
||||
########################## Storage
|
||||
class Storage:
|
||||
class Storage(AzureService):
|
||||
def __init__(self, audit_info):
|
||||
self.service = "storage"
|
||||
self.credentials = audit_info.credentials
|
||||
self.subscriptions = audit_info.identity.subscriptions
|
||||
super().__init__(__class__.__name__, audit_info)
|
||||
self.clients = self.__set_clients__(
|
||||
audit_info.identity.subscriptions, audit_info.credentials
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user