Merge pull request #9 from 0dayCTF/more-hacks

save shell in lS
This commit is contained in:
briskets 2021-03-08 23:23:37 -05:00 committed by GitHub
commit 9f8b7a93e9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -342,7 +342,8 @@
rsgData.shells.forEach(function (shell, i) {
$('#shell').append($('<option>', {
text: shell,
selected: i === 0
selected: i === 0,
class: 'shell-option',
}))
})
},
@ -460,7 +461,11 @@
/*
* Event handlers
*/
$('#shell, #encoding').on('change', rsg.updateReverseShellCommand);
$('#shell, #encoding').on('change', function()
{
rsg.updateReverseShellCommand();
setLocalStorage(shellSelect, "shell", "value");
})
$('#inc-port').on('click', function () {
$('#port').val(rsg.getPort() + 1);
@ -485,6 +490,7 @@
const listenerSelect = document.querySelector("#listener-selection");
const ipInput = document.querySelector("#ip");
const portInput = document.querySelector("#port");
const shellSelect = document.querySelector("#shell");
const autoCopySwitch = document.querySelector("#auto-copy-switch");
/**
@ -516,7 +522,12 @@
element[attribute] = isChecked;
}
if (element.nodeName === "SELECT") {
if (element.class === "SELECT") {
const selectedItem = options.find(option => option[attribute] === localStorage.getItem(key));
selectedItem.selected = true;
}
if (element.id === "shell") {
const selectedItem = options.find(option => option[attribute] === localStorage.getItem(key));
selectedItem.selected = true;
}
@ -534,6 +545,13 @@
rsg.updateListenerCommand();
}, 500);
setTimeout(() => {
const shellOptions = shellSelect.querySelectorAll(".shell-option");
prepopulateElement("shell", shellSelect, "value", [...shellOptions]);
rsg.updateReverseShellCommand();
}, 500);
prepopulateElement("ip", ipInput, "value");
prepopulateElement("port", portInput, "value");
prepopulateElement("auto-copy", autoCopySwitch, "checked");
@ -559,6 +577,14 @@
setLocalStorage(selectedItem, "listener", "value");
});
shellSelect.addEventListener("change", () => {
rsg.updateReverseShellSelection();
const shellOptions = shellSelect.querySelectorAll(".shell-option");
const selectedItem = [...shellOptions].find(option => option.selected);
setLocalStorage(selectedItem, "shell", "value");
});
autoCopySwitch.addEventListener("change", () => {
setLocalStorage(autoCopySwitch, "auto-copy", "checked");
});