Task Module

Description

The new task module has the power to automate ShenCode by chaining commands. With the improved V2 JSON scheme, you are able to use modules more than once in a task file.

Command

shencode core task [-h] [-i INPUT]
 
options:
  -h, --help   show this help message and exit
  -i, --input  Input task file

Build a task

To build a task, you have create a JSON file, which holds the arguments for the needed modules. All needed arguments can be found here: ShenCode Wiki

{
    "name": "Getting started example Task",
    "scheme": "V2",
    "single_step": null,
    "tasks": [
        {
            "id": "1",
            "module": "winexec",
            "args":
            {
                "command_line": "cmd /k net user",
                "output": "netuser.bin",
                "debug": false,
                "random_label": false
            },
            "input_buffer": false,
            "return_buffer": false
        },
        {
            "id": "2",
            "module": "alphanum",
            "args": {
                "input": "netuser.bin",
                "output": "netuser_encoded.bin",
                "compile": true,
                "decode": false
            },
            "input_buffer": false,
            "return_buffer": false
        },
        {
            "id": "3",
            "module": "output",
            "args": {
                "input": "netuser_encoded.bin",
                "syntax": "inspect",
                "bytes_per_row": 16,
                "decimal": true,
                "lines": null,
                "no_line_break": false,
                "range": [0, 0],
                "output": null
            },
            "input_buffer": false,
            "return_buffer": false
        }
    ]
}

Example output

shencode core task -i bytebert.json
[TASKS-V2]-[0.2.0]
 
[*] Task file ok
[*] Starting Task: Test Modules
 
[*] Executing step Task 1: winexec
 
 
[WinEXEC]-[0.1.6]
 
[*] Try to generate shellcode
[*] Compiling object file
[*] Extract .text section from object file
[*] Writing to file netuser.bin
[+] File netuser.bin created
[+] Size 305 bytes
[+] Hash: 50434b67ef99430db24f90807129dfbf2a678193
[+] DONE!
 
[*] Executing step Task 2: alphanum
 
 
[AlphaNum]-[0.2.1]
 
[*] Try to open file netuser.bin
[+] File netuser.bin loaded
[+] Size of shellcode 305 bytes
[+] Hash: 50434b67ef99430db24f90807129dfbf2a678193
[*] Encoder running...
100%|███████████████████████████████████████████████████████████████████████████| 305/305 [00:00<00:00, 2276268.19it/s]
[*] Writing to file netuser_encoded.bin
[+] File netuser_encoded.bin created
[+] Size 686 bytes
[+] Hash: 2590029836f8ab19be13f155f59566f7aaf37d6c
[+] DONE!
 
 
[*] Executing step Task 3: output
 
 
[MODOUT]-[0.2.6]
 
[*] Input File: netuser_encoded.bin
[#] File Hash: 2590029836f8ab19be13f155f59566f7aaf37d6c
[*] processing shellcode format... NoLineBreak: False
 
Offset(d) 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15
00000000: 4d 29 c0 4d 31 db 48 31 ff 48 29 f6 4d 29 d2 eb
00000016: 36 41 58 4d 89 c2 66 41 bb 31 01 4d 85 db 74 2c
...
00000656: 45 69 49 64 4d 65 44 69 45 69 49 64 4d 65 42 69
00000672: 45 69 49 64 4d 65 41 69 46 6e 4d 64 4d 64
 
[#] Total length: 686 bytes
[+] DONE!
 
 
[+] Task DONE!