Skip to main content

Sliver gRPC client library.

Project description

SliverPy

SliverPy is a Python gRPC client library for Sliver. SliverPy can be used to automate any operator interaction with Sliver and connects to servers using gRPC over Mutual TLS (i.e., multiplayer) using Sliver client configuration files. For more details, please see the project documentation.

Not yet implemented:

  • website APIs
  • Realtime events / etc.

SliverPy Documentation Status License: GPL v3

Install

Install the package using pip, for best compatibility use Sliver Server v1.4.11 or later:

pip3 install sliver-py

Examples

List Sessions / Async List Sessions

#!/usr/bin/env python3

import os
import asyncio
from sliver import SliverClientConfig, SliverClient, AsyncSliverClient

CONFIG_DIR = os.path.join(os.path.expanduser("~"), ".sliver-client", "configs")
DEFAULT_CONFIG = os.path.join(CONFIG_DIR, "default.cfg")


def main():
    ''' Client example '''
    config = SliverClientConfig.parse_config_file(DEFAULT_CONFIG)
    client = SliverClient(config)
    client.connect()
    print('Sessions: %r' % client.sessions())


async def run():
    ''' Async client example '''
    config = SliverClientConfig.parse_config_file(DEFAULT_CONFIG)
    client = AsyncSliverClient(config)
    await client.connect()
    sessions = await client.sessions()
    print('[async] Sessions: %r' % sessions)

if __name__ == '__main__':
    main()
    asyncio.run(run())

Interact with Session

#!/usr/bin/env python3

import os
from sliver import SliverClientConfig, SliverClient, AsyncSliverClient

CONFIG_DIR = os.path.join(os.path.expanduser("~"), ".sliver-client", "configs")
DEFAULT_CONFIG = os.path.join(CONFIG_DIR, "default.cfg")


def main():
    ''' Client example '''
    config = SliverClientConfig.parse_config_file(DEFAULT_CONFIG)
    client = SliverClient(config)
    client.connect()
    sessions = client.sessions()
    if len(sessions):
        interact = client.interact(sessions[0].ID)
        print('Interacting with session %d' % interact.session_id)
        print('ls: %r' % interact.ls())

async def run():
    ''' Async client example '''
    config = SliverClientConfig.parse_config_file(DEFAULT_CONFIG)
    client = AsyncSliverClient(config)
    await client.connect()
    sessions = await client.sessions()
    if len(sessions):
        interact = await client.interact(sessions[0].ID)
        print('[async] Interacting with session %d' % interact.session_id)
        ls = await interact.ls()
        print('[async] ls: %r' % ls)

if __name__ == '__main__':
    main()
    asyncio.run(run())

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

sliver-py-0.0.5.tar.gz (56.7 kB view details)

Uploaded Source

Built Distribution

sliver_py-0.0.5-py3-none-any.whl (57.7 kB view details)

Uploaded Python 3

File details

Details for the file sliver-py-0.0.5.tar.gz.

File metadata

  • Download URL: sliver-py-0.0.5.tar.gz
  • Upload date:
  • Size: 56.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4

File hashes

Hashes for sliver-py-0.0.5.tar.gz
Algorithm Hash digest
SHA256 8286750f24aa89f1f741fcb7df15b1ac5ea9d7741e010dbf52e79184f8eba74a
MD5 a6dfc3fefcc3ae7000592a63aafead79
BLAKE2b-256 1d05202cc7ca8b695a5a25061bef2233eac219e951d509129b7ff6b5f800052d

See more details on using hashes here.

File details

Details for the file sliver_py-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: sliver_py-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 57.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4

File hashes

Hashes for sliver_py-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 2060eea58f7977673a79c8ee2727e6b7f0cf7fc39003b5cbde3a80421f206012
MD5 ef0a0c35be5d2ef397273f51442dd53e
BLAKE2b-256 7f3f5d925fc8de605b35671d0926b06be898939a33e02f139ab5723cab0eb99e

See more details on using hashes here.

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