mirror of
https://github.com/Mezeporta/Erupe.git
synced 2025-12-14 07:55:33 +01:00
update legacy WIIU code
This commit is contained in:
@@ -112,23 +112,24 @@ func (s *Session) authenticate(username string, password string) {
|
|||||||
func (s *Session) handleWIIUSGN(bf *byteframe.ByteFrame) {
|
func (s *Session) handleWIIUSGN(bf *byteframe.ByteFrame) {
|
||||||
_ = bf.ReadBytes(1)
|
_ = bf.ReadBytes(1)
|
||||||
wiiuKey := string(bf.ReadBytes(64))
|
wiiuKey := string(bf.ReadBytes(64))
|
||||||
var reqUsername string
|
var uid uint32
|
||||||
err := s.server.db.QueryRow(`SELECT username FROM users WHERE wiiu_key = $1`, wiiuKey).Scan(&reqUsername)
|
err := s.server.db.QueryRow(`SELECT id FROM users WHERE wiiu_key = $1`, wiiuKey).Scan(&uid)
|
||||||
|
if err != nil {
|
||||||
if err == sql.ErrNoRows {
|
if err == sql.ErrNoRows {
|
||||||
resp := byteframe.NewByteFrame()
|
s.logger.Info("Unlinked Wii U attempted to authenticate", zap.String("Key", wiiuKey))
|
||||||
resp.WriteUint8(uint8(SIGN_ECOGLINK))
|
s.sendCode(SIGN_ECOGLINK)
|
||||||
s.cryptConn.SendPacket(resp.Data())
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
s.authenticate(reqUsername, "")
|
s.sendCode(SIGN_EABORT)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
s.cryptConn.SendPacket(s.makeSignResponse(uid))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Session) handlePSSGN(bf *byteframe.ByteFrame) {
|
func (s *Session) handlePSSGN(bf *byteframe.ByteFrame) {
|
||||||
// Prevent reading malformed request
|
// Prevent reading malformed request
|
||||||
if len(bf.DataFromCurrent()) < 128 {
|
if len(bf.DataFromCurrent()) < 128 {
|
||||||
resp := byteframe.NewByteFrame()
|
s.sendCode(SIGN_EABORT)
|
||||||
resp.WriteUint8(uint8(SIGN_EABORT))
|
|
||||||
s.cryptConn.SendPacket(resp.Data())
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
_ = bf.ReadNullTerminatedBytes() // VITA = 0000000256, PS3 = 0000000255
|
_ = bf.ReadNullTerminatedBytes() // VITA = 0000000256, PS3 = 0000000255
|
||||||
|
|||||||
Reference in New Issue
Block a user