-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathExample.py
More file actions
65 lines (57 loc) · 4.1 KB
/
Example.py
File metadata and controls
65 lines (57 loc) · 4.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# ----------------------------------------------------------------- #
# Here is an example script to create your own plugin for the tool. #
# ----------------------------------------------------------------- #
from Config.Utils import * # Imports all elements defined in Config.Utils, making them directly accessible in the current module.
def Register(): # Main plugin execution function. (Required)
return {
"name" : "%NAME%", # Name displayed in the menu.
"description": "%DESCRIPTION%", # Description displayed in the menu.
"function" : Run, # Function executed when the tool is called.
"arguments" : { # CLI arguments automatically handled by argparse. (Leave blank if needed)
# Required argument examples for correct functioning:
# ----------------------------------------------------------------------------------------
# * Option : "required": True / False
# * Description : Makes the argument required or not.
# ----------------------------------------------------------------------------------------
# * Option : "type": int / float / str
# * Description : Automatically converts the value to the specified type.
# ----------------------------------------------------------------------------------------
# * Option : "help": "%TEXT%"
# * Description : Text displayed in CLI help to explain the argument.
# ----------------------------------------------------------------------------------------
# Optional argument examples:
# ----------------------------------------------------------------------------------------
# * Option : "nargs": 1
# * Description : The argument must contain exactly 1 value.
# ----------------------------------------------------------------------------------------
# * Option : "nargs": "+"
# * Description : The argument must contain at least 1 value.
# ----------------------------------------------------------------------------------------
# * Option : "nargs": "?"
# * Description : The argument can contain 0 or 1 value.
# ----------------------------------------------------------------------------------------
# * Option : "nargs": "*"
# * Description : The argument can contain 0, 1, or multiple values.
# ----------------------------------------------------------------------------------------
# * Option : "choices": ["%CHOICE_1%", "%CHOICE_2%", "%CHOICE_3%"]
# * Description : Restricts allowed values to a predefined list.
# ----------------------------------------------------------------------------------------
# * Option : "default": "%VALUE%"
# * Description : Sets a default value if the argument is not provided.
# ----------------------------------------------------------------------------------------
# * Option : "action": "store_true"
# * Description : Converts the argument into a boolean. (True if present, False otherwise)
# Example:
"url" : {"required": True, "type": str, "help": "Target: <url>"},
"method" : {"required": False, "type": str, "help": "HTTP method: GET / POST / HEAD", "default": "GET", "choices": ["GET", "POST", "HEAD"]},
"timeout": {"required": False, "type": float, "help": "timeout in seconds: <timeout>", "default": 5},
}
}
def Run(url=None, method=None, timeout=None): # Function used to execute the plugin.
Title("%NAME%") # Add a title to the command window.
# The arguments must also be accessible through interactive inputs so the script can be executed without using the command line.
# Example:
if not url : url = input("URL -> ")
if not method : method = input("Method -> ")
if not timeout: timeout = float(input("Timeout -> "))
pass # Your script..