-
Notifications
You must be signed in to change notification settings - Fork 1.1k
/
console.go
699 lines (623 loc) · 21.7 KB
/
console.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
package console
/*
Sliver Implant Framework
Copyright (C) 2019 Bishop Fox
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import (
"bufio"
"context"
"fmt"
"io"
"io/ioutil"
"log"
insecureRand "math/rand"
"path"
"path/filepath"
"strconv"
"strings"
"sync"
"time"
"github.com/bishopfox/sliver/client/assets"
consts "github.com/bishopfox/sliver/client/constants"
"github.com/bishopfox/sliver/client/core"
"github.com/bishopfox/sliver/client/prelude"
"github.com/bishopfox/sliver/client/spin"
"github.com/bishopfox/sliver/client/version"
"github.com/bishopfox/sliver/protobuf/clientpb"
"github.com/bishopfox/sliver/protobuf/commonpb"
"github.com/bishopfox/sliver/protobuf/rpcpb"
"github.com/desertbit/go-shlex"
"github.com/desertbit/grumble"
"github.com/fatih/color"
"google.golang.org/protobuf/proto"
)
const (
// ANSI Colors
Normal = "\033[0m"
Black = "\033[30m"
Red = "\033[31m"
Green = "\033[32m"
Orange = "\033[33m"
Blue = "\033[34m"
Purple = "\033[35m"
Cyan = "\033[36m"
Gray = "\033[37m"
Bold = "\033[1m"
Clearln = "\r\x1b[2K"
UpN = "\033[%dA"
DownN = "\033[%dB"
Underline = "\033[4m"
// Info - Display colorful information
Info = Bold + Cyan + "[*] " + Normal
// Warn - Warn a user
Warn = Bold + Red + "[!] " + Normal
// Debug - Display debug information
Debug = Bold + Purple + "[-] " + Normal
// Woot - Display success
Woot = Bold + Green + "[$] " + Normal
// Success - Diplay success
Success = Bold + Green + "[+] " + Normal
)
// Observer - A function to call when the sessions changes
type Observer func(*clientpb.Session, *clientpb.Beacon)
type BeaconTaskCallback func(*clientpb.BeaconTask)
type ActiveTarget struct {
session *clientpb.Session
beacon *clientpb.Beacon
observers map[int]Observer
observerID int
}
type SliverConsoleClient struct {
App *grumble.App
Rpc rpcpb.SliverRPCClient
ActiveTarget *ActiveTarget
BeaconTaskCallbacks map[string]BeaconTaskCallback
BeaconTaskCallbacksMutex *sync.Mutex
IsServer bool
Settings *assets.ClientSettings
}
// BindCmds - Bind extra commands to the app object
type BindCmds func(console *SliverConsoleClient)
// Start - Console entrypoint
func Start(rpc rpcpb.SliverRPCClient, bindCmds BindCmds, extraCmds BindCmds, isServer bool) error {
assets.Setup(false, false)
settings, _ := assets.LoadSettings()
con := &SliverConsoleClient{
App: grumble.New(&grumble.Config{
Name: "Sliver",
Description: "Sliver Client",
HistoryFile: path.Join(assets.GetRootAppDir(), "history"),
PromptColor: color.New(),
HelpHeadlineColor: color.New(),
HelpHeadlineUnderline: true,
HelpSubCommands: true,
}),
Rpc: rpc,
ActiveTarget: &ActiveTarget{
observers: map[int]Observer{},
observerID: 0,
},
BeaconTaskCallbacks: map[string]BeaconTaskCallback{},
BeaconTaskCallbacksMutex: &sync.Mutex{},
IsServer: isServer,
Settings: settings,
}
con.App.SetPrintASCIILogo(func(_ *grumble.App) {
con.PrintLogo()
})
con.App.SetPrompt(con.GetPrompt())
bindCmds(con)
extraCmds(con)
con.ActiveTarget.AddObserver(func(_ *clientpb.Session, _ *clientpb.Beacon) {
con.App.SetPrompt(con.GetPrompt())
})
go con.EventLoop()
go core.TunnelLoop(rpc)
err := con.App.Run()
if err != nil {
log.Printf("Run loop returned error: %v", err)
}
return err
}
func (con *SliverConsoleClient) EventLoop() {
eventStream, err := con.Rpc.Events(context.Background(), &commonpb.Empty{})
if err != nil {
fmt.Printf(Warn+"%s\n", err)
return
}
for {
event, err := eventStream.Recv()
if err == io.EOF || event == nil {
return
}
// Trigger event based on type
switch event.EventType {
case consts.CanaryEvent:
eventMsg := fmt.Sprintf(Bold+"WARNING: %s%s has been burned (DNS Canary)\n", Normal, event.Session.Name)
sessions := con.GetSessionsByName(event.Session.Name)
for _, session := range sessions {
shortID := strings.Split(session.ID, "-")[0]
con.PrintEventErrorf(eventMsg+"\n"+Clearln+"\t🔥 Session %s is affected\n", shortID)
}
case consts.WatchtowerEvent:
msg := string(event.Data)
eventMsg := fmt.Sprintf(Bold+"WARNING: %s%s has been burned (seen on %s)\n", Normal, event.Session.Name, msg)
sessions := con.GetSessionsByName(event.Session.Name)
for _, session := range sessions {
shortID := strings.Split(session.ID, "-")[0]
con.PrintEventErrorf(eventMsg+"\n"+Clearln+"\t🔥 Session %s is affected", shortID)
}
case consts.JoinedEvent:
con.PrintEventInfof("%s has joined the game", event.Client.Operator.Name)
case consts.LeftEvent:
con.PrintEventInfof("%s left the game", event.Client.Operator.Name)
case consts.JobStoppedEvent:
job := event.Job
con.PrintEventErrorf("Job #%d stopped (%s/%s)", job.ID, job.Protocol, job.Name)
case consts.SessionOpenedEvent:
session := event.Session
currentTime := time.Now().Format(time.RFC1123)
shortID := strings.Split(session.ID, "-")[0]
con.PrintEventInfof("Session %s %s - %s (%s) - %s/%s - %v",
shortID, session.Name, session.RemoteAddress, session.Hostname, session.OS, session.Arch, currentTime)
// Prelude Operator
if prelude.SessionMapper != nil {
err = prelude.SessionMapper.AddSession(session)
if err != nil {
con.PrintEventErrorf("Could not add session to Operator: %s", err)
}
}
case consts.SessionUpdateEvent:
session := event.Session
currentTime := time.Now().Format(time.RFC1123)
shortID := strings.Split(session.ID, "-")[0]
con.PrintEventInfof("Session %s has been updated - %v", shortID, currentTime)
case consts.SessionClosedEvent:
session := event.Session
currentTime := time.Now().Format(time.RFC1123)
shortID := strings.Split(session.ID, "-")[0]
con.PrintEventErrorf("Lost session %s %s - %s (%s) - %s/%s - %v",
shortID, session.Name, session.RemoteAddress, session.Hostname, session.OS, session.Arch, currentTime)
activeSession := con.ActiveTarget.GetSession()
if activeSession != nil && activeSession.ID == session.ID {
con.ActiveTarget.Set(nil, nil)
con.PrintEventErrorf("Active session disconnected")
con.App.SetPrompt(con.GetPrompt())
}
if prelude.SessionMapper != nil {
err = prelude.SessionMapper.RemoveSession(session)
if err != nil {
con.PrintEventErrorf("Could not remove session from Operator: %s", err)
}
con.PrintEventInfof("Removed session %s from Operator", session.Name)
}
case consts.BeaconRegisteredEvent:
beacon := &clientpb.Beacon{}
proto.Unmarshal(event.Data, beacon)
currentTime := time.Now().Format(time.RFC1123)
shortID := strings.Split(beacon.ID, "-")[0]
con.PrintEventInfof("Beacon %s %s - %s (%s) - %s/%s - %v",
shortID, beacon.Name, beacon.RemoteAddress, beacon.Hostname, beacon.OS, beacon.Arch, currentTime)
case consts.BeaconTaskResultEvent:
con.triggerBeaconTaskCallback(event.Data)
}
con.triggerReactions(event)
con.Printf(Clearln + con.GetPrompt())
bufio.NewWriter(con.App.Stdout()).Flush()
}
}
func (con *SliverConsoleClient) triggerReactions(event *clientpb.Event) {
reactions := core.Reactions.On(event.EventType)
if len(reactions) == 0 {
return
}
// We need some special handling for SessionOpenedEvent to
// set the new session as the active session
currentActiveSession, currentActiveBeacon := con.ActiveTarget.Get()
defer func() {
con.ActiveTarget.Set(currentActiveSession, currentActiveBeacon)
}()
con.ActiveTarget.Set(nil, nil)
if event.EventType == consts.SessionOpenedEvent {
con.ActiveTarget.Set(event.Session, nil)
} else if event.EventType == consts.BeaconRegisteredEvent {
beacon := &clientpb.Beacon{}
proto.Unmarshal(event.Data, beacon)
con.ActiveTarget.Set(nil, beacon)
}
for _, reaction := range reactions {
for _, line := range reaction.Commands {
con.PrintInfof("Execute reaction: '%s'\n", line)
args, err := shlex.Split(line, true)
if err != nil {
con.PrintErrorf("Reaction command has invalid args: %s\n", err)
continue
}
err = con.App.RunCommand(args)
if err != nil {
con.PrintErrorf("Reaction command error: %s\n", err)
}
}
}
}
// triggerBeaconTaskCallback - Triggers the callback for a beacon task
func (con *SliverConsoleClient) triggerBeaconTaskCallback(data []byte) {
task := &clientpb.BeaconTask{}
err := proto.Unmarshal(data, task)
if err != nil {
con.PrintErrorf("\rCould not unmarshal beacon task: %s\n", err)
return
}
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
defer cancel()
beacon, _ := con.Rpc.GetBeacon(ctx, &clientpb.Beacon{ID: task.BeaconID})
// If the callback is not in our map then we don't do anything, the beacon task
// was either issued by another operator in multiplayer mode or the client process
// was restarted between the time the task was created and when the server got the result
con.BeaconTaskCallbacksMutex.Lock()
defer con.BeaconTaskCallbacksMutex.Unlock()
if callback, ok := con.BeaconTaskCallbacks[task.ID]; ok {
if con.Settings.BeaconAutoResults {
if beacon != nil {
con.PrintEventSuccessf("%s completed task %s", beacon.Name, strings.Split(task.ID, "-")[0])
}
task, err = con.Rpc.GetBeaconTaskContent(ctx, &clientpb.BeaconTask{
ID: task.ID,
})
con.Printf(Clearln + "\r")
if err == nil {
callback(task)
} else {
con.PrintErrorf("Could not get beacon task content: %s\n", err)
}
con.Println()
}
delete(con.BeaconTaskCallbacks, task.ID)
}
}
func (con *SliverConsoleClient) AddBeaconCallback(taskID string, callback BeaconTaskCallback) {
con.BeaconTaskCallbacksMutex.Lock()
defer con.BeaconTaskCallbacksMutex.Unlock()
con.BeaconTaskCallbacks[taskID] = callback
}
func (con *SliverConsoleClient) GetPrompt() string {
prompt := Underline + "sliver" + Normal
if con.IsServer {
prompt = Bold + "[server] " + Normal + Underline + "sliver" + Normal
}
if con.ActiveTarget.GetSession() != nil {
prompt += fmt.Sprintf(Bold+Red+" (%s)%s", con.ActiveTarget.GetSession().Name, Normal)
} else if con.ActiveTarget.GetBeacon() != nil {
prompt += fmt.Sprintf(Bold+Blue+" (%s)%s", con.ActiveTarget.GetBeacon().Name, Normal)
}
prompt += " > "
return Clearln + prompt
}
func (con *SliverConsoleClient) PrintLogo() {
serverVer, err := con.Rpc.GetVersion(context.Background(), &commonpb.Empty{})
if err != nil {
panic(err.Error())
}
dirty := ""
if serverVer.Dirty {
dirty = fmt.Sprintf(" - %sDirty%s", Bold, Normal)
}
serverSemVer := fmt.Sprintf("%d.%d.%d", serverVer.Major, serverVer.Minor, serverVer.Patch)
logo := asciiLogos[insecureRand.Intn(len(asciiLogos))]
con.Println(logo)
con.Println("All hackers gain " + abilities[insecureRand.Intn(len(abilities))])
con.Printf(Info+"Server v%s - %s%s\n", serverSemVer, serverVer.Commit, dirty)
if version.GitCommit != serverVer.Commit {
con.Printf(Info+"Client %s\n", version.FullVersion())
}
con.Println(Info + "Welcome to the sliver shell, please type 'help' for options")
con.Println()
if serverVer.Major != int32(version.SemanticVersion()[0]) {
con.Printf(Warn + "Warning: Client and server may be running incompatible versions.\n")
}
con.CheckLastUpdate()
}
func (con *SliverConsoleClient) CheckLastUpdate() {
now := time.Now()
lastUpdate := getLastUpdateCheck()
compiledAt, err := version.Compiled()
if err != nil {
log.Printf("Failed to parse compiled at timestamp %s", err)
return
}
day := 24 * time.Hour
if compiledAt.Add(30 * day).Before(now) {
if lastUpdate == nil || lastUpdate.Add(30*day).Before(now) {
con.Printf(Info + "Check for updates with the 'update' command\n\n")
}
}
}
func getLastUpdateCheck() *time.Time {
appDir := assets.GetRootAppDir()
lastUpdateCheckPath := filepath.Join(appDir, consts.LastUpdateCheckFileName)
data, err := ioutil.ReadFile(lastUpdateCheckPath)
if err != nil {
log.Printf("Failed to read last update check %s", err)
return nil
}
unixTime, err := strconv.Atoi(string(data))
if err != nil {
log.Printf("Failed to parse last update check %s", err)
return nil
}
lastUpdate := time.Unix(int64(unixTime), 0)
return &lastUpdate
}
// GetSession - Get session by session ID or name
func (con *SliverConsoleClient) GetSession(arg string) *clientpb.Session {
sessions, err := con.Rpc.GetSessions(context.Background(), &commonpb.Empty{})
if err != nil {
con.PrintWarnf("%s\n", err)
return nil
}
for _, session := range sessions.GetSessions() {
if session.Name == arg || strings.HasPrefix(session.ID, arg) {
return session
}
}
return nil
}
// GetSessionsByName - Return all sessions for an Implant by name
func (con *SliverConsoleClient) GetSessionsByName(name string) []*clientpb.Session {
sessions, err := con.Rpc.GetSessions(context.Background(), &commonpb.Empty{})
if err != nil {
fmt.Printf(Warn+"%s\n", err)
return nil
}
matched := []*clientpb.Session{}
for _, session := range sessions.GetSessions() {
if session.Name == name {
matched = append(matched, session)
}
}
return matched
}
// GetActiveSessionConfig - Get the active sessions's config
// TODO: Switch to query config based on ConfigID
func (con *SliverConsoleClient) GetActiveSessionConfig() *clientpb.ImplantConfig {
session := con.ActiveTarget.GetSession()
if session == nil {
return nil
}
c2s := []*clientpb.ImplantC2{}
c2s = append(c2s, &clientpb.ImplantC2{
URL: session.GetActiveC2(),
Priority: uint32(0),
})
config := &clientpb.ImplantConfig{
Name: session.GetName(),
GOOS: session.GetOS(),
GOARCH: session.GetArch(),
Debug: true,
Evasion: session.GetEvasion(),
MaxConnectionErrors: uint32(1000),
ReconnectInterval: int64(60),
Format: clientpb.OutputFormat_SHELLCODE,
IsSharedLib: true,
C2: c2s,
}
return config
}
// PrintAsyncResponse - Print the generic async response information
func (con *SliverConsoleClient) PrintAsyncResponse(resp *commonpb.Response) {
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
defer cancel()
beacon, err := con.Rpc.GetBeacon(ctx, &clientpb.Beacon{ID: resp.BeaconID})
if err != nil {
fmt.Printf(Warn+"%s\n", err)
return
}
con.PrintInfof("Tasked beacon %s (%s)\n", beacon.Name, strings.Split(resp.TaskID, "-")[0])
}
func (con *SliverConsoleClient) Printf(format string, args ...interface{}) (n int, err error) {
return fmt.Fprintf(con.App.Stdout(), format, args...)
}
func (con *SliverConsoleClient) Println(args ...interface{}) (n int, err error) {
return fmt.Fprintln(con.App.Stdout(), args...)
}
func (con *SliverConsoleClient) PrintInfof(format string, args ...interface{}) (n int, err error) {
return fmt.Fprintf(con.App.Stdout(), Clearln+Info+format, args...)
}
func (con *SliverConsoleClient) PrintSuccessf(format string, args ...interface{}) (n int, err error) {
return fmt.Fprintf(con.App.Stdout(), Clearln+Success+format, args...)
}
func (con *SliverConsoleClient) PrintWarnf(format string, args ...interface{}) (n int, err error) {
return fmt.Fprintf(con.App.Stdout(), Clearln+"⚠️ "+Normal+format, args...)
}
func (con *SliverConsoleClient) PrintErrorf(format string, args ...interface{}) (n int, err error) {
return fmt.Fprintf(con.App.Stderr(), Clearln+Warn+format, args...)
}
func (con *SliverConsoleClient) PrintEventInfof(format string, args ...interface{}) (n int, err error) {
return fmt.Fprintf(con.App.Stdout(), Clearln+Info+format+"\n"+Clearln+"\r\n"+Clearln+"\r", args...)
}
func (con *SliverConsoleClient) PrintEventErrorf(format string, args ...interface{}) (n int, err error) {
return fmt.Fprintf(con.App.Stderr(), Clearln+Warn+format+"\n"+Clearln+"\r\n"+Clearln+"\r", args...)
}
func (con *SliverConsoleClient) PrintEventSuccessf(format string, args ...interface{}) (n int, err error) {
return fmt.Fprintf(con.App.Stdout(), Clearln+Success+format+"\n"+Clearln+"\r\n"+Clearln+"\r", args...)
}
func (con *SliverConsoleClient) SpinUntil(message string, ctrl chan bool) {
go spin.Until(con.App.Stdout(), message, ctrl)
}
//
// -------------------------- [ Active Target ] --------------------------
//
// GetSessionInteractive - Get the active target(s)
func (s *ActiveTarget) GetInteractive() (*clientpb.Session, *clientpb.Beacon) {
if s.session == nil && s.beacon == nil {
fmt.Printf(Warn + "Please select a session or beacon via `use`\n")
return nil, nil
}
return s.session, s.beacon
}
// GetSessionInteractive - Get the active target(s)
func (s *ActiveTarget) Get() (*clientpb.Session, *clientpb.Beacon) {
return s.session, s.beacon
}
// GetSessionInteractive - GetSessionInteractive the active session
func (s *ActiveTarget) GetSessionInteractive() *clientpb.Session {
if s.session == nil {
fmt.Printf(Warn + "Please select a session via `use`\n")
return nil
}
return s.session
}
// GetSession - Same as GetSession() but doesn't print a warning
func (s *ActiveTarget) GetSession() *clientpb.Session {
return s.session
}
// GetBeaconInteractive - Get beacon interactive the active session
func (s *ActiveTarget) GetBeaconInteractive() *clientpb.Beacon {
if s.beacon == nil {
fmt.Printf(Warn + "Please select a beacon via `use`\n")
return nil
}
return s.beacon
}
// GetBeacon - Same as GetBeacon() but doesn't print a warning
func (s *ActiveTarget) GetBeacon() *clientpb.Beacon {
return s.beacon
}
// IsSession - Is the current target a session?
func (s *ActiveTarget) IsSession() bool {
return s.session != nil
}
// AddObserver - Observers to notify when the active session changes
func (s *ActiveTarget) AddObserver(observer Observer) int {
s.observerID++
s.observers[s.observerID] = observer
return s.observerID
}
func (s *ActiveTarget) RemoveObserver(observerID int) {
delete(s.observers, observerID)
}
func (s *ActiveTarget) Request(ctx *grumble.Context) *commonpb.Request {
if s.session == nil && s.beacon == nil {
return nil
}
timeout := int(time.Second) * ctx.Flags.Int("timeout")
req := &commonpb.Request{}
req.Timeout = int64(timeout)
if s.session != nil {
req.Async = false
req.SessionID = s.session.ID
}
if s.beacon != nil {
req.Async = true
req.BeaconID = s.beacon.ID
}
return req
}
// Set - Change the active session
func (s *ActiveTarget) Set(session *clientpb.Session, beacon *clientpb.Beacon) {
if session != nil && beacon != nil {
panic("cannot set both an active beacon and an active session")
}
if session == nil && beacon == nil {
s.session = nil
s.beacon = nil
for _, observer := range s.observers {
observer(s.session, s.beacon)
}
return
}
if session != nil {
s.session = session
s.beacon = nil
for _, observer := range s.observers {
observer(s.session, s.beacon)
}
} else if beacon != nil {
s.beacon = beacon
s.session = nil
for _, observer := range s.observers {
observer(s.session, s.beacon)
}
}
}
// Background - Background the active session
func (s *ActiveTarget) Background() {
s.session = nil
s.beacon = nil
for _, observer := range s.observers {
observer(nil, nil)
}
}
var abilities = []string{
"first strike",
"vigilance",
"haste",
"indestructible",
"hexproof",
"deathtouch",
"fear",
"epic",
"ninjitsu",
"recover",
"persist",
"conspire",
"reinforce",
"exalted",
"annihilator",
"infect",
"undying",
"living weapon",
"miracle",
"scavenge",
"cipher",
"evolve",
"dethrone",
"hidden agenda",
"prowess",
"dash",
"exploit",
"renown",
"skulk",
"improvise",
"assist",
"jump-start",
}
var asciiLogos = []string{
Red + `
██████ ██▓ ██▓ ██▒ █▓▓█████ ██▀███
▒██ ▒ ▓██▒ ▓██▒▓██░ █▒▓█ ▀ ▓██ ▒ ██▒
░ ▓██▄ ▒██░ ▒██▒ ▓██ █▒░▒███ ▓██ ░▄█ ▒
▒ ██▒▒██░ ░██░ ▒██ █░░▒▓█ ▄ ▒██▀▀█▄
▒██████▒▒░██████▒░██░ ▒▀█░ ░▒████▒░██▓ ▒██▒
▒ ▒▓▒ ▒ ░░ ▒░▓ ░░▓ ░ ▐░ ░░ ▒░ ░░ ▒▓ ░▒▓░
░ ░▒ ░ ░░ ░ ▒ ░ ▒ ░ ░ ░░ ░ ░ ░ ░▒ ░ ▒░
░ ░ ░ ░ ░ ▒ ░ ░░ ░ ░░ ░
░ ░ ░ ░ ░ ░ ░ ░
` + Normal,
Green + `
███████╗██╗ ██╗██╗ ██╗███████╗██████╗
██╔════╝██║ ██║██║ ██║██╔════╝██╔══██╗
███████╗██║ ██║██║ ██║█████╗ ██████╔╝
╚════██║██║ ██║╚██╗ ██╔╝██╔══╝ ██╔══██╗
███████║███████╗██║ ╚████╔╝ ███████╗██║ ██║
╚══════╝╚══════╝╚═╝ ╚═══╝ ╚══════╝╚═╝ ╚═╝
` + Normal,
Bold + Gray + `
.------..------..------..------..------..------.
|S.--. ||L.--. ||I.--. ||V.--. ||E.--. ||R.--. |
| :/\: || :/\: || (\/) || :(): || (\/) || :(): |
| :\/: || (__) || :\/: || ()() || :\/: || ()() |
| '--'S|| '--'L|| '--'I|| '--'V|| '--'E|| '--'R|
` + "`------'`------'`------'`------'`------'`------'" + `
` + Normal,
}