debil-finder/checks/git.go
2021-10-08 15:20:19 +02:00

31 lines
601 B
Go

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)))
}
}