diff options
| author | Shulhan <ms@kilabit.info> | 2024-02-21 01:29:25 +0700 |
|---|---|---|
| committer | Shulhan <ms@kilabit.info> | 2024-02-21 01:34:56 +0700 |
| commit | 9ca138628023b926ddf07cbd2e93562b8e782cf6 (patch) | |
| tree | b2c4524d4ed5ebd7098ad69c2917ee49159e2d93 /_www/target.ts | |
| parent | 99999635f67931e1a6deb608f13b2dc2ecd9df73 (diff) | |
| download | gorankusu-9ca138628023b926ddf07cbd2e93562b8e782cf6.tar.xz | |
all: add global HTTP headers for Target
The Headers field on Target define the global headers that will be send
along with all HTTPTarget or WebSocketTarget.
The same header can also be defined on HTTPTarget that override the
value of Target.
Diffstat (limited to '_www/target.ts')
| -rw-r--r-- | _www/target.ts | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/_www/target.ts b/_www/target.ts index 26c15b2..9e637cc 100644 --- a/_www/target.ts +++ b/_www/target.ts @@ -9,6 +9,7 @@ import { loadTargetOptDuration, loadTargetOptRatePerSecond, loadTargetOptTimeout, + loadTargetHeader, loadTargetVar, } from "./functions.js"; import { @@ -90,6 +91,7 @@ export class Target { private generateContent(gorankusu: GorankusuInterface) { this.generateContentBaseURL(); this.generateContentAttackOptions(); + this.generateContentHeaders(); this.generateContentVars(); this.generateHTTPTargets(gorankusu); this.generateWebSocketTargets(gorankusu); @@ -179,6 +181,25 @@ export class Target { this.elContent.appendChild(wrapper); } + private generateContentHeaders() { + if (!this.opts.Headers) { + return; + } + + const wrapper = document.createElement("fieldset"); + + const legend = document.createElement("legend"); + legend.innerText = "Headers"; + wrapper.appendChild(legend); + + for (const [key, fi] of Object.entries(this.opts.Headers)) { + fi.value = loadTargetHeader(this.opts, key); + generateFormInput(wrapper, fi); + } + + this.elContent.appendChild(wrapper); + } + private generateContentVars() { if (!this.opts.Vars) { return; |
