Sliver gRPC client library.
Project description
SliverPy
SliverPy is a Python gRPC client library for Sliver.
Install
Install the package using pip:
pip3 install sliver-py
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
Release history Release notifications | RSS feed
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.3.tar.gz
(49.2 kB
view details)
Built Distribution
sliver_py-0.0.3-py3-none-any.whl
(49.5 kB
view details)
File details
Details for the file sliver-py-0.0.3.tar.gz
.
File metadata
- Download URL: sliver-py-0.0.3.tar.gz
- Upload date:
- Size: 49.2 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
Algorithm | Hash digest | |
---|---|---|
SHA256 | d1c9ca269b48fb43c691a55cfb90587eeda5a55861fbc843370655899d4a929f |
|
MD5 | 8f13448d639bfa55e3017a5b9d91eee9 |
|
BLAKE2b-256 | e82b977f0b67c8f82fdaa8c1dea6859017bf5146a5a0cca274fba96440529657 |
File details
Details for the file sliver_py-0.0.3-py3-none-any.whl
.
File metadata
- Download URL: sliver_py-0.0.3-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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6c09a75fe9373737fb95de342177ed10cec26122b42507c083781b0152893b4f |
|
MD5 | 1934ef798d27cd00b9a284ce8509285a |
|
BLAKE2b-256 | bc613bb9b90c88b179c84fe38f59473349455d5e396fafa55a823a25c9242873 |