mirror of
https://github.com/shadow1ng/fscan.git
synced 2026-09-22 03:10:42 +08:00
增加指纹识别功能,可识别尝试CMS、框架,如致远OA、通达OA等
This commit is contained in:
+43
-16
@@ -13,7 +13,9 @@ import (
|
||||
"time"
|
||||
)
|
||||
|
||||
func WebTitle(info *common.HostInfo) (err error, result string) {
|
||||
var CheckData []WebScan.CheckDatas
|
||||
|
||||
func WebTitle(info *common.HostInfo) error {
|
||||
if info.Ports == "80" {
|
||||
info.Url = fmt.Sprintf("http://%s", info.Host)
|
||||
} else if info.Ports == "443" {
|
||||
@@ -22,24 +24,36 @@ func WebTitle(info *common.HostInfo) (err error, result string) {
|
||||
info.Url = fmt.Sprintf("http://%s:%s", info.Host, info.Ports)
|
||||
}
|
||||
|
||||
err, result = geturl(info)
|
||||
if common.IsWebCan || err != nil {
|
||||
return
|
||||
err, result := geturl(info, true)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if result == "https" {
|
||||
err, _ := geturl(info, true)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
if result == "https" {
|
||||
err, result = geturl(info)
|
||||
if err == nil {
|
||||
WebScan.WebScan(info)
|
||||
}
|
||||
} else {
|
||||
err, _ = geturl(info, false)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
WebScan.InfoCheck(info.Url, CheckData)
|
||||
|
||||
if common.IsWebCan == false {
|
||||
WebScan.WebScan(info)
|
||||
}
|
||||
return err, result
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
func geturl(info *common.HostInfo) (err error, result string) {
|
||||
url := info.Url
|
||||
func geturl(info *common.HostInfo, flag bool) (err error, result string) {
|
||||
Url := info.Url
|
||||
if flag == false {
|
||||
Url += "/favicon.ico"
|
||||
}
|
||||
tr := &http.Transport{
|
||||
TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
|
||||
DisableKeepAlives: false,
|
||||
@@ -52,14 +66,22 @@ func geturl(info *common.HostInfo) (err error, result string) {
|
||||
IdleConnTimeout: time.Duration(info.WebTimeout+3) * time.Second,
|
||||
TLSHandshakeTimeout: 5 * time.Second,
|
||||
}
|
||||
//u, err := url.Parse("http://127.0.0.1:8080")
|
||||
//if err != nil {
|
||||
// return err,result
|
||||
//}
|
||||
//tr.Proxy = http.ProxyURL(u)
|
||||
|
||||
var client = &http.Client{Timeout: time.Duration(info.WebTimeout) * time.Second, Transport: tr}
|
||||
res, err := http.NewRequest("GET", url, nil)
|
||||
res, err := http.NewRequest("GET", Url, nil)
|
||||
if err == nil {
|
||||
res.Header.Add("User-agent", "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1468.0 Safari/537.36")
|
||||
res.Header.Add("Accept", "*/*")
|
||||
res.Header.Add("Accept-Language", "zh-CN,zh;q=0.9")
|
||||
res.Header.Add("Accept-Encoding", "gzip, deflate")
|
||||
if flag == true {
|
||||
res.Header.Add("Cookie", "rememberMe=1")
|
||||
}
|
||||
res.Header.Add("Connection", "close")
|
||||
resp, err := client.Do(res)
|
||||
if err == nil {
|
||||
@@ -76,8 +98,13 @@ func geturl(info *common.HostInfo) (err error, result string) {
|
||||
} else {
|
||||
title = "None"
|
||||
}
|
||||
result = fmt.Sprintf("WebTitle:%-25v %-3v %v", url, resp.StatusCode, title)
|
||||
common.LogSuccess(result)
|
||||
if flag == true {
|
||||
result = fmt.Sprintf("WebTitle:%-25v %-3v %v", Url, resp.StatusCode, title)
|
||||
common.LogSuccess(result)
|
||||
}
|
||||
|
||||
CheckData = append(CheckData, WebScan.CheckDatas{body, fmt.Sprintf("%s", resp.Header)})
|
||||
|
||||
if resp.StatusCode == 400 && info.Url[:5] != "https" {
|
||||
info.Url = strings.Replace(info.Url, "http://", "https://", 1)
|
||||
return err, "https"
|
||||
|
||||
Reference in New Issue
Block a user