Projects STRLCPY reverse_ssh Commits ea507c0f
🤬
  • Make proxy an embeddable feature, add proxy setting to link, thanks @AdrianVollmer

  • Loading...
  • NHAS committed 11 months ago
    ea507c0f
    1 parent ad46ba4f
Revision indexing in progress... (symbol navigation in revisions will be accurate after indexed)
  • ■ ■ ■ ■ ■
    internal/server/commands/link.go
    skipped 108 lines
    109 109   return err
    110 110   }
    111 111   
    112  - url, err := webserver.Build(goos, goarch, homeserver_address, fingerprint, name, comment, line.IsSet("shared-object"), line.IsSet("upx"), line.IsSet("garble"))
     112 + proxy, err := line.GetArgString("proxy")
     113 + if err != nil && err != terminal.ErrFlagNotSet {
     114 + return err
     115 + }
     116 + 
     117 + url, err := webserver.Build(goos, goarch, homeserver_address, fingerprint, name, comment, proxy, line.IsSet("shared-object"), line.IsSet("upx"), line.IsSet("garble"))
    113 118   if err != nil {
    114 119   return err
    115 120   }
    skipped 30 lines
    146 151   "\t--goos\tSet the target build operating system (default to runtime GOOS)",
    147 152   "\t--goarch\tSet the target build architecture (default to runtime GOARCH)",
    148 153   "\t--name\tSet link name",
     154 + "\t--proxy\tSet connect proxy address to bake it",
    149 155   "\t--shared-object\tGenerate shared object file",
    150 156   "\t--fingerprint\tSet RSSH server fingerprint will default to server public key",
    151 157   "\t--upx\tUse upx to compress the final binary (requires upx to be installed)",
    skipped 8 lines
  • ■ ■ ■ ■ ■ ■
    internal/server/webserver/buildmanager.go
    skipped 40 lines
    41 41   cachePath string
    42 42  )
    43 43   
    44  -func Build(goos, goarch, suppliedConnectBackAdress, fingerprint, name, comment string, shared, upx, garble bool) (string, error) {
     44 +func Build(goos, goarch, suppliedConnectBackAdress, fingerprint, name, comment, proxy string, shared, upx, garble bool) (string, error) {
    45 45   if !webserverOn {
    46  - return "", fmt.Errorf("web server is not enabled.")
     46 + return "", errors.New("web server is not enabled")
    47 47   }
    48 48   
    49 49   if len(goarch) != 0 && !validArchs[goarch] {
    skipped 105 lines
    155 155   return "", err
    156 156   }
    157 157   
    158  - buildArguments = append(buildArguments, fmt.Sprintf("-ldflags=-s -w -X main.destination=%s -X main.fingerprint=%s -X github.com/NHAS/reverse_ssh/internal.Version=%s", suppliedConnectBackAdress, fingerprint, strings.TrimSpace(f.Version)))
     158 + buildArguments = append(buildArguments, fmt.Sprintf("-ldflags=-s -w -X main.destination=%s -X main.fingerprint=%s -X main.proxy=%s -X github.com/NHAS/reverse_ssh/internal.Version=%s", suppliedConnectBackAdress, fingerprint, proxy, strings.TrimSpace(f.Version)))
    159 159   buildArguments = append(buildArguments, "-o", f.Path, filepath.Join(projectRoot, "/cmd/client"))
    160 160   
    161 161   cmd := exec.Command(buildTool, buildArguments...)
    skipped 201 lines
Please wait...
Page is in error, reload to recover