package l2next.loginserver.clientpackets;
import l2next.loginserver.Config;
import l2next.loginserver.GameServerManager;
import l2next.loginserver.IpBanManager;
import l2next.loginserver.L2LoginClient;
import l2next.loginserver.accounts.Account;
import l2next.loginserver.accounts.SessionManager;
import l2next.loginserver.crypt.PasswordHash;
import l2next.loginserver.gameservercon.GameServer;
import l2next.loginserver.gameservercon.lspackets.GetAccountInfo;
import l2next.loginserver.serverpackets.LoginFail;
import l2next.loginserver.serverpackets.LoginOk;
import l2next.loginserver.utils.Log;
import javax.crypto.Cipher;
public class RequestLogin extends L2LoginClientPacket {
private byte[] _raw = new byte[128];
@Override
protected void readImpl()
{
readD();
readB(_raw);
readD();
readH();
readC();
}
@Override
protected void runImpl() throws Exception
{
L2LoginClient client = getClient();
byte[] decrypted;
try
{
Cipher rsaCipher = Cipher.getInstance("RSA/ECB/nopadding");
rsaCipher.init(Cipher.DECRYPT_MODE, client.getRSAPrivateKey());
decrypted = rsaCipher.doFinal(_raw, 0x00, 0x80);
}
catch(Exception e)
{
client.closeNow();
return;
}
String user = new String(decrypted, 0x40, 14).trim();
user = user.toLowerCase();
String password = new String(decrypted, 0x60, 16).trim();
int currentTime = (int) (System.currentTimeMillis() / 1000L);
Account account = new Account(user);
account.restore();
String passwordHash = Config.DEFAULT_CRYPT.encrypt(password);
if(account.getPasswordHash() == null)
{
if(Config.AUTO_CREATE_ACCOUNTS && user.matches(Config.ANAME_TEMPLATE) && password.matches(Config.APASSWD_TEMPLATE))
{
account.setAllowedIP("");
account.setPasswordHash(passwordHash);
account.save();
}
else
{
client.close(LoginFail.LoginFailReason.REASON_USER_OR_PASS_WRONG);
return;
}
}
boolean passwordCorrect = account.getPasswordHash().equals(passwordHash);
if(!passwordCorrect)
// проверяем не зашифрован ли пароль одним из устаревших но
// поддерживаемых алгоритмов
{
for(PasswordHash c : Config.LEGACY_CRYPT)
{
if(c.compare(password, account.getPasswordHash()))
{
passwordCorrect = true;
account.setPasswordHash(passwordHash);
break;
}
}
}
if(!IpBanManager.getInstance().tryLogin(client.getIpAddress(), passwordCorrect))
{
client.closeNow();
return;
}
if(!passwordCorrect)
{
client.close(LoginFail.LoginFailReason.REASON_USER_OR_PASS_WRONG);
return;
}
if(account.getAccessLevel() < 0)
{
client.close(LoginFail.LoginFailReason.REASON_ACCESS_FAILED);
return;
}
if(account.getBanExpire() > currentTime)
{
client.close(LoginFail.LoginFailReason.REASON_ACCESS_FAILED);
return;
}
if(!account.isAllowedIP(client.getIpAddress()))
{
client.close(LoginFail.LoginFailReason.REASON_ATTEMPTED_RESTRICTED_IP);
return;
}
for(GameServer gs : GameServerManager.getInstance().getGameServers())
{
if(gs.getProtocol() >= 2 && gs.isAuthed())
{
gs.sendPacket(new GetAccountInfo(user));
}
}
account.setLastAccess(currentTime);
account.setLastIP(client.getIpAddress());
Log.LogAccount(account);
SessionManager.Session session = SessionManager.getInstance().openSession(account);
client.setAuthed(true);
client.setLogin(user);
client.setAccount(account);
client.setSessionKey(session.getSessionKey());
client.setState(L2LoginClient.LoginClientState.AUTHED);
client.sendPacket(new LoginOk(client.getSessionKey()));
}
}
Ну это такое, с соц сетями тоже ведь так же: зашел разок после закачки браузера и все. Я вот, честно говоря, даже не помню пароль от ВК своего, все время перебираю возможные паролидля этого придумали авторизации через соц сети.
Там дело было в том, что можно было запускать клиент указав данные логина и пароля (клиент после запуска сразу соглашение показывал). Все дело было в полях s2c auth пакета какого то.И заставляем юзеров ограничивать на символы свои пароли, как минимум на сепараторы.
Лет много назад с мХардом(ЗГ) был подобный опыт(лаунчер с автовходом, валидацией через веб, на плюсах и всетакое...), игроки не оценили, финиш.
К чему этот пост :/?Там дело было в том, что можно было запускать клиент указав данные логина и пароля (клиент после запуска сразу соглашение показывал). Все дело было в полях s2c auth пакета какого то.
compile-authserver:
[delete] Deleting directory C:\Users\Home\Desktop\Патч\build\classes
[mkdir] Created dir: C:\Users\Home\Desktop\Патч\build\classes
[javac] Compiling 59 source files to C:\Users\Home\Desktop\Патч\build\classes
[javac] warning: [path] bad path element "C:\Users\Home\Desktop\Патч\DataPack\lib\L2NT-Scripts.jar": no such file or directory
[javac] warning: [options] bootstrap class path not set in conjunction with -source 1.7
[javac] C:\Users\Home\Desktop\Патч\Src\l2next\loginserver\clientpackets\RequestLogin .java:23: error: class RequestLogin is public, should be declared in a file named RequestLogin.java
[javac] public class RequestLogin extends L2LoginClientPacket {
[javac] ^
[javac] C:\Users\Home\Desktop\Патч\Src\l2next\loginserver\L2LoginPacketHandler.java:38: error: an enum switch case label must be the unqualified name of an enumeration constant
[javac] case 0x0B:
switch(state)
{
case CONNECTED:
if(opcode == 0x07)
{
packet = new AuthGameGuard();
}
break;
case AUTHED_GG:
if(opcode == 0x00)
{
packet = new RequestAuthLogin();
}
break;
case 0x0B:
if(opcode == 0x0B)
{
packet = new RequestLogin();
}
break;
case AUTHED:
if(opcode == 0x05)
{
packet = new RequestServerList();
}
else if(opcode == 0x02)
{
packet = new RequestServerLogin();
}
break;
default:
break;
l2.exe account= password=
ExternalLogin=false
CmdLineLogin=false
ExternalLogin=true
CmdLineLogin=true
ANZO;369791 написал(а):Вы не можете просматривать ссылку пожалуйста воспользуйтесь следующими ссылками Вход или Регистрация
+ пакет на стороне сервера полностью копирующий RequestLogin. Точно не помню -
Код:if(opcode == 0x00) { if(Config.USE_ONLY_CMD_AUTH) packet = new RequestLogin(); else packet = new RequestAuthLogin(); } else if(opcode == 0x0b) packet = new RequestLogin(); else debugOpcode(opcode, state);
Возможно еще придется внести правки в l2.ini (что то там насчет CommandLine бла бла бла = true)
package l2next.loginserver.clientpackets;
import l2next.loginserver.Config;
import l2next.loginserver.GameServerManager;
import l2next.loginserver.IpBanManager;
import l2next.loginserver.L2LoginClient;
import l2next.loginserver.accounts.Account;
import l2next.loginserver.accounts.SessionManager;
import l2next.loginserver.crypt.PasswordHash;
import l2next.loginserver.gameservercon.GameServer;
import l2next.loginserver.gameservercon.lspackets.GetAccountInfo;
import l2next.loginserver.serverpackets.LoginFail;
import l2next.loginserver.serverpackets.LoginOk;
import l2next.loginserver.utils.Log;
import javax.crypto.Cipher;
/**
* Новый пакет авторизации для захода без ввода логина и пароля
* Created by WoWan-SM on 17.07.2014.
* L2Dev.su
*/
public class RequestLogin extends L2LoginClientPacket {
private byte[] _raw = new byte[128];
@Override
protected void readImpl()
{
readD();
readB(_raw);
readD();
readH();
readC();
}
@Override
protected void runImpl() throws Exception
{
L2LoginClient client = getClient();
byte[] decrypted;
try
{
Cipher rsaCipher = Cipher.getInstance("RSA/ECB/nopadding");
rsaCipher.init(Cipher.DECRYPT_MODE, client.getRSAPrivateKey());
decrypted = rsaCipher.doFinal(_raw, 0x00, 0x80);
}
catch(Exception e)
{
client.closeNow();
return;
}
String user = new String(decrypted, 0x40, 14).trim();
user = user.toLowerCase();
String password = new String(decrypted, 0x60, 16).trim();
int currentTime = (int) (System.currentTimeMillis() / 1000L);
Account account = new Account(user);
account.restore();
String passwordHash = Config.DEFAULT_CRYPT.encrypt(password);
if(account.getPasswordHash() == null)
{
if(Config.AUTO_CREATE_ACCOUNTS && user.matches(Config.ANAME_TEMPLATE) && password.matches(Config.APASSWD_TEMPLATE))
{
account.setAllowedIP("");
account.setPasswordHash(passwordHash);
account.save();
}
else
{
client.close(LoginFail.LoginFailReason.REASON_USER_OR_PASS_WRONG);
return;
}
}
boolean passwordCorrect = account.getPasswordHash().equals(passwordHash);
if(!passwordCorrect)
// проверяем не зашифрован ли пароль одним из устаревших но
// поддерживаемых алгоритмов
{
for(PasswordHash c : Config.LEGACY_CRYPT)
{
if(c.compare(password, account.getPasswordHash()))
{
passwordCorrect = true;
account.setPasswordHash(passwordHash);
break;
}
}
}
if(!IpBanManager.getInstance().tryLogin(client.getIpAddress(), passwordCorrect))
{
client.closeNow();
return;
}
if(!passwordCorrect)
{
client.close(LoginFail.LoginFailReason.REASON_USER_OR_PASS_WRONG);
return;
}
if(account.getAccessLevel() < 0)
{
client.close(LoginFail.LoginFailReason.REASON_ACCESS_FAILED);
return;
}
if(account.getBanExpire() > currentTime)
{
client.close(LoginFail.LoginFailReason.REASON_ACCESS_FAILED);
return;
}
if(!account.isAllowedIP(client.getIpAddress()))
{
client.close(LoginFail.LoginFailReason.REASON_ATTEMPTED_RESTRICTED_IP);
return;
}
for(GameServer gs : GameServerManager.getInstance().getGameServers())
{
if(gs.getProtocol() >= 2 && gs.isAuthed())
{
gs.sendPacket(new GetAccountInfo(user));
}
}
account.setLastAccess(currentTime);
account.setLastIP(client.getIpAddress());
Log.LogAccount(account);
SessionManager.Session session = SessionManager.getInstance().openSession(account);
client.setAuthed(true);
client.setLogin(user);
client.setAccount(account);
client.setSessionKey(session.getSessionKey());
client.setState(L2LoginClient.LoginClientState.AUTHED);
client.sendPacket(new LoginOk(client.getSessionKey()));
}
}
String user = new String(decrypted, 0x5E, 14).trim();
user = user.toLowerCase();
String password = new String(decrypted, 0x6C, 16).trim();
String user = new String(decrypted, 0x40, 14).trim();
user = user.toLowerCase();
String password = new String(decrypted, 0x60, 16).trim();
Открываешь исходники логин сервера перекодишь в папкуНо как данний пакет установить?
Все слелал ток опкод не могу поставить (Открываешь исходники логин сервера перекодишь в папку
l2next.loginserver.clientpackets
и там создаешь новый класс
RequestLogin
И копируешь туда все содержимое моей реализации.
Да и не забыть добавить опкод 0x0B для этого пакета, путь сказать не могу, сам поищи там на логине мало классов.
switch(state)
{
case CONNECTED:
if(opcode == 0x07)
{
packet = new AuthGameGuard();
}
break;
case AUTHED_GG:
if(opcode == 0x00)
{
packet = new RequestAuthLogin();
}
if(opcode == 0x0B)
{
packet = new RequestLogin();
}
break;
case AUTHED:
if(opcode == 0x05)
{
packet = new RequestServerList();
}
else if(opcode == 0x02)
{
packet = new RequestServerLogin();
}
break;
default:
break;
}
return packet;
compile-authserver:
[delete] Deleting directory C:\Users\Home\Desktop\Патч\build\classes
[mkdir] Created dir: C:\Users\Home\Desktop\Патч\build\classes
[javac] Compiling 59 source files to C:\Users\Home\Desktop\Патч\build\classes
[javac] warning: [path] bad path element "C:\Users\Home\Desktop\Патч\DataPack\lib\L2NT-Scripts.jar": no such file or directory
[javac] warning: [options] bootstrap class path not set in conjunction with -source 1.7
[javac] C:\Users\Home\Desktop\Патч\Src\l2next\loginserver\clientpackets\RequestLogin .java:23: error: class RequestLogin is public, should be declared in a file named RequestLogin.java
[javac] public class RequestLogin extends L2LoginClientPacket {
[javac] ^
[javac] C:\Users\Home\Desktop\Патч\Src\l2next\loginserver\clientpackets\RequestLogin .java:50: error: method closeNow in class MMOClient<T> cannot be applied to given types;
[javac] client.closeNow();
[javac] ^
[javac] required: boolean
[javac] found: no arguments
[javac] reason: actual and formal argument lists differ in length
[javac] where T is a type-variable:
[javac] T extends MMOConnection declared in class MMOClient
[javac] C:\Users\Home\Desktop\Патч\Src\l2next\loginserver\clientpackets\RequestLogin .java:99: error: method closeNow in class MMOClient<T> cannot be applied to given types;
[javac] client.closeNow();
[javac] ^
[javac] required: boolean
[javac] found: no arguments
[javac] reason: actual and formal argument lists differ in length
[javac] where T is a type-variable:
[javac] T extends MMOConnection declared in class MMOClient
[javac] 3 errors
[javac] 2 warnings
BUILD FAILED
compile-authserver:
[delete] Deleting directory C:\Users\Home\Desktop\Патч\build\classes
[mkdir] Created dir: C:\Users\Home\Desktop\Патч\build\classes
[javac] Compiling 59 source files to C:\Users\Home\Desktop\Патч\build\classes
[javac] warning: [path] bad path element "C:\Users\Home\Desktop\Патч\DataPack\lib\L2NT-Scripts.jar": no such file or directory
[javac] warning: [options] bootstrap class path not set in conjunction with -source 1.7
[javac] C:\Users\Home\Desktop\Патч\Src\l2next\loginserver\clientpackets\RequestLogin .java:23: error: class RequestLogin is public, should be declared in a file named RequestLogin.java
[javac] public class RequestLogin extends L2LoginClientPacket {
[javac] ^
[javac] 1 error
[javac] 2 warnings
Всем спс тему Closed
Нет, но человеку, который мне помог я бы минимум поставил "Мне нравится" и подкинул репутации.Купили бы вы лаунчер за 500р) з Авторизациею ?)
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?