pry0cc / axiom

The dynamic infrastructure framework for everybody! Distribute the workload of many different scanning tools with ease, including nmap, ffuf, masscan, nuclei, meg and many more!
MIT License
4k stars 622 forks source link

Proxify all instances through themselves #707

Open gwen001 opened 1 year ago

gwen001 commented 1 year ago

Don't know if anyone would find this interesting but I tried and it works pretty well ! To avoid errors I also manually opened the port 8080 in the security group rules.

1/ get fleet ips axiom-ls | ansi2txt | awk '{print $2}' | egrep "^[0-9]{1,3}\." | sort > fleet-ips

2/ upload the ips list on all instances axiom-scp fleet-ips '\*':~/

3/ upload the magic script below on all instances axiom-scp fleet-proxies.sh '\*':~/

4/ upload the ssh key on all instances axiom-scp ~/.ssh/axiom_rsa '\*':~/.ssh/

5/ run the magic script on all instances axiom-exec '~/fleet-proxies.sh'

6/ connect on a single instance using axiom-ssh ...

7/ check the ip changing at every request curl -s -x socks5h://127.0.0.1:1337 https://ipinfo.io


The magic script fleet-proxies.sh (don't forget to chmod +x it !) I used the code from the original axiom-proxy.

#!/bin/bash

sudo apt-get -yq install haproxy

eval $(ssh-agent)
ssh-add ~/.ssh/axiom_rsa

echo -e "global\n\t\tdaemon\n\t\tuser root\n\t\tgroup root\n\ndefaults\n\t\tmode tcp\n\t\tmaxconn 3000\n\t\ttimeout connect 5000ms\n\t\ttimeout client 50000ms\n\t\ttimeout server 50000ms\n\nlisten funnel_proxy\n\t\tbind *:1337\n\t\tmode tcp\n\t\tbalance roundrobin\n\t\tdefault_backend doxycannon\n\nbackend doxycannon" >> "haproxy.cfg"

i=0

cat "fleet-ips" | while read ip ; do
    i=$((i+1))
    append=$(printf "%02d" "$i")
    port="50$append"
    ssh-keygen -R "[$ip]:2266" >>  /dev/null 2>&1
    ssh -p2266 -o StrictHostKeyChecking=no -D $port op@$ip -R 8080:127.0.0.1:8080 -N 2>&1 >>/dev/null &
    echo -e "\tserver $ip 127.0.0.1:$port" >> haproxy.cfg
done

sudo cp /etc/haproxy/haproxy.cfg /etc/haproxy/haproxy.cfg.bak
sudo cp haproxy.cfg /etc/haproxy/haproxy.cfg
sudo /etc/init.d/haproxy restart