You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
func Execute(input interface{}, op options.PluginOption) (interface{}, error) {
data, ok := input.(*types.AssetHttp)
if !ok {
return nil, nil
}
parameter := op.Parameter
var filgerFile string
thread := 20
if parameter != "" {
args, err := utils.Tools.ParseArgs(parameter, "finger", "thread")
if err != nil {
} else {
for key, value := range args {
if value != "" {
switch key {
case "finger":
filgerFile = value
case "thread":
thread, _ = strconv.Atoi(value)
}
}
}
}
}
if filgerFile == "" {
return nil, nil
}
fingerFilePath := filepath.Join(global.DictPath, filgerFile)
content, err := os.ReadFile(fingerFilePath)
if err != nil {
op.Log(fmt.Sprintf("read finger error: %v", err))
return nil, nil
}
var fingers Fingerprints
err = json.Unmarshal(content, &fingers)
if err != nil {
op.Log(fmt.Sprintf("json to fingers error: %v", err))
return nil, nil
}
semaphore := make(chan struct{}, thread)
var wg sync.WaitGroup
uniqueCms := sync.Map{}
for _, finp := range fingers.Fingerprint {
select {
case <-op.Ctx.Done():
break
default:
semaphore <- struct{}{}
wg.Add(1)
go func(finger Fingerprint) {
defer func() {
<-semaphore
wg.Done()
}()
if finger.Location == "body" {
if finger.Method == "keyword" {
if iskeyword(data.ResponseBody, finger.Keyword) {
uniqueCms.Store(finger.Cms, true)
}
}
if finger.Method == "faviconhash" {
if data.FavIconMMH3 == finger.Keyword[0] {
uniqueCms.Store(finger.Cms, true)
}
}
if finger.Method == "regular" {
if isregular(data.ResponseBody, finger.Keyword) {
uniqueCms.Store(finger.Cms, true)
}
}
}
if finger.Location == "header" {
if finger.Method == "keyword" {
if iskeyword(data.RawHeaders, finger.Keyword) {
uniqueCms.Store(finger.Cms, true)
}
}
if finger.Method == "regular" {
if isregular(data.RawHeaders, finger.Keyword) {
uniqueCms.Store(finger.Cms, true)
}
}
}
if finger.Location == "title" {
if finger.Method == "keyword" {
if iskeyword(data.Title, finger.Keyword) {
uniqueCms.Store(finger.Cms, true)
}
}
if finger.Method == "regular" {
if isregular(data.Title, finger.Keyword) {
uniqueCms.Store(finger.Cms, true)
}
}
}
}(finp)
}
}
wg.Wait()
var result []string
existingMap := make(map[string]bool)
for _, v := range data.Technologies {
lowerV := strings.ToLower(v)
if _, exists := existingMap[lowerV]; !exists {
result = append(result, v)
existingMap[lowerV] = true
}
}
uniqueCms.Range(func(key, value interface{}) bool {
cms := key.(string)
lowerCms := strings.ToLower(cms)
if _, exists := existingMap[lowerCms]; !exists {
result = append(result, cms)
existingMap[lowerCms] = true
}
return true
})
data.Technologies = result
return nil, nil
}
Execute is registered to the main program through yaegi, and then the main program calls it. By printing the log, I found that panic: reflect.Value.Call: call of nil function appeared in go func(finger Fingerprint) {. I can rule out the problem of Fingerprint because I will execute this code many times, and sometimes there is no error. I can't debug and confirm where the specific cause is. Is there any way to locate the error caused here?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
The main code is as follows
Execute is registered to the main program through yaegi, and then the main program calls it. By printing the log, I found that panic: reflect.Value.Call: call of nil function appeared in go func(finger Fingerprint) {. I can rule out the problem of Fingerprint because I will execute this code many times, and sometimes there is no error. I can't debug and confirm where the specific cause is. Is there any way to locate the error caused here?
Beta Was this translation helpful? Give feedback.
All reactions