pry0cc / axiom

The dynamic infrastructure framework for everybody! Distribute the workload of many different scanning tools with ease, including nmap, ffuf, masscan, nuclei, meg and many more!
MIT License
3.91k stars 615 forks source link

How do you specify region for aws fleet #759

Open rew1nter opened 8 months ago

rew1nter commented 8 months ago

Apparently, something like this doesn't work axiom-fleet named -r ap-south-1,ap-south-2,ap-southeast-1

0xtavian commented 8 months ago

Hey @rew1nter, so unfortunately aws does not automatically transfer the image to a region just because you requested the image in that region.

The providers that currently support round robin, region distribution and automatic image transfer currently are: DO. We had to add code specifically since they don’t automatically transfer the image https://github.com/pry0cc/axiom/blob/master/interact/axiom-fleet

We didn’t have to add code for Linode or IBM since they transfer the image automatically

azure is in the same boat as AWS, we need to add code the same way we did for DO to transfer the image.

So for AWS, you'll need to manually transfer the image to the new region and hope you can still reference the image by name. If not, we’ll have to add code to the AWS providers function file https://github.com/pry0cc/axiom/blob/master/providers/aws-functions.sh

If you want to figure out the cli commands to transfer an axiom image to the new region, I can try to integrate it.

rew1nter commented 8 months ago

My knowledge of the cloud is very basic. So It'd be really great if you could add the code for AWS like DO. I appreciate your time and effort

ethicalhackingplayground commented 7 months ago

I've been looking into this myself, I've programmed a function that can return the image_id based on the region you specify

get_image_id() {                                                                                                                                                                                                         
    region="$1"                                                                                                                                                                                                      
    images=$(aws ec2 describe-images --query 'Images[*]' --owners self --region $region)                                                                                                                             
    name=$(echo $images| jq -r '.[].Name' | tail -n 1)                                                                                                                                                               
    id=$(echo $image |  jq -r ".[] | select(.Name==\"$name\") | .ImageId")                                                                                                                                           
    echo $id                                                                                                                                                                                                 
} 

but it still isn't working correctly, I still get the following error:

The image id '[ami-fd9cecc7]' does not exist

I think it's because it's looking for the original image_id and when you copy the AMI to a different region the image ids are different, if the image_id was mutable then we might not have a problem but since they are immutable it's causing this problem, I'm sure there is a solution to this problem.