├── README.md └── pshtt.sh /README.md: -------------------------------------------------------------------------------- 1 | # PSHTT -------------------------------------------------------------------------------- /pshtt.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ################################################# 4 | # Install and Setup PSHTT 5 | # Joshua Harvey | September 2019 6 | # josh[at]macjeezy.com 7 | ################################################# 8 | 9 | ### Variables 10 | PSHTT_HOME="/home/$USER/pshtt-develop" 11 | PSHTT_TEMP="/tmp/PSHTT" 12 | 13 | if [[ ! -d "$PSHTT_TEMP" ]]; then 14 | mkdir "$PSHTT_TEMP" 15 | fi 16 | 17 | if [[ -d /tmp/pshtt_results.tar ]]; then 18 | rm -rf /tmp/pshtt_results.tar 19 | fi 20 | 21 | echo "Starting PSHTT download.." 22 | # Download PSHTT and unzip it 23 | if [[ ! -f "/home/$USER/develop.zip" ]]; then 24 | echo "Downloading PSHTT" 25 | wget https://github.com/dhs-ncats/pshtt/archive/develop.zip -o /home/$USER/develop.zip 26 | unzip /home/$USER/develop.zip 27 | else 28 | echo "PSHTT Files Found" 29 | fi 30 | 31 | # Build docker container 32 | echo "Starting to build docker container" 33 | docker build -t pshtt "$PSHTT_HOME" 34 | 35 | echo "Build Complete..." 36 | 37 | COUNT_HOSTS=$(cat /home/$USER/hosts.txt | wc -l) 38 | 39 | CHECK_HOSTS=$(cat /home/$USER/hosts.txt) 40 | if [[ -z "$CHECK_HOSTS" ]]; then 41 | echo "Missing List of Hosts. Please enter them in /home/$USER/hosts.txt, then run the script again" 42 | echo "Use nano /home/$USER/hosts.txt to open the file and paste or enter the hosts in" 43 | exit 1 44 | else 45 | echo "Starting PSHTT Scan for $COUNT_HOSTS hostnames" 46 | fi 47 | 48 | while read input; do 49 | echo "Scanning $input" 50 | docker run pshtt "$input" -j --output=$input.json &> /dev/null 51 | GET_RESULTS=$(sudo find /var/lib/docker/overlay2/ -iname $input.json) 52 | sudo mv "$GET_RESULTS" "$PSHTT_TEMP"/$input.json 53 | sudo chmod 0755 "$PSHTT_TEMP"/"$input".json 54 | done < /home/$USER/hosts.txt 55 | 56 | echo "Compressing Results" 57 | tar -zcvf /tmp/pshtt_results.tar "$PSHTT_TEMP" 58 | 59 | echo "Results saved at /tmp/pshtt_results.tar and ready for download." 60 | 61 | echo "" > /home/$USER/hosts.txt 62 | 63 | rm -rf "$PSHTT_TEMP"/* 64 | --------------------------------------------------------------------------------