воппрос по аутху ц1 птс (request_login)

john2023

Единомышленник
Участник
Сообщения
69
Розыгрыши
0
Репутация
6
Реакции
48
Баллы
104
Оверпостинг
аутх декодирует пакет и пропускает буфер дальше
RSA декодер (ц4+) декодирует 128 байт и получаем на выходе акаунт и пароль
так работает до каких-то хроник, на ц6 точно работает

но если пакет больше 256, то надо RSA декодировать в 2 етапа
1 етап после декодирования получаю 000000000... вроди недекодирует
но в 2 етап получаю конец пароля = значит декодирует

вопрос: почему в ц6 буфер декодируется нормально a в хрониках XXX что-то да не так
первая мысль - буфер идёт какой-то другой

ещё впрос

есть такой пакет - фейл логина. отправляет код. а клиент показывает текст по етому коду
впрос: есть ли вариант отправить свой текст? например код 100 по которому клиент понимает что дальше идёт текст в пакете
 

Оверпостинг
аутх декодирует пакет и пропускает буфер дальше
RSA декодер (ц4+) декодирует 128 байт и получаем на выходе акаунт и пароль
так работает до каких-то хроник, на ц6 точно работает

но если пакет больше 256, то надо RSA декодировать в 2 етапа
1 етап после декодирования получаю 000000000... вроди недекодирует
но в 2 етап получаю конец пароля = значит декодирует

вопрос: почему в ц6 буфер декодируется нормально a в хрониках XXX что-то да не так
первая мысль - буфер идёт какой-то другой
нууу

Если смотреть на скриптов:

есть 2 варианта входа, который использует 2 массива:
1 на 128 байт и 2 на 128 байт.
Если размер пакета больше или равна 256, значит испрльзуем 2 массива. Если меньше - тобько 1.
Если 2 массив имеет данные, значит логин будет на офсете 0x4E с размером 32, а пароль во втором массиве на офсете 0x5C с размером 16.

Если только 1 массив представлен - логин будет на смещении 0x5E с размером 14, а пароль 0x6C с размером 16.

Ещё можно OTP пароль доставать, он будет или во втором массиве, или если нет второго массива - в первом - последние 4 байта в виде Integer.

Код с которым баловаться давно:
Java:
package org.l2j.loginserver.network.client2server;

import org.index.commons.StatSet;
import org.index.network.NetworkReader;
import org.index.commons.CommonPair;
import org.index.utils.Utils;
import org.l2j.commons.crypt.RSACrypt;
import org.l2j.commons.totp.TOTPImpl;
import org.l2j.loginserver.enums.ErrorMessageCode;
import org.l2j.loginserver.model.Account;
import org.l2j.loginserver.model.LoginClient;
import org.l2j.loginserver.model.database.AvailableAccounts;
import org.l2j.loginserver.network.common.LoginController;
import org.l2j.loginserver.network.common.handler.AuthClientPacket;
import org.l2j.loginserver.network.server2client.LoginOk;
import org.l2j.loginserver.network.server2client.ScCheckRequest;
import org.l2j.loginserver.network.server2client.SendServerFail;

/**
 * aAqLogin = AQ_LOGIN
 */
public class RequestLogin extends AuthClientPacket
{
    private final byte[] _raw01 = new byte[128];
    private final byte[] _raw02 = new byte[128];
    private boolean _newAuthMethod = false;

    @Override
    protected void readImpl()
    {
        if (available() >= (_raw01.length + _raw02.length))
        {
            _newAuthMethod = true;
            readBytes(_raw01);
            readBytes(_raw02);
        }
        if (available() >= (_raw01.length))
        {
            readBytes(_raw01);
        }
    }

    @Override
    public void run()
    {
        final CommonPair<byte[], byte[]> decrypted = decryptData(client, _raw01, _raw02, _newAuthMethod);
        if (decrypted.isNull())
        {
            return;
        }
        final CommonPair<String, String> converted = convertByteToString(decrypted.getKey(), decrypted.getValue());
        final int otpKey = getOtpKey(decrypted.getKey(), decrypted.getValue(), _newAuthMethod);
        if (true || tryToLogin(converted.getKey(), converted.getValue(), otpKey))
        {
            client.sendPacket(new LoginOk());
        }
    }

