Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Teamserver/teamclient Sliver model #1359

Closed
wants to merge 130 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
130 commits
Select commit Hold shift + click to select a range
44ceccf
Fix some newlines printed or not
maxlandon Jun 7, 2023
bce0c8d
Add a flags package, in which we store some command utility functions to
maxlandon Jun 7, 2023
ec88f9b
Start splitting commands declarations
maxlandon Jun 7, 2023
f370e96
Finish splitting server commands in their files
maxlandon Jun 20, 2023
e23f040
Split sliver commands in their files
maxlandon Jun 22, 2023
2da61c1
Finish splits. Compiles
maxlandon Jun 22, 2023
51473ec
Add many missing completers
maxlandon Jun 22, 2023
ba34df3
Merge remote-tracking branch 'BishopFox/master' into beacon-commands
maxlandon Jul 19, 2023
c3881b2
Successful use of teamserver/teamclient on first test
maxlandon Jul 19, 2023
9a51d32
New vendor deps + renaming
maxlandon Jul 19, 2023
8cf8e66
A base sliver-server/client compiling with team library
maxlandon Jul 19, 2023
e7b6f5e
The teamserver/teamclient model now works mostly as intended:
maxlandon Jul 20, 2023
2492669
Big refactoring of the client/server console entry/creation code
maxlandon Jul 20, 2023
f3e02c0
Comment server-binary entry and refactor other entries
maxlandon Jul 21, 2023
6e6b774
Comment client entrypoints, remove useless files
maxlandon Jul 21, 2023
1711475
Clean client console a bit
maxlandon Jul 22, 2023
334f8dd
Simplify pre-runners binding
maxlandon Jul 22, 2023
bb59e1e
Add gRPC teamserver/client backend, no code removed yet.
maxlandon Jul 22, 2023
617b5b7
Start removing/cleaning up unused code with teamserver.
maxlandon Jul 23, 2023
139b44d
Keep removing old code not needed
maxlandon Jul 23, 2023
cb8d01e
End of previous commit
maxlandon Jul 23, 2023
e39db64
Remove related operators commands and RPC stub
maxlandon Jul 23, 2023
5583b65
Remove client configs code
maxlandon Jul 23, 2023
d31592b
Go fmt
maxlandon Jul 23, 2023
47a280c
Fix beacon compile flags + debug level for client asciicast
maxlandon Jul 23, 2023
163c11b
Fmt
maxlandon Jul 23, 2023
be65f1c
Filter portfwd/socks commands out of beacons
maxlandon Jul 23, 2023
d5c1daa
Simplify binding commands with groups
maxlandon Jul 23, 2023
fb8e0de
Merge branch 'beacon-commands' into teamclient
maxlandon Jul 23, 2023
af1e52b
Revert "Go fmt"
maxlandon Jul 23, 2023
2ecb88d
Merge back beacon-commands client code
maxlandon Jul 23, 2023
e57f8e8
Simplify binding server-binary-only commands
maxlandon Jul 23, 2023
c9cac60
Add completion for all builder flags
maxlandon Jul 23, 2023
b4f49ca
Update team module dep
maxlandon Jul 23, 2023
0cbdadb
Don't stream client output when completing
maxlandon Jul 24, 2023
cc48d60
Test caching completions. Much better
maxlandon Jul 24, 2023
0c9f918
Fix of all client logstreams, optimized for completion
maxlandon Jul 24, 2023
e3d2026
Find a way more efficient to pre-connect in completions
maxlandon Jul 24, 2023
4fa2c7a
Specify socks/portforwarders IDs as arguments
maxlandon Jul 25, 2023
c793aa5
Fix dymanic sliver target parsing/applying
maxlandon Jul 26, 2023
e0e1992
Cache armory completions to disk
maxlandon Jul 26, 2023
eee1dc2
Simplify sliver implant command tree entry
maxlandon Jul 26, 2023
5d60a3c
Add active target method to filter a command tree
maxlandon Jul 26, 2023
1404c23
Remove dependency buildinfo embeddings
maxlandon Jul 26, 2023
7a2fe67
Add per-implant history stream and commands for query.
maxlandon Jul 27, 2023
c17c6d0
Fix command history not being saved in implant CLI
maxlandon Jul 27, 2023
984b334
Unwrap all gRPC errors returned by calls in commands
maxlandon Jul 27, 2023
8dd3196
Refactor C2 job control command tree & dispatch
maxlandon Jul 27, 2023
1ab9ebb
Add a small cache for Metasploit data:
maxlandon Jul 28, 2023
41fbd48
And deactivate it since we can't really choose payloads
maxlandon Jul 28, 2023
a279ee1
Clean
maxlandon Jul 28, 2023
c535491
Use comp cache duraction groups
maxlandon Jul 28, 2023
63a9edf
Cleanup completion pre-run setup
maxlandon Jul 28, 2023
e795203
Cleanup/rewrite comments for modified transport stack
maxlandon Jul 28, 2023
ecdbf6e
Further cleanup in teamserver transport
maxlandon Jul 28, 2023
1686af1
Fix some log errors
maxlandon Jul 29, 2023
9565314
Cleanup and tidy server transport package.
maxlandon Jul 29, 2023
50d5301
Commit dependencies (useless)
maxlandon Jul 29, 2023
eb127ea
Cleanup and tidy client console/transport code
maxlandon Jul 29, 2023
d5d24e6
Rename a completion pre-runner
maxlandon Jul 29, 2023
15a01fc
Ultimate refactoring/tidying of sliver entrypoints
maxlandon Jul 29, 2023
96585c1
Comment console command yielder
maxlandon Jul 29, 2023
9d76975
Move console connection funcs
maxlandon Jul 29, 2023
6debdb8
Fixes/tweaks to final command output printing
maxlandon Jul 30, 2023
2af630e
Keep tidying
maxlandon Jul 30, 2023
da42eab
Cleanup
maxlandon Jul 30, 2023
27af882
Most of the transition to team/server & team/client is done.
maxlandon Jul 30, 2023
0a22f66
Update teamserver library dependency
maxlandon Jul 30, 2023
a285f40
Switch some commands and completers to multiple args
maxlandon Aug 5, 2023
a995c14
Fixes during presentations
maxlandon Aug 7, 2023
88fc7b6
Update completion engine version
maxlandon Aug 8, 2023
678faac
Cleanups and fixes in command display groups
maxlandon Aug 9, 2023
ed12971
Fixes
maxlandon Aug 10, 2023
87d26f8
Handle blocking operations in CLI
maxlandon Aug 10, 2023
f49fe4b
Move reactions loading to console entry command
maxlandon Aug 10, 2023
2559942
Correctly filter commands even in CLI
maxlandon Aug 10, 2023
0b9cea4
Cleaner interrupts in all menus
maxlandon Aug 10, 2023
0e6c859
Ensure "task sent" is printed before result.
maxlandon Aug 10, 2023
ac04f6d
Fix help completion for implant subtree
maxlandon Aug 10, 2023
83c3565
Fix teamserver not using the db.Client
maxlandon Aug 10, 2023
c7f5f48
Port all beacon commands to Cli usage compatibility
maxlandon Aug 10, 2023
82d0c9c
Update console/completion dependencies
maxlandon Aug 10, 2023
916284c
Fix correct hiding and erroring of unavailable commands
maxlandon Aug 10, 2023
fa61c19
Update deps + few fixes
maxlandon Aug 10, 2023
f256621
Rename flag/comp util functions
maxlandon Aug 10, 2023
16733dd
Update go 1.21
maxlandon Aug 10, 2023
735c233
Update console/readline dependency to latest version.
maxlandon Aug 17, 2023
41aa386
Update following dependencies
maxlandon Aug 17, 2023
3355627
Mostly display fixes and enhancements
maxlandon Aug 17, 2023
3415cce
Fixes to logging
maxlandon Aug 17, 2023
c0810ee
Update team dependency with first release
maxlandon Aug 17, 2023
90760ec
Update vendor dependencies
maxlandon Aug 17, 2023
3d2a337
Rename/cleanup command utility binders/generators
maxlandon Aug 18, 2023
fad8d23
Split/restructure console code into files, check comments everywhere
maxlandon Aug 18, 2023
64628c5
Comment remaining client code
maxlandon Aug 18, 2023
8040e5f
Cleanup, slicker API, fixes and optimizations
maxlandon Aug 18, 2023
6e685e9
Rename some function better, update dependencies with fix.
maxlandon Aug 18, 2023
efb1b6d
Finish builder client port to teamclient
maxlandon Aug 18, 2023
532bfaf
Test and fix builders with a simple teamclient backend.
maxlandon Aug 18, 2023
8b56c5b
Fix mistake, fortunately
maxlandon Aug 18, 2023
7ae0eee
Remove most calls to panic in client (where possible and safe)
maxlandon Aug 18, 2023
67a6e3b
Fixes
maxlandon Aug 18, 2023
ab0755b
Implement task-canceled for clients to unblock
maxlandon Aug 18, 2023
c4dd651
Better wrapping for all tables
maxlandon Aug 18, 2023
06005d9
Fix stupid Tailscale compilation issue and keep last commits' work
maxlandon Aug 19, 2023
85cf086
Update console dependency with fixes
maxlandon Aug 19, 2023
84779ea
Hide some commands in CLI
maxlandon Aug 26, 2023
a9f47db
Merge remote-tracking branch 'BishopFox/master' into teamclient
maxlandon Aug 26, 2023
ec6c545
fix kill for sessions
rkervella Aug 8, 2023
89cc659
Fix status when killing session
maxlandon Aug 26, 2023
0f27771
Don't add version to offline commands
maxlandon Aug 26, 2023
287a48b
Update readline version with fixes
maxlandon Aug 27, 2023
08bf40b
Merge remote-tracking branch 'BishopFox/master' into teamclient
maxlandon Nov 28, 2023
08d26e9
Fix all merge stuff, compiles
maxlandon Nov 28, 2023
fd29866
Re-add all newly implemented commands
maxlandon Nov 28, 2023
2f6f675
Update carapace completion dependency
maxlandon Nov 29, 2023
bcebf21
Update console/dependencies dependencies to latest versions
maxlandon Dec 14, 2023
4437cc5
Merge remote-tracking branch 'BishopFox/master' into teamclient
maxlandon Dec 14, 2023
f0dbb75
Remove empty files
maxlandon Dec 16, 2023
05647d0
Merge remote-tracking branch 'BishopFox/master' into teamclient
maxlandon Dec 16, 2023
4e64b1d
Update team library dependency version
maxlandon Dec 25, 2023
c2afd3f
Fixing an issue where C2 URLs are duplicated every time a profile is …
RafBishopFox Dec 22, 2023
3636244
multimanifest extension support
C-Sto Aug 31, 2023
51498f3
revise manifest schema
C-Sto Sep 30, 2023
181826d
Update extension commands per C-Sto code
maxlandon Dec 25, 2023
f512db9
Menu better
maxlandon Dec 25, 2023
9168b11
use bof arg packer for extensions
C-Sto Oct 7, 2023
742eacf
Update docs latest
maxlandon Dec 25, 2023
4dbb9c7
Make vendor dir identical to master, then update console deps
maxlandon Dec 25, 2023
14b0bfb
Add commented out permissions middleware builder/crack
maxlandon Dec 25, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
6 changes: 3 additions & 3 deletions client/assets/aliases.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,20 @@ const (
AliasesDirName = "aliases"
)

