mirror of
https://github.com/projectdiscovery/nuclei.git
synced 2025-12-21 23:05:29 +00:00
Added elasticsearch host reporting field support
This commit is contained in:
parent
9eea441b0e
commit
6d96f75df7
@ -19,10 +19,12 @@ import (
|
|||||||
|
|
||||||
// Options contains necessary options required for elasticsearch communication
|
// Options contains necessary options required for elasticsearch communication
|
||||||
type Options struct {
|
type Options struct {
|
||||||
|
// Host is the hostname of the elasticsearch instance
|
||||||
|
Host string `yaml:"host" validate:"required_without=IP"`
|
||||||
// IP for elasticsearch instance
|
// IP for elasticsearch instance
|
||||||
IP string `yaml:"ip" validate:"required,ip"`
|
IP string `yaml:"ip" validate:"required,ip"`
|
||||||
// Port is the port of elasticsearch instance
|
// Port is the port of elasticsearch instance
|
||||||
Port int `yaml:"port" validate:"required,gte=0,lte=65535"`
|
Port int `yaml:"port" validate:"gte=0,lte=65535"`
|
||||||
// SSL (optional) enables ssl for elasticsearch connection
|
// SSL (optional) enables ssl for elasticsearch connection
|
||||||
SSL bool `yaml:"ssl"`
|
SSL bool `yaml:"ssl"`
|
||||||
// SSLVerification (optional) disables SSL verification for elasticsearch
|
// SSLVerification (optional) disables SSL verification for elasticsearch
|
||||||
@ -81,7 +83,16 @@ func New(option *Options) (*Exporter, error) {
|
|||||||
auth = "Basic " + auth
|
auth = "Basic " + auth
|
||||||
authentication = auth
|
authentication = auth
|
||||||
}
|
}
|
||||||
url := fmt.Sprintf("%s%s:%d/%s/_doc", scheme, option.IP, option.Port, option.IndexName)
|
var addr string
|
||||||
|
if option.Host != "" {
|
||||||
|
addr = option.Host
|
||||||
|
} else {
|
||||||
|
addr = option.IP
|
||||||
|
}
|
||||||
|
if option.Port != 0 {
|
||||||
|
addr += fmt.Sprintf(":%d", option.Port)
|
||||||
|
}
|
||||||
|
url := fmt.Sprintf("%s%s/%s/_doc", scheme, addr, option.IndexName)
|
||||||
|
|
||||||
ei = &Exporter{
|
ei = &Exporter{
|
||||||
url: url,
|
url: url,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user