    private boolean tryToLogin(String login, String password, int otpKey)
    {
        final boolean isAccountExist = AvailableAccounts.getInstance().isAccountAvailable(login);
        final StatSet accountSet = isAccountExist ? AvailableAccounts.getInstance().getAccountInfo(login) : null;
        // is account exist and info null = account is innactive - need to ask DB.
        // is account exist and info is contains = restore account info from local
        // is account do not exist but auto-reg is turn on
        final Account account = isAccountExist ? (accountSet == null ? null : new Account(accountSet)) : new Account(login, password);
        if (isAccountExist && account == null)
        {
            // try to restore from DB because account is inactive but exist
            // send system error
            client.disconnect(new SendServerFail(ErrorMessageCode.MESSAGE_01));
            return false;
        }
        // account not exist but autoregistration is enabled. Add new account info and store
        if (!isAccountExist /* && autoreg */)
        {
            account.setAccessLevel(0);
            account.setLastAccessTime(System.currentTimeMillis());
            account.setOtpSecurityKey(Utils.EMPTY_STRING);
            AvailableAccounts.getInstance().addNewAccountInfo(account);
        }
        if (isAccountExist && !compareLoginInfo(login, password, account))
        {
            // try to restore from DB because account is inactive but exist
            // send system error
            client.disconnect(new SendServerFail(ErrorMessageCode.MESSAGE_02));
            return false;
        }
        // account exist but OTP check is enabled
        else if (false /*is otp check*/)
        {
            // OTP key cannot be less than zero. Or client hax, or otp key is not entered
            if (otpKey < 0)
            {
                // send "account enabled otp key"
                client.disconnect(new SendServerFail(ErrorMessageCode.MESSAGE_73));
                return false;
            }
            final String otpSecureKey = account.getOtpSecurityKey();
            final boolean isCorrectOTPKey = TOTPImpl.getInstance().verifyKey(otpKey, otpSecureKey, 6);
            if (isCorrectOTPKey)
            {
                // all fine, continue
            }
            else
            {
                // send error
                client.disconnect(new SendServerFail(ErrorMessageCode.MESSAGE_33));
                return false;
            }
        }
        if (false/* one time password check with 4 digits*/)
        {
            client.sendPacket(new ScCheckRequest());
            // we cant send login ok but need to store account info
        }
        LoginController.getInstance().addLoginInformation(client, login, password);
        return true;
    }

    private boolean compareLoginInfo(String login, String password, Account account)
    {
        // use SHA key?
        return account.getPassword().equals(password);
    }

    private static CommonPair<byte[], byte[]> decryptData(LoginClient client, byte[] raw01, byte[] raw02, boolean newAuthMethod)
    {
        byte[] decodedUser = RSACrypt.decodeByteArrayByRSA(raw01, 0, client.getScrambledPair().getPair().getPrivate());
        byte[] decodedPass = RSACrypt.decodeByteArrayByRSA(raw02, 0, client.getScrambledPair().getPair().getPrivate());
        return new CommonPair<>(decodedUser, decodedPass);
    }

    private static CommonPair<String, String> convertByteToString(byte[] user, byte[] pass)
    {
        final String userInfo;
        final String passInfo;
        if (pass != null)
        {
            userInfo = new String(user, 0x4E, 32).trim().toLowerCase();
            passInfo = new String(pass, 0x5C, 16).trim();
        }
        else
        {
            userInfo = new String(user, 0x5E, 14).trim().toLowerCase();
            passInfo = new String(user, 0x6C, 16).trim();
        }
        return new CommonPair<>(userInfo, passInfo);
    }

    private static int getOtpKey(byte[] user, byte[] pass, boolean newAuthMethod)
    {
        if (user == null || (newAuthMethod && pass == null))
        {
            return -1;
        }
        final byte[] searchingArray = newAuthMethod ? pass : user;
        final int otpKey = new NetworkReader(searchingArray, 124).readInt();
        return otpKey < 0 ? -1 : otpKey;
    }
}

ещё впрос

есть такой пакет - фейл логина. отправляет код. а клиент показывает текст по етому коду
впрос: есть ли вариант отправить свой текст? например код 100 по которому клиент понимает что дальше идёт текст в пакете
там всегда была структура cd, значит свой уникальный текст не втыкгуть.
Искать с какого места идут сообщения и дописывать свои.
Java:
package org.l2j.loginserver.enums;

/**
 * @author Index
 */
