Metadata-Version: 2.1
Name: sliver-py
Version: 0.0.2
Summary: Sliver gRPC client library.
Home-page: https://github.com/moloch--/sliver-py
Author: moloch
Author-email: 875022+moloch--@users.noreply.github.com
License: UNKNOWN
Project-URL: Bug Tracker, https://github.com/moloch--/sliver-py/issues
Platform: UNKNOWN
Classifier: Programming Language :: Python :: 3
Requires-Python: >=3.6
Description-Content-Type: text/markdown
Requires-Dist: grpc
Requires-Dist: grpcio-tools

SliverPy
==========

SliverPy is a Python gRPC client library for [Sliver](https://github.com/BishopFox/sliver).


## Examples

#### List Sessions / Async List Sessions
```python
#!/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
```python
#!/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())
```


