Skip to content

Commit

Permalink
Merge pull request #1352 from xinhuang/pr/no-http-fallback-master
Browse files Browse the repository at this point in the history
Add option to disable connect to tcp/80 when tcp/443 not reachable
  • Loading branch information
rkervella committed Jul 13, 2023
2 parents 452ce12 + 5a39e25 commit a1c19bc
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion implant/sliver/transports/httpclient/httpclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ type HTTPOptions struct {
PollTimeout time.Duration
MaxErrors int
ForceHTTP bool
NoFallback bool
DisableUpgradeHeader bool
HostHeader string

Expand Down Expand Up @@ -110,6 +111,7 @@ func ParseHTTPOptions(c2URI *url.URL) *HTTPOptions {
PollTimeout: pollTimeout,
MaxErrors: maxErrors,
ForceHTTP: c2URI.Query().Get("force-http") == "true",
NoFallback: c2URI.Query().Get("no-fallback") == "true",
DisableUpgradeHeader: c2URI.Query().Get("disable-upgrade-header") == "true",
HostHeader: c2URI.Query().Get("host-header"),

Expand All @@ -133,7 +135,7 @@ func HTTPStartSession(address string, pathPrefix string, opts *HTTPOptions) (*Sl
return client, nil
}
}
if err != nil || opts.ForceHTTP {
if (err != nil && !opts.NoFallback) || opts.ForceHTTP {
// If we're using default ports then switch to 80
if strings.HasSuffix(address, ":443") {
address = fmt.Sprintf("%s:80", address[:len(address)-4])
Expand Down

0 comments on commit a1c19bc

Please sign in to comment.