wip updating examples

This commit is contained in:
moloch--
2022-09-05 11:06:40 -07:00
parent ae447c3ba4
commit 79185d2e32
7 changed files with 477 additions and 591 deletions
+415 -578
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -9,6 +9,6 @@
"author": "",
"license": "ISC",
"dependencies": {
"sliver-script": "^1.0.32"
"sliver-script": "^1.2.5"
}
}
+5 -8
View File
@@ -1,13 +1,11 @@
import { SliverClient } from '../../src/client'
import { ParseConfigFile } from '../../src/config'
//import { SliverClient } from '../../src/client'
//import { ParseConfigFile } from '../../src/config'
// Use this import when using the NPM module, and remove the relative imports above:
// import { SliverClient, ParseConfigFile } from 'sliver-script';
import { SliverClient, ParseConfigFile } from 'sliver-script';
import * as os from 'os'
import * as path from 'path'
import * as tls from 'tls'
import * as fs from 'fs'
const DEFAULT_CONFIG_PATH = path.join(os.homedir(), '.sliver-client', 'configs', 'default.cfg')
@@ -21,13 +19,12 @@ const SLIVER_CONFIG_FILE = process.env['SLIVER_CONFIG_FILE'] || DEFAULT_CONFIG_P
console.log(`Connecting to ${config.lhost} ...`)
try {
await client.connect()
await client.connect();
} catch (err) {
console.error(err)
process.exit(9)
}
const sessions = await client.sessions()
if (!sessions) {
console.error(`No sessions found`)
@@ -35,7 +32,7 @@ const SLIVER_CONFIG_FILE = process.env['SLIVER_CONFIG_FILE'] || DEFAULT_CONFIG_P
}
console.log(sessions);
if (0 < sessions.length) {
const interact = await client.interactWith(sessions[0])
const interact = await client.interactSession(sessions[0].ID)
const shell = await interact.shell('/bin/bash', true)
shell.stdout.subscribe(data => {
process.stdout.write(data)
+1 -1
Submodule sliver updated: 68b129acaa...d94c596a1e
+2 -3
View File
@@ -482,6 +482,7 @@ export class InteractiveSession extends BaseCommands {
}
const stdout = new Observable<Buffer>(producer => {
this._tunnelStream.on('data', (tunnelData: sliverpb.TunnelData) => {
console.log(tunnelData);
if (tunnelData.TunnelID !== tunnelId) {
return; // Data is from another tunnel
}
@@ -493,9 +494,7 @@ export class InteractiveSession extends BaseCommands {
}
producer.complete();
} else {
if (tunnelData?.Data.length) {
producer.next(Buffer.from(tunnelData.Data));
}
producer.next(Buffer.from(tunnelData.Data));
}
});
});
+23
View File
@@ -409,6 +409,7 @@ export namespace commonpb {
Ppid?: number;
Executable?: string;
Owner?: string;
Architecture?: string;
SessionID?: number;
CmdLine?: string[];
}) {
@@ -427,6 +428,9 @@ export namespace commonpb {
if ("Owner" in data && data.Owner != undefined) {
this.Owner = data.Owner;
}
if ("Architecture" in data && data.Architecture != undefined) {
this.Architecture = data.Architecture;
}
if ("SessionID" in data && data.SessionID != undefined) {
this.SessionID = data.SessionID;
}
@@ -459,6 +463,12 @@ export namespace commonpb {
set Owner(value: string) {
pb_1.Message.setField(this, 4, value);
}
get Architecture() {
return pb_1.Message.getField(this, 7) as string;
}
set Architecture(value: string) {
pb_1.Message.setField(this, 7, value);
}
get SessionID() {
return pb_1.Message.getField(this, 5) as number;
}
@@ -476,6 +486,7 @@ export namespace commonpb {
Ppid?: number;
Executable?: string;
Owner?: string;
Architecture?: string;
SessionID?: number;
CmdLine?: string[];
}) {
@@ -492,6 +503,9 @@ export namespace commonpb {
if (data.Owner != null) {
message.Owner = data.Owner;
}
if (data.Architecture != null) {
message.Architecture = data.Architecture;
}
if (data.SessionID != null) {
message.SessionID = data.SessionID;
}
@@ -506,6 +520,7 @@ export namespace commonpb {
Ppid?: number;
Executable?: string;
Owner?: string;
Architecture?: string;
SessionID?: number;
CmdLine?: string[];
} = {};
@@ -521,6 +536,9 @@ export namespace commonpb {
if (this.Owner != null) {
data.Owner = this.Owner;
}
if (this.Architecture != null) {
data.Architecture = this.Architecture;
}
if (this.SessionID != null) {
data.SessionID = this.SessionID;
}
@@ -541,6 +559,8 @@ export namespace commonpb {
writer.writeString(3, this.Executable);
if (typeof this.Owner === "string" && this.Owner.length)
writer.writeString(4, this.Owner);
if (typeof this.Architecture === "string" && this.Architecture.length)
writer.writeString(7, this.Architecture);
if (this.SessionID !== undefined)
writer.writeInt32(5, this.SessionID);
if (this.CmdLine !== undefined)
@@ -566,6 +586,9 @@ export namespace commonpb {
case 4:
message.Owner = reader.readString();
break;
case 7:
message.Architecture = reader.readString();
break;
case 5:
message.SessionID = reader.readInt32();
break;
+30
View File
@@ -917,6 +917,7 @@ proto.commonpb.Process.toObject = function(includeInstance, msg) {
ppid: jspb.Message.getFieldWithDefault(msg, 2, 0),
executable: jspb.Message.getFieldWithDefault(msg, 3, ""),
owner: jspb.Message.getFieldWithDefault(msg, 4, ""),
architecture: jspb.Message.getFieldWithDefault(msg, 7, ""),
sessionid: jspb.Message.getFieldWithDefault(msg, 5, 0),
cmdlineList: (f = jspb.Message.getRepeatedField(msg, 6)) == null ? undefined : f
};
@@ -971,6 +972,10 @@ proto.commonpb.Process.deserializeBinaryFromReader = function(msg, reader) {
var value = /** @type {string} */ (reader.readString());
msg.setOwner(value);
break;
case 7:
var value = /** @type {string} */ (reader.readString());
msg.setArchitecture(value);
break;
case 5:
var value = /** @type {number} */ (reader.readInt32());
msg.setSessionid(value);
@@ -1036,6 +1041,13 @@ proto.commonpb.Process.serializeBinaryToWriter = function(message, writer) {
f
);
}
f = message.getArchitecture();
if (f.length > 0) {
writer.writeString(
7,
f
);
}
f = message.getSessionid();
if (f !== 0) {
writer.writeInt32(
@@ -1125,6 +1137,24 @@ proto.commonpb.Process.prototype.setOwner = function(value) {
};
/**
* optional string Architecture = 7;
* @return {string}
*/
proto.commonpb.Process.prototype.getArchitecture = function() {
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 7, ""));
};
/**
* @param {string} value
* @return {!proto.commonpb.Process} returns this
*/
proto.commonpb.Process.prototype.setArchitecture = function(value) {
return jspb.Message.setProto3StringField(this, 7, value);
};
/**
* optional int32 SessionID = 5;
* @return {number}