Replies: 1 comment
-
|
This discussion closed automatically due to inactivity. Feel free to reopen or start new if still relevant. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
When I use my own method to call the nuclei core method for scanning, it can send HTTP requests normally when scanning vulnerabilities for only one host. However, if I use a for loop to send HTTP requests to multiple hosts, it can only successfully send HTTP requests to the first host. For other machines, only TCP requests are sent. Could you please help me identify the problem? I am using Nuclei version 2.9.13. Below is my code.
`
func main(){
items := map[string]int{"1.7.20.21":9152,"1.7.7.76":12345}
for ip, port := range items{
YamlScan(vulcommon.HostInfo{
Host: ip,
Ports: port,
}, "tmp", apache-dolphinscheduler-default-login.yaml)
}
}
// scan vul use yaml file
func YamlScan(hostinfo vulcommon.HostInfo, templatePath, templateFileName string) error {
//step1: parse and compile yaml
//parse yaml file to template struct
template, err := Yaml2template(templatePath, templateFileName)
if err != nil {
return err
}
}
// parse yaml file to template struct & compile
func parse(templatePath, templateFileName string, options protocols.ExecutorOptions, template *templates.Template) (*templates.Template, error) {
if template.Requests() == 0 {
return nil, fmt.Errorf("no requests defined for %s", templateFileName)
}
}
// get template struct from yaml
func Yaml2template(templatePath, templateFileName string) (*templates.Template, error) {
catalog := disk.NewCatalog(templatePath)
template := &templates.Template{}
}
// when get vul result from yaml, write result to mongodb
func callback(hostinfo vulcommon.HostInfo, result *output.ResultEvent) {
vulcommon.INTLogSuccess(hostinfo, fmt.Sprintf(" %s \n,IP:%s port:%s \ninfo:%s", result.Info.Name, hostinfo.Host, hostinfo.Ports, result.Matched), map[string]string{
"name": result.Info.Name,
"info": result.Info.Description,
"level": result.Info.SeverityHolder.Severity.String(),
"author": result.Info.Authors.String(),
"url": result.Info.Reference.String(),
"keyword": result.Info.Tags.String(),
})
}
// compileProtocolRequests compiles all the protocol requests for the template
func compileProtocolRequests(options protocols.ExecutorOptions, template *templates.Template) error {
templateRequests := template.Requests()
}
func initProtocol(options *types.Options) error {
uarand.Default = uarand.NewWithCustomList(userAgents)
}
// convert request
func convertRequestToProtocolsRequest(requests interface{}) []protocols.Request {
switch reflect.TypeOf(requests).Kind() {
case reflect.Slice:
s := reflect.ValueOf(requests)
}
// expandPreprocessors expands the pre-processors if any for a template data.
func expandPreprocessors(data []byte) []byte {
preprocessorRegex := regexp.MustCompile(
{{([a-z0-9_]+)}})foundMap := make(map[string]struct{})
}
// execute given template on given single target
func executeTemplatesOnTarget(hostinfo vulcommon.HostInfo, template *templates.Template, target *contextargs.MetaInput, results *atomic.Bool) {
wp := core.NewWorkPool(core.WorkPoolConfig{
InputConcurrency: 1,
TypeConcurrency: 1,
HeadlessInputConcurrency: 1,
HeadlessTypeConcurrency: 1,
})
}
`
Here are the templates involved:
`
id: apache-dolphinscheduler-default-login
info:
name: Apache Dolphinscheduler default login
author: XIukD
severity: high
description: Apache Dolphinscheduler default login
reference:
- https://dolphinscheduler.apache.org/zh-cn/docs/3.2.1/guide/start/quick-start
tags: dolphinscheduler
metadata:
max-request: 4
http:
raw:
|
POST /dolphinscheduler/login HTTP/1.1
Host: {{Hostname}}
Accept: application/json, text/plain, /
Content-Type: application/x-www-form-urlencoded
userName={{username}}&userPassword={{password}}
payloads:
username:
- admin
password:
- dolphinscheduler123
- admin
- dolphinscheduler123456
- dolphinscheduler
attack: clusterbomb
matchers:
part: body
words:
- "sessionId"
- "PASSWORD"
condition: and
`
Beta Was this translation helpful? Give feedback.
All reactions