{"id":18839329,"url":"https://github.com/andreswebs/kali-ec2-lab","last_synced_at":"2025-04-14T06:51:38.053Z","repository":{"id":124076692,"uuid":"264789638","full_name":"andreswebs/kali-ec2-lab","owner":"andreswebs","description":"Setup Kali Linux on an AWS EC2 instance and connect to it via RDP","archived":false,"fork":false,"pushed_at":"2023-03-02T16:11:52.000Z","size":17,"stargazers_count":2,"open_issues_count":0,"forks_count":5,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-27T20:40:26.347Z","etag":null,"topics":["aws","kali-linux","penetration-testing","security"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/andreswebs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-05-18T01:06:22.000Z","updated_at":"2025-03-25T01:18:12.000Z","dependencies_parsed_at":null,"dependency_job_id":"8e15de4e-1dc6-4a6a-ad01-d7e400c69777","html_url":"https://github.com/andreswebs/kali-ec2-lab","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreswebs%2Fkali-ec2-lab","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreswebs%2Fkali-ec2-lab/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreswebs%2Fkali-ec2-lab/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreswebs%2Fkali-ec2-lab/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/andreswebs","download_url":"https://codeload.github.com/andreswebs/kali-ec2-lab/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248837274,"owners_count":21169373,"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","kali-linux","penetration-testing","security"],"created_at":"2024-11-08T02:42:46.525Z","updated_at":"2025-04-14T06:51:38.045Z","avatar_url":"https://github.com/andreswebs.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Lab: Kali linux on EC2\n\nThis lab shows how to setup Kali Linux on an AWS EC2 instance and connect to it\nvia RDP.\n\n## Warning\n\nBefore going through this lab or doing any penetration testing in AWS, make sure\nyou read the\n[AWS Customer Support Policy for Penetration Testing](https://aws.amazon.com/security/penetration-testing/).\n\nRemember to clean up the created resources from your AWS account after this lab.\n\n## Pre-requisites\n\n- AWS CLI installed and configured with proper credentials.\n\n- An RDP client installed.\n\n- A subscription to the Kali Linux official AWS AMI on the\n  [AWS Marketplace](https://aws.amazon.com/marketplace) (search for \"Kali\n  Linux\").\n\n- Go to the product subscription page in the AWS Marketplace and find the AMI\n  ID. Save it for later.\n\n## Steps\n\n0. copy the example instance configuration:\n   ```sh\n   cp instance.example.json instance.json\n   ```\n\n1. edit the `instance.json` file to add the property:\n\n- `ImageId`: the Kali AMI ID (from **Pre-requisites**)\n- also remove the `DryRun` property\n\n2. set environment variables for the scripts:\n   ```sh\n   export SECURITY_GROUP_ALLOWED_CIDR=\"$(curl --silent checkip.amazonaws.com)/32\" \n   export SECURITY_GROUP_NAME=\"kali-lab\"\n   export SECURITY_GROUP_DESCRIPTION=\"Allow SSH and RDP traffic\"\n   export KEY_NAME=\"kali\"\n   ```\n\n3. create a security group:\n   ```sh\n   ./create-security-group\n   ```\n\n4. create a key pair:\n   ```sh\n   ./create-key-pair\n   ```\n\n5. create an EC2 instance:\n   ```sh\n   ./create-instance\n   ```\n\n6. find the instance ip:\n   ```sh\n   export INSTANCE_IP=$(./get-instance-ip)\n   ```\n\n7. connect to the instance via SSH:\n   ```sh\n   ./kali-ssh \"${INSTANCE_IP}\"\n   ```\n\n8. install a kali metapackage to get some tools:\n   ```sh\n   sudo apt install --yes kali-linux-headless\n   ```\n\n9. run the commands listed in [rdp-setup.md](rdp-setup.md)\n\n10. connect via RDP client through the public ip with the username and password\n    created in the previous step\n\n## Next Steps\n\nSet up some vulnerable infrastructure to test against !\n\nCheck out, for example, [AWSGoat](https://github.com/ine-labs/AWSGoat).\n\n## Clean Up\n\nGo to the AWS console and delete the resources created during the lab:\n\n- EC2 instance\n- SSH key pair\n- Security group\n\n## Author\n\n**Andre Silva** - [@andreswebs](https://github.com/andreswebs)\n\n## License\n\nThis project is licensed under the [Unlicense](UNLICENSE.md).\n\n## References\n\n\u003chttps://aws.amazon.com/security/penetration-testing/\u003e\n\n\u003chttps://www.kali.org/\u003e\n\n\u003chttps://remmina.org/\u003e\n\n\u003chttps://docs.aws.amazon.com/cli/latest/\u003e\n\n\u003chttps://docs.aws.amazon.com/cli/latest/userguide/cli-usage-skeleton.html\u003e\n\n\u003chttps://serverfault.com/questions/981763/how-do-i-set-user-data-when-using-the-aws-cli-cli-input-json-argument\u003e\n\n\u003chttps://www.onemarcfifty.com/blog/video/How-to-build-Kali-Linux-from-Debian/\u003e\n\n\u003chttps://www.kali.org/docs/cloud/aws/\u003e\n\n\u003chttps://www.kali.org/docs/general-use/xfce-with-rdp/\u003e\n\n\u003chttps://github.com/ine-labs/AWSGoat\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandreswebs%2Fkali-ec2-lab","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandreswebs%2Fkali-ec2-lab","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandreswebs%2Fkali-ec2-lab/lists"}