SkillAgentSearch skills...

Airgapt

Automate "airgapped" server proxy with ssh socks proxy

Install / Use

/learn @AkselAllas/Airgapt
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

Airgapt - "airgapped" apt <sup><sub>*</sub></sup>

Script for setup of package management Proxy for situations where you can ssh, but target doesn't have an outgoing network connection to public web.

Uses local socks5 proxy & ssh remote proxy.

After running the script you can also query arbitrary URLs via curl -L --socks5 localhost:6666 google.com

<img src="https://user-images.githubusercontent.com/26136082/144587454-c442d3b1-525a-49c9-88cb-07b7742b84d5.png" alt="drawing" width="450"/> <sup>*NB! If you can proxy connections like this, then your system isn't actually airgapped :)</sup>

Usage

Choose one of these:

--) Docker usage via runDocker.sh

--) Bash usage via airgapt.sh

Docker usage

Make sure you have docker installed

  1. wget https://raw.githubusercontent.com/AkselAllas/airgapt/master/runDocker.sh

  2. Edit runDocker.sh input variables

LOCAL_SOCKS_PORT=44444
LOCAL_USER="kali" #This user must match your LOCAL_SSH_KEY's owner
LOCAL_USER_ID=1000
TARGET="example.domain"
TARGET_USER="ubuntu"
TARGET_FORWARDED_PORT="6666"
LOCAL_SSH_KEY_PATH="/home/${LOCAL_USER}/.ssh/id_rsa"
REMOTE_SSH_KEY_PATH="/home/${LOCAL_USER}/.ssh/custom_key"
  1. Run ./runDocker.sh

Bash script usage

  1. wget https://raw.githubusercontent.com/AkselAllas/airgapt/master/airgapt.sh

  2. Edit airgapt.sh input variables

LOCAL_SOCKS_PORT=44444
LOCAL_USER="kali"
TARGET="example.domain"
TARGET_USER="ubuntu"
TARGET_FORWARDED_PORT="6666"
LOCAL_SSH_KEY_PATH="/home/${LOCAL_USER}/.ssh/id_rsa"
REMOTE_SSH_KEY_PATH="/home/${LOCAL_USER}/.ssh/custom_key"
  1. Run .airgapt.sh

Custom proxy queries

In your target machine you can use proxy to request arbitrary URLs. For that run

curl -L --socks5 localhost:6666 google.com

You can also optionally install proxychains on the target server to enable any software to use the forwarded SOCKS proxy It uses a LD_PRELOAD trick to redirect TCP and DNS requests from arbitrary commands into a proxy and is really handy.

Setup /etc/proxychains.conf to use the forwarded socks proxy:

[ProxyList]
# SSH reverse proxy
socks5  127.0.0.1 6666

e.g. proxychains yum update

Future plans

[ ] add yum, pac, pkg detection & proxy setup to ensure_remote_server_has_proxy_config() function

Related Skills

View on GitHub
GitHub Stars101
CategoryDevelopment
Updated2y ago
Forks3

Languages

Shell

Security Score

80/100

Audited on Feb 1, 2024

No findings