-
Notifications
You must be signed in to change notification settings - Fork 1k
/
websites-update-content.go
43 lines (38 loc) · 1.13 KB
/
websites-update-content.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
package websites
import (
"context"
"github.com/bishopfox/sliver/client/console"
"github.com/bishopfox/sliver/protobuf/clientpb"
"github.com/desertbit/grumble"
)
// WebsitesUpdateContentCmd - Update metadata about static website content
func WebsitesUpdateContentCmd(ctx *grumble.Context, con *console.SliverConsoleClient) {
websiteName := ctx.Flags.String("website")
if websiteName == "" {
con.PrintErrorf("Must specify a website name via --website, see --help\n")
return
}
webPath := ctx.Flags.String("web-path")
if webPath == "" {
con.PrintErrorf("Must specify a web path via --web-path, see --help\n")
return
}
contentType := ctx.Flags.String("content-type")
if contentType == "" {
con.PrintErrorf("Must specify a new --content-type, see --help\n")
return
}
updateWeb := &clientpb.WebsiteAddContent{
Name: websiteName,
Contents: map[string]*clientpb.WebContent{},
}
updateWeb.Contents[webPath] = &clientpb.WebContent{
ContentType: contentType,
}
web, err := con.Rpc.WebsiteUpdateContent(context.Background(), updateWeb)
if err != nil {
con.PrintErrorf("%s", err)
return
}
PrintWebsite(web, con)
}