// GetAliasesDir - Returns the path to the config dir
// GetAliasesDir - Returns the path to the config dir.
func GetAliasesDir() string {
rootDir, _ := filepath.Abs(GetRootAppDir())
dir := filepath.Join(rootDir, AliasesDirName)
if _, err := os.Stat(dir); os.IsNotExist(err) {
err = os.MkdirAll(dir, 0700)
err = os.MkdirAll(dir, 0o700)
if err != nil {
log.Fatal(err)
}
}
return dir
}

// GetInstalledAliasManifests - Returns a list of installed alias manifests
// GetInstalledAliasManifests - Returns a list of installed alias manifests.
func GetInstalledAliasManifests() []string {
aliasDir := GetAliasesDir()
aliasDirContent, err := os.ReadDir(aliasDir)
Expand Down
8 changes: 4 additions & 4 deletions client/assets/armories.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ const (
)

var (
// DefaultArmoryPublicKey - The default public key for the armory
// DefaultArmoryPublicKey - The default public key for the armory.
DefaultArmoryPublicKey string
// DefaultArmoryRepoURL - The default repo url for the armory
// DefaultArmoryRepoURL - The default repo url for the armory.
DefaultArmoryRepoURL string

defaultArmoryConfig = &ArmoryConfig{
Expand All @@ -42,15 +42,15 @@ var (
}
)

// ArmoryConfig - The armory config file
// ArmoryConfig - The armory config file.
type ArmoryConfig struct {
PublicKey string `json:"public_key"`
RepoURL string `json:"repo_url"`
Authorization string `json:"authorization"`
AuthorizationCmd string `json:"authorization_cmd"`
}

// GetArmoriesConfig - The parsed armory config file
// GetArmoriesConfig - The parsed armory config file.
func GetArmoriesConfig() []*ArmoryConfig {
armoryConfigPath := filepath.Join(GetRootAppDir(), armoryConfigFileName)
if _, err := os.Stat(armoryConfigPath); os.IsNotExist(err) {
Expand Down
18 changes: 9 additions & 9 deletions client/assets/assets.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,42 +30,42 @@ import (
)

const (
// SliverClientDirName - Directory storing all of the client configs/logs
// SliverClientDirName - Directory storing all of the client configs/logs.
SliverClientDirName = ".sliver-client"

versionFileName = "version"
)

// GetRootAppDir - Get the Sliver app dir ~/.sliver-client/
// GetRootAppDir - Get the Sliver app dir ~/.sliver-client/.
func GetRootAppDir() string {
user, _ := user.Current()
dir := filepath.Join(user.HomeDir, SliverClientDirName)
if _, err := os.Stat(dir); os.IsNotExist(err) {
err = os.MkdirAll(dir, 0700)
err = os.MkdirAll(dir, 0o700)
if err != nil {
log.Fatal(err)
}
}
return dir
}

// GetClientLogsDir - Get the Sliver client logs dir ~/.sliver-client/logs/
// GetClientLogsDir - Get the Sliver client logs dir ~/.sliver-client/logs/.
func GetClientLogsDir() string {
logsDir := filepath.Join(GetRootAppDir(), "logs")
if _, err := os.Stat(logsDir); os.IsNotExist(err) {
err = os.MkdirAll(logsDir, 0700)
err = os.MkdirAll(logsDir, 0o700)
if err != nil {
log.Fatal(err)
}
}
return logsDir
}

// GetConsoleLogsDir - Get the Sliver client console logs dir ~/.sliver-client/logs/console/
// GetConsoleLogsDir - Get the Sliver client console logs dir ~/.sliver-client/logs/console/.
func GetConsoleLogsDir() string {
consoleLogsDir := filepath.Join(GetClientLogsDir(), "console")
if _, err := os.Stat(consoleLogsDir); os.IsNotExist(err) {
err = os.MkdirAll(consoleLogsDir, 0700)
err = os.MkdirAll(consoleLogsDir, 0o700)
if err != nil {
log.Fatal(err)
}
Expand All @@ -86,10 +86,10 @@ func saveAssetVersion(appDir string) {
versionFilePath := filepath.Join(appDir, versionFileName)
fVer, _ := os.Create(versionFilePath)
defer fVer.Close()
fVer.Write([]byte(ver.GitCommit))
fVer.WriteString(ver.GitCommit)
}

// Setup - Extract or create local assets
// Setup - Extract or create local assets.
func Setup(force bool, echo bool) {
appDir := GetRootAppDir()
localVer := assetVersion()
Expand Down
123 changes: 0 additions & 123 deletions client/assets/config.go

This file was deleted.

8 changes: 4 additions & 4 deletions client/assets/extensions.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,24 +25,24 @@ import (
)

const (
// ExtensionsDirName - Directory storing the client side extensions
// ExtensionsDirName - Directory storing the client side extensions.
ExtensionsDirName = "extensions"
)

// GetExtensionsDir - Get the Sliver extension directory: ~/.sliver-client/extensions
// GetExtensionsDir - Get the Sliver extension directory: ~/.sliver-client/extensions.
func GetExtensionsDir() string {
rootDir, _ := filepath.Abs(GetRootAppDir())
dir := filepath.Join(rootDir, ExtensionsDirName)
if _, err := os.Stat(dir); os.IsNotExist(err) {
err = os.MkdirAll(dir, 0700)
err = os.MkdirAll(dir, 0o700)
if err != nil {
log.Fatal(err)
}
}
return dir
}

// GetInstalledExtensionManifests - Returns a list of installed extension manifests
// GetInstalledExtensionManifests - Returns a list of installed extension manifests.
func GetInstalledExtensionManifests() []string {
extDir := GetExtensionsDir()
extDirContent, err := os.ReadDir(extDir)
Expand Down
6 changes: 3 additions & 3 deletions client/assets/settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const (
settingsFileName = "tui-settings.json"
)

// ClientSettings - Client JSON config
// ClientSettings - Client JSON config.
type ClientSettings struct {
TableStyle string `json:"tables"`
AutoAdult bool `json:"autoadult"`
Expand All @@ -40,7 +40,7 @@ type ClientSettings struct {
ConsoleLogs bool `json:"console_logs"`
}

// LoadSettings - Load the client settings from disk
// LoadSettings - Load the client settings from disk.
func LoadSettings() (*ClientSettings, error) {
rootDir, _ := filepath.Abs(GetRootAppDir())
data, err := os.ReadFile(filepath.Join(rootDir, settingsFileName))
Expand All @@ -67,7 +67,7 @@ func defaultSettings() *ClientSettings {
}
}

// SaveSettings - Save the current settings to disk
// SaveSettings - Save the current settings to disk.
func SaveSettings(settings *ClientSettings) error {
rootDir, _ := filepath.Abs(GetRootAppDir())
if settings == nil {
Expand Down
Loading