cyclarity-sdk


Namecyclarity-sdk JSON
Version 1.0.58 PyPI version JSON
download
home_pageNone
SummaryNone
upload_time2024-09-29 12:05:56
maintainerNone
docs_urlNone
authorYour Name
requires_python<4.0,>=3.10
licenseNone
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            Project description
CyClarity SDK

Introduction

CyClarity SDK is a Python package that provides an interface for interacting with the CyClarity platform. It includes classes and methods for creating, managing, and interacting with various resources on the platform.

Installation

You can install the CyClarity SDK using poetry in your poetry project:

```bash
  poetry add cyclarity-sdk
```

To create a poetry project use this docs: https://python-poetry.org/docs/

You can download your sdk-usage-example using cyclarity git hub example : https://github.com/cyclarity/cyclarity-sdk-usage-examples
Usage

Here are examples of how to use the classes in the CyClarity SDK. Runnable The Runnable class is a base class for creating objects that can be run with setup and teardown phases. It has setup, run, and teardown methods that need to be implemented. 

This is the structure of a runnable:
```python
from cyclarity_sdk.runnable import Runnable, BaseResultsModel
from cyclarity_sdk.sdk_models.findings import PTFinding
import cyclarity_sdk.sdk_models.findings.types import FindingStatus , FindingType , AssessmentCategory
import cyclarity_sdk.sdk_models.findings.types as PTFindingTypes
class MyResult(BaseResultsModel):
    res_str: str

class MyRunnable(Runnable[MyResult]):
    desc: str
    cli_args: str
    #self.platform_api inherited attribute,initiates PlatformApi class
    def setup(self):  
        self.logger.info("Setting up")  
    #the run function is the first function to be initiated when a runnable is executed.
    def run(self):  
        self.logger.info("Running")  
        self.platform_api.send_test_report_description("This is a test description")
        self.platform_api.send_finding(PTFinding(
            topic='hello world',
            status=PTFindingTypes.FindingStatus.FINISHED,
            type=PTFindingTypes.FindingType.FINDING,
            assessment_category=PTFindingTypes.AssessmentCategory.FUNCTIONAL_TEST,
            assessment_technique=PTFindingTypes.AssessmentTechnique.OTHER_EXPLORATION,
            purpose='Snippet example',
            description='This is an example snippet on how to user platform_api'))
        for percentage in range(101):
            self.platform_api.report_test_progress(percentage=percentage)
            time.sleep(0.01)  
        return MyResult(res_str="success!")  

    def teardown(self, exception_type, exception_value, traceback):  
        self.logger.info("Tearing down")  
```

## PlatformApi
The PlatformApi class provides methods for interacting with the CyClarity platform. It is used within a Runnable instance through the self.platform_api attribute.
```python

from cyclarity_sdk.platform_api.Iplatform_connector import IPlatformConnectorApi as IPlatformConnectorApi
from cyclarity_sdk.sdk_models.findings import PTFinding as PTFinding

class PlatformApi:
    def __init__(self, platform_connector: IPlatformConnectorApi | None = None) -> None: ...
    def send_test_report_description(self, description: str): ...
    def send_finding(self, pt_finding: PTFinding): ...
    def report_test_progress(self, percentage: int): ...

```
### send_test_report_description:
description: str (expects a description)
### send_finding:
Gets PTfinding object and sends it to be visible on the website (See [PTFinding](#ptfinding))
### report_test_progress
percentage: int (expects a percentage , example above)

## PTFinding
```python
from pydantic import BaseModel, Field, computed_field, field_validator
from enum import Enum
from cyclarity_sdk.sdk_models.findings.types import FindingStatus, FindingType, AssessmentCategory, AssessmentTechnique
from cyclarity_sdk.sdk_models import ExecutionMetadata, MessageType

class PTFinding(BaseModel):
    topic: str
    status: FindingStatus
    type: FindingType
    assessment_category: AssessmentCategory
    assessment_technique: AssessmentTechnique
    purpose: str
    description: str

class FindingStatus(str, Enum):
    FINISHED = 'Finished'
    PARTIALLY_PERFORMED = 'Partially Performed'
    NOT_PERFORMED = 'Not Performed'

class FindingType(str, Enum):
    FINDING = 'Finding'
    NON_FINDING = 'Non Finding'
    INSIGHT = 'Insight'
    ADDITIONAL_INFORMATION = 'Additional Information'

class AssessmentCategory(str, Enum):
    FUNCTIONAL_TEST = 'functional test'
    PENTEST = 'pentest'
    VULNERABILITY_ANALYSIS = 'vulnerability analysis'
    INCIDENT = 'incident'
    CODE_REVIEW = 'code review'
    UNKNOWN = 'unknown'

class AssessmentTechnique(str, Enum):
    SPEC_BASED_TEST_CASE = 'specification-based test case'
    HARDWARE_ANALYSIS = 'hardware analysis'
    BINARY_ANALYSIS = 'binary analysis'
    INTERFACE_ANALYSIS = 'interface analysis'
    NETWORK_ANALYSIS = 'network analysis'
    CODE_REVIEW = 'code review'
    SPECIFICATION_REVIEW = 'specification review'
    CVE_SEARCH = 'CVE search'
    OTHER_EXPLORATION = 'other exploration'
    UNKNOWN = 'unknown'
```
            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "cyclarity-sdk",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.10",
    "maintainer_email": null,
    "keywords": null,
    "author": "Your Name",
    "author_email": "you@example.com",
    "download_url": "https://files.pythonhosted.org/packages/1f/7d/171713dfb184517ae854958b99e13abcae8dcb792520cad1cf9d05b4763b/cyclarity_sdk-1.0.58.tar.gz",
    "platform": null,
    "description": "Project description\nCyClarity SDK\n\nIntroduction\n\nCyClarity SDK is a Python package that provides an interface for interacting with the CyClarity platform. It includes classes and methods for creating, managing, and interacting with various resources on the platform.\n\nInstallation\n\nYou can install the CyClarity SDK using poetry in your poetry project:\n\n```bash\n  poetry add cyclarity-sdk\n```\n\nTo create a poetry project use this docs: https://python-poetry.org/docs/\n\nYou can download your sdk-usage-example using cyclarity git hub example : https://github.com/cyclarity/cyclarity-sdk-usage-examples\nUsage\n\nHere are examples of how to use the classes in the CyClarity SDK. Runnable The Runnable class is a base class for creating objects that can be run with setup and teardown phases. It has setup, run, and teardown methods that need to be implemented. \n\nThis is the structure of a runnable:\n```python\nfrom cyclarity_sdk.runnable import Runnable, BaseResultsModel\nfrom cyclarity_sdk.sdk_models.findings import PTFinding\nimport cyclarity_sdk.sdk_models.findings.types import FindingStatus , FindingType , AssessmentCategory\nimport cyclarity_sdk.sdk_models.findings.types as PTFindingTypes\nclass MyResult(BaseResultsModel):\n    res_str: str\n\nclass MyRunnable(Runnable[MyResult]):\n    desc: str\n    cli_args: str\n    #self.platform_api inherited attribute,initiates PlatformApi class\n    def setup(self):  \n        self.logger.info(\"Setting up\")  \n    #the run function is the first function to be initiated when a runnable is executed.\n    def run(self):  \n        self.logger.info(\"Running\")  \n        self.platform_api.send_test_report_description(\"This is a test description\")\n        self.platform_api.send_finding(PTFinding(\n            topic='hello world',\n            status=PTFindingTypes.FindingStatus.FINISHED,\n            type=PTFindingTypes.FindingType.FINDING,\n            assessment_category=PTFindingTypes.AssessmentCategory.FUNCTIONAL_TEST,\n            assessment_technique=PTFindingTypes.AssessmentTechnique.OTHER_EXPLORATION,\n            purpose='Snippet example',\n            description='This is an example snippet on how to user platform_api'))\n        for percentage in range(101):\n            self.platform_api.report_test_progress(percentage=percentage)\n            time.sleep(0.01)  \n        return MyResult(res_str=\"success!\")  \n\n    def teardown(self, exception_type, exception_value, traceback):  \n        self.logger.info(\"Tearing down\")  \n```\n\n## PlatformApi\nThe PlatformApi class provides methods for interacting with the CyClarity platform. It is used within a Runnable instance through the self.platform_api attribute.\n```python\n\nfrom cyclarity_sdk.platform_api.Iplatform_connector import IPlatformConnectorApi as IPlatformConnectorApi\nfrom cyclarity_sdk.sdk_models.findings import PTFinding as PTFinding\n\nclass PlatformApi:\n    def __init__(self, platform_connector: IPlatformConnectorApi | None = None) -> None: ...\n    def send_test_report_description(self, description: str): ...\n    def send_finding(self, pt_finding: PTFinding): ...\n    def report_test_progress(self, percentage: int): ...\n\n```\n### send_test_report_description:\ndescription: str (expects a description)\n### send_finding:\nGets PTfinding object and sends it to be visible on the website (See [PTFinding](#ptfinding))\n### report_test_progress\npercentage: int (expects a percentage , example above)\n\n## PTFinding\n```python\nfrom pydantic import BaseModel, Field, computed_field, field_validator\nfrom enum import Enum\nfrom cyclarity_sdk.sdk_models.findings.types import FindingStatus, FindingType, AssessmentCategory, AssessmentTechnique\nfrom cyclarity_sdk.sdk_models import ExecutionMetadata, MessageType\n\nclass PTFinding(BaseModel):\n    topic: str\n    status: FindingStatus\n    type: FindingType\n    assessment_category: AssessmentCategory\n    assessment_technique: AssessmentTechnique\n    purpose: str\n    description: str\n\nclass FindingStatus(str, Enum):\n    FINISHED = 'Finished'\n    PARTIALLY_PERFORMED = 'Partially Performed'\n    NOT_PERFORMED = 'Not Performed'\n\nclass FindingType(str, Enum):\n    FINDING = 'Finding'\n    NON_FINDING = 'Non Finding'\n    INSIGHT = 'Insight'\n    ADDITIONAL_INFORMATION = 'Additional Information'\n\nclass AssessmentCategory(str, Enum):\n    FUNCTIONAL_TEST = 'functional test'\n    PENTEST = 'pentest'\n    VULNERABILITY_ANALYSIS = 'vulnerability analysis'\n    INCIDENT = 'incident'\n    CODE_REVIEW = 'code review'\n    UNKNOWN = 'unknown'\n\nclass AssessmentTechnique(str, Enum):\n    SPEC_BASED_TEST_CASE = 'specification-based test case'\n    HARDWARE_ANALYSIS = 'hardware analysis'\n    BINARY_ANALYSIS = 'binary analysis'\n    INTERFACE_ANALYSIS = 'interface analysis'\n    NETWORK_ANALYSIS = 'network analysis'\n    CODE_REVIEW = 'code review'\n    SPECIFICATION_REVIEW = 'specification review'\n    CVE_SEARCH = 'CVE search'\n    OTHER_EXPLORATION = 'other exploration'\n    UNKNOWN = 'unknown'\n```",
    "bugtrack_url": null,
    "license": null,
    "summary": null,
    "version": "1.0.58",
    "project_urls": null,
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0b12759ee23959a1b015636fb1aa6e8694bb3c36b5998c94a325d0f0375e25d4",
                "md5": "586e5648547eacca855eda514b1ce30b",
                "sha256": "a1fbd0af58b9ad7b0640f77062162627b8116edf1a70b44b998d3fff1b0fbfc8"
            },
            "downloads": -1,
            "filename": "cyclarity_sdk-1.0.58-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "586e5648547eacca855eda514b1ce30b",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.10",
            "size": 20768,
            "upload_time": "2024-09-29T12:05:55",
            "upload_time_iso_8601": "2024-09-29T12:05:55.911864Z",
            "url": "https://files.pythonhosted.org/packages/0b/12/759ee23959a1b015636fb1aa6e8694bb3c36b5998c94a325d0f0375e25d4/cyclarity_sdk-1.0.58-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1f7d171713dfb184517ae854958b99e13abcae8dcb792520cad1cf9d05b4763b",
                "md5": "3e28d75a9e6cf6cf40f636446663d3a1",
                "sha256": "f6a1a8465379c56d7119810b02e14f76da162291aa99941528e2a80b1b8a8352"
            },
            "downloads": -1,
            "filename": "cyclarity_sdk-1.0.58.tar.gz",
            "has_sig": false,
            "md5_digest": "3e28d75a9e6cf6cf40f636446663d3a1",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.10",
            "size": 14629,
            "upload_time": "2024-09-29T12:05:56",
            "upload_time_iso_8601": "2024-09-29T12:05:56.879935Z",
            "url": "https://files.pythonhosted.org/packages/1f/7d/171713dfb184517ae854958b99e13abcae8dcb792520cad1cf9d05b4763b/cyclarity_sdk-1.0.58.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-09-29 12:05:56",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "cyclarity-sdk"
}
        
Elapsed time: 0.41752s