Skip to content

Commit 322782c

Browse files
frjcompfrjcomp
and
frjcomp
authored
Proxy Aware HTTP Client (#26)
* added proxy feature --------- Co-authored-by: frjcomp <frj1@securelogon.ch>
1 parent e21f6f6 commit 322782c

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

readme.md

+6
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,12 @@ You can tweak `--threads`, `--max-artifact-size` and `--job-limit` to obtain a c
5757

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

60+
61+
Setting an HTTP proxy is possible by setting the environment variable `HTTP_PROXY` e.g. to route through Burp:
62+
```bash
63+
HTTP_PROXY=http://127.0.0.1:8080 pipeleak scan --token glpat-xxxxxxxxxxx --gitlab https://gitlab.com
64+
```
65+
6066
## Customizing Scan Rules
6167

6268
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.

src/pipeleak/helper/helper.go

+12
Original file line numberDiff line numberDiff line change
@@ -189,9 +189,21 @@ func RegisterGracefulShutdownHandler(handler ShutdownHandler) {
189189
}
190190

191191
func GetNonVerifyingHTTPClient() *http.Client {
192+
proxyServer, isSet := os.LookupEnv("HTTP_PROXY")
193+
192194
tr := &http.Transport{
193195
TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
194196
}
197+
198+
if isSet {
199+
proxyUrl, err := url.Parse(proxyServer)
200+
if err != nil {
201+
log.Fatal().Err(err).Str("HTTP_PROXY", proxyServer).Msg("Invalid Proxy URL in HTTP_PROXY environment variable")
202+
}
203+
log.Debug().Str("proxy", proxyUrl.String()).Msg("Auto detected proxy")
204+
tr.Proxy = http.ProxyURL(proxyUrl)
205+
}
206+
195207
return &http.Client{Transport: tr, Timeout: 15 * time.Second}
196208
}
197209

0 commit comments

Comments
 (0)