mirror of https://github.com/daffainfo/nuclei.git
Squashed commit of the following:
commit b590de2de14923e4cb35dd19845e12833a4ccbfa Author: Xavier Stevens <xstevens@users.noreply.github.com> Date: Wed Mar 23 08:29:37 2022 -0700 Updated rand_ip to use variadic args commit ea883be8c0aa56174a1301252129289334659f3f Author: Xavier Stevens <xstevens@users.noreply.github.com> Date: Tue Mar 22 16:59:19 2022 -0700 Updated rand_ip function to handle multiple CIDRsdev
parent
6213454cb3
commit
4a65097194
|
@ -39,33 +39,34 @@ requests:
|
||||||
27: {{rand_int()}}
|
27: {{rand_int()}}
|
||||||
28: {{rand_ip("192.168.0.0/24")}}
|
28: {{rand_ip("192.168.0.0/24")}}
|
||||||
29: {{rand_ip("2002:c0a8::/24")}}
|
29: {{rand_ip("2002:c0a8::/24")}}
|
||||||
30: {{rand_text_alpha(10, "abc")}}
|
30: {{rand_ip("192.168.0.0/24","10.0.100.0/24")}}
|
||||||
31: {{rand_text_alpha(10, "")}}
|
31: {{rand_text_alpha(10, "abc")}}
|
||||||
32: {{rand_text_alpha(10)}}
|
32: {{rand_text_alpha(10, "")}}
|
||||||
33: {{rand_text_alphanumeric(10, "ab12")}}
|
33: {{rand_text_alpha(10)}}
|
||||||
34: {{rand_text_alphanumeric(10)}}
|
34: {{rand_text_alphanumeric(10, "ab12")}}
|
||||||
35: {{rand_text_numeric(10, 123)}}
|
35: {{rand_text_alphanumeric(10)}}
|
||||||
36: {{rand_text_numeric(10)}}
|
36: {{rand_text_numeric(10, 123)}}
|
||||||
37: {{regex("H([a-z]+)o", "Hello")}}
|
37: {{rand_text_numeric(10)}}
|
||||||
38: {{remove_bad_chars("abcd", "bc")}}
|
38: {{regex("H([a-z]+)o", "Hello")}}
|
||||||
39: {{repeat("a", 5)}}
|
39: {{remove_bad_chars("abcd", "bc")}}
|
||||||
40: {{replace("Hello", "He", "Ha")}}
|
40: {{repeat("a", 5)}}
|
||||||
41: {{replace_regex("He123llo", "(\\d+)", "")}}
|
41: {{replace("Hello", "He", "Ha")}}
|
||||||
42: {{reverse("abc")}}
|
42: {{replace_regex("He123llo", "(\\d+)", "")}}
|
||||||
43: {{sha1("Hello")}}
|
43: {{reverse("abc")}}
|
||||||
44: {{sha256("Hello")}}
|
44: {{sha1("Hello")}}
|
||||||
45: {{to_lower("HELLO")}}
|
45: {{sha256("Hello")}}
|
||||||
46: {{to_upper("hello")}}
|
46: {{to_lower("HELLO")}}
|
||||||
47: {{trim("aaaHelloddd", "ad")}}
|
47: {{to_upper("hello")}}
|
||||||
48: {{trim_left("aaaHelloddd", "ad")}}
|
48: {{trim("aaaHelloddd", "ad")}}
|
||||||
49: {{trim_prefix("aaHelloaa", "aa")}}
|
49: {{trim_left("aaaHelloddd", "ad")}}
|
||||||
50: {{trim_right("aaaHelloddd", "ad")}}
|
50: {{trim_prefix("aaHelloaa", "aa")}}
|
||||||
51: {{trim_space(" Hello ")}}
|
51: {{trim_right("aaaHelloddd", "ad")}}
|
||||||
52: {{trim_suffix("aaHelloaa", "aa")}}
|
52: {{trim_space(" Hello ")}}
|
||||||
53: {{unix_time(10)}}
|
53: {{trim_suffix("aaHelloaa", "aa")}}
|
||||||
54: {{url_decode("https:%2F%2Fprojectdiscovery.io%3Ftest=1")}}
|
54: {{unix_time(10)}}
|
||||||
55: {{url_encode("https://projectdiscovery.io/test?a=1")}}
|
55: {{url_decode("https:%2F%2Fprojectdiscovery.io%3Ftest=1")}}
|
||||||
56: {{wait_for(1)}}
|
56: {{url_encode("https://projectdiscovery.io/test?a=1")}}
|
||||||
|
57: {{wait_for(1)}}
|
||||||
|
|
||||||
extractors:
|
extractors:
|
||||||
- type: regex
|
- type: regex
|
||||||
|
|
|
@ -401,10 +401,18 @@ func init() {
|
||||||
return rand.Intn(max-min) + min, nil
|
return rand.Intn(max-min) + min, nil
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
"rand_ip": makeDslFunction(1, func(args ...interface{}) (interface{}, error) {
|
"rand_ip": makeDslWithOptionalArgsFunction(
|
||||||
cidr := args[0].(string)
|
"(cidr ...string) string",
|
||||||
return randomip.GetRandomIPWithCidr(cidr)
|
func(args ...interface{}) (interface{}, error) {
|
||||||
}),
|
if len(args) == 0 {
|
||||||
|
return nil, invalidDslFunctionError
|
||||||
|
}
|
||||||
|
var cidrs []string
|
||||||
|
for _, arg := range args {
|
||||||
|
cidrs = append(cidrs, arg.(string))
|
||||||
|
}
|
||||||
|
return randomip.GetRandomIPWithCidr(cidrs...)
|
||||||
|
}),
|
||||||
"generate_java_gadget": makeDslFunction(3, func(args ...interface{}) (interface{}, error) {
|
"generate_java_gadget": makeDslFunction(3, func(args ...interface{}) (interface{}, error) {
|
||||||
gadget := args[0].(string)
|
gadget := args[0].(string)
|
||||||
cmd := args[1].(string)
|
cmd := args[1].(string)
|
||||||
|
|
|
@ -12,7 +12,12 @@ const (
|
||||||
maxIterations = 255
|
maxIterations = 255
|
||||||
)
|
)
|
||||||
|
|
||||||
func GetRandomIPWithCidr(cidr string) (net.IP, error) {
|
func GetRandomIPWithCidr(cidrs ...string) (net.IP, error) {
|
||||||
|
if len(cidrs) == 0 {
|
||||||
|
return nil, errors.Errorf("must specify at least one cidr")
|
||||||
|
}
|
||||||
|
cidr := cidrs[rand.Intn(len(cidrs))]
|
||||||
|
|
||||||
if !iputil.IsCIDR(cidr) {
|
if !iputil.IsCIDR(cidr) {
|
||||||
return nil, errors.Errorf("%s is not a valid cidr", cidr)
|
return nil, errors.Errorf("%s is not a valid cidr", cidr)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue