From f75ea5a4c45e370d168760983bf1c9b296d54324 Mon Sep 17 00:00:00 2001 From: prodigysml Date: Sat, 8 Apr 2023 12:32:36 +1000 Subject: [PATCH 1/5] added in safe target --- Interlace/lib/core/input.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/Interlace/lib/core/input.py b/Interlace/lib/core/input.py index f8bef43..c1c28d9 100644 --- a/Interlace/lib/core/input.py +++ b/Interlace/lib/core/input.py @@ -113,12 +113,16 @@ class InputHelper(object): @staticmethod def _replace_target_variables_in_commands(tasks, str_targets, ipset_targets): + def starts_and_ends_with(string, character): + return string[0] == character and string[-1] == character TARGET_VAR = "_target_" HOST_VAR = "_host_" CLEANTARGET_VAR = "_cleantarget_" + SAFE_TARGET = "_safe-target_" for task in tasks: command = task.name() - if TARGET_VAR in command or HOST_VAR in command: + print(command) + if TARGET_VAR in command or HOST_VAR in command or SAFE_TARGET in command: for dirty_target in itertools.chain(str_targets, ipset_targets): yielded_task = task.clone() dirty_target = str(dirty_target) @@ -129,6 +133,13 @@ class InputHelper(object): dirty_target.replace("http://", "").replace( "https://", "").rstrip("/").replace("/", "-"), ) + + if SAFE_TARGET in command: + if (starts_and_ends_with(dirty_target, "'")) or (starts_and_ends_with(dirty_target, '"')): + pass + else: + dirty_target = f"'{dirty_target}'" + yielded_task.replace(SAFE_TARGET, dirty_target) yield yielded_task elif CLEANTARGET_VAR in command: for dirty_target in itertools.chain(str_targets, ipset_targets): From 6661a4ca23f0a7b3442e87e7eaa6b6fc0e3197e1 Mon Sep 17 00:00:00 2001 From: prodigysml Date: Sat, 8 Apr 2023 12:33:05 +1000 Subject: [PATCH 2/5] removed debugs --- Interlace/lib/core/input.py | 1 - 1 file changed, 1 deletion(-) diff --git a/Interlace/lib/core/input.py b/Interlace/lib/core/input.py index c1c28d9..4a04ea6 100644 --- a/Interlace/lib/core/input.py +++ b/Interlace/lib/core/input.py @@ -121,7 +121,6 @@ class InputHelper(object): SAFE_TARGET = "_safe-target_" for task in tasks: command = task.name() - print(command) if TARGET_VAR in command or HOST_VAR in command or SAFE_TARGET in command: for dirty_target in itertools.chain(str_targets, ipset_targets): yielded_task = task.clone() From 52f6631c3bca5e5a16611b4051d59b47ed8204e7 Mon Sep 17 00:00:00 2001 From: prodigysml Date: Sat, 8 Apr 2023 12:33:39 +1000 Subject: [PATCH 3/5] removed unnecessary imports --- Interlace/lib/core/input.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/Interlace/lib/core/input.py b/Interlace/lib/core/input.py index 4a04ea6..a3b1efc 100644 --- a/Interlace/lib/core/input.py +++ b/Interlace/lib/core/input.py @@ -1,8 +1,6 @@ import functools import itertools import os.path -import socket -import struct import sys from argparse import ArgumentParser from io import TextIOWrapper From 74fdb5349438faedd3c1f017f3e09a4f5238a191 Mon Sep 17 00:00:00 2001 From: prodigysml Date: Sat, 8 Apr 2023 12:33:52 +1000 Subject: [PATCH 4/5] version increment --- Interlace/lib/core/__version__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Interlace/lib/core/__version__.py b/Interlace/lib/core/__version__.py index 71e0d8e..2015c15 100644 --- a/Interlace/lib/core/__version__.py +++ b/Interlace/lib/core/__version__.py @@ -1 +1 @@ -__version__ = '1.9.7' +__version__ = '1.9.8' From 575582e5702070e101f6040ff3cafecb15bf1706 Mon Sep 17 00:00:00 2001 From: prodigysml Date: Sat, 8 Apr 2023 12:36:03 +1000 Subject: [PATCH 5/5] added in doco --- README.md | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 77a995f..cb5be1d 100644 --- a/README.md +++ b/README.md @@ -73,16 +73,17 @@ Alternatively, you can pass targets in via STDIN and neither -t or -tL will be r # Variable Replacements The following variables will be replaced in commands at runtime: -| Variable | Replacement | -|-----------|-------------------------------------------------------------------------| -| \_target\_ | Replaced with the expanded target list that the current thread is running against | -| \_cleantarget\_ | Replaced with target cleanded from http:// or https:// | -| \_host\_ | Works the same as \_target\_, and can be used interchangeably | -| \_output\_ | Replaced with the output folder variable from Interlace | -| \_port\_ | Replaced with the expanded port variable from Interlace | -| \_realport\_ | Replaced with the real port variable from Interlace | -| \_proxy\_ | Replaced with the proxy list from Interlace | -| \_random\_ | Replaced with the randomly chosen file from Interlace | +| Variable | Replacement | +|-----------------|---------------------------------------------------------------------------------------| +| \_target\_ | Replaced with the expanded target list that the current thread is running against | +| \_cleantarget\_ | Replaced with target cleaned from http:// or https:// | +| \_safe-target\_ | Replaced with target automatically quoting for commands, stopping subcommands running | +| \_host\_ | Works the same as \_target\_, and can be used interchangeably | +| \_output\_ | Replaced with the output folder variable from Interlace | +| \_port\_ | Replaced with the expanded port variable from Interlace | +| \_realport\_ | Replaced with the real port variable from Interlace | +| \_proxy\_ | Replaced with the proxy list from Interlace | +| \_random\_ | Replaced with the randomly chosen file from Interlace | # Advanced Command File Usage Interlace also makes the use of two additional features for controlling execution flow within a command file: `_blocker_` and `_block:_`. Blockers prevent execution of commands listed after them, until all commands before them have completed, and blocks can be used to force sequential execution of commands listed within a block, for a target.