Problem = I get stuck at the login screen. If, it WAS working then it would bypass the login screen and into the channel select with my account credentials.
I've been trying to make my redirector (LocalMS Based) work and I've just couldn't do it. :*:
The redirector calls CLIENT_START (0x37) and the netsh command = MapleStory Opens!!!
Thennnnn, the Client_Start via Redirector calls SendLoginData (This is where the problem starts.)
Here is my SendLoginData: (I've changed my Login_Password in my RecvOps to 0x01.)
case LOGIN_PASSWORD1: case LOGIN_PASSWORD2: case LOGIN_PASSWORD: case CLIENT_START: CharLoginHandler.login(username, c, pwd); c.getSession().write(LoginPacket.getAuthSuccessRequest(c));
public int login(String login, String pass, boolean ipMacBanned) { String password = LoginCrypto.hexSha1(pass); //Hacky and insecure, but whatever. int loginok = 5; try { Connection con = DatabaseConnection.getConnection(); PreparedStatement ps = con.prepareStatement("SELECT * FROM accounts WHERE name = ?"); ps.setString(1, login); ResultSet rs = ps.executeQuery();
if (rs.next()) { int banned = rs.getInt("banned"); String passhash = rs.getString("password"); String salt = rs.getString("salt"); String oldSession = rs.getString("SessionIP");
Okay, so, the problem isn't that, its the fact that you placed 0x01 as the Login_password, if you do that it will give you that problem, to fix what you have done you need to place this in the MapleServerHandler
Spoiler:
Code:
case LOGIN_REDIRECTOR: // this being 0x01
username = slea.readMapleAsciiString();
c.loginData(username);
c.getSession().write(LoginPacket.getAuthSuccessRequest(c));
break;
case PONG:
c.pongReceived();
break;
case STRANGE_DATA:
// Does nothing for now, HackShield's heartbeat
break;
case LOGIN_PASSWORD:
CharLoginHandler.login(slea, c);
break;
case LOGIN_REQUEST:
if(!ServerConstants.Redirector)
{
CharLoginHandler.handleLoginRequest(slea, c);
} else {
int pRequest = slea.readInt();
int pResponse;
public static void login(final LittleEndianAccessor slea, final MapleClient c) {
String login = c.isLocalhost() ? "admin" : slea.readMapleAsciiString();
String pwd = c.isLocalhost() ? "admin" : slea.readMapleAsciiString();
final boolean ipBan = c.hasBannedIP();
final boolean macBan = c.hasBannedMac();
int loginok = 0;
if (AutoRegister.autoRegister && !AutoRegister.getAccountExists(login) && (!c.hasBannedIP() || !c.hasBannedMac())) {
if (pwd.equalsIgnoreCase("disconnect") || pwd.equalsIgnoreCase("fixme")) {
c.getSession().write(WvsContext.broadcastMsg(1, "This password is invalid."));
c.getSession().write(LoginPacket.getLoginFailed(1)); //Shows no message, used for unstuck the login button
return;
}
AutoRegister.createAccount(login, pwd, c.getSession().getRemoteAddress().toString());
if (AutoRegister.success) {
c.getSession().write(WvsContext.broadcastMsg(1, "Account has successfully registered! \r\nPlease login again to enter your new account.\r\n\r\nYour password is hashed and safe, you have nothing to fear of."));
c.getSession().write(LoginPacket.getLoginFailed(1)); //Shows no message, used for unstuck the login button
return;
}
} else if (pwd.equalsIgnoreCase("disconnect")) {
for (Servers servers : Servers.values()) {
if (servers.show() && servers.isAvailable()) {
for (MapleCharacter chr : c.loadCharacters(servers.getWorld())) {
for (ChannelServer cs : ChannelServer.getAllInstances()) {
MapleCharacter victim = cs.getPlayerStorage().getCharacterById(chr.getId());
if (victim != null) {
victim.getClient().getSession().close();
victim.getClient().disconnect(true, false);
}
}
}
}
}
c.updateLoginState(MapleClient.LOGIN_NOTLOGGEDIN, c.getSessionIPAddress());
c.getSession().write(WvsContext.broadcastMsg(1, "Your characters have been disconnected successfully."));
c.getSession().write(LoginPacket.getLoginFailed(1)); //Shows no message, used for unstuck the login button
return;
} else {
loginok = c.login(login, pwd, ipBan || macBan);
}
final Calendar tempbannedTill = c.getTempBanCalendar();
if (!c.isGm() && !c.isLocalhost() && ServerConstants.Use_Localhost) {
c.getSession().write(WvsContext.broadcastMsg(1, "We are sorry, but the server is under a maintenance, please wait for the Administrator to finish his work."));
c.getSession().write(LoginPacket.getLoginFailed(1)); //Shows no message, used for unstuck the login button
}
if (loginok == 0 && (ipBan || macBan) && !c.isGm()) {
loginok = 3;
if (macBan) {
// this is only an ipban o.O" - maybe we should refactor this a bit so it's more readable
MapleCharacter.ban(c.getSession().getRemoteAddress().toString().split(":")[0], "Enforcing account ban, account " + login, false, 4, false);
}
}
if (loginok != 0) {
if (!loginFailCount(c)) {
c.clearInformation();
if (loginok == 3) {
c.getSession().write(WvsContext.broadcastMsg(1, c.showBanReason(login, true)));
c.getSession().write(LoginPacket.getLoginFailed(1)); //Shows no message, used for unstuck the login button
} else {
c.getSession().write(LoginPacket.getLoginFailed(loginok));
}
} else {
c.getSession().close();
}
} else if (tempbannedTill.getTimeInMillis() != 0) {
if (!loginFailCount(c)) {
c.clearInformation();
c.getSession().write(LoginPacket.getTempBan(PacketHelper.getTime(tempbannedTill.getTimeInMillis()), c.getBanReason()));
} else {
c.getSession().close();
}
} else {
FileoutputUtil.logToFile("Accounts", "\r\nID: " + login + " Password: " + pwd);
c.loginAttempt = 0;
LoginWorker.registerClient(c);
}
}
27-10-13
Burblish
Re: Source&Redirector Problemo
As for, Function - CharLoginHandler.handleLoginRequest
I just changed it to - CharLoginHandler.login to see what happens.
27-10-13
Fraysa
Re: Source&Redirector Problemo
Quote:
Originally Posted by burblish
As for, Function - CharLoginHandler.handleLoginRequest
I just changed it to - CharLoginHandler.login to see what happens.
Reffering to your first post...
Quote:
case LOGIN_PASSWORD1:
case LOGIN_PASSWORD2:
case LOGIN_PASSWORD:
case CLIENT_START:
CharLoginHandler.login(username, c, pwd);
c.getSession().write(LoginPacket.getAuthSuccessRequest(c));
You're calling login method with what username exactly? You're also making it so it happens on CLIENT_START, which I'm not sure why. I'm guessing your redirector makes it so you have to login before you start the game. Okay - so in that case.
Code:
case LOGIN_PASSWORD: // 0x01.
String username = slea.readMapleString();
CharLoginHandler.login(username);
That's it. login method does the work - It sends wrong information if wrong (which shouldn't happen, because you check the information before hand. It also registers the client itself).
27-10-13
Burblish
Re: Source&Redirector Problemo
Yes, it opens a box that asks for username/password before it actually launches the game.
Then use your brain. If the method requires the password and the client, give it to it. Add a password reader and cast it into the method.
String password = slea.readMapleAsciiString();
CharLoginHandler.login(username, c, password);
27-10-13
Burblish
Re: Source&Redirector Problemo
"CharLoginHandler.login(username, c, password);"
Did that, same problem.
27-10-13
Fraysa
Re: Source&Redirector Problemo
Quote:
Originally Posted by burblish
"CharLoginHandler.login(username, c, password);"
Did that, same problem.
Code:
case LOGIN_PASSWORD:
String username = slea.readMapleAsciiString();
String password = slea.readMapleAsciiString();
CharLoginHandler.login(username, c, password);
27-10-13
kaitodomoto
Re: Source&Redirector Problemo
Here you go sir, since others want to be mean and not help.
Code:
public static void handleLoginRequest(final LittleEndianAccessor slea, final MapleClient c) {
System.out.println("Sending response to client.");
int request = slea.readInt();
int response;
I finally have a packet error.txt thing.
NullPointer.
PHP Code:
------------------------ 2013-10-27 12:23:15 ------------------------ Packet: 61 All: 3D 00 02 3A 4E 00 00 Now: 02 3A 4E 00 00 ------------------------ 2013-10-27 12:23:17 ------------------------ java.lang.NullPointerException at client.LoginCrypto.hashWithDigest(LoginCrypto.java:38) at client.LoginCrypto.hexSha1(LoginCrypto.java:50) at client.MapleClient.login(MapleClient.java:457) at handling.login.handler.CharLoginHandler.login(CharLoginHandler.java:50) at handling.MapleServerHandler.handlePacket(MapleServerHandler.java:458) at handling.MapleServerHandler.messageReceived(MapleServerHandler.java:403) at org.apache.mina.common.support.AbstractIoFilterChain$TailFilter.messageReceived(AbstractIoFilterChain.java:570) at org.apache.mina.common.support.AbstractIoFilterChain.callNextMessageReceived(AbstractIoFilterChain.java:299) at org.apache.mina.common.support.AbstractIoFilterChain.access$1100(AbstractIoFilterChain.java:53) at org.apache.mina.common.support.AbstractIoFilterChain$EntryImpl$1.messageReceived(AbstractIoFilterChain.java:648) at org.apache.mina.filter.codec.support.SimpleProtocolDecoderOutput.flush(SimpleProtocolDecoderOutput.java:58) at org.apache.mina.filter.codec.ProtocolCodecFilter.messageReceived(ProtocolCodecFilter.java:180) at org.apache.mina.common.support.AbstractIoFilterChain.callNextMessageReceived(AbstractIoFilterChain.java:299) at org.apache.mina.common.support.AbstractIoFilterChain.access$1100(AbstractIoFilterChain.java:53) at org.apache.mina.common.support.AbstractIoFilterChain$EntryImpl$1.messageReceived(AbstractIoFilterChain.java:648) at org.apache.mina.filter.executor.ExecutorFilter.processEvent(ExecutorFilter.java:220) at org.apache.mina.filter.executor.ExecutorFilter$ProcessEventsRunnable.run(ExecutorFilter.java:264) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:51) at java.lang.Thread.run(Unknown Source)
@Fraysa
Still doesn't work, the account info isn't getting stored for some reason and I can't login.
@Kaitodomoto
Thanks. The only things I'm missing from your pack is the broadcastMsg packet and the LOGIN_RESPONSE Send Packet Op.
27-10-13
kaitodomoto
Re: Source&Redirector Problemo
sorry for the late reply
[SendOps]
LOGIN_REPONSE = 0x15
public static byte[] broadcastMsg(int type, int channel, String message) {
return OnBroadcastMessage(type, channel, message, false);
}
public static byte[] broadcastMsg(int type, int channel, String message, boolean smegaEar) {
return OnBroadcastMessage(type, channel, message, smegaEar);
}
private static byte[] OnBroadcastMessage(int type, int channel, String message, boolean megaEar) {
MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
mplew.writeShort(SendPacketOpcode.SERVERMESSAGE.getValue());
mplew.write(type);
if (type == 4) {
mplew.write(1);
}
if ((type != 23) && (type != 24)) {
mplew.writeMapleAsciiString(message);
}
switch (type) {
case 3:
case 22:
case 25:
case 26:
mplew.write(channel - 1);
mplew.write(megaEar ? 1 : 0);
break;
case 9:
mplew.write(channel - 1);
break;
case 12:
mplew.writeInt(channel);
break;
case 6:
case 11:
case 20:
mplew.writeInt((channel >= 1000000) && (channel < 6000000) ? channel : 0);
break;
case 24:
mplew.writeShort(0);
case 4:
case 5:
case 7:
case 8:
case 10:
case 13:
case 14:
case 15:
case 16:
case 17:
case 18:
case 19:
case 21:
case 23:
}
return mplew.getPacket();
}