|
12 | 12 | ContextVariableUtil,
|
13 | 13 | )
|
14 | 14 | from .const import (
|
| 15 | + DETECT_MODE_FAST, |
15 | 16 | CALLBACK_PREPARE_FULLPAYLOADGEN,
|
16 | 17 | CALLBACK_GENERATE_FULLPAYLOAD,
|
17 | 18 | STRING,
|
@@ -299,7 +300,6 @@ def prepare_extra_context_vars(self, append_targets: Union[List, None] = None):
|
299 | 300 | continue
|
300 | 301 | self.added_extra_context_vars.add(target)
|
301 | 302 |
|
302 |
| - |
303 | 303 | def add_context_variable(
|
304 | 304 | self,
|
305 | 305 | payload: str,
|
@@ -352,13 +352,15 @@ def generate_with_tree(
|
352 | 352 | assert self.payload_gen is not None, "when prepared, we should have payload_gen"
|
353 | 353 | assert isinstance(self.outer_pattern, str)
|
354 | 354 |
|
355 |
| - # 添加一系列值为字符串的变量,需要从生成目标中取出需要生成的字符串 |
356 |
| - extra_strings = [] |
357 |
| - if gen_type == OS_POPEN_READ: |
358 |
| - extra_strings = [args[0]] |
359 |
| - elif gen_type == EVAL and args[0][0] == STRING: |
360 |
| - extra_strings = [args[0][1]] |
361 |
| - self.prepare_extra_context_vars(extra_strings) |
| 355 | + # 在生成模式不是快速时生成一系列的字符串变量以减少嵌套括号 |
| 356 | + if self.options != DETECT_MODE_FAST: |
| 357 | + # 添加一系列值为字符串的变量,需要从生成目标中取出需要生成的字符串 |
| 358 | + extra_strings = [] |
| 359 | + if gen_type == OS_POPEN_READ: |
| 360 | + extra_strings = [args[0]] |
| 361 | + elif gen_type == EVAL and args[0][0] == STRING: |
| 362 | + extra_strings = [args[0][1]] |
| 363 | + self.prepare_extra_context_vars(extra_strings) |
362 | 364 |
|
363 | 365 | logger.info("Start generating final expression...")
|
364 | 366 |
|
|
0 commit comments