mirror of https://github.com/daffainfo/nuclei.git
test: extra DSL function test cases
parent
04e7e053de
commit
9fd9892f49
|
@ -16,57 +16,65 @@ requests:
|
||||||
04: {{base64_py("Hello")}}
|
04: {{base64_py("Hello")}}
|
||||||
05: {{concat("Hello", "world")}}
|
05: {{concat("Hello", "world")}}
|
||||||
06: {{contains("Hello", "lo")}}
|
06: {{contains("Hello", "lo")}}
|
||||||
07: {{generate_java_gadget("commons-collections3.1", "wget http://{{interactsh-url}}", "base64")}}
|
07: {{date_time("%Y-%M-%D")}}
|
||||||
08: {{gzip("Hello")}}
|
08: {{date_time("%Y-%M-%D", unix_time())}}
|
||||||
09: {{hex_decode("6161")}}
|
09: {{date_time("%H-%m")}}
|
||||||
10: {{hex_encode("aa")}}
|
10: {{date_time("02-01-2006 15:04")}}
|
||||||
11: {{html_escape("<body>test</body>")}}
|
11: {{date_time("02-01-2006 15:04", unix_time())}}
|
||||||
12: {{html_unescape("<body>test</body>")}}
|
12: {{generate_java_gadget("commons-collections3.1", "wget http://{{interactsh-url}}", "base64")}}
|
||||||
13: {{len("Hello")}}
|
13: {{gzip("Hello")}}
|
||||||
14: {{len(5555)}}
|
14: {{hex_decode("6161")}}
|
||||||
15: {{md5("Hello")}}
|
15: {{hex_encode("aa")}}
|
||||||
16: {{md5(1234)}}
|
16: {{hmac("sha1", "test", "scrt")}}
|
||||||
17: {{mmh3("Hello")}}
|
17: {{hmac("sha256", "test", "scrt")}}
|
||||||
18: {{print_debug(1+2, "Hello")}}
|
18: {{html_escape("<body>test</body>")}}
|
||||||
19: {{rand_base(5, "abc")}}
|
19: {{html_unescape("<body>test</body>")}}
|
||||||
20: {{rand_base(5, "")}}
|
20: {{join("_", "hello", "world")}}
|
||||||
21: {{rand_base(5)}}
|
21: {{len("Hello")}}
|
||||||
22: {{rand_char("abc")}}
|
22: {{len(5555)}}
|
||||||
23: {{rand_char("")}}
|
23: {{md5("Hello")}}
|
||||||
24: {{rand_char()}}
|
24: {{md5(1234)}}
|
||||||
25: {{rand_int(1, 10)}}
|
25: {{mmh3("Hello")}}
|
||||||
26: {{rand_int(10)}}
|
26: {{print_debug(1+2, "Hello")}}
|
||||||
27: {{rand_int()}}
|
27: {{rand_base(5, "abc")}}
|
||||||
28: {{rand_ip("192.168.0.0/24")}}
|
28: {{rand_base(5, "")}}
|
||||||
29: {{rand_ip("2002:c0a8::/24")}}
|
29: {{rand_base(5)}}
|
||||||
30: {{rand_ip("192.168.0.0/24","10.0.100.0/24")}}
|
30: {{rand_char("abc")}}
|
||||||
31: {{rand_text_alpha(10, "abc")}}
|
31: {{rand_char("")}}
|
||||||
32: {{rand_text_alpha(10, "")}}
|
32: {{rand_char()}}
|
||||||
33: {{rand_text_alpha(10)}}
|
33: {{rand_int(1, 10)}}
|
||||||
34: {{rand_text_alphanumeric(10, "ab12")}}
|
34: {{rand_int(10)}}
|
||||||
35: {{rand_text_alphanumeric(10)}}
|
35: {{rand_int()}}
|
||||||
36: {{rand_text_numeric(10, 123)}}
|
36: {{rand_ip("192.168.0.0/24")}}
|
||||||
37: {{rand_text_numeric(10)}}
|
37: {{rand_ip("2002:c0a8::/24")}}
|
||||||
38: {{regex("H([a-z]+)o", "Hello")}}
|
38: {{rand_ip("192.168.0.0/24","10.0.100.0/24")}}
|
||||||
39: {{remove_bad_chars("abcd", "bc")}}
|
39: {{rand_text_alpha(10, "abc")}}
|
||||||
40: {{repeat("a", 5)}}
|
40: {{rand_text_alpha(10, "")}}
|
||||||
41: {{replace("Hello", "He", "Ha")}}
|
41: {{rand_text_alpha(10)}}
|
||||||
42: {{replace_regex("He123llo", "(\\d+)", "")}}
|
42: {{rand_text_alphanumeric(10, "ab12")}}
|
||||||
43: {{reverse("abc")}}
|
43: {{rand_text_alphanumeric(10)}}
|
||||||
44: {{sha1("Hello")}}
|
44: {{rand_text_numeric(10, 123)}}
|
||||||
45: {{sha256("Hello")}}
|
45: {{rand_text_numeric(10)}}
|
||||||
46: {{to_lower("HELLO")}}
|
46: {{regex("H([a-z]+)o", "Hello")}}
|
||||||
47: {{to_upper("hello")}}
|
47: {{remove_bad_chars("abcd", "bc")}}
|
||||||
48: {{trim("aaaHelloddd", "ad")}}
|
48: {{repeat("a", 5)}}
|
||||||
49: {{trim_left("aaaHelloddd", "ad")}}
|
49: {{replace("Hello", "He", "Ha")}}
|
||||||
50: {{trim_prefix("aaHelloaa", "aa")}}
|
50: {{replace_regex("He123llo", "(\\d+)", "")}}
|
||||||
51: {{trim_right("aaaHelloddd", "ad")}}
|
51: {{reverse("abc")}}
|
||||||
52: {{trim_space(" Hello ")}}
|
52: {{sha1("Hello")}}
|
||||||
53: {{trim_suffix("aaHelloaa", "aa")}}
|
53: {{sha256("Hello")}}
|
||||||
54: {{unix_time(10)}}
|
54: {{to_lower("HELLO")}}
|
||||||
55: {{url_decode("https:%2F%2Fprojectdiscovery.io%3Ftest=1")}}
|
55: {{to_upper("hello")}}
|
||||||
56: {{url_encode("https://projectdiscovery.io/test?a=1")}}
|
56: {{trim("aaaHelloddd", "ad")}}
|
||||||
57: {{wait_for(1)}}
|
57: {{trim_left("aaaHelloddd", "ad")}}
|
||||||
|
58: {{trim_prefix("aaHelloaa", "aa")}}
|
||||||
|
59: {{trim_right("aaaHelloddd", "ad")}}
|
||||||
|
60: {{trim_space(" Hello ")}}
|
||||||
|
61: {{trim_suffix("aaHelloaa", "aa")}}
|
||||||
|
62: {{unix_time(10)}}
|
||||||
|
63: {{url_decode("https:%2F%2Fprojectdiscovery.io%3Ftest=1")}}
|
||||||
|
64: {{url_encode("https://projectdiscovery.io/test?a=1")}}
|
||||||
|
65: {{wait_for(1)}}
|
||||||
|
|
||||||
extractors:
|
extractors:
|
||||||
- type: regex
|
- type: regex
|
||||||
|
|
|
@ -256,7 +256,7 @@ func (h *httpDSLFunctions) Execute(filePath string) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
totalExtracted := strings.Split(submatch[1], ",")
|
totalExtracted := strings.Split(submatch[1], ",")
|
||||||
numberOfDslFunctions := 57
|
numberOfDslFunctions := 65
|
||||||
if len(totalExtracted) != numberOfDslFunctions {
|
if len(totalExtracted) != numberOfDslFunctions {
|
||||||
return errors.New("incorrect number of results")
|
return errors.New("incorrect number of results")
|
||||||
}
|
}
|
||||||
|
|
|
@ -209,8 +209,9 @@ func TestDslExpressions(t *testing.T) {
|
||||||
`html_escape("<body>test</body>")`: "<body>test</body>",
|
`html_escape("<body>test</body>")`: "<body>test</body>",
|
||||||
`html_unescape("<body>test</body>")`: "<body>test</body>",
|
`html_unescape("<body>test</body>")`: "<body>test</body>",
|
||||||
`date_time("%Y-%M-%D")`: fmt.Sprintf("%02d-%02d-%02d", now.Year(), now.Month(), now.Day()),
|
`date_time("%Y-%M-%D")`: fmt.Sprintf("%02d-%02d-%02d", now.Year(), now.Month(), now.Day()),
|
||||||
|
`date_time("%Y-%M-%D", unix_time())`: fmt.Sprintf("%02d-%02d-%02d", now.Year(), now.Month(), now.Day()),
|
||||||
`date_time("%H-%m")`: fmt.Sprintf("%02d-%02d", now.Hour(), now.Minute()),
|
`date_time("%H-%m")`: fmt.Sprintf("%02d-%02d", now.Hour(), now.Minute()),
|
||||||
`date_time("02-01-2006 15:04")`: now.Format("02-01-2006 15:04"),
|
`date_time("02-01-2006 15:04", unix_time())`: now.Format("02-01-2006 15:04"),
|
||||||
`md5("Hello")`: "8b1a9953c4611296a827abf8c47804d7",
|
`md5("Hello")`: "8b1a9953c4611296a827abf8c47804d7",
|
||||||
`md5(1234)`: "81dc9bdb52d04dc20036dbd8313ed055",
|
`md5(1234)`: "81dc9bdb52d04dc20036dbd8313ed055",
|
||||||
`mmh3("Hello")`: "316307400",
|
`mmh3("Hello")`: "316307400",
|
||||||
|
|
Loading…
Reference in New Issue