debil-finder/checks/git.go

32 lines
601 B
Go
Raw Normal View History

2021-10-08 13:20:19 +00:00
package checks
import (
"io/ioutil"
"log"
"strings"
)
func (c *Checks) CheckGit(domain string) {
url := "https://" + domain + "/.git/HEAD"
res, err := c.get(url)
if err != nil {
//log.Println(domain + " error: " + err.Error())
return
}
bbody, err := ioutil.ReadAll(res.Body)
if err != nil {
//log.Println(domain + " read error: " + err.Error())
return
}
body := string(bbody)
if strings.HasPrefix(body, "ref:") {
c.Message("znalazło debila\n" + url + "\n\n" + body)
log.Println("DEBIL " + url)
} else {
//log.Println(domain + " size: " + strconv.Itoa(len(body)))
}
}