From 58b4ebb68afa3c39691c11bcd5186cf98f2e2ab7 Mon Sep 17 00:00:00 2001 From: ESONHUGH <32677240+Esonhugh@users.noreply.github.com> Date: Sat, 22 Jul 2023 05:56:56 +0800 Subject: [PATCH] add docs - helper function: index and len (#156) * typo update * Add note to mention mandatory and optional fields * misc update * Update nuclei.md fixed a small typo * update docs helperfunction: index and len --------- Co-authored-by: Sandeep Singh Co-authored-by: sandeep <8293321+ehsandeep@users.noreply.github.com> Co-authored-by: shubhamrasal Co-authored-by: Pj Metz <65838556+MetzinAround@users.noreply.github.com> --- docs/templating-guide/helper-functions.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/templating-guide/helper-functions.md b/docs/templating-guide/helper-functions.md index c04b406a..36068be9 100644 --- a/docs/templating-guide/helper-functions.md +++ b/docs/templating-guide/helper-functions.md @@ -27,10 +27,11 @@ Here is the list of all supported helper functions can be used in the RAW reques | hmac(algorithm, data, secret) string | hmac function that accepts a hashing function type with data and secret | `hmac("sha1", "test", "scrt")` | `8856b111056d946d5c6c92a21b43c233596623c6` | | html_escape(input interface{}) string | HTML escapes the given input | `html_escape("test")` | `<body>test</body>` | | html_unescape(input interface{}) string | HTML un-escapes the given input | `html_unescape("<body>test</body>")` | `test` | +| index(stringOrSlice any, index int) string | receive string or []string return the string of the index | 1.`index(split("www.example.com", "."), 1)`
2.`index("www.example.com",1)` | 1.`example`



2.`w` | | join(separator string, elements ...interface{}) string | Joins the given elements using the specified separator | `join("_", 123, "hello", "world")` | `123_hello_world` | | json_minify(json) string | Minifies a JSON string by removing unnecessary whitespace | `json_minify("{ \"name\": \"John Doe\", \"foo\": \"bar\" }")` | `{"foo":"bar","name":"John Doe"}` | | json_prettify(json) string | Prettifies a JSON string by adding indentation | `json_prettify("{\"foo\":\"bar\",\"name\":\"John Doe\"}")` | `{\n \"foo\": \"bar\",\n \"name\": \"John Doe\"\n}` | -| len(arg interface{}) int | Returns the length of the input | `len("Hello")` | `5` | +| len(arg interface{}) int | Returns the length of the input | 1.`len("Hello") `
2. `len(split("www.example.com","."))` | 1. `5`

2. `3` | | line_ends_with(str string, suffix ...string) bool | Checks if any line of the string ends with any of the provided substrings | `line_ends_with("Hello\nHi", "lo")` | `true` | | line_starts_with(str string, prefix ...string) bool | Checks if any line of the string starts with any of the provided substrings | `line_starts_with("Hi\nHello", "He")` | `true` | | md5(input interface{}) string | Calculates the MD5 (Message Digest) hash of the input | `md5("Hello")` | `8b1a9953c4611296a827abf8c47804d7` |