public enum ErrorMessageCode
{
    /**
     * @implNote any message
     */
    NONE(0),
    /**
     * @implNote This is a system error. Please logging in again later.
     */
    MESSAGE_01(1),
    /**
     * @implNote The username and password do not match. Please check you account information and try logging in again.
     */
    MESSAGE_02(2),
    /**
     * @implNote The username and password do not match. Please check you account information and try logging in again.
     */
    MESSAGE_03(3),
    /**
     * @implNote You are unable to connect to the server. Please try again later .
     */
    MESSAGE_04(4),
    /**
     * @implNote Incorrect account information. Please inquire though the Lineage II Customer Service Center or the 1:1 support in the official website.
     */
    MESSAGE_05(5),
    /**
     * @implNote You are unable to connect to the server. Please try again later .
     */
    MESSAGE_06(6),
    /**
     * @implNote Account is already in use.
     */
    MESSAGE_07(7),
    /**
     * @apiNote If send on confirmation User Agreement - game will close session but still on the same page
     */
    NULL(8),
    /**
     * @implNote You are unable to connect to the server. Please try again later .
     */
    MESSAGE_09(9),
    /**
     * @implNote You are unable to connect to the server. Please try again later .
     */
    MESSAGE_10(10),
    /**
     * @implNote You are unable to connect to the server. Please try again later .
     */
    MESSAGE_11(11),
    /**
     * @implNote In order to play Lineage II, you must be Ages 15 or above. You must be 18 or above in order to use the PvP servers.
     */
    MESSAGE_12(12),
    /**
     * @implNote You are unable to connect to the server. Please try again later .
     */
    MESSAGE_13(13),
    /**
     * @implNote You are unable to connect to the server. Please try again later .
     */
    MESSAGE_14(14),
    /**
     * @implNote Due to high server traffic, your login attempt has failed. Please try again soon.
     * @apiNote it will call huge window and after pressing ok you still be on the same place
     */
    MESSAGE_15(15),
    /**
     * @implNote We are currently undergoing game server maintenance. Please log in again later.
     */
    MESSAGE_16(16),
    /**
     * @implNote Please login after changing your temporary password.
     */
    MESSAGE_17(17),
    /**
     * @implNote Your game time has expired. You can not login. To continue playing, please purchase Lineage II either directly from the PlayNC Store or from any leading games retailer.
     */
    MESSAGE_18(18),
    /**
     * @implNote There is no time left on this account.
     */
    MESSAGE_19(19),
    /**
     * @implNote System error.
     */
    MESSAGE_20(20),
    /**
     * @implNote You are unable to connect to the server.
     */
    MESSAGE_21(21),
    /**
     * @implNote Game connection attempted through a restricted IP.
     */
    MESSAGE_22(22),
    /**
     * @implNote This week's available time is over.
     */
    MESSAGE_30(30),
    /**
     * @implNote Please enter the card number for number 0
     * @apiNote no matter what you type in field - game will hide UI
     */
    MESSAGE_31(31),
    /**
     * @implNote Users who did not complete the Age 18 Verification may not login between 10PM and 6AM the next day.
     */
    MESSAGE_32(32),
    /**
     * @implNote This server cannot be accessed with the coupon you are using.
     */
    MESSAGE_33(33),
    /**
     * @implNote You are using a computer that does not allow you to log in with two accounts at the same time.
     */
    MESSAGE_35(35),
    /**
     * @implNote Your account is currently dormant. If happens if you do not log in the game for a period of time. You may switch your account mode to active by visiting the 4game website (https://eu.4gamesupport.com) 1:1 Customer Service Center.
     * @apiNote it will call huge window and after pressing ok you will be redirected to entering login and password
     */
    MESSAGE_36(36),
    /**
     * @implNote Your account has not been authenticated yet. Please visit the homepage(https://eu.4gamesupport.com) and confirm your identity.
     * @apiNote it will call huge window and after pressing ok you will be redirected to entering login and password
     */
    MESSAGE_37(37),
    /**
     * @implNote Your account has not completed the Parental Agreement.\n\nPlease confirm the Parental Agreement before logging in.
     * @apiNote it will call huge window and after pressing ok you will be redirected to entering login and password
     */
    MESSAGE_38(38),
    /**
     * @implNote This account has declined the User Agreement or has request for membership withdrawal.  Please try again after\n\n cancelling the Game Agreement declination or cancelling the membership withdrawal request.
     * @apiNote it will call huge window and after pressing ok you will be redirected to entering login and password
     */
    MESSAGE_39(39),
    /**
     * @implNote All permissions on your account are restricted.\n\nPlease go to http://eu.4game.com/ for details.
     * @apiNote it will call huge window and after pressing ok you will be redirected to entering login and password
     */
    MESSAGE_40(40),
    /**
     * @implNote You must change your password and secret question in order to log in. Please visit the 4game website (https://eu.4gamesupport.com) 1:1 Customer Service Center and change the password and secret question.
     * @apiNote it will call huge window and after pressing ok you will be redirected to entering login and password
     */
    MESSAGE_41(41),
    /**
     * @implNote You are currently logged into 10 of your accounts and can no longer access your other accounts.
     */
    MESSAGE_42(42),
    /**
     * @implNote Your master account has been restricted.
     */
    MESSAGE_43(43),
    /**
     * @implNote Authentication has failed as you have entered an incorrect authentication number or did not enter the authentication number.  If you fail authentication 3 times in row, game access be restricted for 30 min..
     * @apiNote it will call huge window and after pressing ok you will be redirected to entering login and password
     */
    MESSAGE_46(46),
    /**
     * @implNote Due to problems with communications, our telephone certification service is currently unavailable. Please try again later.
     * @apiNote it will call huge window and after pressing ok you will be redirected to entering login and password
     */
    MESSAGE_47(47),
    /**
     * @implNote Due to problems with communications, telephone signals are being delayed. Please try again later.
     * @apiNote it will call huge window and after pressing ok you will be redirected to entering login and password
     */
    MESSAGE_48(48),
    /**
     * @implNote The certification failed because the line was busy or the call was not received. Please try again.
     * @apiNote it will call huge window and after pressing ok you will be redirected to entering login and password
     */
    MESSAGE_49(49),
    /**
     * @implNote An unexpected error has occured. Please contact our Customer Support Team at https://eu.4gamesupport.com
     * @apiNote it will call huge window and after pressing ok you will be redirected to entering login and password
     */
    MESSAGE_50(50),
    /**
     * @implNote The telephone certification service is currently being checked. Please try again later.
     * @apiNote it will call huge window and after pressing ok you will be redirected to entering login and password
     */
    MESSAGE_51(51),
    /**
     * @implNote Due to heavy volume, the telephone certification service cannot be used at this time. Please try again later.
     * @apiNote it will call huge window and after pressing ok you will be redirected to entering login and password
     */
    MESSAGE_52(52),
    /**
     * @implNote An unexpected error has occured. Please contact our Customer Support Team at https://eu.4gamesupport.com
     * @apiNote it will call huge window and after pressing ok you will be redirected to entering login and password
     */
    MESSAGE_53(53),
    /**
     * @implNote If you fail authentication 3 times in a row,  game access will be resticted for 30 min.. Please try again later.
     * @apiNote it will call huge window and after pressing ok you will be redirected to entering login and password
     */
    MESSAGE_54(54),
    /**
     * @implNote The number of uses of the daily telephone certification service has been exceeded.
     * @apiNote it will call huge window and after pressing ok you will be redirected to entering login and password
     */
    MESSAGE_55(55),
    /**
     * @implNote Telephone certification is already underway. Please try again later.
     * @apiNote it will call huge window and after pressing ok you will be redirected to entering login and password
     */
    MESSAGE_56(56),
    /**
     * @implNote You can't log in with an unregistered PC.
     */
    MESSAGE_59(59),
    /**
     * @implNote That account is pending email authentication. Please verify authentication email with registered email account.
     */
    MESSAGE_72(72),
    /**
     * @implNote You have enabled OTP authentication. Enter your one-time password, please.
     */
    MESSAGE_73(73),
    /**
     * @implNote Could not connect to Authentication Server. Please try again later.
     */
    MESSAGE_74(74),
    /**
     * @implNote Failed to view the rank
     */
    MESSAGE_75(75),
    /**
     * @implNote You have not used your account for a long time. If you have not logged into the game for a set period of time, you will be able to log in via play nc homepage (id.plaync.com/account/dormant/index) https://id.plaync.com/account/dormant/index">id.plaync.com/account/dormant/index).
     * @apiNote it will call huge window and after pressing ok you will be redirected to entering login and password
     */
    MESSAGE_77(77),
    /**
     * @implNote Old) NC OTP related information was deleter of Wednesday August 30th, 2017. Accordingly, Old) NC OTP service account require personal verification to reactivate. Complete the personal verification process at
     */
    MESSAGE_79(79),
    /**
     * @implNote The security card service has ended so you will be able to connect to the game after cancelling the security card. In order to protect your account, please cancel the security card and request Google OTP.
     */
    MESSAGE_80(80),
    ;

    private final int _clientId;

    ErrorMessageCode(int clientId)
    {
        _clientId = clientId;
    }

    public int getClientId()
    {
        return _clientId;
    }
}
 
Последнее редактирование:
<code>
/**
* @implNote Dualbox forbidden.
*/
MESSAGE_23(23),
</code>
 
другой вопрос. запрограмировал аутх ц1 чтоб понимал клиент 166 (фафурион)
на сервер ц1 птс можно зайти етим клиентом через такой аутх
а вот если поставить тот же аутх для сервера 166 птс. то сервер невыдаёт окно выбора персонажа

у меня подозрение что сервер пакет декодирует по своему а не по принципу бловфиша или же ему надо послать етот ключь бловфиша (который у меня стандартный от ц6)
может кто сталкивался?
 
Назад
Сверху Снизу