mirror of
https://github.com/0dayCTF/reverse-shell-generator.git
synced 2024-12-18 10:56:10 +00:00
Merge pull request #80 from rohitkumarankam/main
Adding Download button to download payload files.
This commit is contained in:
commit
4576ff515e
1
assets/floppy-disk-solid.svg
Normal file
1
assets/floppy-disk-solid.svg
Normal file
@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--! Font Awesome Pro 6.0.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2022 Fonticons, Inc. --><path d="M433.1 129.1l-83.9-83.9C342.3 38.32 327.1 32 316.1 32H64C28.65 32 0 60.65 0 96v320c0 35.35 28.65 64 64 64h320c35.35 0 64-28.65 64-64V163.9C448 152.9 441.7 137.7 433.1 129.1zM224 416c-35.34 0-64-28.66-64-64s28.66-64 64-64s64 28.66 64 64S259.3 416 224 416zM320 208C320 216.8 312.8 224 304 224h-224C71.16 224 64 216.8 64 208v-96C64 103.2 71.16 96 80 96h224C312.8 96 320 103.2 320 112V208z"/></svg>
|
After Width: | Height: | Size: 633 B |
@ -109,6 +109,14 @@ h2 {
|
||||
animation: octocat-wave 560ms ease-in-out
|
||||
}
|
||||
|
||||
.download-svg {
|
||||
height: 20px;
|
||||
width: 20px;
|
||||
filter: invert(100%) sepia(0%) saturate(7497%) hue-rotate(347deg) brightness(103%) contrast(99%);
|
||||
}
|
||||
.download-svg:hover {
|
||||
filter: invert(100%) sepia(0%) saturate(7497%) hue-rotate(347deg) brightness(50%) contrast(99%);
|
||||
}
|
||||
@keyframes octocat-wave {
|
||||
0%, 100% {
|
||||
transform: rotate(0)
|
||||
|
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:bold;font-size:1em}.highlighted-warning{color:red;font-weight:bold}.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,0.75)}#reverse-shell-command{border:none !important;border-radius:5px;box-shadow:10px 10px 20px 0 rgba(0,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,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,0.75);background-color:#464646;max-height:20rem}#theme-selector{width:100px;height:30px;font-size:13px;margin-top:5px}.custom-select{background-color:#646464;color:white}.container{padding:10px;border-radius:20px;box-shadow:10px 0 20px 0 rgba(0,0,0,0.75);height:100% !important}h2{color:white;text-align:center}.pre-wrap{white-space:pre-wrap}.card-body{max-height:40rem}.list-group-item.active,.list-group-item-action:focus,.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}}
|
||||
.prompt-sign{position:absolute;top:25px;left:40px;pointer-events:none;font-size:1em}.highlighted-parameter{color:#426992;font-weight:bold;font-size:1em}.highlighted-warning{color:red;font-weight:bold}.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,0.75)}#reverse-shell-command{border:none !important;border-radius:5px;box-shadow:10px 10px 20px 0 rgba(0,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,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,0.75);background-color:#464646;max-height:20rem}#theme-selector{width:100px;height:30px;font-size:13px;margin-top:5px}.custom-select{background-color:#646464;color:white}.container{padding:10px;border-radius:20px;box-shadow:10px 0 20px 0 rgba(0,0,0,0.75);height:100% !important}h2{color:white;text-align:center}.pre-wrap{white-space:pre-wrap}.card-body{max-height:40rem}.list-group-item.active,.list-group-item-action:focus,.list-group-item-action:hover{background-color:#375a7f}.github-corner:hover .octo-arm{animation:octocat-wave 560ms ease-in-out}.download-svg{height:20px;width:20px;filter:invert(100%) sepia(0) saturate(7497%) hue-rotate(347deg) brightness(103%) contrast(99%)}.download-svg:hover{filter:invert(100%) sepia(0) saturate(7497%) hue-rotate(347deg) brightness(50%) contrast(99%)}@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}}
|
@ -175,7 +175,12 @@ Ain't got time for using CSS the right way. !important everything!
|
||||
[data-theme="light"] .card-body {
|
||||
max-height: 40rem;
|
||||
}
|
||||
|
||||
[data-theme="light"] .download-svg {
|
||||
filter: none;
|
||||
}
|
||||
[data-theme="light"] .download-svg:hover {
|
||||
filter: opacity(50%);
|
||||
}
|
||||
@font-face {
|
||||
font-family: "Comic Mono";
|
||||
src: url(../assets/ComicMono.ttf);
|
||||
|
2
css/light-mode.min.css
vendored
2
css/light-mode.min.css
vendored
@ -1 +1 @@
|
||||
[data-theme="light"]{background-color:#f6f6f6 !important}[data-theme="light"] .card{background-color:white !important;color:#000}[data-theme="light"] .bg-white{background-color:#ddd7d7 !important}[data-theme="light"] .bg-dark{background-color:#ecefff !important}[data-theme="light"] .rainbow{color:#000}[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:#c0c8f1;color:#000}[data-theme="light"] .btn{background-color:#1e63b8;color:#fff;border:0}[data-theme="light"] .highlighted-parameter{color:#7223b5;font-weight:bold;font-size:1em}[data-theme="light"] .highlighted-warning{color:red;font-weight:bold}[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(209,209,209,0.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(209,209,209,0.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(209,209,209,0.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(209,209,209,0.75);background-color:#2d8b87;color:#000;max-height:20rem}[data-theme="light"] .custom-select{background-color:#f2f2f2;color:#000;border-color:#e4e3e2}[data-theme="light"] .nav-link{color:#000;background:transparent;box-shadow:5px 5px 5px 0 rgba(209,209,209,0.75);border:0}[data-theme="light"] .nav-link:hover{background-color:#c0c8f1}[data-theme="light"] .nav-link.active{background-color:#1e63b8;color:#fff}[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:#ecefff;color:#000;border-color: #AAA}[data-theme="light"] .list-group-item.active{background-color:#586edd;border-color:#444}[data-theme="light"] .list-group-item:hover{background-color:#c0c8f1}[data-theme="light"] .list-group-item.hover{background-color:#c0c8f1}[data-theme="light"] .container{padding:10px;border-radius:20px;box-shadow:10px 0 20px 5px rgba(209,209,209,0.75);height:100% !important}[data-theme="light"] .card-title{color:#000 !important}[data-theme="light"] .custom-control-label{color:black}[data-theme="light"] h2{color:white;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)}
|
||||
[data-theme="light"]{background-color:#f6f6f6 !important}[data-theme="light"] .card{background-color:white !important;color:#000}[data-theme="light"] .bg-white{background-color:#ddd7d7 !important}[data-theme="light"] .bg-dark{background-color:#ecefff !important}[data-theme="light"] .rainbow{color:#000}[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:#c0c8f1;color:#000}[data-theme="light"] .btn{background-color:#1e63b8;color:#fff;border:0}[data-theme="light"] .highlighted-parameter{color:#7223b5;font-weight:bold;font-size:1em}[data-theme="light"] .highlighted-warning{color:red;font-weight:bold}[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(209,209,209,0.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(209,209,209,0.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(209,209,209,0.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(209,209,209,0.75);background-color:#2d8b87;color:#000;max-height:20rem}[data-theme="light"] .custom-select{background-color:#f2f2f2;color:#000;border-color:#e4e3e2}[data-theme="light"] .nav-link{color:#000;background:transparent;box-shadow:5px 5px 5px 0 rgba(209,209,209,0.75);border:0}[data-theme="light"] .nav-link:hover{background-color:#c0c8f1}[data-theme="light"] .nav-link.active{background-color:#1e63b8;color:#fff}[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:#ecefff;color:#000;border-color:#AAA}[data-theme="light"] .list-group-item.active{background-color:#586edd;border-color:#444}[data-theme="light"] .list-group-item:hover{background-color:#c0c8f1}[data-theme="light"] .list-group-item.hover{background-color:#c0c8f1}[data-theme="light"] .container{padding:10px;border-radius:20px;box-shadow:10px 0 20px 5px rgba(209,209,209,0.75);height:100% !important}[data-theme="light"] .card-title{color:#000 !important}[data-theme="light"] .custom-control-label{color:black}[data-theme="light"] h2{color:white;text-align:center}[data-theme="light"] .pre-wrap{white-space:pre-wrap}[data-theme="light"] .card-body{max-height:40rem}[data-theme="light"] .download-svg{filter:none}[data-theme="light"] .download-svg:hover{filter:opacity(50%)}@font-face{font-family:"Comic Mono";src:url(../assets/ComicMono.ttf)}
|
@ -179,6 +179,9 @@ Ain't got time for using CSS the right way. !important everything!
|
||||
max-height: 40rem;
|
||||
}
|
||||
|
||||
[data-theme="meme"] .download-svg:hover {
|
||||
filter: opacity(70%);
|
||||
}
|
||||
@font-face {
|
||||
font-family: "Comic Mono";
|
||||
src: url(../assets/ComicMono.ttf);
|
||||
|
2
css/meme-mode.min.css
vendored
2
css/meme-mode.min.css
vendored
@ -1 +1 @@
|
||||
[data-theme="meme"]{background-color:pink !important}[data-theme="meme"] .card{background-color:#af8bad !important;color:#000}[data-theme="meme"] .bg-white{background-color:#ddd7d7 !important}[data-theme="meme"] .bg-dark{background-color:#e7d4e0 !important}[data-theme="meme"] .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="meme"] .prompt-sign{position:absolute;top:25px;left:40px;pointer-events:none;font-size:1em;color:#2e3e86}[data-theme="meme"] .input-group-text{background-color:#f1c6ce;color:#000}[data-theme="meme"] .btn{background-color:#a56096;color:#000;border-color:#a56096}[data-theme="meme"] .highlighted-parameter{color:#7223b5;font-weight:bold;font-size:1em}[data-theme="meme"] .highlighted-warning{color:red;font-weight:bold}[data-theme="meme"] .custom-switch label{cursor:pointer;user-select:none}[data-theme="meme"] .custom-control-input:checked~.custom-control-label::before{background-color:#7223b5}[data-theme="meme"] #listener-command{border:none !important;border-radius:5px;box-shadow:10px 10px 20px 0 rgba(153,28,143,0.75);background-color:#2d8b87;color:#000}[data-theme="meme"] #reverse-shell-command{border:none !important;border-radius:5px;box-shadow:10px 10px 20px 0 rgba(153,28,143,0.75);background-color:#2d8b87;color:#000;max-height:20rem}[data-theme="meme"] #bind-shell-command{border:none !important;border-radius:5px;box-shadow:10px 10px 20px 0 rgba(153,28,143,0.75);background-color:#2d8b87;color:#000;max-height:20rem}[data-theme="meme"] #msfvenom-command{border:none !important;border-radius:5px;box-shadow:10px 10px 20px 0 rgba(153,28,143,0.75);background-color:#2d8b87;color:#000;max-height:20rem}[data-theme="meme"] .custom-select{background-color:#f1c6ce;color:#000;border-color:#a56096}[data-theme="meme"] .nav-link{color:#000;background:transparent;box-shadow:5px 5px 5px 0 rgba(153,28,143,0.75)}[data-theme="meme"] .nav-link:hover{background-color:#7223b5}[data-theme="meme"] .nav-link.active{background-color:#a56096;color:#000}[data-theme="meme"] .custom-control-input:checked{color:#000}[data-theme="meme"] a{background-color:#f1c6ce;color:#000}[data-theme="meme"] .list-group-item{background-color:#f1c6ce;color:#000}[data-theme="meme"] .list-group-item.active{background-color:#a56096;border-color:#000}[data-theme="meme"] .list-group-item:hover{background-color:#a56096}[data-theme="meme"] .list-group-item.hover{background-color:rgba(153,28,143,0.75)}[data-theme="meme"] .container{padding:10px;border-radius:20px;box-shadow:10px 0 20px 0 rgba(153,28,143,0.75);height:100% !important}[data-theme="meme"] .card-title{color:#000 !important}[data-theme="meme"] .custom-control-label{color:black}[data-theme="meme"] h2{color:white;text-align:center}[data-theme="meme"] .pre-wrap{white-space:pre-wrap}[data-theme="meme"] .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:CadetBlue}40%{color:yellow}50%{color:coral}60%{color:green}70%{color:cyan}80%{color:DeepPink}90%{color:DodgerBlue}100%{color:orange}}@-ms-keyframes rainbow{0%{color:orange}10%{color:purple}20%{color:red}30%{color:CadetBlue}40%{color:yellow}50%{color:coral}60%{color:green}70%{color:cyan}80%{color:DeepPink}90%{color:DodgerBlue}100%{color:orange}}@keyframes rainbow{0%{color:orange}10%{color:purple}20%{color:red}30%{color:CadetBlue}40%{color:yellow}50%{color:coral}60%{color:green}70%{color:cyan}80%{color:DeepPink}90%{color:DodgerBlue}100%{color:orange}}
|
||||
[data-theme="meme"]{background-color:pink !important}[data-theme="meme"] .card{background-color:#af8bad !important;color:#000}[data-theme="meme"] .bg-white{background-color:#ddd7d7 !important}[data-theme="meme"] .bg-dark{background-color:#e7d4e0 !important}[data-theme="meme"] .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="meme"] .prompt-sign{position:absolute;top:25px;left:40px;pointer-events:none;font-size:1em;color:#2e3e86}[data-theme="meme"] .input-group-text{background-color:#f1c6ce;color:#000}[data-theme="meme"] .btn{background-color:#a56096;color:#000;border-color:#a56096}[data-theme="meme"] .highlighted-parameter{color:#7223b5;font-weight:bold;font-size:1em}[data-theme="meme"] .highlighted-warning{color:red;font-weight:bold}[data-theme="meme"] .custom-switch label{cursor:pointer;user-select:none}[data-theme="meme"] .custom-control-input:checked~.custom-control-label::before{background-color:#7223b5}[data-theme="meme"] #listener-command{border:none !important;border-radius:5px;box-shadow:10px 10px 20px 0 rgba(153,28,143,0.75);background-color:#2d8b87;color:#000}[data-theme="meme"] #reverse-shell-command{border:none !important;border-radius:5px;box-shadow:10px 10px 20px 0 rgba(153,28,143,0.75);background-color:#2d8b87;color:#000;max-height:20rem}[data-theme="meme"] #bind-shell-command{border:none !important;border-radius:5px;box-shadow:10px 10px 20px 0 rgba(153,28,143,0.75);background-color:#2d8b87;color:#000;max-height:20rem}[data-theme="meme"] #msfvenom-command{border:none !important;border-radius:5px;box-shadow:10px 10px 20px 0 rgba(153,28,143,0.75);background-color:#2d8b87;color:#000;max-height:20rem}[data-theme="meme"] .custom-select{background-color:#f1c6ce;color:#000;border-color:#a56096}[data-theme="meme"] .nav-link{color:#000;background:transparent;box-shadow:5px 5px 5px 0 rgba(153,28,143,0.75)}[data-theme="meme"] .nav-link:hover{background-color:#7223b5}[data-theme="meme"] .nav-link.active{background-color:#a56096;color:#000}[data-theme="meme"] .custom-control-input:checked{color:#000}[data-theme="meme"] a{background-color:#f1c6ce;color:#000}[data-theme="meme"] .list-group-item{background-color:#f1c6ce;color:#000}[data-theme="meme"] .list-group-item.active{background-color:#a56096;border-color:#000}[data-theme="meme"] .list-group-item:hover{background-color:#a56096}[data-theme="meme"] .list-group-item.hover{background-color:rgba(153,28,143,0.75)}[data-theme="meme"] .container{padding:10px;border-radius:20px;box-shadow:10px 0 20px 0 rgba(153,28,143,0.75);height:100% !important}[data-theme="meme"] .card-title{color:#000 !important}[data-theme="meme"] .custom-control-label{color:black}[data-theme="meme"] h2{color:white;text-align:center}[data-theme="meme"] .pre-wrap{white-space:pre-wrap}[data-theme="meme"] .card-body{max-height:40rem}[data-theme="meme"] .download-svg:hover{filter:opacity(70%)}@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:CadetBlue}40%{color:yellow}50%{color:coral}60%{color:green}70%{color:cyan}80%{color:DeepPink}90%{color:DodgerBlue}100%{color:orange}}@-ms-keyframes rainbow{0%{color:orange}10%{color:purple}20%{color:red}30%{color:CadetBlue}40%{color:yellow}50%{color:coral}60%{color:green}70%{color:cyan}80%{color:DeepPink}90%{color:DodgerBlue}100%{color:orange}}@keyframes rainbow{0%{color:orange}10%{color:purple}20%{color:red}30%{color:CadetBlue}40%{color:yellow}50%{color:coral}60%{color:green}70%{color:cyan}80%{color:DeepPink}90%{color:DodgerBlue}100%{color:orange}}
|
@ -210,6 +210,7 @@
|
||||
style="padding-top:2px" data-toggle="tooltip" title="Display all advanced settings">
|
||||
Show Advanced
|
||||
</label>
|
||||
<img src="/assets/floppy-disk-solid.svg" class="download-svg" data-toggle="tooltip" title="Download Shell Code">
|
||||
</div>
|
||||
<!-- /Show all advanced switch -->
|
||||
|
||||
@ -308,6 +309,7 @@
|
||||
<label for="auto-copy-switch" class="custom-control-label small pr-2 pb-1"
|
||||
style="padding-top: 2px">Auto-copy</label>
|
||||
</div> -->
|
||||
|
||||
<!-- Raw button -->
|
||||
<button type="button" class="raw-listener btn btn-primary float-right mr-3"
|
||||
data-toggle="tooltip" title="View raw">
|
||||
@ -337,6 +339,7 @@
|
||||
<div class="tab-pane" id="bind" role="tabpanel" aria-labelledby="bind-tab">
|
||||
<div class="card shadow mb-5">
|
||||
<div class="card-body">
|
||||
<img src="/assets/floppy-disk-solid.svg" class="download-svg float-right" data-toggle="tooltip" title="Download Shell Code">
|
||||
<div class="card-text mt-4">
|
||||
<div class="row">
|
||||
<!-- Left column: Bind selection -->
|
||||
@ -389,6 +392,7 @@
|
||||
<div class="tab-pane" id="msfvenom" role="tabpanel" aria-labelledby="msfvenom-tab">
|
||||
<div class="card shadow mb-5">
|
||||
<div class="card-body">
|
||||
<img src="/assets/floppy-disk-solid.svg" class="download-svg float-right" data-toggle="tooltip" title="Download Shell Code">
|
||||
<div class="card-text mt-4">
|
||||
<div class="row">
|
||||
<!-- Left column: MSFVenom selection -->
|
||||
|
821
js/script.js
821
js/script.js
@ -1,454 +1,467 @@
|
||||
|
||||
// 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");
|
||||
// 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'
|
||||
};
|
||||
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("#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("#reverse-tab").addEventListener("click", () => {
|
||||
rsg.setState({
|
||||
commandType: CommandType.ReverseShell,
|
||||
});
|
||||
})
|
||||
|
||||
document.querySelector("#bind-tab").addEventListener("click", () => {
|
||||
rsg.setState({
|
||||
commandType: CommandType.BindShell,
|
||||
encoding: "None"
|
||||
});
|
||||
})
|
||||
document.querySelector("#bind-tab").addEventListener("click", () => {
|
||||
rsg.setState({
|
||||
commandType: CommandType.BindShell,
|
||||
encoding: "None"
|
||||
});
|
||||
})
|
||||
|
||||
document.querySelector("#bind-tab").addEventListener("click", () => {
|
||||
document.querySelector("#bind-shell-selection").innerHTML = "";
|
||||
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,
|
||||
encoding: "None"
|
||||
});
|
||||
});
|
||||
document.querySelector("#msfvenom-tab").addEventListener("click", () => {
|
||||
document.querySelector("#msfvenom-selection").innerHTML = "";
|
||||
rsg.setState({
|
||||
commandType: CommandType.MSFVenom,
|
||||
encoding: "None"
|
||||
});
|
||||
});
|
||||
|
||||
var rawLinkButtons = document.querySelectorAll('.raw-listener');
|
||||
for (const button of rawLinkButtons) {
|
||||
button.addEventListener("click", () => {
|
||||
const rawLink = RawLink.generate(rsg);
|
||||
window.location = rawLink;
|
||||
});
|
||||
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;
|
||||
}
|
||||
|
||||
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);
|
||||
});
|
||||
if (!filter) {
|
||||
return true;
|
||||
}
|
||||
|
||||
const query = new URLSearchParams(location.hash.substring(1));
|
||||
if (filter === FilterType.All) {
|
||||
return true;
|
||||
}
|
||||
|
||||
const rsg = {
|
||||
ip: query.get('ip') || localStorage.getItem('ip') || '10.10.10.10',
|
||||
port: query.get('port') || localStorage.getItem('port') || 9001,
|
||||
payload: query.get('payload') || localStorage.getItem('payload') || 'windows/x64/meterpreter/reverse_tcp',
|
||||
shell: query.get('shell') || localStorage.getItem('shell') || rsgData.shells[0],
|
||||
listener: query.get('listener') || localStorage.getItem('listener') || rsgData.listenerCommands[0][1],
|
||||
encoding: query.get('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,
|
||||
return item.meta.includes(filter);
|
||||
});
|
||||
}
|
||||
|
||||
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'
|
||||
}
|
||||
},
|
||||
const query = new URLSearchParams(location.hash.substring(1));
|
||||
|
||||
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')
|
||||
}
|
||||
},
|
||||
const rsg = {
|
||||
ip: query.get('ip') || localStorage.getItem('ip') || '10.10.10.10',
|
||||
port: query.get('port') || localStorage.getItem('port') || 9001,
|
||||
payload: query.get('payload') || localStorage.getItem('payload') || 'windows/x64/meterpreter/reverse_tcp',
|
||||
shell: query.get('shell') || localStorage.getItem('shell') || rsgData.shells[0],
|
||||
listener: query.get('listener') || localStorage.getItem('listener') || rsgData.listenerCommands[0][1],
|
||||
encoding: query.get('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,
|
||||
|
||||
escapeHTML: (text) => String(text).replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>'),
|
||||
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'
|
||||
}
|
||||
},
|
||||
|
||||
getIP: () => rsg.ip,
|
||||
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')
|
||||
}
|
||||
},
|
||||
|
||||
getPort: () => Number(rsg.port),
|
||||
escapeHTML: (text) => String(text).replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>'),
|
||||
|
||||
getShell: () => rsg.shell,
|
||||
getIP: () => rsg.ip,
|
||||
|
||||
getEncoding: () => rsg.encoding,
|
||||
getPort: () => Number(rsg.port),
|
||||
|
||||
getSelectedCommandName: () => {
|
||||
return rsg.selectedValues[rsg.commandType];
|
||||
},
|
||||
getShell: () => rsg.shell,
|
||||
|
||||
getReverseShellCommand: () => {
|
||||
const reverseShellData = rsgData.reverseShellCommands.find((item) => item.name === rsg.getSelectedCommandName());
|
||||
return reverseShellData.command;
|
||||
},
|
||||
getEncoding: () => rsg.encoding,
|
||||
|
||||
getPayload: () => {
|
||||
if (rsg.commandType === 'MSFVenom') {
|
||||
let cmd = rsg.getReverseShellCommand();
|
||||
// msfvenom -p windows/x64/meterpreter_reverse_tcp ...
|
||||
let regex = /\s+-p\s+(?<payload>[a-zA-Z0-9/_]+)/;
|
||||
let match = regex.exec(cmd);
|
||||
if (match) {
|
||||
return match.groups.payload;
|
||||
}
|
||||
}
|
||||
getSelectedCommandName: () => {
|
||||
return rsg.selectedValues[rsg.commandType];
|
||||
},
|
||||
|
||||
return 'windows/x64/meterpreter/reverse_tcp'
|
||||
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(toBinary(payload))
|
||||
function toBinary(string) {
|
||||
const codeUnits = new Uint16Array(string.length);
|
||||
for (let i = 0; i < codeUnits.length; i++) {
|
||||
codeUnits[i] = string.charCodeAt(i);
|
||||
}
|
||||
const charCodes = new Uint8Array(codeUnits.buffer);
|
||||
let result = '';
|
||||
for (let i = 0; i < charCodes.byteLength; i++) {
|
||||
result += String.fromCharCode(charCodes[i]);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
} else {
|
||||
command = rsg.getReverseShellCommand()
|
||||
}
|
||||
|
||||
const encoding = rsg.getEncoding();
|
||||
if (encoding === 'Base64') {
|
||||
command = rsg.insertParameters(command, (text) => text)
|
||||
command = btoa(command)
|
||||
} else {
|
||||
function encoder(string) {
|
||||
return (encoding === 'encodeURI' || encoding === 'encodeURIComponent') ? window[
|
||||
encoding](string) : string
|
||||
}
|
||||
|
||||
command = rsg.escapeHTML(command);
|
||||
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}'), 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())
|
||||
command = command.replace('{ip}', rsg.getIP())
|
||||
command = command.replace('{payload}', rsg.getPayload())
|
||||
|
||||
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')
|
||||
getPayload: () => {
|
||||
if (rsg.commandType === 'MSFVenom') {
|
||||
let cmd = rsg.getReverseShellCommand();
|
||||
// msfvenom -p windows/x64/meterpreter_reverse_tcp ...
|
||||
let regex = /\s+-p\s+(?<payload>[a-zA-Z0-9/_]+)/;
|
||||
let match = regex.exec(cmd);
|
||||
if (match) {
|
||||
return match.groups.payload;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Init
|
||||
*/
|
||||
rsg.init();
|
||||
return 'windows/x64/meterpreter/reverse_tcp'
|
||||
|
||||
},
|
||||
|
||||
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(toBinary(payload))
|
||||
function toBinary(string) {
|
||||
const codeUnits = new Uint16Array(string.length);
|
||||
for (let i = 0; i < codeUnits.length; i++) {
|
||||
codeUnits[i] = string.charCodeAt(i);
|
||||
}
|
||||
const charCodes = new Uint8Array(codeUnits.buffer);
|
||||
let result = '';
|
||||
for (let i = 0; i < charCodes.byteLength; i++) {
|
||||
result += String.fromCharCode(charCodes[i]);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
} else {
|
||||
command = rsg.getReverseShellCommand()
|
||||
}
|
||||
|
||||
const encoding = rsg.getEncoding();
|
||||
if (encoding === 'Base64') {
|
||||
command = rsg.insertParameters(command, (text) => text)
|
||||
command = btoa(command)
|
||||
} else {
|
||||
function encoder(string) {
|
||||
return (encoding === 'encodeURI' || encoding === 'encodeURIComponent') ? window[
|
||||
encoding](string) : string
|
||||
}
|
||||
|
||||
command = rsg.escapeHTML(command);
|
||||
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();
|
||||
},
|
||||
|
||||
/*
|
||||
* Event handlers/functions
|
||||
*/
|
||||
ipInput.addEventListener("input", (e) => {
|
||||
rsg.setState({
|
||||
ip: e.target.value
|
||||
})
|
||||
insertParameters: (command, encoder) => {
|
||||
return command
|
||||
.replaceAll(encoder('{ip}'), 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;
|
||||
});
|
||||
|
||||
portInput.addEventListener("input", (e) => {
|
||||
rsg.setState({
|
||||
port: Number(e.target.value)
|
||||
})
|
||||
const shellOptions = shellSelect.querySelectorAll(".shell-option");
|
||||
shellOptions.forEach((option) => {
|
||||
option.selected = rsg.shell === option.value;
|
||||
});
|
||||
|
||||
listenerSelect.addEventListener("change", (e) => {
|
||||
rsg.setState({
|
||||
listener: e.target.value
|
||||
})
|
||||
const encodingOptions = encodingSelect.querySelectorAll("option");
|
||||
encodingOptions.forEach((option) => {
|
||||
option.selected = rsg.encoding === option.value;
|
||||
});
|
||||
|
||||
shellSelect.addEventListener("change", (e) => {
|
||||
rsg.setState({
|
||||
shell: e.target.value
|
||||
})
|
||||
});
|
||||
ipInput.value = rsg.ip;
|
||||
portInput.value = rsg.port;
|
||||
},
|
||||
|
||||
encodingSelect.addEventListener("change", (e) => {
|
||||
rsg.setState({
|
||||
encoding: e.target.value
|
||||
})
|
||||
});
|
||||
updateTabList: () => {
|
||||
const data = rsgData.reverseShellCommands;
|
||||
const filteredItems = filterCommandData(
|
||||
data,
|
||||
{
|
||||
filter: rsg.filter,
|
||||
commandType: rsg.commandType
|
||||
}
|
||||
);
|
||||
|
||||
document.querySelector('#inc-port').addEventListener('click', () => {
|
||||
rsg.setState({
|
||||
port: rsg.getPort() + 1
|
||||
})
|
||||
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);
|
||||
})
|
||||
|
||||
document.querySelector('#listener-advanced-switch').addEventListener('change', rsg.updateSwitchStates);
|
||||
document.querySelector('#revshell-advanced-switch').addEventListener('change', rsg.updateSwitchStates);
|
||||
const listSelectionSelector = rsg.uiElements[rsg.commandType].listSelection;
|
||||
document.querySelector(listSelectionSelector).replaceChildren(documentFragment)
|
||||
},
|
||||
|
||||
setInterval(rsg.updateSwitchStates, 500) // fix switch changes in rapid succession
|
||||
updateListenerCommand: () => {
|
||||
const privilegeWarning = document.querySelector("#port-privileges-warning");
|
||||
let command = listenerSelect.value;
|
||||
command = rsg.highlightParameters(command)
|
||||
command = command.replace('{port}', rsg.getPort())
|
||||
command = command.replace('{ip}', rsg.getIP())
|
||||
command = command.replace('{payload}', rsg.getPayload())
|
||||
|
||||
document.querySelector('#copy-listener').addEventListener('click', () => {
|
||||
rsg.copyToClipboard(listenerCommand.innerText)
|
||||
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
|
||||
})
|
||||
});
|
||||
|
||||
document.querySelector('#copy-reverse-shell-command').addEventListener('click', () => {
|
||||
rsg.copyToClipboard(reverseShellCommand.innerText)
|
||||
})
|
||||
portInput.addEventListener("input", (e) => {
|
||||
rsg.setState({
|
||||
port: Number(e.target.value)
|
||||
})
|
||||
});
|
||||
|
||||
document.querySelector('#copy-bind-shell-command').addEventListener('click', () => {
|
||||
rsg.copyToClipboard(bindShellCommand.innerText)
|
||||
})
|
||||
listenerSelect.addEventListener("change", (e) => {
|
||||
rsg.setState({
|
||||
listener: e.target.value
|
||||
})
|
||||
});
|
||||
|
||||
document.querySelector('#copy-msfvenom-command').addEventListener('click', () => {
|
||||
rsg.copyToClipboard(msfVenomCommand.innerText)
|
||||
})
|
||||
shellSelect.addEventListener("change", (e) => {
|
||||
rsg.setState({
|
||||
shell: e.target.value
|
||||
})
|
||||
});
|
||||
|
||||
// autoCopySwitch.addEventListener("change", () => {
|
||||
// setLocalStorage(autoCopySwitch, "auto-copy", "checked");
|
||||
// });
|
||||
encodingSelect.addEventListener("change", (e) => {
|
||||
rsg.setState({
|
||||
encoding: e.target.value
|
||||
})
|
||||
});
|
||||
|
||||
// Popper tooltips
|
||||
$(function () {
|
||||
$('[data-toggle="tooltip"]').tooltip()
|
||||
});
|
||||
document.querySelector('#inc-port').addEventListener('click', () => {
|
||||
rsg.setState({
|
||||
port: rsg.getPort() + 1
|
||||
})
|
||||
})
|
||||
|
||||
// TODO: add a random fifo for netcat mkfifo
|
||||
//let randomId = Math.random().toString(36).substring(2, 4);
|
||||
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)
|
||||
})
|
||||
|
||||
var downloadButton = document.querySelectorAll(".download-svg");
|
||||
for (const Dbutton of downloadButton) {
|
||||
Dbutton.addEventListener("click", () => {
|
||||
var element = document.createElement('a');
|
||||
const rawLink = RawLink.generate(rsg);
|
||||
element.setAttribute('href', rawLink);
|
||||
element.setAttribute('download', rsg.getSelectedCommandName());
|
||||
document.body.appendChild(element);
|
||||
element.click();
|
||||
document.body.removeChild(element);
|
||||
});
|
||||
}
|
||||
|
||||
// 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