Skip to main content

Python matos gcp provider

Project description

Unit Test Pylint

matos-gcp-provider

The 'matos-gcp-provider' is an open-source python package for developing security tools to identify threats in your Google Cloud Platform (GCP) infrastructure. It uses the service providers Cloud SDK to deduce the current state and metadata of the underlying services.

Quickstart

  1. Clone this repository.
  2. Create a virtualenv and activate.
  3. Install requirement packages inside install_requires list of setup.py list.
  4. Sample demo, import working folder into path src\matos_gcp_provider
from matos_gcp_provider.provider import Provider 
#credential can be import by either input dict or json load inside /credentials folder
dummy_credential = {
  "tenantId": "",
  "clientId": "",
  "clientSecret": "",
  "subscription_id": ""
}
# construct provider object, optional resource type for select specific resource
provider = Provider(dummy_credential=dummy_credential, resource_type="")
# asset discover 
assets = provider.get_assets()
# fetching resource details 
resources = provider.get_resource_inventories(assets)
  1. Run prebuild package environment and unit test:
    python -m pip install -U tox
    python -m tox -e py
    
  2. Build local wheel file
    python -m pip install -U setuptools wheel build
    python -m build .
    

Add resource api plugin

  • resource provider register through plugin design pattern, adding new plugin inside plugins folder
  • Example resource and register step
class SamplePlugin(BaseProvider):
    """service plugins

    Args:
        BaseProvider (Class): base provider class
    """
    def __init__(self, resource: Dict, **kwargs) -> None:
        """
        Construct cluster service
        """
        super().__init__(**kwargs)

    def get_inventory(self) -> Any:
        """
        Service discovery
        """
        pass
    
def register() -> Any:
    """Register plugins type"""
    factory.register("resource_type", SamplePlugin)

Version handling and publish release

  • Version is managed through bumpversion. Command to update new version, setup.py and .bumpversion.cfg will auto update
    bumpversion major|minor|patch --allow-dirty(optional)
    

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

matos-gcp-provider-1.0.12.tar.gz (21.4 kB view hashes)

Uploaded Source

Built Distribution

matos_gcp_provider-1.0.12-py3-none-any.whl (24.8 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page