private void updatePresence(ref TmpEntry entry, EndianIO readerIO, EndianIO writerIO) { entry.ClientSession = Misc.BytesToHexString(readerIO.Reader.ReadBytes(0x10)); entry.ClientTitle = Misc.BytesToHexString(readerIO.Reader.ReadBytes(0x4)); entry.ClientGT = GlobalMisc.ConvertBytesToString(readerIO.Reader.ReadBytes(0x15)); //Globals.write("updateShit Session: {0}", entry.ClientSession); if (ConsoleMySQL.getConsole(ref entry, true)) { if (entry.ClientEnabled) { writerIO.Writer.Write(Globals.XSTL_STATUS_SUCCESS); } else { if (ConsoleMySQL.autoUpdateTime(ref entry)) { writerIO.Writer.Write(Globals.XSTL_STATUS_SUCCESS); } else { writerIO.Writer.Write(Globals.XSTL_STATUS_EXPIRED); } } ConsoleMySQL.saveConsole(ref entry); } else { writerIO.Writer.Write(Globals.XSTL_STATUS_ERROR); } }
private void getSalt(ref TmpEntry entry, EndianIO readerIO, EndianIO writerIO) { entry.ClientConType = Convert.ToBoolean(readerIO.Reader.ReadInt32()); entry.CPUKey = Misc.BytesToHexString(readerIO.Reader.ReadBytes(0x10)); //if (BufferCount >= 0x14) entry.KVDat = readerIO.Reader.ReadBytes(BufferCount - 0x14); // BufferCount > 20 if (!Globals.allowAnonUsers) { if (ConsoleMySQL.getConsole(ref entry)) { entry.ClientSession = Misc.BytesToHexString(Security.RandomBytes(0x10)); ConsoleMySQL.saveConsole(ref entry); if (entry.ClientBanned) { Globals.write("Client [{0}] Banned CPUKey: {1}", IPAddr, entry.CPUKey); ConsoleMySQL.updateOtherConsoles(ref entry, true); writerIO.Writer.Write(Globals.XSTL_STATUS_BANNED); return; } if (entry.ClientEnabled) { Globals.write("Client [{0}] Authorized {1} CPUKey: {2}", IPAddr, !entry.ClientConType ? "Jtag" : "Devkit", entry.CPUKey); writerIO.Writer.Write(Globals.XSTL_STATUS_STEALTHED); writerIO.Writer.Write(Misc.HexStringToBytes(entry.ClientSession)); } else { if (ConsoleMySQL.autoUpdateTime(ref entry)) { if (entry.daysLeft <= 499) { Globals.write("Client [{0}] Started their next 24 hours! - CPUKey: {1}", IPAddr, entry.CPUKey); writerIO.Writer.Write(Globals.XSTL_STATUS_DAY_STARTED); } else { writerIO.Writer.Write(Globals.XSTL_STATUS_STEALTHED); } writerIO.Writer.Write(Misc.HexStringToBytes(entry.ClientSession)); } else { Globals.write("Client [{0}] Expired CPUKey: {1}", IPAddr, entry.CPUKey); writerIO.Writer.Write(Globals.XSTL_STATUS_EXPIRED); } } ConsoleMySQL.saveConsole(ref entry); } else { Globals.write("Client [{0}] Failed Authorization! CPUKey: {1}", IPAddr, entry.CPUKey); ConsoleMySQL.updateOtherConsoles(ref entry); writerIO.Writer.Write(Globals.XSTL_STATUS_ERROR); return; } } else { if (AnonSQL.getConsoleAnon(ref entry)) { entry.ClientSession = Misc.BytesToHexString(Security.RandomBytes(0x10)); if (entry.ClientBanned) { Globals.write("Anon [{0}] Banned CPUKey: {1}", IPAddr, entry.CPUKey); ConsoleMySQL.updateOtherConsoles(ref entry, true); writerIO.Writer.Write(Globals.XSTL_STATUS_BANNED); return; } Globals.write("Anon [{0}] Authorized {1} CPUKey: {2}", IPAddr, entry.ClientConType ? "Devkit" : "Jtag", entry.CPUKey); writerIO.Writer.Write(Globals.XSTL_STATUS_XBLFREE); writerIO.Writer.Write(Misc.HexStringToBytes(entry.ClientSession)); } else { AnonSQL.addAnon(ref entry); Globals.write("Anon [{0}] New User! CPUKey: {1}", IPAddr, entry.CPUKey); writerIO.Writer.Write(Globals.XSTL_STATUS_XBLFREE); writerIO.Writer.Write(Misc.HexStringToBytes(entry.ClientSession)); } } }