Сообщений: 527
Тем: 17
Зарегистрирован: Oct 2010
Репутация:
1,919
Такие проблемы случаются если не правильно задан порт ГСа, или какой то гвард не дает зайти.
Если бы был занят порт то оно не запустило бы ГС.
Сообщений: 794
Тем: 31
Зарегистрирован: Dec 2012
Репутация:
2,838
Сырки у Вас есть? Нужно прописать в сокет свой Ip.
Сообщений: 889
Тем: 21
Зарегистрирован: May 2010
Репутация:
12,856
Все говорят про порты ип но никто даже не думает что он мог вырезать криво привязку и защиту
Сообщений: 33
Тем: 7
Зарегистрирован: Sep 2012
Репутация:
21
Сырки как я понял Сурсы...
Да есть.
Сообщений: 794
Тем: 31
Зарегистрирован: Dec 2012
Репутация:
2,838
Откройте GameServer и посмотрите на какой Ip у Вас сокет открывается? И напишите сюда все строки, отвечающие за GAMESERVER_HOSTNAME примерно.
Сообщений: 33
Тем: 7
Зарегистрирован: Sep 2012
Репутация:
21
06-15-2013, 12:36 PM
(Сообщение последний раз редактировалось: 06-15-2013, 12:40 PM lCxAxAl.)
Mangol Написал:Все говорят про порты ип но никто даже не думает что он мог вырезать криво привязку и защиту Ну тогда мб подскажите как правильно вырезать пакет l2nt.project?
Добавлено через 3 минуты
Код: public class GameServer {
public static final int LOGIN_SERVER_PROTOCOL = 2;
private static final Logger _log = LoggerFactory.getLogger(GameServer.class);
public static GameServer _instance;
private final SelectorThread<GameClient> _selectorThreads[];
private final GameServerListenerList _listeners;
private Version version;
private TelnetServer statusServer;
private int _serverStarted;
@SuppressWarnings("unchecked")
public GameServer() throws Exception {
long serverLoadStart = System.currentTimeMillis();
_instance = this;
_serverStarted = time();
_listeners = new GameServerListenerList();
new File("./log/").mkdir();
version = new Version(GameServer.class);
_log.info("=================================================");
_log.info("Author:...................Novell-Team");
_log.info("Revision: ................ " + version.getRevisionNumber());
_log.info("Build date: .............. " + version.getBuildDate());
_log.info("Compiler version: ........ " + version.getBuildJdk());
_log.info("=================================================");
// Initialize config
Config.load();
// Check binding address
checkFreePorts();
// Initialize database
Class.forName(Config.DATABASE_DRIVER).newInstance();
DatabaseFactory.getInstance().getConnection().close();
IdFactory _idFactory = IdFactory.getInstance();
if (!_idFactory.isInitialized()) {
_log.error("Could not read object IDs from DB. Please Check Your Data.");
throw new Exception("Could not initialize the ID factory");
}
CacheManager.getInstance();
ThreadPoolManager.getInstance();
Scripts.getInstance();
GeoEngine.loadGeo();
Strings.reload();
GameTimeController.getInstance();
World.init();
Parsers.parseAll();
ItemsDAO.getInstance();
CrestCache.getInstance();
CharacterDAO.getInstance();
ClanTable.getInstance();
SkillTreeTable.getInstance();
AugmentationData.getInstance();
PetSkillsTable.getInstance();
EnchantHPBonusTable.getInstance();
ItemAuctionManager.getInstance();
SpawnManager.getInstance().spawnAll();
StaticObjectHolder.getInstance().spawnAll();
RaidBossSpawnManager.getInstance();
Scripts.getInstance().init();
Announcements.getInstance();
LotteryManager.getInstance();
PlayerMessageStack.getInstance();
if (Config.AUTODESTROY_ITEM_AFTER > 0)
ItemsAutoDestroy.getInstance();
MonsterRace.getInstance();
AutoChatHandler _autoChatHandler = AutoChatHandler.getInstance();
_log.info("AutoChatHandler: Loaded " + _autoChatHandler.size() + " handlers in total.");
if (Config.ENABLE_OLYMPIAD) {
Olympiad.load();
Hero.getInstance();
}
PetitionManager.getInstance();
CursedWeaponsManager.getInstance();
if (!Config.ALLOW_WEDDING) {
CoupleManager.getInstance();
_log.info("CoupleManager initialized");
}
ItemHandler.getInstance();
AdminCommandHandler.getInstance().log();
UserCommandHandler.getInstance().log();
VoicedCommandHandler.getInstance().log();
TaskManager.getInstance();
_log.info("=[Events]=========================================");
ResidenceHolder.getInstance().callInit();
EventHolder.getInstance().callInit();
_log.info("==================================================");
BoatHolder.getInstance().spawnAll();
CastleManorManager.getInstance();
Runtime.getRuntime().addShutdownHook(Shutdown.getInstance());
_log.info("IdFactory: Free ObjectID's remaining: " + IdFactory.getInstance().size());
CoupleManager.getInstance();
if (Config.ALT_FISH_CHAMPIONSHIP_ENABLED)
FishingChampionShipManager.getInstance();
HellboundManager.getInstance();
NaiaTowerManager.getInstance();
NaiaCoreManager.getInstance();
SoDManager.getInstance();
SoIManager.getInstance();
SoHManager.getInstance();
HarnakUndegroundManager.getInstance();
MiniGameScoreManager.getInstance();
/************** L2WT **************/
if (Config.L2TOP_MANAGER_ENABLED)
L2TopManager.getInstance();
if (Config.MMO_TOP_MANAGER_ENABLED)
MMOTopManager.getInstance();
CommissionShopManager.getInstance();
AwakingManager.getInstance();
PartySubstitute.getInstance();
/************** L2WT **************/
ArcanManager.getInstance();
WorldStatisticsManager.getInstance();
DimensionalRiftManager.getInstance();
//CastleSpawnManager.getInstance(); //preTest
// Only while need
//new DeadlockDetector().start(); // for test
ParnassusManager.getInstance();
BaltusManager.getInstance();
SubClassTable.getInstance();
if (Config.GARBAGE_COLLECTOR_INTERVAL > 0)
Class.forName(GarbageCollector.class.getName());
Shutdown.getInstance().schedule(Config.RESTART_AT_TIME, Shutdown.RESTART);
_log.info("GameServer Started");
_log.info("Maximum Numbers of Connected Players: " + Config.MAXIMUM_ONLINE_USERS);
GamePacketHandler gph = new GamePacketHandler();
InetAddress serverAddr = Config.GAMESERVER_HOSTNAME.equalsIgnoreCase("*") ? null : InetAddress.getByName(Config.GAMESERVER_HOSTNAME);
_selectorThreads = new SelectorThread[Config.PORTS_GAME.length];
for (int i = 0; i < Config.PORTS_GAME.length; i++) {
_selectorThreads[i] = new SelectorThread<GameClient>(Config.SELECTOR_CONFIG, gph, gph, gph, null);
_selectorThreads[i].openServerSocket(serverAddr, Config.PORTS_GAME[i]);
_selectorThreads[i].start();
}
LoginServerCommunication.getInstance().start();
if (Config.SERVICES_OFFLINE_TRADE_RESTORE_AFTER_RESTART)
ThreadPoolManager.getInstance().schedule(new RestoreOfflineTraders(), 30000L);
getListeners().onStart();
if (Config.IS_TELNET_ENABLED)
statusServer = new TelnetServer();
else
_log.info("Telnet server is currently disabled.");
_log.info("=================================================");
String memUsage = String.valueOf(StatsUtils.getMemUsage());
for (String line : memUsage.split("\n"))
_log.info(line);
_log.info("=================================================");
long serverLoadEnd = System.currentTimeMillis();
_log.info("Server Loaded in " + ((serverLoadEnd - serverLoadStart) / 1000) + " seconds");
}
public static GameServer getInstance() {
return _instance;
}
public static void checkFreePorts() {
boolean binded = false;
while (!binded)
for (int PORT_GAME : Config.PORTS_GAME)
try {
ServerSocket ss;
if (Config.GAMESERVER_HOSTNAME.equalsIgnoreCase("*"))
ss = new ServerSocket(PORT_GAME);
else
ss = new ServerSocket(PORT_GAME, 50, InetAddress.getByName(Config.GAMESERVER_HOSTNAME));
ss.close();
binded = true;
} catch (Exception e) {
_log.warn("Port " + PORT_GAME + " is allready binded. Please free it and restart server.");
binded = false;
try {
Thread.sleep(1000);
} catch (InterruptedException ignored) {
}
}
}
public static void main(String[] args) throws Exception {
new GameServer();
}
public SelectorThread<GameClient>[] getSelectorThreads() {
return _selectorThreads;
}
public int time() {
return (int) (System.currentTimeMillis() / 1000);
}
public int uptime() {
return time() - _serverStarted;
}
public GameServerListenerList getListeners() {
return _listeners;
}
public <T extends GameListener> boolean addListener(T listener) {
return _listeners.add(listener);
}
public <T extends GameListener> boolean removeListener(T listener) {
return _listeners.remove(listener);
}
public Version getVersion() {
return version;
}
public TelnetServer getStatusServer() {
return statusServer;
}
public class GameServerListenerList extends ListenerList<GameServer> {
public void onStart() {
for (Listener<GameServer> listener : getListeners())
if (OnStartListener.class.isInstance(listener))
((OnStartListener) listener).onStart();
}
public void onShutdown() {
for (Listener<GameServer> listener : getListeners())
if (OnShutdownListener.class.isInstance(listener))
((OnShutdownListener) listener).onShutdown();
}
}
}
Сообщений: 794
Тем: 31
Зарегистрирован: Dec 2012
Репутация:
2,838
У Вас что указано в Config.GAMESERVER_HOSTNAME?
И покажите clientpacket AuthLogin
Сообщений: 33
Тем: 7
Зарегистрирован: Sep 2012
Репутация:
21
06-15-2013, 12:54 PM
(Сообщение последний раз редактировалось: 06-15-2013, 12:59 PM lCxAxAl.)
Код: public abstract class L2LoginClientPacket extends ReceivablePacket<L2LoginClient>
{
private static Logger _log = LoggerFactory.getLogger(L2LoginClientPacket.class);
@Override
protected final boolean read()
{
try
{
readImpl();
return true;
}
catch (Exception e)
{
_log.error("", e);
return false;
}
}
@Override
public void run()
{
try
{
runImpl();
}
catch (Exception e)
{
_log.error("", e);
}
}
protected abstract void readImpl();
protected abstract void runImpl() throws Exception;
}
GameserverHostname = *
Добавлено через 4 минуты
Вот наверное Auth
Код: /**
* Format: b[128]ddddddhc b[128]: the rsa encrypted block with the login an password
*/
public class RequestAuthLogin extends L2LoginClientPacket
{
private byte[] _raw = new byte[128];
@Override
protected void readImpl()
{
readB(_raw);
readD();
readD();
readD();
readD();
readD();
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(true);
return;
}
String user = new String(decrypted, 0x5E, 14).trim();
user = user.toLowerCase();
String password = new String(decrypted, 0x6C, 16).trim();
int ncotp = decrypted[0x7c];
ncotp |= decrypted[0x7d] << 8;
ncotp |= decrypted[0x7e] << 16;
ncotp |= decrypted[0x7f] << 24;
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(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(false);
return;
}
if (!passwordCorrect)
{
client.close(LoginFailReason.REASON_USER_OR_PASS_WRONG);
return;
}
if (account.getAccessLevel() < 0)
{
client.close(LoginFailReason.REASON_ACCESS_FAILED);
return;
}
if (account.getBanExpire() > currentTime)
{
client.close(LoginFailReason.REASON_ACCESS_FAILED);
return;
}
if (!account.isAllowedIP(client.getIpAddress()))
{
client.close(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);
Session session = SessionManager.getInstance().openSession(account);
client.setAuthed(true);
client.setLogin(user);
client.setAccount(account);
client.setSessionKey(session.getSessionKey());
client.setState(LoginClientState.AUTHED);
client.sendPacket(new LoginOk(client.getSessionKey()));
}
}
Сообщений: 794
Тем: 31
Зарегистрирован: Dec 2012
Репутация:
2,838
lCxAxAl Написал:Вот наверное Auth
Код: /**
* Format: b[128]ddddddhc b[128]: the rsa encrypted block with the login an password
*/
public class RequestAuthLogin extends L2LoginClientPacket
{
private byte[] _raw = new byte[128];
@Override
protected void readImpl()
{
readB(_raw);
readD();
readD();
readD();
readD();
readD();
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(true);
return;
}
String user = new String(decrypted, 0x5E, 14).trim();
user = user.toLowerCase();
String password = new String(decrypted, 0x6C, 16).trim();
int ncotp = decrypted[0x7c];
ncotp |= decrypted[0x7d] << 8;
ncotp |= decrypted[0x7e] << 16;
ncotp |= decrypted[0x7f] << 24;
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(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(false);
return;
}
if (!passwordCorrect)
{
client.close(LoginFailReason.REASON_USER_OR_PASS_WRONG);
return;
}
if (account.getAccessLevel() < 0)
{
client.close(LoginFailReason.REASON_ACCESS_FAILED);
return;
}
if (account.getBanExpire() > currentTime)
{
client.close(LoginFailReason.REASON_ACCESS_FAILED);
return;
}
if (!account.isAllowedIP(client.getIpAddress()))
{
client.close(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);
Session session = SessionManager.getInstance().openSession(account);
client.setAuthed(true);
client.setLogin(user);
client.setAccount(account);
client.setSessionKey(session.getSessionKey());
client.setState(LoginClientState.AUTHED);
client.sendPacket(new LoginOk(client.getSessionKey()));
}
}
Это LS. Смотрите GS, clientpacket AuthLogin.
Сообщений: 33
Тем: 7
Зарегистрирован: Sep 2012
Репутация:
21
Код: /**
* cSddddd cSdddddQ loginName + keys must match what the loginserver used.
*/
public class AuthLogin extends L2GameClientPacket
{
private String _loginName;
private int _playKey1;
private int _playKey2;
private int _loginKey1;
private int _loginKey2;
private byte[] _data = new byte[48];
@Override
protected void readImpl()
{
_loginName = readS(32).toLowerCase();
_playKey2 = readD();
_playKey1 = readD();
_loginKey1 = readD();
_loginKey2 = readD();
}
@Override
protected void runImpl()
{
GameClient client = getClient();
SessionKey key = new SessionKey(_loginKey1, _loginKey2, _playKey1, _playKey2);
client.setSessionId(key);
client.setLoginName(_loginName);
if (Shutdown.getInstance().getMode() != Shutdown.NONE && Shutdown.getInstance().getSeconds() <= 15)
client.closeNow(false);
else
{
if (LoginServerCommunication.getInstance().isShutdown())
{
client.close(new LoginFail(LoginFail.SYSTEM_ERROR_LOGIN_LATER));
return;
}
GameClient oldClient = LoginServerCommunication.getInstance().addWaitingClient(client);
if (oldClient != null)
oldClient.close(ServerClose.STATIC);
LoginServerCommunication.getInstance().sendPacket(new PlayerAuthRequest(client));
}
}
}
|