mirror of
https://github.com/shadow1ng/fscan.git
synced 2025-05-08 19:56:30 +00:00
减少http client初始化次数
This commit is contained in:
parent
14c9847f88
commit
583e51d479
@ -3,6 +3,7 @@ package Plugins
|
|||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"github.com/shadow1ng/fscan/WebScan"
|
||||||
"github.com/shadow1ng/fscan/common"
|
"github.com/shadow1ng/fscan/common"
|
||||||
"reflect"
|
"reflect"
|
||||||
"strconv"
|
"strconv"
|
||||||
@ -24,6 +25,7 @@ func Scan(info common.HostInfo) {
|
|||||||
if info.Scantype == "portscan" {
|
if info.Scantype == "portscan" {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
WebScan.Inithttp(common.Pocinfo)
|
||||||
var severports []string //severports := []string{"21","22","135"."445","1433","3306","5432","6379","9200","11211","27017"...}
|
var severports []string //severports := []string{"21","22","135"."445","1433","3306","5432","6379","9200","11211","27017"...}
|
||||||
for _, port := range common.PORTList {
|
for _, port := range common.PORTList {
|
||||||
severports = append(severports, strconv.Itoa(port))
|
severports = append(severports, strconv.Itoa(port))
|
||||||
|
@ -5,6 +5,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"github.com/shadow1ng/fscan/WebScan/lib"
|
"github.com/shadow1ng/fscan/WebScan/lib"
|
||||||
"github.com/shadow1ng/fscan/common"
|
"github.com/shadow1ng/fscan/common"
|
||||||
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
@ -22,11 +23,6 @@ func WebScan(info *common.HostInfo) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func Execute(PocInfo common.PocInfo) error {
|
func Execute(PocInfo common.PocInfo) error {
|
||||||
//PocInfo.Proxy = "http://127.0.0.1:8080"
|
|
||||||
err := lib.InitHttpClient(PocInfo.Num, PocInfo.Proxy, time.Duration(PocInfo.Timeout)*time.Second)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
req, err := http.NewRequest("GET", PocInfo.Target, nil)
|
req, err := http.NewRequest("GET", PocInfo.Target, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@ -44,3 +40,11 @@ func Execute(PocInfo common.PocInfo) error {
|
|||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func Inithttp(PocInfo common.PocInfo) {
|
||||||
|
//PocInfo.Proxy = "http://127.0.0.1:8080"
|
||||||
|
err := lib.InitHttpClient(PocInfo.Num, PocInfo.Proxy, time.Duration(PocInfo.Timeout)*time.Second)
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -31,6 +31,8 @@ var RuleDatas = []RuleData{
|
|||||||
{"atmail-WebMail", "code", "(/index.php/mail/auth/processlogin)"},
|
{"atmail-WebMail", "code", "(/index.php/mail/auth/processlogin)"},
|
||||||
{"weblogic", "code", "(/console/framework/skins/wlsconsole/images/login_WebLogic_branding.png|Welcome to Weblogic Application Server|<i>Hypertext Transfer Protocol -- HTTP/1.1</i>)"},
|
{"weblogic", "code", "(/console/framework/skins/wlsconsole/images/login_WebLogic_branding.png|Welcome to Weblogic Application Server|<i>Hypertext Transfer Protocol -- HTTP/1.1</i>)"},
|
||||||
{"致远OA", "code", "(/seeyon/USER-DATA/IMAGES/LOGIN/login.gif)"},
|
{"致远OA", "code", "(/seeyon/USER-DATA/IMAGES/LOGIN/login.gif)"},
|
||||||
|
{"致远OA", "code", "(/seeyon/common/)"},
|
||||||
|
{"discuz", "code", "(content=\"Discuz! X\")"},
|
||||||
{"Typecho", "code", "(Typecho</a>)"},
|
{"Typecho", "code", "(Typecho</a>)"},
|
||||||
{"金蝶EAS", "code", "(easSessionId)"},
|
{"金蝶EAS", "code", "(easSessionId)"},
|
||||||
{"phpMyAdmin", "cookie", "(pma_lang|phpMyAdmin)"},
|
{"phpMyAdmin", "cookie", "(pma_lang|phpMyAdmin)"},
|
||||||
@ -75,8 +77,7 @@ var RuleDatas = []RuleData{
|
|||||||
{"H3C ICG1000", "code", "(ICG1000系统管理)"},
|
{"H3C ICG1000", "code", "(ICG1000系统管理)"},
|
||||||
{"CISCO-CX20", "code", "(CISCO-CX20)"},
|
{"CISCO-CX20", "code", "(CISCO-CX20)"},
|
||||||
{"H3C ER5200", "code", "(ER5200系统管理)"},
|
{"H3C ER5200", "code", "(ER5200系统管理)"},
|
||||||
{"linksys-vpn-bragap14-parintins", "code",
|
{"linksys-vpn-bragap14-parintins", "code", "(linksys-vpn-bragap14-parintins)"},
|
||||||
"(linksys-vpn-bragap14-parintins)"},
|
|
||||||
{"360网站卫士常用前端公共库", "code", "(libs.useso.com)"},
|
{"360网站卫士常用前端公共库", "code", "(libs.useso.com)"},
|
||||||
{"H3C ER3100", "code", "(ER3100系统管理)"},
|
{"H3C ER3100", "code", "(ER3100系统管理)"},
|
||||||
{"H3C-SecBlade-FireWall", "code", "(js/MulPlatAPI.js)"},
|
{"H3C-SecBlade-FireWall", "code", "(js/MulPlatAPI.js)"},
|
||||||
@ -111,8 +112,14 @@ var RuleDatas = []RuleData{
|
|||||||
{"金蝶政务GSiS", "code", "(/kdgs/script/kdgs.js)"},
|
{"金蝶政务GSiS", "code", "(/kdgs/script/kdgs.js)"},
|
||||||
{"Jboss", "code", "(Welcome to JBoss|jboss.css)"},
|
{"Jboss", "code", "(Welcome to JBoss|jboss.css)"},
|
||||||
{"Jboss", "headers", "(JBoss)"},
|
{"Jboss", "headers", "(JBoss)"},
|
||||||
{"泛微E-mobile", "code", "(Weaver E-mobile)"},
|
{"泛微E-mobile", "code", "(Weaver E-mobile|weaver,e-mobile)"},
|
||||||
{"齐治堡垒机", "code", "(logo-icon-ico72.png)"},
|
{"齐治堡垒机", "code", "(logo-icon-ico72.png)"},
|
||||||
|
{"ThinkPHP", "headers", "(ThinkPHP)"},
|
||||||
|
{"ThinkPHP", "code", "(/Public/static/js/)"},
|
||||||
|
{"weaver-ebridge", "code", "(e-Bridge,http://wx.weaver)"},
|
||||||
|
{"Laravel", "headers", "(laravel_session)"},
|
||||||
|
{"DWR", "code", "(dwr/engine.js)"},
|
||||||
|
{"swagger_ui", "code", "(swagger-ui/css|\"swagger\":)"},
|
||||||
}
|
}
|
||||||
|
|
||||||
var Md5Datas = []Md5Data{
|
var Md5Datas = []Md5Data{
|
||||||
|
@ -14,7 +14,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
client *http.Client
|
Client *http.Client
|
||||||
clientNoRedirect *http.Client
|
clientNoRedirect *http.Client
|
||||||
dialTimout = 5 * time.Second
|
dialTimout = 5 * time.Second
|
||||||
keepAlive = 15 * time.Second
|
keepAlive = 15 * time.Second
|
||||||
@ -44,7 +44,7 @@ func InitHttpClient(ThreadsNum int, DownProxy string, Timeout time.Duration) err
|
|||||||
tr.Proxy = http.ProxyURL(u)
|
tr.Proxy = http.ProxyURL(u)
|
||||||
}
|
}
|
||||||
|
|
||||||
client = &http.Client{
|
Client = &http.Client{
|
||||||
Transport: tr,
|
Transport: tr,
|
||||||
Timeout: Timeout,
|
Timeout: Timeout,
|
||||||
}
|
}
|
||||||
@ -70,7 +70,7 @@ func DoRequest(req *http.Request, redirect bool) (*Response, error) {
|
|||||||
var oResp *http.Response
|
var oResp *http.Response
|
||||||
var err error
|
var err error
|
||||||
if redirect {
|
if redirect {
|
||||||
oResp, err = client.Do(req)
|
oResp, err = Client.Do(req)
|
||||||
} else {
|
} else {
|
||||||
oResp, err = clientNoRedirect.Do(req)
|
oResp, err = clientNoRedirect.Do(req)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user