| 49 | } |
| 50 | |
| 51 | func attack(url string, pocs map[string]interface{}, hashmap map[string]interface{}) { |
| 52 | p := hashmap["Pocs"].(string) |
| 53 | // 以,分割,获取poc name 将其转换为数组 |
| 54 | pocsName := strings.Split(p, ",") |
| 55 | //log.Debugf("[*] Pocs: %s", pocsName) |
| 56 | //var ps []string |
| 57 | //if pocsName != nil { |
| 58 | // for _, v := range pocsName { |
| 59 | // log.Debugf("[*] 分割字符串 %s", v) |
| 60 | // ps = append(ps, v) |
| 61 | // } |
| 62 | //} |
| 63 | // 如果没有选定字符串 则默认所有pocs |
| 64 | if len(pocsName) == 1 && pocsName[0] == "" { |
| 65 | f := pocs["ISAlIVEURL"].(poc.PoC).CheckExp(nil, url, hashmap) |
| 66 | if f { |
| 67 | log.Infof("[*] %s is alive", url) |
| 68 | } else { |
| 69 | log.Infof("[*] %s is not alive, donot attack all pocs, Please check url is alive ?", url) |
| 70 | return |
| 71 | } |
| 72 | log.Info("[*] attack all pocs") |
| 73 | for k, v := range pocs { |
| 74 | if k == "ISAlIVEURL" { |
| 75 | continue |
| 76 | } |
| 77 | log.Infof("[*] attack %s poc %s", url, k) |
| 78 | t := v.(poc.PoC) |
| 79 | t.SendPoc(url, hashmap) |
| 80 | } |
| 81 | } else { |
| 82 | for _, v := range pocsName { |
| 83 | log.Infof("[*] attack %s poc %s", url, v) |
| 84 | if v != "" { |
| 85 | t := pocs[v].(poc.PoC) |
| 86 | t.SendPoc(url, hashmap) |
| 87 | } |
| 88 | } |
| 89 | } |
| 90 | |
| 91 | } |