This repository has been archived on 2024-04-13. You can view files and clone it, but cannot push or open issues or pull requests.
shallot/shallot.sh
2023-01-17 22:57:13 +01:00

78 lines
2.3 KiB
Bash
Executable File

#!/bin/bash
set -e
# Setting env
SCAN_DATE=`date "+%F-%H-%M"`
export SHALLOT_DIR="/tmp/shallot-$SCAN_DATE"
mkdir -p $SHALLOT_DIR
echo "Shallot scritp v0.1.1"
if [[ $# -eq 0 ]] ; then
echo "[ERRO] No arguments was passed, exiting..."
exit 1
fi
if [[ $# -ge 2 ]] ; then
echo "[WARRNING] Too much argument was passed, this script uses only first one."
fi
[ $(type -P "npx") ] || echo "[ERRO] npx is not in the path, install npm first!"
export ONIONSITE=$1
echo "Checking if Tor Browser proxy is running..."
#NETSTAT_OUTPUT=`netstat -tlnp 2> /dev/null`
#IF_TOR_RUNNING=`echo $NETSTAT_OUTPUT | grep -Ezqv "/tor" && echo 0 || echo 1`
IF_TOR_RUNNING=`ps -eaf | grep -i tor |sed '/^$/d' | wc -l`
if [[ "$IF_TOR_RUNNING" > 1 ]] ; then
echo "[INFO] Tor is running!"
else
echo "[ERRO] Tor is not running, start Tor Browser and connect to Tor, then restart this scritp"
exit 1;
fi
IS_ADDRESS_ONION=`echo $1 | grep -Ei "\.onion\/?$" | wc -c`
if [[ $IS_ADDRESS_ONION > 0 ]] ; then
echo "Checking Onion Service, address: $1"
else
echo "[ERRO] Looks like $1 is not an onion site, exiting..."
exit 1
fi
echo ""
# OnionScan
echo "[INFO] Runnning OnionScan aginst address, this will take a while..."
export ONIONSCAN_REPORT=$(onionscan --jsonReport --torProxyAddress "127.0.0.1:9150" $1 2>$SHALLOT_DIR/onionscan_error.log | jq)
echo $ONIONSCAN_REPORT > $SHALLOT_DIR/onionscan_result.txt
if [ $? ] ; then
echo "[INFO] OnionScan done! Saved in $SHALLOT_DIR/onionscan_result.txt"
else
echo "[ERRO] Error occured, exiting, check $SHALLOT_DIR/onionscan_error.log for details."
fi
# HTTP Headers
echo "Scanning HTTP headers, wait..."
#export HTTP_HEADERS=$(proxychains -q -f /etc/proxychains4.conf /usr/bin/curl -I -s $1 | tail -n +3 | sed 's/\r//g' | head -n -1 | jq -R 'split(":")|{(.[0]) : .[1]}' | sed 's/\\"//g' 2>$SHALLOT_DIR/http_headers_error.log)
export HTTP_HEADERS=$(proxychains -q -f /etc/proxychains4.conf /usr/bin/curl -LIs -D - $1 -o /dev/null | npx curl-headers-to-json | sed 's/\\"//g' | jq 2>$SHALLOT_DIR/http_headers_error.log)
echo $HTTP_HEADERS > $SHALLOT_DIR/http_headers.txt
if [ $? ] ; then
echo "[INFO] HTTP headers done! Saved in $SHALLOT_DIR/http_headers.txt"
else
echo "[ERRO] Error occured, check $SHALLOT_DIR/http_headers_error.log"
fi
# Report analysis
python3 main.py
echo "Works done, exiting."
exit 0