public override void run() { if (getClient().login1 != login1 && getClient().login2 != login2) { getClient().sendPacket(new LoginFail(getClient(), LoginFail.LoginFailReason.REASON_ACCESS_FAILED)); return; } L2Server server = ServerThreadPool.getInstance().get(serverId); if (server == null) { getClient().sendPacket(new LoginFail(getClient(), LoginFail.LoginFailReason.REASON_ACCESS_FAILED)); return; } if (server.connected == 0) { getClient().sendPacket(new LoginFail(getClient(), LoginFail.LoginFailReason.REASON_SERVER_MAINTENANCE)); } else { ServerThreadPool.getInstance().SendPlayer(serverId, getClient(), DateTime.Now.ToLocalTime().ToString()); //login updates here getClient().sendPacket(new PlayOk(getClient())); } }
public override void run() { L2Server server = null; foreach (L2Server srv in ServerThreadPool.getInstance().servers) { if (srv.code == code) { srv.thread = thread; server = srv; break; } } if (server == null) { CLogger.error("code '" + code + "' for server was not found. closing"); thread.close(new ServerLoginFail("wrong code")); return; } thread.id = server.id; thread.info = info; thread.wan = host; thread.port = port; thread.maxp = maxp; thread.gmonly = gmonly == 1; thread.testMode = test == 1; thread.connected = true; thread.sendPacket(new ServerLoginOk()); CLogger.extra_info("AuthThread: Server #" + server.id + " connected"); }
public void Start() { Console.Title = "L2dotNET Loginserver"; Cfg.load(); ClientManager.Instance.Initialize(); ServerThreadPool.getInstance(); NetworkRedirect.getInstance(); LoginListener = new TcpListener(IPAddress.Parse(Cfg.SERVER_HOST), Cfg.SERVER_PORT); LoginListener.Start(); CLogger.extra_info("Auth server listening clients at " + Cfg.SERVER_HOST + ":" + Cfg.SERVER_PORT); new System.Threading.Thread(ServerThreadPool.getInstance().start).Start(); TcpClient clientSocket = default(TcpClient); while (true) { clientSocket = LoginListener.AcceptTcpClient(); AcceptClient(clientSocket); } }
public override void run() { string username, password; CipherParameters key = getClient().RsaPair._privateKey; RSAEngine rsa = new RSAEngine(); rsa.init(false, key); byte[] decrypt = rsa.processBlock(_raw, 0, 128); if (decrypt.Length < 128) { byte[] temp = new byte[128]; Array.Copy(decrypt, 0, temp, 128 - decrypt.Length, decrypt.Length); decrypt = temp; } username = Encoding.ASCII.GetString(decrypt, 0x5e, 14).Replace("\0", ""); password = Encoding.ASCII.GetString(decrypt, 0x6c, 16).Replace("\0", ""); AccountModel account = accountService.GetAccountByLogin(username); if (account == null) { if (Cfg.AUTO_ACCOUNTS) { account = accountService.CreateAccount(username, L2Security.HashPassword(password)); } else { getClient().sendPacket(new LoginFail(getClient(), LoginFail.LoginFailReason.REASON_USER_OR_PASS_WRONG)); getClient().close(); return; } } else { if (!accountService.CheckIfAccountIsCorrect(username, L2Security.HashPassword(password))) { getClient().sendPacket(new LoginFail(getClient(), LoginFail.LoginFailReason.REASON_USER_OR_PASS_WRONG)); getClient().close(); return; } if (ServerThreadPool.getInstance().LoggedAlready(username.ToLower())) { getClient().sendPacket(new LoginFail(getClient(), LoginFail.LoginFailReason.REASON_ACCOUNT_IN_USE)); getClient().close(); return; } } Random rnd = new Random(); getClient().activeAccount = account; getClient().setLoginPair(rnd.Next(), rnd.Next()); getClient().setPlayPair(rnd.Next(), rnd.Next()); getClient().sendPacket(new LoginOk(getClient())); }
public ServerList(LoginClient Client) { base.makeme(Client); servers = ServerThreadPool.getInstance().servers; }