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

30 lines
600 B
Go

package checks
import (
"io/ioutil"
"log"
"strings"
)
func (c *Checks) CheckIndex(domain string) {
url := "https://" + domain + "/"
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.Contains(body, "Index of /") && !strings.Contains(body, "Proudly Served by LiteSpeed Web Server at") {
c.Message("znalazło debila z indeksowaniem\n" + url)
log.Println("DEBIL " + url)
}
}