> For the complete documentation index, see [llms.txt](https://hackerlab.gitbook.io/wiki.hackerlab.cz/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://hackerlab.gitbook.io/wiki.hackerlab.cz/web-pentesting/http-proxy-override.md).

# HTTP Proxy Override

## OS Linux - Terminal

The app or a library has to be coded to reflect these specific environment variables. Otherwise, explore a specific app configuration or CLI parameters for HTTP proxy features.

```bash
export http_proxy='127.0.0.1:8080'    
export https_proxy='127.0.0.1:8080'
```

You can unset back the variables by

```markup
unset http_proxy
unset https_proxy
```

## Metasploit

```
msf> set Proxies http:127.0.0.1:8080
```

There are different types of proxies you can define.

```
set Proxies socks4:127.0.0.1:5555
set Proxies socks5:127.0.0.1:5555
```

## Java (VM)

Forward HTTP/HTTPS traffic for your Java app to Burp Suite Proxy. The same analogy applies to FTP, explore the following Java documentation.

{% embed url="<https://docs.oracle.com/javase/8/docs/technotes/guides/net/proxies.html>" %}

### HTTP

Before you start your java application, add the following parameters to JVM.

```bash
java -Dhttp.proxyHost=127.0.0.1 -Dhttp.proxyPort=8080
```

### HTTP & HTTPS

```bash
"%JAVA_HOME%\bin\java" …  
-Dhttp.proxyHost=127.0.0.1 
-Dhttp.proxyPort=8080
-Dhttps.proxyHost=127.0.0.1      
-Dhttps.proxyPort=8080 
-Dhttp.nonProxyHosts=localhost 
-Djavax.net.ssl.trustStore=C:\Users\Administrator\.keystore
-Djavax.net.ssl.trustStorePassword=changeme
```

{% hint style="info" %}
**HTTPS Troubleshooting** - add the following JVM parameter to track SSL/TLS handshake and certificate look up errors **Djavax.net.debug=ssl,handshake**
{% endhint %}

### Create Java Keystore

Briefly, Java Key Store (JKS) is a secured storage protected by password (trustStorePassword).

```bash
cd %JAVA_HOME%/bin
keytool.exe -keystore C:/Users/Administrator/.keystore -genkey -alias client
```

### Import certificate (CER or DER)

```bash
keytool.exe -importcert -file certificate.cer -keystore C:\Users\Administrator\.keystore -alias "BurpCert" 
```

## Visual Studio 2015|2019

Find VS software home (installation directory)&#x20;

**%ProgramFiles%\Microsoft Visual Studio\2019\Enterprise\Common7\IDE%**

edit **devenv.exe.config** file

```markup
<system.net>
<defaultProxy useDefaultCredentials="true" enabled="true">
    <proxy bypassonlocal="true" proxyaddress="http://127.0.0.1:8080" />
</defaultProxy>
</system.net>
```

with authentication option

```markup
<system.net>
<defaultProxy useDefaultCredentials="true" enabled="true">
    <proxy bypassonlocal="true" proxyaddress="http://Username:Password@yourproxyaddress.net:8080" />
</defaultProxy>
</system.net>
```
