(target string, hashmap map[string]interface{})
| 11 | type Demo struct{} |
| 12 | |
| 13 | func (d Demo) SendPoc(target string, hashmap map[string]interface{}) { |
| 14 | |
| 15 | log.Debugf("[+] Running default poc") |
| 16 | //reqinfo := req2.NewReqInfo() |
| 17 | //reqmap := structs.Map(reqinfo) |
| 18 | reqmap := req2.NewReqInfoToMap(hashmap) |
| 19 | // TODO 每次传入的url 都是标准的 http(s)://host:port/path |
| 20 | // 可以使用 url.Parse 来解析获取 host 和 port |
| 21 | // for example: |
| 22 | //result, err := url.Parse(target) |
| 23 | //if err != nil { |
| 24 | // log.Debugln("[-] url parse error") |
| 25 | // log.Errorf("[-] url parse error: %s", err) |
| 26 | // return |
| 27 | //} |
| 28 | //target = result.Scheme + "://" + result.Host + result.Port() + "/" + result.Path |
| 29 | |
| 30 | reqmap["url"] = target |
| 31 | |
| 32 | // 请求方法 |
| 33 | reqmap["method"] = "GET" |
| 34 | // 默认随机UA 不需要设置 |
| 35 | reqmap["headers"] = map[string]string{ |
| 36 | "User-Agent": utils.GetUA(), |
| 37 | } |
| 38 | // 请求body |
| 39 | reqmap["body"] = "" |
| 40 | |
| 41 | // TODO 可以设置超时时间 重复次数 代理等 下面默认使用默认值 |
| 42 | //reqmap["timeout"] = hashmap["Timeout"].(int) |
| 43 | //reqmap["retry"] = hashmap["Retry"].(int) |
| 44 | //reqmap["proxy"] = hashmap["Proxy"].(string) |
| 45 | //reqmap["mode"] = hashmap["Mode"].(int) |
| 46 | //reqmap["h1"] = hashmap["H1"].(bool) |
| 47 | // 发送请求, 获取响应 resp := utils.Send(reqmap) |
| 48 | |
| 49 | resp := utils.Send(reqmap) |
| 50 | log.Debugln("[+] resp: ", resp.Dump()) |
| 51 | |
| 52 | // TODO check exp |
| 53 | d.CheckExp(resp, target, hashmap) |
| 54 | |
| 55 | // TODO 保存结果 |
| 56 | d.SaveResult(target, hashmap["Out"].(string)) |
| 57 | |
| 58 | } |
| 59 | |
| 60 | func (d Demo) init() { |
| 61 | log.Debugln("[+] Registering Demo poc") |
nothing calls this directly
no test coverage detected