├── pscan.sh └── ranges.txt /pscan.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | 4 | ## pscan ranges.txt myproject 5 | name="$2" 6 | global_name=$name 7 | scope="$1" 8 | total=10 9 | # Start fleet using the supplied name, spend $0.1 and self-destruct after 1 hour 10 | echo ' 11 | _ ______ __ 12 | ____ __ __(_)___ ____ ___ / __/ /__ ___ / /_ 13 | / __ `/ |/_/ / __ \/ __ `__ \______/ /_/ / _ \/ _ \/ __/ 14 | / /_/ /> $name.txt' "$name*" 50 | 51 | # Wait until the scan has finished, then press enter to tear down! 52 | instances=$(axiom-ls -d | grep -E "$name*") 53 | total=$(echo $instances | tr " " "\n" | wc -l | awk '{ print $1 }') 54 | echo "TOTAL FIRST INSTANCES: $total $(echo $instances | tr '\n' ', ')" 55 | sleep 1 56 | while [[ "$(axiom-ls -d | grep -E "$name*" | tr ' ' '\n' | wc -l | awk '{ print $1 }')" -gt 0 ]] 57 | do 58 | sleep 1 59 | instances=$(axiom-ls -d | grep -E "$name*") 60 | total=$(echo $instances | tr ' ' '\n' | wc -l | awk '{ print $1 }') 61 | echo "TOTAL INSTANCES: $total $(echo $instances | tr '\n' ', ')" 62 | for instance in $instances 63 | do 64 | echo "Checking $instance..." 65 | count=$(timeout 5 axiom-exec "ps aux | grep '[m]asscan' | wc -l | awk '{ print \$1 }'" "$instance" -q) 66 | 67 | if [[ "$count" -lt 1 ]] 68 | then 69 | echo "Killing $instance" 70 | axiom-scp $instance:~/$instance.txt $instance.txt 71 | cat $instance.txt >> all.txt 72 | rm -f $instance.txt 73 | axiom-rm $instance -f 74 | sleep 2 75 | fi 76 | done 77 | done 78 | 79 | # Download all the output masscan files 80 | #for i in $(axiom-ls -d | grep -E "$global_name*"); do axiom-scp $i:~/$i.txt $i.txt; cat $i.txt >> all.txt; rm -f ./$i.txt; done 81 | 82 | cat all.txt | grep -v "#" | sort -u > $global_name.txt 83 | rm -f all.txt 84 | 85 | --------------------------------------------------------------------------------