laceworksdk


Namelaceworksdk JSON
Version 4.0.0 PyPI version JSON
download
home_pagehttps://github.com/lacework/python-sdk
SummaryCommunity-developed Python SDK for the Lacework APIs
upload_time2024-02-14 16:54:55
maintainerTim MacDonald
docs_urlNone
authorLacework
requires_python>=3.8,<4
licenseMIT
keywords lacework api sdk python
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <img src="https://techally-content.s3-us-west-1.amazonaws.com/public-content/lacework_logo_full.png" width="600">

# Lacework Python SDK

![Build Status](https://github.com/lacework/python-sdk/actions/workflows/python-test.yml/badge.svg)
[![Downloads](https://pepy.tech/badge/laceworksdk)](https://pepy.tech/project/laceworksdk)

**laceworksdk** is a community developed Python library for interacting with the Lacework APIs.

The purpose of this library is to simplify the common tasks required for interacting with the Lacework API, and allow
users write simple code to automate tasks related to their Lacework instance(s). From data retrieval to configuration,
this library aims to expose all publicly available APIs. For example, the following code would authenticate,
fetch events, fetch host vulnerabilities, and fetch container vulnerabilities. The latest version of the SDK supports
expressive searches as enabled by v2 of the Lacework APIs.

For more information read the [documentation](https://lacework.github.io/python-sdk/)
```python
from laceworksdk import LaceworkClient

lw = LaceworkClient() # This would leverage your default Lacework CLI profile.
lw = LaceworkClient(account="ACCOUNT",
                    subaccount="SUBACCOUNT",
                    api_key="API KEY",
                    api_secret="API SECRET")

events = lw.events.search(json={
  "timeFilter": {
    "startTime": start_time,
    "endTime": end_time
  }
})

host_vulns = lw.vulnerabilities.hosts.search(json={
    "timeFilter": {
        "startTime": start_time,
        "endTime": end_time
    }
})

container_vulns = lw.vulnerabilities.containers.search(json={
    "timeFilter": {
        "startTime": start_time,
        "endTime": end_time
    },
    "filters": [
        {
            "field": "imageId",
            "expression": "eq",
            "value": "sha256:657922eb2d64b0a34fe7339f8b48afb9f2f44635d7d6eaa92af69591d29b3330"
        }
    ]
})
```

## Requirements

- Python 3.8 or higher
- Lacework API Credentials
  - Account Name
  - API Key
  - API Secret

## How-To

The following information is required to instantiate a LaceworkClient instance:

- `account`: The Lacework account/organization domain. (`xxxxx`.lacework.net)
- `api_key`: The API Key that was generated from the Lacework UI/API.
- `api_secret`: The API Secret that was generated from the Lacework UI/API.

Optionally, you can also set a Lacework Sub-Account using the `subaccount` parameter.

To generate API credentials, you'll need to do the following in Lacework:

1.  In the Lacework web interface, go to Settings -> API Keys
2.  Create a new API Key and download information the credentials.

## Environment Variables

If you wish to configure the LaceworkClient instance using environment variables, this module honors the same
variables used by the Lacework CLI. The `account`, `subaccount`, `api_key`, `api_secret`, and `profile` parameters
can all be configured as specified below.

| Environment Variable | Description                                                          | Required |
| -------------------- | -------------------------------------------------------------------- | :------: |
| `LW_PROFILE`         | Lacework CLI profile to use (configured at ~/.lacework.toml)         |    N     |
| `LW_ACCOUNT`         | Lacework account/organization domain (i.e. `<account>`.lacework.net) |    Y     |
| `LW_SUBACCOUNT`      | Lacework sub-account                                                 |    N     |
| `LW_API_KEY`         | Lacework API Access Key                                              |    Y     |
| `LW_API_SECRET`      | Lacework API Access Secret                                           |    Y     |

## Installation

Installing and upgrading `laceworksdk` is easy:

**Install via PIP**

`$ pip install laceworksdk`

**Upgrading to the latest Version**

`$ pip install laceworksdk --upgrade`

## Examples

Are you looking for some sample scripts? Check out the [examples](examples/) folder!

### [Contributing](CONTRIBUTING.md)

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/lacework/python-sdk",
    "name": "laceworksdk",
    "maintainer": "Tim MacDonald",
    "docs_url": null,
    "requires_python": ">=3.8,<4",
    "maintainer_email": "tim.macdonald@lacework.net",
    "keywords": "lacework,api,sdk,python",
    "author": "Lacework",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/52/75/99ebfdeda0cd54b36f5b613bdd2c7f48d598fddeed46ce9e875145c1397e/laceworksdk-4.0.0.tar.gz",
    "platform": null,
    "description": "<img src=\"https://techally-content.s3-us-west-1.amazonaws.com/public-content/lacework_logo_full.png\" width=\"600\">\n\n# Lacework Python SDK\n\n![Build Status](https://github.com/lacework/python-sdk/actions/workflows/python-test.yml/badge.svg)\n[![Downloads](https://pepy.tech/badge/laceworksdk)](https://pepy.tech/project/laceworksdk)\n\n**laceworksdk** is a community developed Python library for interacting with the Lacework APIs.\n\nThe purpose of this library is to simplify the common tasks required for interacting with the Lacework API, and allow\nusers write simple code to automate tasks related to their Lacework instance(s). From data retrieval to configuration,\nthis library aims to expose all publicly available APIs. For example, the following code would authenticate,\nfetch events, fetch host vulnerabilities, and fetch container vulnerabilities. The latest version of the SDK supports\nexpressive searches as enabled by v2 of the Lacework APIs.\n\nFor more information read the [documentation](https://lacework.github.io/python-sdk/)\n```python\nfrom laceworksdk import LaceworkClient\n\nlw = LaceworkClient() # This would leverage your default Lacework CLI profile.\nlw = LaceworkClient(account=\"ACCOUNT\",\n                    subaccount=\"SUBACCOUNT\",\n                    api_key=\"API KEY\",\n                    api_secret=\"API SECRET\")\n\nevents = lw.events.search(json={\n  \"timeFilter\": {\n    \"startTime\": start_time,\n    \"endTime\": end_time\n  }\n})\n\nhost_vulns = lw.vulnerabilities.hosts.search(json={\n    \"timeFilter\": {\n        \"startTime\": start_time,\n        \"endTime\": end_time\n    }\n})\n\ncontainer_vulns = lw.vulnerabilities.containers.search(json={\n    \"timeFilter\": {\n        \"startTime\": start_time,\n        \"endTime\": end_time\n    },\n    \"filters\": [\n        {\n            \"field\": \"imageId\",\n            \"expression\": \"eq\",\n            \"value\": \"sha256:657922eb2d64b0a34fe7339f8b48afb9f2f44635d7d6eaa92af69591d29b3330\"\n        }\n    ]\n})\n```\n\n## Requirements\n\n- Python 3.8 or higher\n- Lacework API Credentials\n  - Account Name\n  - API Key\n  - API Secret\n\n## How-To\n\nThe following information is required to instantiate a LaceworkClient instance:\n\n- `account`: The Lacework account/organization domain. (`xxxxx`.lacework.net)\n- `api_key`: The API Key that was generated from the Lacework UI/API.\n- `api_secret`: The API Secret that was generated from the Lacework UI/API.\n\nOptionally, you can also set a Lacework Sub-Account using the `subaccount` parameter.\n\nTo generate API credentials, you'll need to do the following in Lacework:\n\n1.  In the Lacework web interface, go to Settings -> API Keys\n2.  Create a new API Key and download information the credentials.\n\n## Environment Variables\n\nIf you wish to configure the LaceworkClient instance using environment variables, this module honors the same\nvariables used by the Lacework CLI. The `account`, `subaccount`, `api_key`, `api_secret`, and `profile` parameters\ncan all be configured as specified below.\n\n| Environment Variable | Description                                                          | Required |\n| -------------------- | -------------------------------------------------------------------- | :------: |\n| `LW_PROFILE`         | Lacework CLI profile to use (configured at ~/.lacework.toml)         |    N     |\n| `LW_ACCOUNT`         | Lacework account/organization domain (i.e. `<account>`.lacework.net) |    Y     |\n| `LW_SUBACCOUNT`      | Lacework sub-account                                                 |    N     |\n| `LW_API_KEY`         | Lacework API Access Key                                              |    Y     |\n| `LW_API_SECRET`      | Lacework API Access Secret                                           |    Y     |\n\n## Installation\n\nInstalling and upgrading `laceworksdk` is easy:\n\n**Install via PIP**\n\n`$ pip install laceworksdk`\n\n**Upgrading to the latest Version**\n\n`$ pip install laceworksdk --upgrade`\n\n## Examples\n\nAre you looking for some sample scripts? Check out the [examples](examples/) folder!\n\n### [Contributing](CONTRIBUTING.md)\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Community-developed Python SDK for the Lacework APIs",
    "version": "4.0.0",
    "project_urls": {
        "Homepage": "https://github.com/lacework/python-sdk",
        "Repository": "https://github.com/lacework/python-sdk"
    },
    "split_keywords": [
        "lacework",
        "api",
        "sdk",
        "python"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "907cc5170aebdd82ef25345106c01bb67addb99477da26c50b535e587d22c80a",
                "md5": "3b5938a965be3935e52f15083a882c14",
                "sha256": "96a0b33679231eee646fccc545d3bd9a9402fbd47f24e293f12499a3ab1d9f87"
            },
            "downloads": -1,
            "filename": "laceworksdk-4.0.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "3b5938a965be3935e52f15083a882c14",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8,<4",
            "size": 56735,
            "upload_time": "2024-02-14T16:54:54",
            "upload_time_iso_8601": "2024-02-14T16:54:54.346399Z",
            "url": "https://files.pythonhosted.org/packages/90/7c/c5170aebdd82ef25345106c01bb67addb99477da26c50b535e587d22c80a/laceworksdk-4.0.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "527599ebfdeda0cd54b36f5b613bdd2c7f48d598fddeed46ce9e875145c1397e",
                "md5": "6026c1e3e2e2c4485cb9db5656eeee66",
                "sha256": "492607ed839fdd15c73df6cf6d2fc84888f7a099cc06084a62df4f818f3867b3"
            },
            "downloads": -1,
            "filename": "laceworksdk-4.0.0.tar.gz",
            "has_sig": false,
            "md5_digest": "6026c1e3e2e2c4485cb9db5656eeee66",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8,<4",
            "size": 33118,
            "upload_time": "2024-02-14T16:54:55",
            "upload_time_iso_8601": "2024-02-14T16:54:55.824817Z",
            "url": "https://files.pythonhosted.org/packages/52/75/99ebfdeda0cd54b36f5b613bdd2c7f48d598fddeed46ce9e875145c1397e/laceworksdk-4.0.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-02-14 16:54:55",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "lacework",
    "github_project": "python-sdk",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "laceworksdk"
}
        
Elapsed time: 0.31858s