{"id":17293029,"url":"https://github.com/macmod/cloudpersist","last_synced_at":"2026-05-09T17:37:36.624Z","repository":{"id":159861081,"uuid":"630601258","full_name":"Macmod/CloudPersist","owner":"Macmod","description":"A collection of simple scripts to achieve persistence quick in cloud environments without generating too much noise.","archived":false,"fork":false,"pushed_at":"2023-12-14T16:17:26.000Z","size":10,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-01T01:06:33.395Z","etag":null,"topics":["aws","azure","cloud","gcp","infosec","pentest","persistence","post-exploitation","redteam","security"],"latest_commit_sha":null,"homepage":"","language":"Shell","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/Macmod.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-04-20T18:25:56.000Z","updated_at":"2023-05-08T13:45:51.000Z","dependencies_parsed_at":"2023-12-14T17:43:34.710Z","dependency_job_id":null,"html_url":"https://github.com/Macmod/CloudPersist","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Macmod%2FCloudPersist","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Macmod%2FCloudPersist/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Macmod%2FCloudPersist/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Macmod%2FCloudPersist/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Macmod","download_url":"https://codeload.github.com/Macmod/CloudPersist/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245719437,"owners_count":20661263,"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","azure","cloud","gcp","infosec","pentest","persistence","post-exploitation","redteam","security"],"created_at":"2024-10-15T10:45:02.815Z","updated_at":"2026-05-09T17:37:31.582Z","avatar_url":"https://github.com/Macmod.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CloudPersist\n\nA collection of simple scripts to achieve persistence quick in cloud environments without generating too much noise.\n\n# Usage\n\n## AWS\n\nTo use the AWS scripts you must have [AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html) installed and authenticated (with `aws configure` for instance).\n\n### aws-create-iam-user\n\nCreates an IAM user with a login profile with the specified IAM policy.\nThis script will try to use the `AdministratorAccess` managed IAM policy by default, but you can also specify a custom policy ARN.\n\nExamples:\n```bash\n$ ./aws-create-iam-user.sh \"myuser\" \"mypassword\" \"arn:aws:iam::aws:policy/AmazonS3FullAccess\"\n$ ./aws-create-iam-user.sh \"myuser\" \"mypassword\" # Uses AdministratorAccess\n```\n\n### aws-create-access-key\n\nCreates an access key for the specified IAM user.\n\nExample:\n```\n$ ./aws-create-access-key myiamuser\n```\n\n## GCP\n\nTo use the GCP scripts you must have [GCP CLI](https://cloud.google.com/sdk/docs/install?hl=pt-br) installed and authenticated (with `gcloud init` or `gcloud auth login` for instance).\n\n### gcp-invite-account\n\nInvites a Google account to an existing GCP project using the specified role.\n\nIf a role is not specified, it'll try to use `roles/editor` by default.\n\nExamples:\n```bash\n$ ./gcp-invite-account.sh my-project-123 \"myemail@gmail.com\" \"roles/viewer\"\n$ ./gcp-invite-account.sh my-project-123 \"myemail@gmail.com\" # Uses roles/editor\n```\n\n### gcp-gce-exec-ssh\n\nRuns the specified script on a Google Compute Instance via SSH (no need to provide keys, they will be generated and inserted in the VM by `gcloud cli` automatically through the API).\n\nTo execute this script you must first obtain the name of your target VM (with `gcloud compute instances list` for example). Then run:\n```bash\n$ ./gcp-gce-exec-ssh.sh \"\u003cinstance name\u003e\" \"\u003ccommand to run\u003e\"\n```\n\n## Azure\n\nTo use the Azure scripts you must have [Azure CLI](https://learn.microsoft.com/pt-br/cli/azure/install-azure-cli) installed and authenticated (with `az login` for instance).\n\n### az-create-aad-user\n\nCreates a new user in Azure Active Directory using the specified role.\n\nIf a role is not specified, it'll try to use the `Owner` role for the current subscription by default.\n\nExamples:\n```bash\n$ ./az-create-aad-user.sh \"myemail@gmail.com\" \"mypassword\" \"myname\" \"Reader\"\n$ ./az-create-aad-user.sh \"myemail@gmail.com\" \"mypassword\" \"myname\" # Uses the \"Owner\" role by default\n```\n\n### az-create-aad-service-principal\n\nCreates a new service principal in Azure Active Directory using the specified role.\n\nIf a role is not specified, it'll try to use the `Owner` role for the current subscription by default.\n\nExamples:\n```bash\n$ ./az-create-aad-service-principal.sh \"myname\" \"Reader\" \"/subscriptions/\u003csubscription ID\u003e\"\n$ ./az-create-aad-service-principal.sh \"myname\" \"Reader\" # Uses the current subscription by default\n$ ./az-create-aad-service-principal.sh \"myname\" # Uses the \"Owner\" role of the current subscription by default\n```\n\n### az-vm-exec-runcommand\n\nRuns the specified Shell (unix)/PowerShell (windows) command on a list of VMs. Can be used to easily backdoor multiple VMs at once.\n\nTo execute this script you must first obtain the resource IDs for your target VMs (with `az vm list` for instance). Then specify them *separated with spaces and enclosed in quotes* in the 1st argument of the script:\n\n```bash\n$ ./az-vm-exec-runcommand.sh \"\u003cresource IDs\u003e\" \"\u003ccommand to run\u003e\" # For Shellscript\n$ ./az-vm-exec-runcommand.sh \"\u003cresource IDs\u003e\" \"\u003ccommand to run\u003e\" windows # For PowerShell\n```\n\nThe command to run can also be stored in a file and specified with an `@`. Example:\n\n```bash\n$ ./az-vm-exec-runcommand.sh \"/subscriptions/\u003cSUBSCRIPTIONID1\u003e/resourceGroups/\u003cRESOURCEGROUP1\u003e/providers/Microsoft.Compute/virtualMachines/\u003cVMNAME1\u003e /subscriptions/\u003cSUBSCRIPTIONID2\u003e/resourceGroups/\u003cRESOURCEGROUP2\u003e/providers/Microsoft.Compute/virtualMachines/\u003cVMNAME2\u003e\" @persistencescript.sh\n```\n\n# TODO\n* Add more options to existing scripts\n* Make powershell version of scripts\n* Test scripts more to make sure they're working properly\n* Idea - Execute persistence script in existing AWS EC2 / Azure VMs / GCP Compute Instances (similarly to T1525 but on running instances)\n* Idea - Provisioning of malicious event-triggered AWS Lambda/GCP Cloud Function/Azure Function (T1546)\n* Idea - Make scripts for persistence with cross-account sharing of resources\n* Idea - Long-term persistence by adding custom identity providers / custom signup flows (T1556)\n\n# License\nThe MIT License (MIT)\n\nCopyright (c) 2023 Artur Henrique Marzano Gonzaga\n\nPermission is hereby granted, free of charge, to any person\nobtaining a copy of this software and associated documentation\nfiles (the \"Software\"), to deal in the Software without\nrestriction, including without limitation the rights to use,\ncopy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the\nSoftware is furnished to do so, subject to the following\nconditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES\nOF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\nNONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\nHOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\nWHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\nFROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR\nOTHER DEALINGS IN THE SOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmacmod%2Fcloudpersist","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmacmod%2Fcloudpersist","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmacmod%2Fcloudpersist/lists"}