1.2.5 • Published 2 years ago

sliver-script v1.2.5

Weekly downloads
42
License
GPL-3.0-or-later
Repository
github
Last release
2 years ago

Sliver Script

Sliver-script is a TypeScript/JavaScript client library for Sliver, it can be used to automate any operator interaction with Sliver. Sliver-script uses existing Sliver client configuration files and connects to servers using gRPC over Mutual-TLS. It also provides RxJS abstractions for easy interactions with real-time components.

⚠️ Support for Sliver v1.5+ is a work in progress.

NPM Publish License: GPL v3

Install

Node v14 or later is required for this package, and it can be installed via npm:

npm install sliver-script

TypeScript Example

Basic

import { SliverClient, ParseConfigFile } from 'sliver-script'

(async function() {
    
    const config = await ParseConfigFile('./moloch_localhost.cfg')
    const client = new SliverClient(config)

    console.log(`Connecting to ${client.host()} ...`)
    await client.connect()

    const sessions = await client.sessions()
    console.log(sessions)

})()

Monitor Events in Real-time

import { SliverClient, ParseConfigFile } from 'sliver-script'

(async function() {

    const config = await ParseConfigFile('./moloch_localhost.cfg')

    const client = new SliverClient(config)
    await client.connect()
    client.event$.subscribe((event) => {
        console.log(event)
    })

})()

Automatically Interact with New Sessions

import { SliverClient, ParseConfigFile } from 'sliver-script'


(async function() {

    const config = await ParseConfigFile('moloch_localhost.cfg')
    const client = new SliverClient(config);
    await client.connect()

    console.log('Waiting for new sessions ...')
    client.session$.subscribe(async (event) => {
        console.log(`New session #${event.getSession().getId()}!`)
        const session = await client.interactWith(event.getSession())
        const ls = await session.ls()
        console.log(`Path: ${ls.getPath()}`)
        ls.getFilesList().forEach(file => {
            console.log(`Name: ${file.getName()} (Size: ${file.getSize()})`)
        })
    })

})()

JavaScript Example

const sliver = require('sliver-script')

(async function() { 

    const config = await sliver.ParseConfigFile('./moloch_localhost.cfg')
    const client = new sliver.SliverClient(config)
    await client.connect()

    console.log('Waiting for new sessions ...')

    client.session$.subscribe(async (event) => {

        console.log(`New session #${event.getSession().getId()}!`)

        const session = await client.interactWith(event.getSession())
        const ls = await session.ls()
        console.log(`Path: ${ls.getPath()}`)
        ls.getFilesList().forEach(file => {
            console.log(`Name: ${file.getName()} (Size: ${file.getSize()})`)
        })
        
    })

})()
1.2.5

2 years ago

1.2.4

2 years ago

1.2.0

2 years ago

1.2.3

2 years ago

1.2.2

2 years ago

1.2.1

2 years ago

1.1.1

2 years ago

1.1.0

2 years ago

1.1.3

2 years ago

1.1.2

2 years ago

1.0.39

3 years ago

1.0.38

3 years ago

1.0.37

3 years ago

1.0.36

3 years ago

1.0.35

3 years ago

1.0.34

3 years ago

1.0.33

3 years ago

1.0.32

3 years ago

1.0.31

3 years ago

1.0.30

3 years ago

1.0.29

3 years ago

1.0.28

3 years ago

1.0.27

3 years ago

1.0.26

3 years ago

1.0.25

3 years ago

1.0.24

3 years ago

1.0.23

3 years ago

1.0.22

3 years ago

1.0.21

3 years ago

1.0.20

4 years ago

1.0.19

4 years ago

1.0.18

4 years ago

1.0.17

4 years ago

1.0.16

4 years ago

1.0.15

4 years ago

1.0.14

4 years ago

1.0.12

4 years ago

1.0.11

4 years ago

1.0.9

4 years ago

1.0.8

4 years ago

1.0.7

4 years ago

1.0.10

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago