Skip to content

Commit 194eda2

Browse files
committed
Add arguments to script and template to install tools
Add the optional arguments parameter to the install script and ISSUE templates. The wrapper install script must translate the parameter to parameter= because the value might contain - or --
1 parent 93ce8d3 commit 194eda2

File tree

5 files changed

+41
-6
lines changed

5 files changed

+41
-6
lines changed

.github/ISSUE_TEMPLATE/new_node_package.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,13 @@ body:
102102
label: Tool's description
103103
description: |
104104
The tool description should be short and not include version specific details or other information that is likely to change in a future version. Example: `Deobfuscator to remove common JS obfuscation techniques.`.
105+
- type: input
106+
id: arguments
107+
attributes:
108+
label: Arguments
109+
description: |
110+
Command-line arguments to pass to the tool when running it from the `Tools` directory. For example `--help`.
111+
value: --help
105112
- type: input
106113
id: dependencies
107114
attributes:

.github/ISSUE_TEMPLATE/new_package.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,13 @@ body:
134134
label: Download SHA256 Hash
135135
description: |
136136
SHA256 hash of the `.zip` file downloaded from the download url introduced in the previous field. The hash is used for verification purposes. Example: `62af5cce80dbbf5cdf961ec9515549334a2112056d4168fced75c892c24baa95 `
137+
- type: input
138+
id: arguments
139+
attributes:
140+
label: Arguments
141+
description: |
142+
Command-line arguments to pass to the tool when running it from the `Tools` directory. For example `--help`.
143+
value: --help
137144
- type: input
138145
id: dependencies
139146
attributes:

.github/ISSUE_TEMPLATE/new_python_tool_pip.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,13 @@ body:
102102
label: Tool's description
103103
description: |
104104
The tool description should be short and not include version specific details or other information that is likely to change in a future version. Example: `FakeNet-NG is a dynamic network analysis tool.`
105+
- type: input
106+
id: arguments
107+
attributes:
108+
label: Arguments
109+
description: |
110+
Command-line arguments to pass to the tool when running it from the `Tools` directory. For example `--help`.
111+
value: --help
105112
- type: input
106113
id: dependencies
107114
attributes:

scripts/utils/create_package_template.py

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,9 @@ def package_version(dependency_version):
107107
108108
$zipUrl = '{target_url}'
109109
$zipSha256 = '{target_hash}'
110+
$arguments = '{arguments}'
110111
111-
VM-Install-From-Zip $toolName $category $zipUrl -zipSha256 $zipSha256 -consoleApp ${console_app} -innerFolder ${inner_folder}
112+
VM-Install-From-Zip $toolName $category $zipUrl -zipSha256 $zipSha256 -consoleApp ${console_app} -innerFolder ${inner_folder} -arguments $arguments
112113
"""
113114

114115
"""
@@ -120,8 +121,9 @@ def package_version(dependency_version):
120121
121122
$toolName = '{tool_name}'
122123
$category = '{category}'
124+
$arguments = '{arguments}'
123125
124-
VM-Install-Node-Tool -toolName $toolName -category $category -arguments "--help"
126+
VM-Install-Node-Tool -toolName $toolName -category $category -arguments $arguments
125127
"""
126128

127129
"""
@@ -155,8 +157,9 @@ def package_version(dependency_version):
155157
156158
$exeUrl = '{target_url}'
157159
$exeSha256 = '{target_hash}'
160+
$arguments = '{arguments}'
158161
159-
VM-Install-Single-Exe $toolName $category $exeUrl -exeSha256 $exeSha256 -consoleApp ${console_app}
162+
VM-Install-Single-Exe $toolName $category $exeUrl -exeSha256 $exeSha256 -consoleApp ${console_app} -arguments $arguments
160163
"""
161164

162165
"""
@@ -200,8 +203,9 @@ def package_version(dependency_version):
200203
$toolName = '{tool_name}'
201204
$category = '{category}'
202205
$version = '=={version}'
206+
$arguments = '{arguments}'
203207
204-
VM-Install-With-Pip -toolName $toolName -category $category -version $version
208+
VM-Install-With-Pip -toolName $toolName -category $category -version $version -arguments $arguments
205209
"""
206210

207211
"""
@@ -267,6 +271,7 @@ def create_zip_exe_template(packages_path, **kwargs):
267271
target_hash=kwargs.get("target_hash"),
268272
console_app=kwargs.get("console_app"),
269273
inner_folder=kwargs.get("inner_folder"),
274+
arguments=kwargs.get("arguments"),
270275
)
271276

272277

@@ -281,6 +286,7 @@ def create_node_template(packages_path, **kwargs):
281286
description=kwargs.get("description"),
282287
tool_name=kwargs.get("tool_name"),
283288
category=kwargs.get("category"),
289+
arguments=kwargs.get("arguments"),
284290
)
285291

286292

@@ -311,6 +317,7 @@ def create_single_exe_template(packages_path, **kwargs):
311317
description=kwargs.get("description"),
312318
tool_name=kwargs.get("tool_name"),
313319
category=kwargs.get("category"),
320+
arguments=kwargs.get("arguments"),
314321
target_url=kwargs.get("target_url"),
315322
target_hash=kwargs.get("target_hash"),
316323
console_app=kwargs.get("console_app"),
@@ -358,6 +365,7 @@ def create_pip_template(packages_path, **kwargs):
358365
description=kwargs.get("description"),
359366
tool_name=kwargs.get("tool_name"),
360367
category=kwargs.get("category"),
368+
arguments=kwargs.get("arguments"),
361369
)
362370

363371
def create_template(
@@ -377,6 +385,7 @@ def create_template(
377385
dependency="",
378386
console_app="",
379387
inner_folder="",
388+
arguments="",
380389
):
381390
pkg_path = os.path.join(packages_path, f"{pkg_name}.vm")
382391
try:
@@ -408,6 +417,7 @@ def create_template(
408417
tool_name=tool_name,
409418
version=version,
410419
category=category,
420+
arguments=arguments,
411421
target_url=target_url,
412422
target_hash=target_hash,
413423
shim_path=shim_path,
@@ -470,6 +480,7 @@ def get_script_directory():
470480
"description",
471481
"tool_name",
472482
"category",
483+
"arguments",
473484
],
474485
},
475486
"SINGLE_EXE": {
@@ -486,6 +497,7 @@ def get_script_directory():
486497
"target_url",
487498
"target_hash",
488499
"console_app",
500+
"arguments",
489501
],
490502
},
491503
"SINGLE_PS1": {
@@ -529,6 +541,7 @@ def get_script_directory():
529541
"description",
530542
"tool_name",
531543
"category",
544+
"arguments",
532545
],
533546
},
534547
}
@@ -601,6 +614,7 @@ def main(argv=None):
601614
parser.add_argument("--shim_path", type=str, default="", help="Metapackage shim path")
602615
parser.add_argument("--console_app", type=str, default="false", choices=["false", "true"], help="The tool is a console application, the shortcut should run it with `cmd /K $toolPath --help` to be able to see the output.")
603616
parser.add_argument("--inner_folder", type=str, default="false", choices=["false", "true"], help="The ZIP file unzip to a single folder that contains all the tools.")
617+
parser.add_argument("--arguments", type=str, required=False, default="", help="Command-line arguments for the execution")
604618
args = parser.parse_args(args=argv)
605619

606620
if args.type is None:

scripts/utils/create_package_template_from_json.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ def main():
2525
for k, v in pkg.items():
2626
if k in ("why", "dependencies", "info"):
2727
continue
28-
cmd_args.append(f"--{k}")
29-
cmd_args.append(f"{v}")
28+
# Use "--argument=<value>" format to avoid issues with if the value contains "-"
29+
cmd_args.append(f"--{k}={v}")
3030

3131
create_package_template.main(cmd_args)
3232

0 commit comments

Comments
 (0)