Skip to main content

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:

  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:

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.

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)

report_test_progress

percentage: int (expects a percentage , example above)

PTFinding

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'

Download files

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

Source Distribution

cyclarity_sdk-1.0.102.tar.gz (20.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cyclarity_sdk-1.0.102-py3-none-any.whl (29.3 kB view details)

Uploaded Python 3

File details

Details for the file cyclarity_sdk-1.0.102.tar.gz.

File metadata

  • Download URL: cyclarity_sdk-1.0.102.tar.gz
  • Upload date:
  • Size: 20.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.10.17 Linux/6.1.79

File hashes

Hashes for cyclarity_sdk-1.0.102.tar.gz
Algorithm Hash digest
SHA256 14b1b4c30332ff8ec76ee6dcc40ea937bc2ad84fa3d89e6ddc9170d657fc1482
MD5 5351f74406cbf83f6f0747d2ff767a30
BLAKE2b-256 ce8df22d6c8b02bf4b53abf277f7cafb199faf8e12ab2b5b3058f7c2c219f7a5

See more details on using hashes here.

File details

Details for the file cyclarity_sdk-1.0.102-py3-none-any.whl.

File metadata

  • Download URL: cyclarity_sdk-1.0.102-py3-none-any.whl
  • Upload date:
  • Size: 29.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.10.17 Linux/6.1.79

File hashes

Hashes for cyclarity_sdk-1.0.102-py3-none-any.whl
Algorithm Hash digest
SHA256 0edc656a01172c2c43a6599b1e001104bd2f920e84ced1f779fc697cf537225d
MD5 643ce6708ce32be932afe60fb2a46d9b
BLAKE2b-256 7ddf788576c9e4b79a34d9eecae8413e8b42a72529d8d0a26b34711445ceaee0

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

1.0.102 This release

2 files

1.0.101

2 files

1.0.100

2 files

1.0.99

2 files

1.0.98

2 files

1.0.97

2 files

1.0.96

2 files

1.0.93

2 files

1.0.92

2 files

1.0.91

2 files

1.0.89

2 files

1.0.88

2 files

1.0.87

2 files

1.0.86

2 files

1.0.85

2 files

1.0.84

2 files

1.0.83

2 files

1.0.82

2 files

1.0.81

2 files

1.0.80

2 files

1.0.79

2 files

1.0.77

2 files

1.0.75

2 files

1.0.74

2 files

1.0.73

2 files

1.0.72

2 files

1.0.71

2 files

1.0.70

2 files

1.0.69

2 files

1.0.68

2 files

1.0.67

2 files

1.0.66

2 files

1.0.65

2 files

1.0.64

2 files

1.0.63

2 files

1.0.62

2 files

1.0.61

2 files

1.0.58

2 files

1.0.57

2 files

1.0.56

2 files

1.0.55

2 files

1.0.54

2 files

1.0.53

2 files

1.0.52

2 files

1.0.51

2 files

1.0.50

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page