Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
460 additions
and
342 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Environment | ||
=========== | ||
|
||
Contains command implementations for manipulating remote environment variables. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package environment | ||
|
||
/* | ||
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 ( | ||
"context" | ||
|
||
"github.com/bishopfox/sliver/client/console" | ||
"github.com/bishopfox/sliver/protobuf/sliverpb" | ||
"github.com/desertbit/grumble" | ||
) | ||
|
||
func EnvGetCmd(ctx *grumble.Context, con *console.SliverConsoleClient) { | ||
session := con.ActiveSession.Get() | ||
if session == nil { | ||
return | ||
} | ||
|
||
name := ctx.Args.String("name") | ||
envInfo, err := con.Rpc.GetEnv(context.Background(), &sliverpb.EnvReq{ | ||
Name: name, | ||
Request: con.ActiveSession.Request(ctx), | ||
}) | ||
|
||
if err != nil { | ||
con.PrintErrorf("%s\n", err) | ||
return | ||
} | ||
|
||
for _, envVar := range envInfo.Variables { | ||
con.Printf("%s=%s\n", envVar.Key, envVar.Value) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
package environment | ||
|
||
/* | ||
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 ( | ||
"context" | ||
|
||
"github.com/bishopfox/sliver/client/console" | ||
"github.com/bishopfox/sliver/protobuf/commonpb" | ||
"github.com/bishopfox/sliver/protobuf/sliverpb" | ||
"github.com/desertbit/grumble" | ||
) | ||
|
||
func EnvSetCmd(ctx *grumble.Context, con *console.SliverConsoleClient) { | ||
session := con.ActiveSession.Get() | ||
if session == nil { | ||
return | ||
} | ||
|
||
name := ctx.Args.String("name") | ||
value := ctx.Args.String("value") | ||
if name == "" || value == "" { | ||
con.PrintErrorf("Usage: setenv KEY VALUE\n") | ||
return | ||
} | ||
|
||
envInfo, err := con.Rpc.SetEnv(context.Background(), &sliverpb.SetEnvReq{ | ||
Variable: &commonpb.EnvVar{ | ||
Key: name, | ||
Value: value, | ||
}, | ||
Request: con.ActiveSession.Request(ctx), | ||
}) | ||
if err != nil { | ||
con.PrintErrorf("%s\n", err) | ||
return | ||
} | ||
if envInfo.Response != nil && envInfo.Response.Err != "" { | ||
con.PrintErrorf("%s\n", envInfo.Response.Err) | ||
return | ||
} | ||
con.PrintInfof("Set %s to %s\n", name, value) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
package environment | ||
|
||
/* | ||
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 ( | ||
"context" | ||
|
||
"github.com/bishopfox/sliver/client/console" | ||
"github.com/bishopfox/sliver/protobuf/sliverpb" | ||
"github.com/desertbit/grumble" | ||
) | ||
|
||
func EnvUnsetCmd(ctx *grumble.Context, con *console.SliverConsoleClient) { | ||
session := con.ActiveSession.Get() | ||
if session == nil { | ||
return | ||
} | ||
|
||
name := ctx.Args.String("name") | ||
if name == "" { | ||
con.PrintErrorf("Usage: setenv NAME\n") | ||
return | ||
} | ||
|
||
unsetResp, err := con.Rpc.UnsetEnv(context.Background(), &sliverpb.UnsetEnvReq{ | ||
Name: name, | ||
Request: con.ActiveSession.Request(ctx), | ||
}) | ||
|
||
if err != nil { | ||
con.PrintErrorf("%s\n", err) | ||
return | ||
} | ||
|
||
if unsetResp.Response != nil && unsetResp.Response.Err != "" { | ||
con.PrintErrorf("%s\n", unsetResp.Response.Err) | ||
return | ||
} | ||
con.PrintInfof("Successfully unset %s\n", name) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Jobs | ||
===== | ||
|
||
Implements commands related to starting/killing jobs like `jobs` and starting C2 listeners (`mtls`, `http`, etc.) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package jobs | ||
|
||
import ( | ||
"context" | ||
"strings" | ||
|
||
"github.com/bishopfox/sliver/client/console" | ||
"github.com/bishopfox/sliver/protobuf/clientpb" | ||
"github.com/desertbit/grumble" | ||
) | ||
|
||
func DNSListenerCmd(ctx *grumble.Context, con *console.SliverConsoleClient) { | ||
|
||
domains := strings.Split(ctx.Flags.String("domains"), ",") | ||
for _, domain := range domains { | ||
if !strings.HasSuffix(domain, ".") { | ||
domain += "." | ||
} | ||
} | ||
|
||
lport := uint16(ctx.Flags.Int("lport")) | ||
|
||
con.PrintInfof("Starting DNS listener with parent domain(s) %v ...\n", domains) | ||
dns, err := con.Rpc.StartDNSListener(context.Background(), &clientpb.DNSListenerReq{ | ||
Domains: domains, | ||
Port: uint32(lport), | ||
Canaries: !ctx.Flags.Bool("no-canaries"), | ||
Persistent: ctx.Flags.Bool("persistent"), | ||
}) | ||
con.Println() | ||
if err != nil { | ||
con.PrintErrorf("%s\n", err) | ||
} else { | ||
con.PrintInfof("Successfully started job #%d\n", dns.JobID) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package jobs | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/bishopfox/sliver/client/console" | ||
"github.com/bishopfox/sliver/protobuf/clientpb" | ||
"github.com/desertbit/grumble" | ||
) | ||
|
||
func HTTPListenerCmd(ctx *grumble.Context, con *console.SliverConsoleClient) { | ||
domain := ctx.Flags.String("domain") | ||
lport := uint16(ctx.Flags.Int("lport")) | ||
|
||
con.PrintInfof("Starting HTTP %s:%d listener ...\n", domain, lport) | ||
http, err := con.Rpc.StartHTTPListener(context.Background(), &clientpb.HTTPListenerReq{ | ||
Domain: domain, | ||
Website: ctx.Flags.String("website"), | ||
Port: uint32(lport), | ||
Secure: false, | ||
Persistent: ctx.Flags.Bool("persistent"), | ||
}) | ||
if err != nil { | ||
con.PrintErrorf("%s\n", err) | ||
} else { | ||
con.PrintInfof("Successfully started job #%d\n", http.JobID) | ||
} | ||
} |
Oops, something went wrong.