scripts

random scripts
git clone git://parazyd.org/scripts.git
Log | Files | Refs

commit 9bb66a8b42e50d5094d14abb3fecd1f37e834cac
parent 61c159ab805636b3acc3793a6361fddfd467355a
Author: parazyd <parazyd@dyne.org>
Date:   Fri, 17 Mar 2017 23:53:49 +0100

torification

Diffstat:
Mblackholedns | 3++-
Mcatfact | 4+++-
Rscan_domains.py -> notinpath/scan_domains.py | 0
Rskrot -> obsolete/skrot | 0
Rtranslate -> obsolete/translate | 0
Msslget | 4+++-
Mticker | 5+++--
Mupdate-gits | 10++++++----
Mys | 4+++-
9 files changed, 20 insertions(+), 10 deletions(-)

diff --git a/blackholedns b/blackholedns @@ -7,8 +7,9 @@ # unbound: # include: "/etc/unbound/blackhole.dns" +[ -n "$TORIFY" ] && proxy="--proxy socks5://127.0.0.1:9050" -urls="$(curl -s http://someonewhocares.org/hosts/hosts)" +urls="$(curl -s ${proxy} http://someonewhocares.org/hosts/hosts)" [ -n "$urls" ] || exit 1 diff --git a/catfact b/catfact @@ -1,3 +1,5 @@ #!/bin/sh -curl -s http://catfacts-api.appspot.com/api/facts | jq -r '.facts[]' +[ -n "$TORIFY" ] && proxy="--proxy socks5://127.0.0.1:9050" + +curl -s ${proxy} http://catfacts-api.appspot.com/api/facts | jq -r '.facts[]' diff --git a/scan_domains.py b/notinpath/scan_domains.py diff --git a/skrot b/obsolete/skrot diff --git a/translate b/obsolete/translate diff --git a/sslget b/sslget @@ -3,8 +3,10 @@ # retrieve SSL certificate of a website # it assumes 443 to be the default SSL port +[ -n "$TORIFY" ] && tor=torsocks + portnum=${2-443} -cert="$(echo | openssl s_client -connect $1:$portnum 2>&1 | sed '/BEGIN CERT/,/END CERT/p;d')" +cert="$(echo | ${tor} openssl s_client -connect $1:$portnum 2>&1 | sed '/BEGIN CERT/,/END CERT/p;d')" printf "%s\n" "$cert" diff --git a/ticker b/ticker @@ -1,12 +1,13 @@ #!/bin/sh -jsonurl="http://api.bitcoincharts.com/v1/markets.json" +[ -n "$TORIFY" ] && proxy="--proxy socks5://127.0.0.1:9050" +jsonurl="http://api.bitcoincharts.com/v1/markets.json" jsonfile=/tmp/bitcoincharts.json [ $(stat --format=%Y $jsonfile) -gt $(( $(date +%s) - 900 )) ] || { printf "curling...\n" - curl -s "$jsonurl" > "$jsonfile" + curl ${proxy} -s "$jsonurl" > "$jsonfile" } parse() { diff --git a/update-gits b/update-gits @@ -1,10 +1,12 @@ #!/bin/sh +[ -n "$TORIFY" ] && tor=torsocks + for i in $(printf %s\\n */); do - cd "$i" - test -d .git && { + test -d "$i/.git" && { + cd "$i" printf "\nupdating %s...\\n" "$i" - git pull origin master + ${tor} git pull origin master + cd - >/dev/null } - cd - >/dev/null done diff --git a/ys b/ys @@ -3,6 +3,8 @@ # 2f30 # search youtube via api +[ -n "$TORIFY" ] && proxy="--proxy socks5://127.0.0.1:9050" + KEY="AIzaSyAa5gAarPnuu9zTVjpp6mPyStbY17uuhSE" NRES=10 @@ -17,7 +19,7 @@ search() { sstr=$1 fi - json="$(curl -s \ + json="$(curl -s ${proxy} \ -G "https://www.googleapis.com/youtube/v3/search" \ -d part="snippet" \ -d q=$sstr \