Skip to content

Instantly share code, notes, and snippets.

@MiranDaniel
Created March 31, 2022 08:42
Show Gist options
  • Save MiranDaniel/a1a6b1b7736316f6af376cc0135436e5 to your computer and use it in GitHub Desktop.
Save MiranDaniel/a1a6b1b7736316f6af376cc0135436e5 to your computer and use it in GitHub Desktop.
Kill all TryHackMe machines
fetch('/api/vm/running')
.then(r => r.json())
.then(vms =>
vms.forEach(vm =>
fetch('/api/vm/terminate', {
method: 'POST',
body: JSON.stringify({ code: vm.roomId }),
headers: {
'csrf-token': csrfToken,
'Content-Type': 'application/json'
}
})
)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment