Skip to content

Commit

Permalink
Simple little script to output current instances to include in pentest
Browse files Browse the repository at this point in the history
requests
  • Loading branch information
LinuxBozo committed Dec 4, 2017
1 parent 1c8faec commit a4a71f6
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions customer-pentest-instances.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env bash

function ec2instances() {
aws ec2 describe-instances | jq "[.Reservations[] | .Instances[0] | select(.State.Name == \"running\") | {Name: .KeyName, PrivateIPAddress: .NetworkInterfaces[0].PrivateIpAddress, VPC: .VpcId, SubnetID: .SubnetId, InstanceID: .InstanceId, InstanceType: .InstanceType, Tags: [.Tags[] | {key: .Key, value: .Value}] | from_entries} | select(.Tags.Name | contains(\"$1\"))]"
}

echo "Routers"
ec2instances | jq 'map(select(.PrivateIPAddress | contains ("10.10"))) | map(select(.Tags.Name | contains("router"))) | .[].InstanceID'
echo "API"
ec2instances | jq 'map(select(.PrivateIPAddress | contains ("10.10"))) | map(select(.Tags.Name | contains("api"))) | .[].InstanceID'
echo "Diego Cells"
ec2instances | jq 'map(select(.PrivateIPAddress | contains ("10.10"))) | map(select(.Tags.Name | contains("cell"))) | .[].InstanceID'

0 comments on commit a4a71f6

Please sign in to comment.