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.4.tar.gz
(55.5 kB
view hashes)
Built Distribution
sliver_py-0.0.4-py3-none-any.whl
(56.9 kB
view hashes)
Close
Hashes for sliver_py-0.0.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b04e0048b2a0e0c0e5bc1d340bf45f13ffa70a9b9b934ed2e516b51bd8cd3645 |
|
MD5 | 7804da124dec6feb32d0207d7b83e1d2 |
|
BLAKE2b-256 | 0f650d47dd069c59d921fd67e0eeb7c65a9d84caaf2cc5d60c8ee0e54f8453e1 |