Add build minification and obfuscation

This commit is contained in:
alanfoster 2022-03-19 20:44:03 +00:00
parent 5a17c144e5
commit 9a4e9e1bb7
13 changed files with 90 additions and 38 deletions

4
.gitignore vendored
View File

@ -1 +1,5 @@
.netlify/
.parcel-cache/
dist/
node_modules/
package-lock.json

14
.parcelrc Normal file
View File

@ -0,0 +1,14 @@
{
"extends": "@parcel/config-default",
"transformers": {
// Leave jQuery/Bootstrap assets as-is, as they're already minified
"*jquery-3.5.1.slim.min.js": [],
"*bootstrap-4.5.2.min.js": [],
// Additionally 'obfuscate' files which may contain shell references
"*data.js": [
"...",
"parcel-transformer-obfuscation"
]
}
}

View File

@ -1 +0,0 @@
.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}}

View File

@ -1 +0,0 @@
[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)}

View File

@ -1 +0,0 @@
[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}}

View File

@ -10,9 +10,9 @@
<script src="assets/jquery-3.5.1.slim.min.js"></script>
<script src="assets/popper-1.16.1.min.js"></script>
<script src="assets/bootstrap-4.5.2.min.js"></script>
<link rel="stylesheet" href="css/dark-mode.min.css">
<link rel="stylesheet" href="css/light-mode.min.css">
<link rel="stylesheet" href="css/meme-mode.min.css">
<link rel="stylesheet" href="css/dark-mode.css">
<link rel="stylesheet" href="css/light-mode.css">
<link rel="stylesheet" href="css/meme-mode.css">
<meta name="description" content="Online Reverse Shell generator with Local Storage functionality, URI & Base64 Encoding, MSFVenom Generator, and Raw Mode. Great for CTFs." />
<meta name="title" content="Online - Reverse Shell Generator">
<!-- Open Graph / Facebook -->
@ -210,7 +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 Payload">
<img src="assets/floppy-disk-solid.svg" class="download-svg" data-toggle="tooltip" title="Download Payload">
</div>
<!-- /Show all advanced switch -->
@ -339,7 +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">
<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 -->
@ -392,7 +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">
<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 -->

View File

@ -467,3 +467,9 @@ const rsgData = {
if (typeof exports !== 'undefined') {
exports.rsgData = rsgData;
}
// Export for use within the browser
if (typeof window !== 'undefined') {
window.rsgData = rsgData;
window.CommandType = CommandType;
}

View File

@ -1,25 +0,0 @@
'''
Use this when you modified any css in the css/ folder.
'''
import os
try:
from csscompressor import compress
except ModuleNotFoundError:
os.system("python -m pip install csscompressor")
from csscompressor import compress
def main():
not_minified = [f"./css/{f}" for f in os.listdir("./css") if not f.endswith(".min.css")]
for file in not_minified:
print(file)
with open(file, "r") as input_file:
css_minified = compress(input_file.read())
with open(f"{file.replace('.css', '')}.min.css", "w") as output_file:
output_file.write(css_minified)
if __name__ == "__main__":
main()

View File

@ -1,6 +1,15 @@
[build]
functions = "server_functions"
[dev]
publish = "."
port = 8888
framework = "#static"
[context.production]
command = "npm run build"
publish = "./dist"
[[redirects]]
from = "/*"
to = "/.netlify/functions/raw"

15
package.json Normal file
View File

@ -0,0 +1,15 @@
{
"source": "index.html",
"scripts": {
"build": "rm -rf ./dist && ./node_modules/.bin/parcel build"
},
"targets": {
"default": {
"sourceMap": false
}
},
"devDependencies": {
"parcel": "2.3.2",
"parcel-transformer-obfuscation": "file:parcel-transformer-obfuscation"
}
}

View File

@ -0,0 +1 @@
This [Parcel](https://parceljs.org/) plugin aims to obfuscate JavaScript assets as part of the netlify build process.

View File

@ -0,0 +1,9 @@
{
"name": "parcel-transformer-obfuscation",
"version": "0.0.1",
"private": true,
"main": "src/index.js",
"engines": {
"parcel": "2.x"
}
}

View File

@ -0,0 +1,22 @@
const parcel = require('@parcel/plugin');
function base64(value) {
return Buffer.from(value).toString('base64');
}
module.exports = new parcel.Transformer({
loadConfig({ config, options }) {
return config
},
async transform({ asset, config, options, logger}) {
const source = await asset.getCode();
// Replace the asset with the 'obfuscated' script that will be evaluated on page load
const obfuscated_source = base64(source)
asset.setCode(`Function(atob("${obfuscated_source}"))();`);
asset.setMap(null);
return [asset];
}
});