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.
Node v14 or later is required for this package, and it can be installed via npm:
npm install sliver-script
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)
})()
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)
})
})()
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()})`)
})
})
})()
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()})`)
})
})
})()