Skip to content

Instantly share code, notes, and snippets.

@infosec-intern
Created May 15, 2018 03:51

Revisions

  1. infosec-intern created this gist May 15, 2018.
    37 changes: 37 additions & 0 deletions .socks
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,37 @@
    SERVER=100.100.100.100
    USER=username
    PROXY="$USER@$SERVER"

    function setProxy() {
    export http_proxy=http://127.0.0.1:8888/
    export https_proxy=$http_proxy
    export ftp_proxy=$http_proxy
    export rsync_proxy=$http_proxy
    export no_proxy="localhost,127.0.0.1,localaddress,.localdomain.com"
    export HTTP_PROXY=$http_proxy
    export HTTPS_PROXY=$https_proxy
    export FTP_PROXY=$ftp_proxy
    export RSYNC_PROXY=$rsync_proxy
    export NO_PROXY=$no_proxy
    echo "[*] Proxy vars set"
    echo "[*] ssh -D 8888 -i ~/.ssh/proxy -C -f -N -q $PROXY"
    ssh -D 8888 -i ~/.ssh/proxy -C -f -N -q $PROXY
    }

    function unsetProxy() {
    unset http_proxy
    unset https_proxy
    unset ftp_proxy
    unset rsync_proxy
    unset no_proxy
    unset HTTP_PROXY
    unset HTTPS_PROXY
    unset FTP_PROXY
    unset RSYNC_PROXY
    unset NO_PROXY
    echo "[*] Proxy vars unset"
    echo '[*] kill -9 `pgrep "ssh" -a -U 1000 | grep $PROXY | cut -d\s -f1`'
    kill -9 `pgrep "ssh" -a -U 1000 | grep $PROXY | cut -d\s -f1`
    }

    setProxy