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.2.tar.gz (49.1 kB view details)

Uploaded Source

Built Distribution

sliver_py-0.0.2-py3-none-any.whl (49.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: sliver-py-0.0.2.tar.gz
  • Upload date:
  • Size: 49.1 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.2.tar.gz
Algorithm Hash digest
SHA256 e241823fe0ff9ad1140c392c4cac01e4a7d0978272e6eddd8f881af890e579b7
MD5 3b1b6d4ef276cba39030a16b587c82f2
BLAKE2b-256 8d473b5d03dab66475cce280d6c1e338e9ceba2c2e2f77de3dfb2916adad7a5b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: sliver_py-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 49.5 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 167f5e6483b2a3b77c018884c262fb70e903d0c07e09d8f5e93a33152a27b74c
MD5 74226d1e4de4990ea4d56f08a408ea55
BLAKE2b-256 d5ba7f94de2b33bd1844a0ea8a355f46a400a612ba7213295837dcfd6be27831

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