Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
projectdiscovery
GitHub Repository: projectdiscovery/nuclei
Path: blob/dev/pkg/utils/expand/expand.go
2070 views
1
package expand
2
3
import (
4
"github.com/projectdiscovery/mapcidr"
5
"github.com/projectdiscovery/mapcidr/asn"
6
)
7
8
// Expands CIDR to IPs
9
func CIDR(value string) []string {
10
var ips []string
11
ipsCh, _ := mapcidr.IPAddressesAsStream(value)
12
for ip := range ipsCh {
13
ips = append(ips, ip)
14
}
15
return ips
16
}
17
18
// Expand ASN to IPs
19
func ASN(value string) []string {
20
var ips []string
21
cidrs, _ := asn.GetCIDRsForASNNum(value)
22
for _, cidr := range cidrs {
23
ips = append(ips, CIDR(cidr.String())...)
24
}
25
return ips
26
}
27
28