mirror of
https://github.com/Mezeporta/Erupe.git
synced 2025-12-13 15:34:38 +01:00
wiiusgn test
This commit is contained in:
5
patch-schema/wiiu-key.sql
Normal file
5
patch-schema/wiiu-key.sql
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
BEGIN;
|
||||||
|
|
||||||
|
ALTER TABLE public.users ADD COLUMN IF NOT EXISTS wiiu_key TEXT;
|
||||||
|
|
||||||
|
END;
|
||||||
@@ -19,6 +19,7 @@ const (
|
|||||||
PC100 Client = iota
|
PC100 Client = iota
|
||||||
VITA
|
VITA
|
||||||
PS3
|
PS3
|
||||||
|
WIIU
|
||||||
)
|
)
|
||||||
|
|
||||||
// Session holds state for the sign server connection.
|
// Session holds state for the sign server connection.
|
||||||
@@ -59,6 +60,9 @@ func (s *Session) handlePacket(pkt []byte) error {
|
|||||||
case "VITASGN:100":
|
case "VITASGN:100":
|
||||||
s.client = VITA
|
s.client = VITA
|
||||||
s.handlePSSGN(bf)
|
s.handlePSSGN(bf)
|
||||||
|
case "WIIUSGN:100":
|
||||||
|
s.client = WIIU
|
||||||
|
s.handleWIIUSGN(bf)
|
||||||
case "DELETE:100":
|
case "DELETE:100":
|
||||||
loginTokenString := string(bf.ReadNullTerminatedBytes())
|
loginTokenString := string(bf.ReadNullTerminatedBytes())
|
||||||
characterID := int(bf.ReadUint32())
|
characterID := int(bf.ReadUint32())
|
||||||
@@ -106,7 +110,7 @@ func (s *Session) authenticate(username string, password string) {
|
|||||||
bf.WriteUint8(uint8(SIGN_EABORT))
|
bf.WriteUint8(uint8(SIGN_EABORT))
|
||||||
s.logger.Error("Error getting user details", zap.Error(err))
|
s.logger.Error("Error getting user details", zap.Error(err))
|
||||||
default:
|
default:
|
||||||
if bcrypt.CompareHashAndPassword([]byte(hash), []byte(password)) == nil || s.client == VITA || s.client == PS3 {
|
if bcrypt.CompareHashAndPassword([]byte(hash), []byte(password)) == nil || s.client == VITA || s.client == PS3 || s.client == WIIU {
|
||||||
s.logger.Debug("Passwords match!")
|
s.logger.Debug("Passwords match!")
|
||||||
if newCharaReq {
|
if newCharaReq {
|
||||||
err = s.server.newUserChara(username)
|
err = s.server.newUserChara(username)
|
||||||
@@ -137,6 +141,20 @@ func (s *Session) authenticate(username string, password string) {
|
|||||||
err = s.cryptConn.SendPacket(bf.Data())
|
err = s.cryptConn.SendPacket(bf.Data())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *Session) handleWIIUSGN(bf *byteframe.ByteFrame) {
|
||||||
|
_ = bf.ReadBytes(1)
|
||||||
|
wiiuKey := string(bf.ReadNullTerminatedBytes())
|
||||||
|
var reqUsername string
|
||||||
|
err := s.server.db.QueryRow(`SELECT username FROM users WHERE wiiu_key = $1`, wiiuKey).Scan(&reqUsername)
|
||||||
|
if err == sql.ErrNoRows {
|
||||||
|
resp := byteframe.NewByteFrame()
|
||||||
|
resp.WriteUint8(uint8(SIGN_ECOGLINK))
|
||||||
|
s.cryptConn.SendPacket(resp.Data())
|
||||||
|
return
|
||||||
|
}
|
||||||
|
s.authenticate(reqUsername, "")
|
||||||
|
}
|
||||||
|
|
||||||
func (s *Session) handlePSSGN(bf *byteframe.ByteFrame) {
|
func (s *Session) handlePSSGN(bf *byteframe.ByteFrame) {
|
||||||
_ = bf.ReadNullTerminatedBytes() // VITA = 0000000256, PS3 = 0000000255
|
_ = bf.ReadNullTerminatedBytes() // VITA = 0000000256, PS3 = 0000000255
|
||||||
_ = bf.ReadBytes(2) // VITA = 1, PS3 = !
|
_ = bf.ReadBytes(2) // VITA = 1, PS3 = !
|
||||||
|
|||||||
Reference in New Issue
Block a user