Add auth check

This commit is contained in:
Nonoo 2020-10-16 17:43:30 +02:00
parent 6ba02ae285
commit f556247588

11
main.go
View file

@ -80,9 +80,9 @@ func main() {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x3e, 0x71, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x2b, 0x3f, 0x55, 0x5c, 0x00, 0x00, 0x00, 0x00, // username: beer
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x5e, 0x3e, 0x2c, 0x54, 0x3a, 0x4f, 0x75, 0x79,
0x2b, 0x3f, 0x55, 0x5c, 0x3f, 0x25, 0x77, 0x58, // pass: beerbeer
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x69, 0x63, 0x6f, 0x6d, 0x2d, 0x70, 0x63, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@ -105,6 +105,13 @@ func main() {
}
errCount = 0
if len(r) == 96 && bytes.Equal(r[:8], []byte{0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00}) {
if bytes.Equal(r[48:52], []byte{0xff, 0xff, 0xff, 0xfe}) {
log.Fatal("invalid user/password")
} else {
log.Print("auth ok")
}
}
if bytes.Equal(r[:6], []byte{0x00, 0x00, 0x00, 0x00, 0x07, 0x00}) {
gotSeq := r[6]
if receivedSeq && lastReceivedSeq+1 != gotSeq {