Esempio n. 1
0
func authenticate(conn net.Conn) (authenticated bool) {
	err := hap.Authenticate(conn, password)
	if err != nil {
		fmt.Println("[!] failed to authenticate:", err.Error())
		return
	}

	err = hap.Challenge(conn, password)
	if err != nil {
		fmt.Println("[!] challenge failed:", err.Error())
		return
	}

	authenticated = true
	return
}
Esempio n. 2
0
func authenticate(conn net.Conn) {
	defer conn.Close()

	err := hap.Challenge(conn, password)
	if err != nil {
		log.Println("challenge failed:", err.Error())
		return
	}

	err = hap.Authenticate(conn, password)
	if err != nil {
		log.Println("authentication failed:", err.Error())
		return
	}

	request := make([]byte, RequestLength)
	_, err = conn.Read(request)
	if err != nil {
		log.Println("error reading client request:", err.Error())
		return
	}
	log.Println("client request:", string(request))
}