Skip to content

Instantly share code, notes, and snippets.

@butlerallenj
Last active April 6, 2020 13:07
Show Gist options
  • Save butlerallenj/b17937b5b42ba172e8ea9f40ef58b1ff to your computer and use it in GitHub Desktop.
Save butlerallenj/b17937b5b42ba172e8ea9f40ef58b1ff to your computer and use it in GitHub Desktop.
Prevent Hack The Box users from reseting machines you are currently working on with a little bit of javascript and your browser console!
/*
* Description: Use this script to cancel resets issued to the specified machine
* on Hack The Box. Must be run in the browser console, just change
* the variable "machine" to the Machine name you would like to
* stop resets to. Copy/Paste into your browser on the Shoutbox
* page, and hack all the things!
*/
// Set your machine name here
var machine = 'Valentine';
var shouts = document.getElementById('shouts');
var last = shouts.children[shouts.children.length -1].innerText;
var token = document.getElementById('postShoutIcon').parentElement.attributes[0].nodeValue.split("'")[1];
function CancelHost(id) {
return sleep(4000).then(() => {
shoutEmojiArea[0].emojioneArea.setText(`/cancel ${id}`);
postShout(20, token);
console.log("[!] Reset Canceled!");
});
}
function sleep (time) {
return new Promise((resolve) => setTimeout(resolve, time));
}
function validate() {
sleep(500).then(() => {
console.log("[+] Checking for resets on: " + machine);
var last = shouts.children[shouts.children.length -1].innerText;
if(last.includes('reset on')) {
var host = last.split('reset on ')[1].split(' ')[0];
if (host == machine) {
var id = last.split('/cancel ')[1].split(' ')[0];
CancelHost(id);
}
}
validate();
})
}
validate();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment