Skip to content

Commit

Permalink
fix path segments generation issues
Browse files Browse the repository at this point in the history
  • Loading branch information
TimBF committed May 30, 2023
1 parent 3b295b3 commit 95a4604
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 21 deletions.
6 changes: 3 additions & 3 deletions implant/sliver/transports/httpclient/httpclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -602,7 +602,7 @@ func (s *SliverHTTPClient) parseSegments(segmentType int) *url.URL {
// {{if .IsFile}}
pollFiles = append(pollFiles, "{{.Value}}")
// {{end}}
// {{if eq .IsFile false}}
// {{if not .IsFile }}
pollPaths = append(pollPaths, "{{.Value}}")
// {{end}}
// {{end}}
Expand All @@ -611,7 +611,7 @@ func (s *SliverHTTPClient) parseSegments(segmentType int) *url.URL {
// {{if .IsFile}}
sessionFiles = append(sessionFiles, "{{.Value}}")
// {{end}}
// {{if eq .IsFile false}}
// {{if not .IsFile }}
sessionPaths = append(sessionPaths, "{{.Value}}")
// {{end}}

Expand All @@ -620,7 +620,7 @@ func (s *SliverHTTPClient) parseSegments(segmentType int) *url.URL {
// {{if .IsFile}}
closeFiles = append(closeFiles, "{{.Value}}")
// {{end}}
// {{if eq .IsFile false}}
// {{if not .IsFile }}
closePaths = append(closePaths, "{{.Value}}")
// {{end}}
// {{end}}
Expand Down
26 changes: 8 additions & 18 deletions server/configs/http-c2.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,14 @@ import (
"errors"
"fmt"
insecureRand "math/rand"
"path"
"regexp"
"strings"

"github.com/bishopfox/sliver/protobuf/clientpb"
"github.com/bishopfox/sliver/server/assets"
"github.com/bishopfox/sliver/server/log"
)

const (
httpC2ConfigFileName = "http-c2.json"
DefaultChromeBaseVer = 106
DefaultMacOSVer = "10_15_7"
)
Expand Down Expand Up @@ -232,13 +229,6 @@ func (h *HTTPC2ImplantConfig) randomSample(values []string, ext string, min int,
return sample
}

// GetHTTPC2ConfigPath - File path to http-c2.json
func GetHTTPC2ConfigPath() string {
appDir := assets.GetRootAppDir()
httpC2ConfigPath := path.Join(appDir, "configs", httpC2ConfigFileName)
return httpC2ConfigPath
}

// CheckHTTPC2ConfigErrors - Get the current HTTP C2 config
func CheckHTTPC2ConfigErrors(config *clientpb.HTTPC2Config) error {
err := checkHTTPC2Config(config)
Expand Down Expand Up @@ -382,11 +372,11 @@ func GenerateDefaultHTTPC2Config() *clientpb.HTTPC2Config {
MinFiles: 2,
MaxPaths: 8,
MinPaths: 2,
StagerFileExtension: ".woff",
PollFileExtension: ".js",
StartSessionFileExtension: ".html",
SessionFileExtension: ".php",
CloseFileExtension: ".png",
StagerFileExtension: "woff",
PollFileExtension: "js",
StartSessionFileExtension: "html",
SessionFileExtension: "php",
CloseFileExtension: "png",
PathSegments: pathSegments,
}

Expand Down Expand Up @@ -464,23 +454,23 @@ func GenerateHTTPC2DefaultPathSegment() []*clientpb.HTTPC2PathSegment {
// paths
for _, poll := range PollPaths {
pathSegments = append(pathSegments, &clientpb.HTTPC2PathSegment{
IsFile: true,
IsFile: false,
SegmentType: 0,
Value: poll,
})
}

for _, session := range SessionPaths {
pathSegments = append(pathSegments, &clientpb.HTTPC2PathSegment{
IsFile: true,
IsFile: false,
SegmentType: 1,
Value: session,
})
}

for _, close := range ClosePaths {
pathSegments = append(pathSegments, &clientpb.HTTPC2PathSegment{
IsFile: true,
IsFile: false,
SegmentType: 2,
Value: close,
})
Expand Down

0 comments on commit 95a4604

Please sign in to comment.