diff --git a/for-developers/writing-tasks/integrating-an-external-command/README.md b/for-developers/writing-tasks/integrating-an-external-command/README.md index ecdc348..baa4c4c 100644 --- a/for-developers/writing-tasks/integrating-an-external-command/README.md +++ b/for-developers/writing-tasks/integrating-an-external-command/README.md @@ -66,6 +66,18 @@ secator x mytool TARGET # will run mytool -u TARGET secator x mytool TXT_FILE # will run mytool -l TXT_FILE ``` +#### Important Note on Command Availability + +Ensure that the external command you are integrating is callable within your system's `PATH`. For example, a file located at `/opt/tools/testssl.sh/testssl.sh` **will not** work unless properly added to your `PATH`. + +To verify if your command is callable, you can run: + +```bash +which [command] +``` + +If it returns the path to your command, then it is available and can be used with secator. If not, you will need to update your PATH or move the file to a directory that is already included in your PATH. + ### Parsing a command's output Now that you have a basic implementation working, you need to convert your command's output into structured output (JSON). @@ -116,6 +128,23 @@ secator x mytool -t tag1,tag2 -dbg -d 5 TARGET # short option forma mytool --include-tags tag1,tag2 --debug --delay 5000 -u TARGET ``` +{% hint style="warning" %} +All keys in `opts` must be in lowercase. If you need to support an uppercase option, follow these steps : + +1. Define the option in opts using a lowercase key: +```py +opts = { + 'my_upper_cas_option':{'type':str, 'shor':'P', 'help': 'Products'} +} +``` +2. Map the lowercase key to its corresponding uppercase option using `opt_key_map`: +```py +opt_key_map = { + 'my_upper_cas_option': 'P' +} +``` +{% endhint %} + *** ### Adding an install command \[optional] @@ -190,7 +219,7 @@ class mytool(Command, HTTPFuzzer): USER_AGENT: 'user-agent', # my tool specific options - 'tags': 'include-tags', + 'tags': 'include-tags', } opt_value_map = { 'delay': lambda x: x * 1000 # convert seconds to milliseconds @@ -258,6 +287,30 @@ mytool \ -u TARGET ``` +However, if your tool doesn’t fit into one of `secator`'s built-in command categories, you can define the `meta` options yourself. + +For example, let's say we want to support only `HEADER` and `PROXY` options for our tool: + +```py +from secator.definitions import HEADER, METHOD +from secator.tasks._categories import OPTS + +@task() +class mytool(Command): + ... + opt_key_map = { + # HTTPFuzzer options mapping + HEADER: 'H', + PROXY: 'x' + } + meta_opts = { + HEADER: OPTS[HEADER], + PROXY: OPTS[PROXY], + } +``` + +With this configuration, you can use your tool with `-method` and `-proxie` options + *** ### Supporting proxies \[optional] diff --git a/for-developers/writing-workflows.md b/for-developers/writing-workflows.md index fa1af46..8f5f8fe 100644 --- a/for-developers/writing-workflows.md +++ b/for-developers/writing-workflows.md @@ -36,6 +36,30 @@ tasks: *** +### Finding the Original Workflow Files + +The original YAML workflow files provided by secator are located in the installed library directory, typically under: + +``` +**/python3.11/site-packages/secator/configs/workflows/*.yaml +``` + +To locate these files on your system, you can use the following command: + +```bash +find / -type f -path "*/secator/configs/workflows/*" -name "*.yaml" +``` + +This command will search your filesystem for YAML files under the `secator/configs/workflows` path. + +### Adding Your Own Workflows + +You can add your custom workflows by placing their YAML files in: + +* `~/.secator/templates/` (or whatever your `dirs.templates` in [configuration.md](../../../getting-started/configuration.md "mention") points to) + +This allows you to extend the functionality of secator without modifying the original library files, making it easier to manage updates and custom configurations. + ## Dynamic targets You can specify dynamic targets for tasks from current run results, by using the `targets_` key in your template like: