Skip to main content

Sliver gRPC client library.

Project description

SliverPy

SliverPy is a Python gRPC client library for Sliver.

Examples

List Sessions / Async List Sessions

#!/usr/bin/env python3

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

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 = SliverAsyncClient(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, SliverAsyncClient

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 = SliverAsyncClient(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.1.tar.gz (55.5 kB view details)

Uploaded Source

Built Distribution

sliver_py-0.0.1-py3-none-any.whl (56.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: sliver-py-0.0.1.tar.gz
  • Upload date:
  • Size: 55.5 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.2

File hashes

Hashes for sliver-py-0.0.1.tar.gz
Algorithm Hash digest
SHA256 32a6d6c1a01de4f8ae42c5220346543da6054b81f16a662df43470321bd35b51
MD5 4d9eea2e4b6fce5f5a089d75c15ffe2e
BLAKE2b-256 a71629fea4b79d012d15b55875b85ff03a641c6ac4b32642e682242b0d61ba5c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: sliver_py-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 56.9 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.2

File hashes

Hashes for sliver_py-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 41bc55c63a2f1766cdbc7de307847373acbfce624f49d3b3f6d91700d0cfc5e7
MD5 af500eafc255cb9f697b3a558014a7da
BLAKE2b-256 202f74ed72b6d0b2b957fc5e6cef228ff778f3e84daa6647276a423fde820ff6

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