From e99c68a42c95b8b96d6aa17c01f81ac3a56eafe0 Mon Sep 17 00:00:00 2001 From: *ERR0R* <59941931+Err0r-ICA@users.noreply.github.com> Date: Sat, 21 Nov 2020 19:39:05 +0100 Subject: [PATCH] Add files via upload --- bin/README.md | 1 + bin/curl | 5 +++++ bin/nc | 5 +++++ bin/nmap | 5 +++++ bin/tor_boot | 6 ++++++ bin/tor_wait | 44 ++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 66 insertions(+) create mode 100644 bin/README.md create mode 100644 bin/curl create mode 100644 bin/nc create mode 100644 bin/nmap create mode 100644 bin/tor_boot create mode 100644 bin/tor_wait diff --git a/bin/README.md b/bin/README.md new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/bin/README.md @@ -0,0 +1 @@ + diff --git a/bin/curl b/bin/curl new file mode 100644 index 0000000..b437991 --- /dev/null +++ b/bin/curl @@ -0,0 +1,5 @@ +#!/bin/sh + +proxychains4 -f /etc/proxychains.conf /usr/bin/curl "$@" + +exit $? diff --git a/bin/nc b/bin/nc new file mode 100644 index 0000000..0051730 --- /dev/null +++ b/bin/nc @@ -0,0 +1,5 @@ +#!/bin/sh + +proxychains4 -f /etc/proxychains.conf /usr/bin/nc "$@" + +exit $? diff --git a/bin/nmap b/bin/nmap new file mode 100644 index 0000000..253903d --- /dev/null +++ b/bin/nmap @@ -0,0 +1,5 @@ +#!/bin/sh + +proxychains4 -f /etc/proxychains.conf /usr/bin/nmap -sT -PN -n "$@" + +exit $? diff --git a/bin/tor_boot b/bin/tor_boot new file mode 100644 index 0000000..87eefb2 --- /dev/null +++ b/bin/tor_boot @@ -0,0 +1,6 @@ +#!/bin/sh + +set -e + +s6-svscan /etc/s6 > /dev/null 2>&1 & +tor_wait diff --git a/bin/tor_wait b/bin/tor_wait new file mode 100644 index 0000000..c2a795a --- /dev/null +++ b/bin/tor_wait @@ -0,0 +1,44 @@ +#!/bin/sh + +set -e + +DEBUG_LEVEL=${DEBUG_LEVEL-0} + +counter=0 + +socket_open() { + echo "[tor_wait retry $counter] Check socket is open on localhost:9050..." + /usr/bin/nc -z localhost 9050 \ + && { echo "[tor_wait retry $counter] Socket OPEN on localhost:9050" ; sleep 1 ; return 0 ; } \ + || { echo "[tor_wait retry $counter] Socket CLOSED on localhost:9050, try again..." ; return 1 ; } +} + +proxy_up() { + echo "[tor_wait retry $counter] Check SOCKS proxy is up on localhost:9050 (timeout $(($((counter+1))*2)) )..." + /usr/bin/curl --max-time $(($((counter+1))*2)) -s -f -I -x socks4h://localhost:9050 http://ipinfo.io/json \ + >/dev/null 2>&1 \ + && { echo "[tor_wait retry $counter] SOCKS proxy UP on localhost:9050" ; return 0 ; } \ + || { echo "[tor_wait retry $counter] SOCKS proxy DOWN on localhost:9050, try again..." ; return 1 ; } +} + +is_ready() { + if test "$DEBUG_LEVEL" -eq 0 ; then + socket_open >/dev/null 2>&1 && proxy_up >/dev/null 2>&1 && return 0 || return 1 + else + socket_open && proxy_up && return 0 || return 1 + fi +} + +echo "[tor_wait] Wait for Tor to boot... (might take a while)" +while true +do + is_ready && { \ + test $counter -eq 0 && { break ; } || { echo "[tor_wait] Done. Tor booted." ; break ; } ; \ + } + + counter=$((counter+1)) + sleep 0.5 +done + +# Use Tor for all DNS queries: +echo 'nameserver 127.0.0.1' > /etc/resolv.conf