# Rpivot

Source: <https://github.com/klsecservices/rpivot>

## Requirements

* Python 2.6/2.7
* Add this line to the /etc/proxychains.conf file:&#x20;
  * *socks4 127.0.0.1 1080*

## When to use rpivot?

Imagine this scenario:

<figure><img src="https://3593245608-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FkPEBr0Ohu5Y49JHmv4La%2Fuploads%2FyjXLPnS6DYr3EQagrIWb%2Fimage.png?alt=media&#x26;token=9909e698-1c05-45e1-bc5f-f6c3d22550c0" alt=""><figcaption><p>Diagram</p></figcaption></figure>

* **A** machine can connect to **B**
* **B** machine can connect to **C**
* **C** can't connect directly to **A**
* So, in this case, we can use rpivot from C to B proxying the access
* After that, we can access **A** directly from **C**

<figure><img src="https://3593245608-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FkPEBr0Ohu5Y49JHmv4La%2Fuploads%2FyjK5umqFeKBILRxrZP6r%2Fimage.png?alt=media&#x26;token=4444e442-cb6f-46b2-9681-fa7342ffdf42" alt=""><figcaption><p>Open the server - Machine C</p></figcaption></figure>

<figure><img src="https://3593245608-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FkPEBr0Ohu5Y49JHmv4La%2Fuploads%2FlD9TYdX1orNrC3PDjDtY%2Fimage.png?alt=media&#x26;token=15a9148a-c8d6-4de7-881a-ae6e8840f617" alt=""><figcaption><p>Connect the client to the server - Machine B</p></figcaption></figure>

<figure><img src="https://3593245608-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FkPEBr0Ohu5Y49JHmv4La%2Fuploads%2FgiXu9O5W5VE3p5OQiVYL%2Fimage.png?alt=media&#x26;token=00e3bb58-f19f-49bd-950e-4d9b4ca8d14e" alt=""><figcaption><p>3rd one - Machine A</p></figcaption></figure>

<figure><img src="https://3593245608-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FkPEBr0Ohu5Y49JHmv4La%2Fuploads%2FSlSDZ9DyvaYzjje8IPJz%2Fimage.png?alt=media&#x26;token=8fb32f48-1cfe-406e-808e-af91a739bf76" alt=""><figcaption><p>Extracting the Shadow of the 3rd machine</p></figcaption></figure>

####

#### In Wireshark we can see that all the communication happened through port 4444 that we set up with rpivot

<figure><img src="https://3593245608-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FkPEBr0Ohu5Y49JHmv4La%2Fuploads%2F5E0oVnjEtVXTPuneN7h1%2Fimage.png?alt=media&#x26;token=42ad3885-f15a-4e01-8253-c1a8f3874af3" alt=""><figcaption><p>Wireshark Results</p></figcaption></figure>

##

## We can also PIVOT through a NTLM Proxy

In this case, we **add** in the client side these flags:

```bash

--ntlm-proxy-ip <proxy_ip> --ntlm-proxy-port 8080 --domain DOMAIN.COM --username John --password password

```

Or using *pass the hash*:

```bash

--ntlm-proxy-ip <proxy_ip> --ntlm-proxy-port 8080 --domain DOMAIN.COM --username John --hashes <hash>

```
