{"id":15297366,"url":"https://github.com/totekuh/aws-kommandos","last_synced_at":"2026-01-05T16:45:43.603Z","repository":{"id":39649091,"uuid":"401120668","full_name":"totekuh/aws-kommandos","owner":"totekuh","description":"Adversary Infrastructure Setup Scripts","archived":false,"fork":false,"pushed_at":"2022-12-07T13:05:31.000Z","size":105,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-08T19:47:15.029Z","etag":null,"topics":["aws","aws-ec2","deploy","ec2","infrastructure","penetration-testing","python3","redteam"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/totekuh.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-08-29T19:03:00.000Z","updated_at":"2023-01-18T12:41:47.000Z","dependencies_parsed_at":"2023-01-24T17:17:05.216Z","dependency_job_id":null,"html_url":"https://github.com/totekuh/aws-kommandos","commit_stats":null,"previous_names":["derstolz/aws-kommandos"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/totekuh%2Faws-kommandos","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/totekuh%2Faws-kommandos/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/totekuh%2Faws-kommandos/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/totekuh%2Faws-kommandos/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/totekuh","download_url":"https://codeload.github.com/totekuh/aws-kommandos/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245467615,"owners_count":20620216,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aws","aws-ec2","deploy","ec2","infrastructure","penetration-testing","python3","redteam"],"created_at":"2024-09-30T19:16:55.733Z","updated_at":"2026-01-05T16:45:43.545Z","avatar_url":"https://github.com/totekuh.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# aws-kommandos\n\nAdvisory Infrastructure Setup Scripts\n\n## About\n\nHave you ever been bothered with setting up your C2 infrastructure on AWS prior to/during a red team engagement? Having\nto deal with logging in, configuring security groups, going through the process of creating DNS record sets and such?\n\nIf you hate doing this time after time and just wanna have a script that does everything for you - you've come to the\nright place.\n\nAWS Kommandos automates the process of creating cloud instances for various purposes - as C2 servers, for example. It\nalso helps you to manage your AWS console - from changing firewall rules and managing your SSH access keys to adjusting\nthe DNS record sets. All in one damn script.\n\nYou're only expected to create an AWS account and configure the access keys for running Kommandos locally.\n\nSee the Usage section for getting an idea how to use it.\n\nKommandos automatically creates its directory under the ~/.aws-kommandos path to store SSH private keys it creates.\n\n## Installation\n\n### Install the toolset\n\n```bash\napt install python3 python3-pip\npip3 install aws-kommandos\n```\n\nNote: if you experience problems with `pandas` after installing `aws-kommandos` via pip, try manually upgrading `pandas` by executing the following command:\n\n```bash\npip3 install --upgrade --force-reinstall pandas\n```\n\n### Configure the AWS credentials\n\nThe first option is to use the *awscli* client to configure your AWS credentials used by Kommandos.\n`aws configure`\n\nThe second options is to export the AWS credentials as environment variables\n```bash\nexport AWS_ACCESS_KEY_ID=key_id\nexport AWS_ACCESS_KEY_SECRET=secret\nexport AWS_REGION=region\n```\n\nThe third option is to use the command-line arguments to pass credentials to Kommandos\n`aws-kommandos --access-key-id \u003ckey_id\u003e --access-key-secret \u003csecret\u003e --region-name \u003cregion\u003e`\n\n## Usage\n\n### Print Kommandos options\n\n`aws-kommandos --help`\n\n`aws-kommandos -h`\n\n### Print AWS stats (instances, security groups, ssh keys, DNS hosted zones)\n\n`aws-kommandos --stats`\n\n### Print detailed AWS stats\n\n`aws-kommandos --stats --verbose`\n\n`aws-kommandos --stats -v`\n\n### Terminate all running EC2 instances\n\n```text\n╰$ aws-kommandos --terminate-all\nTerminating all running instances\nTerminating i-0df15af122876dd62\n```\n\n### Search AMI images\n\n```text\n╰$ aws-kommandos --search-ami \"ubuntu*server*20.04*\"\n{'CreationDate': '2021-07-27T16:45:08.000Z',\n 'ImageId': 'ami-06e715bf46b6caf71',\n 'State': 'available',\n 'Name': 'ubuntu-pro-server/images/hvm-ssd/ubuntu-focal-20.04-amd64-pro-serve-ae7ed378-8838-4fcf-842d-d1d09b34f116-ami-005f184e361f78579.4',\n 'ImageLocation': 'aws-marketplace/ubuntu-pro-server/images/hvm-ssd/ubuntu-focal-20.04-amd64-pro-serve-ae7ed378-8838-4fcf-842d-d1d09b34f116-ami-005f184e361f78579.4',\n 'Description': 'Canonical, Ubuntu Server Pro, 20.04 LTS, amd64 focal image '\n                'build on 2021-07-20',\n 'ImageOwnerAlias': 'aws-marketplace'}\n1 AMI images found\n```\n\n### Start a new instance (minimal configuration)\n\n```text\n╰$ aws-kommandos --security-group sg-66666666661488666 --start\nCreating a new SSH key pair: proxy-key\nThe SSH key pair with the name 'proxy-key' already exists\nStarting a new instance: ami-0746eb3cb5c684ae6 proxy-key sg-030abb524637009f3 t2.micro proxy-instance\nThe instance has been created\nWaiting for the server boot...\nThe server is up and running at 18.197.229.100\nWaiting until the SSH service is available...\nThe default user of the AMI 'ami-0746eb3cb5c684ae6' has been identified as 'ubuntu'\nUse the following command for connecting to the instance: ssh ubuntu@18.197.229.100 -i proxy-key.pem\n```\n\nOh, and did I mention that if you don't have an SSH access key the script automatically creates one for you?\nUse *--force-recreate-key* to force the script into creating a new key even if one with the same name exists.\n\n### Start a new instance and autoconfigure the DNS record sets\nThis command starts a new instance and uses the domain name supplied with the *--fqdn* argument \nto create A and MX record sets pointing to the IP address of the newly created EC2 instance.\n```text\n╰$ aws-kommandos --security-group sg-66666666661488666 --start --link-fqdn --fqdn virtualsquad.ninja\nCreating a new SSH key pair: proxy-key\nThe SSH key pair with the name 'proxy-key' already exists\nStarting a new instance: ami-0746eb3cb5c684ae6 proxy-key sg-030abb524637009f3 t2.micro proxy-instance\nThe instance has been created\nWaiting for the server boot...\nThe server is up and running at 18.184.218.238\nWaiting until the SSH service is available...\nThe default user of the AMI 'ami-0746eb3cb5c684ae6' has been identified as 'ubuntu'\nUse the following command for connecting to the instance: ssh ubuntu@18.184.218.238 -i proxy-key.pem\nA new record set virtualsquad.ninja. A 18.184.218.238 has been created\nA new record set virtualsquad.ninja. MX 1 18.184.218.238 has been created\n```\n\n### Create an inbound firewall rule\n```text\n╰$ aws-kommandos --security-group sg-66666666661488666 --allow-inbound 443/tcp:0.0.0.0/0         \nAuthorizing ingress '[443/tcp -\u003e 0.0.0.0/0] - ' on 'sg-66666666661488666'\nOperation performed successfully\n```\n\n### Revoke an inbound firewall rule\n```text\n╰$ aws-kommandos --security-group sg-66666666661488666 --delete-inbound 443/tcp:0.0.0.0/0\nRevoking ingress '[443/tcp -\u003e 0.0.0.0/0] - ' on 'sg-66666666661488666'\nOperation performed successfully\n```\n\n### Create an outbound firewall rule\n```text\n╰$ aws-kommandos --security-group sg-66666666661488666 --allow-outbound 443/tcp:0.0.0.0/0         \nAuthorizing egress '[443/tcp -\u003e 0.0.0.0/0] - ' on 'sg-66666666661488666'\nOperation performed successfully\n```\n\n### Revoke an outbound firewall rule\n```text\n╰$ aws-kommandos --security-group sg-66666666661488666 --delete-outbound 443/tcp:0.0.0.0/0\nRevoking egress '[443/tcp -\u003e 0.0.0.0/0] - ' on 'sg-66666666661488666'\nOperation performed successfully\n```\n\n### Create a security group w/o description\n```text\n╰$ aws-kommandos --create-security-group NinjaGroup                                         \nA new security group with the name 'NinjaGroup' has been created\n```\n\n### Create a security group w description\n```text\n╰$ aws-kommandos --create-security-group \"NinjaGroup: My Awesome Security Group\"\nA new security group with the name 'NinjaGroup' has been created\n```\n\n### Delete a security group\n```text\n╰$ aws-kommandos --delete-security-group --security-group-id sg-0b2d1b55354c531bd\nThe security group with id 'sg-0b2d1b55354c531bd' has been deleted\n```\n\n### Create a new A record set for domain\n```text\n╰$ aws-kommandos --fqdn virtualsquad.ninja --add-record --record-type A --record-value 55.55.55.55\nA new record set virtualsquad.ninja. A 55.55.55.55 has been created\n```\n\n### Delete a record set from domain\n```text\n╰$ aws-kommandos --fqdn virtualsquad.ninja --delete-record --record-type A --record-value 55.55.55.55\nThe record set virtualsquad.ninja. A 55.55.55.55 has been deleted\n```\n\nAnd many more! Please use --help to see what else you could do with Kommandos.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftotekuh%2Faws-kommandos","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftotekuh%2Faws-kommandos","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftotekuh%2Faws-kommandos/lists"}