- Joined
- Jul 2, 2011
- Messages
- 783
- Reaction score
- 230
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.)
Help me plssssssss!
Extra Info:
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.)
PHP:
void SendLoginData()
{
PacketWriter writer = new PacketWriter();
writer.WriteShort(0x01);//LOGIN_PASSWORD
writer.WriteMapleString(Program.username);
writer.WriteMapleString(Program.password);
writer.WriteMapleString(Environment.OSVersion.VersionString);
outSession.SendPacket(writer.ToArray());
}
Help me plssssssss!
Extra Info:
MapleServerHandler
CharLoginHandler.Login
MapleClient.Login
AuthSuccess:
PHP:
case LOGIN_PASSWORD1:
case LOGIN_PASSWORD2:
case LOGIN_PASSWORD:
case CLIENT_START:
CharLoginHandler.login(username, c, pwd);
c.getSession().write(LoginPacket.getAuthSuccessRequest(c));
CharLoginHandler.Login
PHP:
public static final void login(String username, MapleClient c, String pwd) {
int loginok = 0;
String login = username;
String pass = pwd;
//String ip = c.getSession().getRemoteAddress().toString().split(":")[0].replace("/", "");
c.setAccountName(login);
boolean macBan = c.hasBannedMac();
//loginok = c.login(login, pass, macBan);
loginok = c.login(login, pass, macBan);
Calendar tempbannedTill = c.getTempBanCalendar();
if ((loginok == 0) && (macBan) && (!c.isGm())) {
loginok = 3;
}
if (loginok != 0) {
if (!loginFailCount(c)) {
c.clearInformation();
c.getSession().write(LoginPacket.getLoginFailed(loginok));
} else {
c.getSession().close();
}
} else if (tempbannedTill.getTimeInMillis() != 0L) {
if (!loginFailCount(c)) {
c.clearInformation();
c.getSession().write(LoginPacket.getTempBan(PacketHelper.getTime(tempbannedTill.getTimeInMillis()), c.getBanReason()));
} else {
c.getSession().close();
}
} else {
c.loginAttempt = 0;
LoginWorker.registerClient(c);
}
}
MapleClient.Login
PHP:
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");
this.accountName = login;
this.accId = rs.getInt("id");
this.secondPassword = rs.getString("2ndpassword");
this.salt2 = rs.getString("salt2");
this.gm = (rs.getInt("gm") > 0);
this.greason = rs.getByte("greason");
this.tempban = getTempBanCalendar(rs);
this.gender = rs.getByte("gender");
boolean admin = rs.getInt("gm") > 1;
if ((this.secondPassword != null) && (this.salt2 != null)) {
this.secondPassword = LoginCrypto.rand_r(this.secondPassword);
}
ps.close();
if ((banned > 0) && (!this.gm)) {
loginok = 3;
} else {
if (banned == -1) {
unban();
}
byte loginstate = getLoginState();
if (loginstate > 0) {
this.loggedIn = false;
loginok = 7;
for (ChannelServer cservs : ChannelServer.getAllInstances()) {
for (MapleCharacter players : cservs.getPlayerStorage().getAllCharacters())
if (players.getAccountID() == this.accId) {
players.getClient().getSession().close();
players.getClient().disconnect(true, false);
break;
}
}
try
{
ps = con.prepareStatement("UPDATE accounts SET loggedin = 0 WHERE name = ?");
ps.setString(1, login);
ps.executeUpdate();
ps.close();
} catch (SQLException se) {
}
}
else if ((passhash == null) || (passhash.isEmpty()))
{
if ((oldSession != null) && (!oldSession.isEmpty())) {
this.loggedIn = getSessionIPAddress().equals(oldSession);
loginok = this.loggedIn ? 0 : 4;
} else {
loginok = 4;
this.loggedIn = false;
}
} else if (password.equals(passhash)) {
loginok = 0;
//} else if (LoginCrypto.checkSaltedSha512Hash(passhash, pwd, salt)) {
// loginok = 0;
this.loggedIn = true;
} else {
this.loggedIn = false;
loginok = 4;
}
}
}
rs.close();
ps.close();
} catch (SQLException e) {
System.err.println(new StringBuilder().append("ERROR").append(e).toString());
}
return loginok;
}
AuthSuccess:
PHP:
public static byte[] getAuthSuccessRequest(MapleClient client) {
MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
mplew.writeShort(SendPacketOpcode.LOGIN_STATUS.getValue());
mplew.writeZeroBytes(6);
mplew.writeInt(client.getAccID());
mplew.writeZeroBytes(9);
mplew.writeMapleAsciiString(client.getAccountName());
mplew.writeZeroBytes(10);
mplew.writeLong(PacketHelper.getTime(System.currentTimeMillis()));
mplew.writeInt(3);
mplew.write(HexTool.hex("01 00 01 01 01 00 00 00 00 00 01 01 00 00 00 01 00 01 00 00"));
mplew.write(1);
mplew.write(1);
mplew.writeLong(Randomizer.nextLong());
return mplew.getPacket();
}
PHP:
Recv - CLIENT_AUTH = 0x30
Send - CLIENT_AUTH = 0x15

