debil-finder/checks/env.go

30 lines
546 B
Go
Raw Normal View History

2021-10-08 13:20:19 +00:00
package checks
import (
"io/ioutil"
"log"
)
func (c *Checks) CheckEnv(domain string) {
url := "https://" + domain + "/.env"
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)
contentType := res.Header.Get("Content-Type")
if contentType == "" {
c.Message("znalazło debila\n" + url + "\n\n" + body)
log.Println("DEBIL " + url)
}
}