Skip to content

Instantly share code, notes, and snippets.

@pry0cc
Created June 16, 2020 00:18
Show Gist options
  • Select an option

  • Save pry0cc/d03294ad35eb01eaafee2ab679ff2010 to your computer and use it in GitHub Desktop.

Select an option

Save pry0cc/d03294ad35eb01eaafee2ab679ff2010 to your computer and use it in GitHub Desktop.
Axiom enum.sh to start and delete instances for each enum
#!/bin/bash
base="bb-enum"
machines=$(axiom-ls | awk '{ print $1 }' | grep -v "Name")
domains=($@)
counter=1
log="/tmp/enum_log.txt"
init_scan() {
name="$1"
domain="$2"
echo "$name,$domain" >> /tmp/maps.txt
axiom-init $name >>$log 2>&1
sleep 90
axiom-restore pry0cc/lazy $name >>$log 2>&1
axiom-execb "lazy.sh $domain" "$name" >>$log 2>&1
echo "Enumeration begun for $domain on $name"
}
echo "Initializing, this can take about 3 minutes so standby..."
#for domain in ${domains[@]}
#do
# name="$base$counter"
# echo "Launching enumeration against $domain on $name"
# init_scan $name $domain &
# let counter=counter+1
#done
#echo "Scan/s queued, waiting 200 seconds..."
#sleep 200
while [ "$counter" -gt 0 ]
do
bb=$(doctl compute droplet list -o json | jq -c -r '.[] | select(.name | contains("bb-enum"))')
hosts=$(echo $bb | jq -r '[.name, .networks.v4[].ip_address] | @csv')
for host in $hosts
do
progress=0
name=$(echo $host | cut -d "," -f 1 | cut -d '"' -f 2)
ip=$(echo $host | cut -d "," -f 2 | cut -d '"' -f 2)
new_prog=$(ssh -p2266 -o StrictHostKeyChecking=no op@$ip "cat /tmp/progress")
if [ "$new_prog" != null ]
then
progress=$new_prog
fi
echo "$name is at $progress%"
if [ "$progress" -eq 100 ]
then
echo "$name is DONE!!!!"
echo "Backing up and deleting $name..."
axiom-backup $name
axiom-rm $name -f
let "counter=counter-1"
for d in $(bash -c 'ls ~/.axiom/boxes/ | grep -v "bugbounty\|backup-files.txt"' ); do rsync -a ~/.axiom/boxes/$d/work ~/.axiom/boxes/bugbounty/ 2>> /dev/null; done
echo "Machine $name backed up and deleted..."
fi
done
sleep 10
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment