Skip to content

Commit

Permalink
Proxy Aware HTTP Client (#26)
Browse files Browse the repository at this point in the history
* added proxy feature

---------

Co-authored-by: frjcomp <[email protected]>
  • Loading branch information
frjcomp and frjcomp authored Sep 30, 2024
1 parent e21f6f6 commit 322782c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
6 changes: 6 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@ You can tweak `--threads`, `--max-artifact-size` and `--job-limit` to obtain a c

`register` command: Best effort automation to register a new user on an instance.


Setting an HTTP proxy is possible by setting the environment variable `HTTP_PROXY` e.g. to route through Burp:
```bash
HTTP_PROXY=http://127.0.0.1:8080 pipeleak scan --token glpat-xxxxxxxxxxx --gitlab https://gitlab.com
```

## Customizing Scan Rules

When you run Pipeleak for the first time, it generates a `rules.yml` file based on [this repository](https://github.com/mazen160/secrets-patterns-db/blob/master/db/rules-stable.yml). You can customize your scan rules by modifying this file as needed.
12 changes: 12 additions & 0 deletions src/pipeleak/helper/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,9 +189,21 @@ func RegisterGracefulShutdownHandler(handler ShutdownHandler) {
}

func GetNonVerifyingHTTPClient() *http.Client {
proxyServer, isSet := os.LookupEnv("HTTP_PROXY")

tr := &http.Transport{
TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
}

if isSet {
proxyUrl, err := url.Parse(proxyServer)
if err != nil {
log.Fatal().Err(err).Str("HTTP_PROXY", proxyServer).Msg("Invalid Proxy URL in HTTP_PROXY environment variable")
}
log.Debug().Str("proxy", proxyUrl.String()).Msg("Auto detected proxy")
tr.Proxy = http.ProxyURL(proxyUrl)
}

return &http.Client{Transport: tr, Timeout: 15 * time.Second}
}

Expand Down

0 comments on commit 322782c

Please sign in to comment.