DarknessVoice Posted April 13, 2013 Posted April 13, 2013 hello ,cheaters devlopers O0 i just had a costume mode "changepassword" ingame and and the folder have in it core.patch someone can tell me where to past ...?
0 DarknessVoice Posted April 13, 2013 Author Posted April 13, 2013 it's a normale files contain this Index: head-src/com/l2jfrozen/gameserver/handler/voicedcommandhandlers/ChangePassword.java =================================================================== --- head-src/com/l2jfrozen/gameserver/handler/voicedcommandhandlers/ChangePassword.java (revision 0) +++ head-src/com/l2jfrozen/gameserver/handler/voicedcommandhandlers/ChangePassword.java (revision 0) @@ -0,0 +1,91 @@ +/* + * This program is free software: you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free Software + * Foundation, either version 3 of the License, or (at your option) any later + * version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + * details. + * + * You should have received a copy of the GNU General Public License along with + * this program. If not, see <http://www.gnu.org/licenses/>. + */ +package com.l2jfrozen.gameserver.handler.voicedcommandhandlers; + +import java.util.StringTokenizer; + +import com.l2jfrozen.gameserver.handler.IVoicedCommandHandler; +import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance; +import com.l2jfrozen.gameserver.thread.LoginServerThread; + + + + +/** + * + * @author Nik + * + */ +public class ChangePassword implements IVoicedCommandHandler +{ + private static final String[] _voicedCommands = + { + "changepassword" + }; + + @Override + public boolean useVoicedCommand(String command, L2PcInstance activeChar, String target) + { + if (target != null) + { + StringTokenizer st = new StringTokenizer(target); + try + { + String curpass = null, newpass = null, repeatnewpass = null; + if (st.hasMoreTokens()) curpass = st.nextToken(); + if (st.hasMoreTokens()) newpass = st.nextToken(); + if (st.hasMoreTokens()) repeatnewpass = st.nextToken(); + + if (!(curpass == null || newpass == null || repeatnewpass == null)) + { + if (!newpass.equals(repeatnewpass)) + { + activeChar.sendMessage("The new password doesn't match with the repeated one!"); + return false; + } + if (newpass.length() < 3) + { + activeChar.sendMessage("The new password is shorter than 3 chars! Please try with a longer one."); + return false; + } + if (newpass.length() > 30) + { + activeChar.sendMessage("The new password is longer than 30 chars! Please try with a shorter one."); + return false; + } + + LoginServerThread.getInstance().sendChangePassword(activeChar.getAccountName(), activeChar.getName(), curpass, newpass); + } + else + { + activeChar.sendMessage("Invalid password data! You have to fill all boxes."); + return true; + } + } + catch (Exception e) + { + activeChar.sendMessage("A problem occured while changing password!"); + //_log.log(Level.WARNING, "", e); + } + } + else + { + //showHTML(activeChar); + String html = HtmCache.getInstance().getHtm("en", "data/html/mods/ChangePassword.htm"); + if (html == null) + html = "<html><body><br><br><center><font color=LEVEL>404:</font> File Not Found</center></body></html>"; + activeChar.sendPacket(new NpcHtmlMessage(1, html)); + return true; + } + return true; + } + + @Override + public String[] getVoicedCommandList() + { + return _voicedCommands; + } +} Index: head-src/com/l2jfrozen/gameserver/thread/LoginServerThread.java =================================================================== --- head-src/com/l2jfrozen/gameserver/thread/LoginServerThread.java (revision 986) +++ head-src/com/l2jfrozen/gameserver/thread/LoginServerThread.java (working copy) @@ -32,6 +32,7 @@ import java.security.spec.RSAPublicKeySpec; import java.util.List; import java.util.Map; +import java.util.logging.Level; import java.util.logging.Logger; import javolution.util.FastList; @@ -48,12 +49,14 @@ import com.l2jfrozen.gameserver.network.gameserverpackets.AuthRequest; import com.l2jfrozen.gameserver.network.gameserverpackets.BlowFishKey; import com.l2jfrozen.gameserver.network.gameserverpackets.ChangeAccessLevel; +import com.l2jfrozen.gameserver.network.gameserverpackets.ChangePassword; import com.l2jfrozen.gameserver.network.gameserverpackets.GameServerBasePacket; import com.l2jfrozen.gameserver.network.gameserverpackets.PlayerAuthRequest; import com.l2jfrozen.gameserver.network.gameserverpackets.PlayerInGame; import com.l2jfrozen.gameserver.network.gameserverpackets.PlayerLogout; import com.l2jfrozen.gameserver.network.gameserverpackets.ServerStatus; import com.l2jfrozen.gameserver.network.loginserverpackets.AuthResponse; +import com.l2jfrozen.gameserver.network.loginserverpackets.ChangePasswordResponse; import com.l2jfrozen.gameserver.network.loginserverpackets.InitLS; import com.l2jfrozen.gameserver.network.loginserverpackets.KickPlayer; import com.l2jfrozen.gameserver.network.loginserverpackets.LoginServerFail; @@ -378,6 +381,9 @@ doKickPlayer(kp.getAccount()); kp = null; break; + case 0xF8: + new ChangePasswordResponse(decrypt); + break; } } } @@ -605,6 +611,20 @@ { return _maxPlayer; } + + public void sendChangePassword(String accountName, String charName, String oldpass, String newpass) + { + ChangePassword cp = new ChangePassword(accountName, charName, oldpass, newpass); + try + { + sendPacket(cp); + } + catch (IOException e) + { + if (Config.DEBUG) + _log.log(Level.WARNING, "", e); + } + } /** * @param id Index: head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestBypassToServer.java =================================================================== --- head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestBypassToServer.java (revision 986) +++ head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestBypassToServer.java (working copy) @@ -27,6 +27,8 @@ import com.l2jfrozen.gameserver.datatables.sql.AdminCommandAccessRights; import com.l2jfrozen.gameserver.handler.AdminCommandHandler; import com.l2jfrozen.gameserver.handler.IAdminCommandHandler; +import com.l2jfrozen.gameserver.handler.IVoicedCommandHandler; +import com.l2jfrozen.gameserver.handler.VoicedCommandHandler; import com.l2jfrozen.gameserver.handler.custom.CustomBypassHandler; import com.l2jfrozen.gameserver.model.L2Object; import com.l2jfrozen.gameserver.model.L2World; @@ -287,6 +288,48 @@ + else if (_command.startsWith("voice ")) + { + //only voice commands allowed in bypass for html (bypass -h voice .changepassword) + if (_command.length() > 7 + && _command.charAt(6) == '.') + { + final String vc, vparams; + final int endOfCommand = _command.indexOf(" ", 7); + if (endOfCommand > 0) + { + vc = _command.substring(7, endOfCommand).trim(); + vparams = _command.substring(endOfCommand).trim(); + } + else + { + vc = _command.substring(7).trim(); + vparams = null; + } + if (vc.length() > 0) + { + final IVoicedCommandHandler vch = VoicedCommandHandler.getInstance().getVoicedCommandHandler(vc); + if (vch != null) + vch.useVoicedCommand(vc, activeChar, vparams); + } + } + } else if(_command.startsWith("Quest ")) { if(!activeChar.validateBypass(_command)) Index: head-src/com/l2jfrozen/gameserver/network/loginserverpackets/ChangePasswordResponse.java =================================================================== --- head-src/com/l2jfrozen/gameserver/network/loginserverpackets/ChangePasswordResponse.java (revision 0) +++ head-src/com/l2jfrozen/gameserver/network/loginserverpackets/ChangePasswordResponse.java (revision 0) @@ -0,0 +1,38 @@ +/* + * This program is free software: you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free Software + * Foundation, either version 3 of the License, or (at your option) any later + * version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + * details. + * + * You should have received a copy of the GNU General Public License along with + * this program. If not, see <http://www.gnu.org/licenses/>. + */ +package com.l2jfrozen.gameserver.network.loginserverpackets; + +import com.l2jfrozen.gameserver.model.L2World; +import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance; + + + + +public class ChangePasswordResponse extends LoginServerBasePacket +{ + + public ChangePasswordResponse(byte[] decrypt) + { + super(decrypt); + //boolean isSuccessful = readC() > 0; + String character = readS(); + String msgToSend = readS(); + + L2PcInstance player = L2World.getInstance().getPlayer(character); + + if (player != null) + player.sendMessage(msgToSend); + } +} \ No newline at end of file Index: head-src/com/l2jfrozen/gameserver/network/gameserverpackets/ChangePassword.java =================================================================== --- head-src/com/l2jfrozen/gameserver/network/gameserverpackets/ChangePassword.java (revision 0) +++ head-src/com/l2jfrozen/gameserver/network/gameserverpackets/ChangePassword.java (revision 0) @@ -0,0 +1,41 @@ +/* + * This program is free software: you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free Software + * Foundation, either version 3 of the License, or (at your option) any later + * version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + * details. + * + * You should have received a copy of the GNU General Public License along with + * this program. If not, see <http://www.gnu.org/licenses/>. + */ + +package com.l2jfrozen.gameserver.network.gameserverpackets; + +import java.io.IOException; + + +/** + * @author UnAfraid + * + */ +public class ChangePassword extends GameServerBasePacket +{ + public ChangePassword(String accountName, String characterName, String oldPass, String newPass) + { + writeC(0x1F); + writeS(accountName); + writeS(characterName); + writeS(oldPass); + writeS(newPass); + } + + @Override + public byte[] getContent() throws IOException + { + return getBytes(); + } +} \ No newline at end of file Index: head-src/com/l2jfrozen/gameserver/cache/HtmCache.java =================================================================== --- head-src/com/l2jfrozen/gameserver/cache/HtmCache.java (revision 986) +++ head-src/com/l2jfrozen/gameserver/cache/HtmCache.java (working copy) @@ -213,6 +213,26 @@ return content; } + + //added for gethtm + public String getHtm(String prefix, String path) + { + String newPath = null; + String content; + if (prefix != null && !prefix.isEmpty()) + { + newPath = prefix + path; + content = getHtm(newPath); + if (content != null) + return content; + } + + content = getHtm(path); + if (content != null && newPath != null) + _cache.put(newPath.hashCode(), content); + + return content; + } public String getHtm(String path) { Index: head-src/com/l2jfrozen/loginserver/GameServerThread.java =================================================================== --- head-src/com/l2jfrozen/loginserver/GameServerThread.java (revision 986) +++ head-src/com/l2jfrozen/loginserver/GameServerThread.java (working copy) @@ -41,12 +41,14 @@ import com.l2jfrozen.gameserver.datatables.GameServerTable.GameServerInfo; import com.l2jfrozen.loginserver.network.gameserverpackets.BlowFishKey; import com.l2jfrozen.loginserver.network.gameserverpackets.ChangeAccessLevel; +import com.l2jfrozen.loginserver.network.gameserverpackets.ChangePassword; import com.l2jfrozen.loginserver.network.gameserverpackets.GameServerAuth; import com.l2jfrozen.loginserver.network.gameserverpackets.PlayerAuthRequest; import com.l2jfrozen.loginserver.network.gameserverpackets.PlayerInGame; import com.l2jfrozen.loginserver.network.gameserverpackets.PlayerLogout; import com.l2jfrozen.loginserver.network.gameserverpackets.ServerStatus; import com.l2jfrozen.loginserver.network.loginserverpackets.AuthResponse; +import com.l2jfrozen.loginserver.network.loginserverpackets.ChangePasswordResponse; import com.l2jfrozen.loginserver.network.loginserverpackets.InitLS; import com.l2jfrozen.loginserver.network.loginserverpackets.KickPlayer; import com.l2jfrozen.loginserver.network.loginserverpackets.LoginServerFail; @@ -189,6 +191,9 @@ case 06: onReceiveServerStatus(data); break; + case 0x1F: + new ChangePassword(data); + break; default: _log.warning("Unknown Opcode (" + Integer.toHexString(packetType).toUpperCase() + ") from GameServer, closing connection."); forceClose(LoginServerFail.NOT_AUTHED); @@ -702,6 +707,19 @@ kp = null; } + + public void ChangePasswordResponse(byte successful, String characterName, String msgToSend) + { + ChangePasswordResponse cpr = new ChangePasswordResponse(successful, characterName, msgToSend); + try + { + sendPacket(cpr); + } + catch (IOException e) + { + e.printStackTrace(); + } + } /** * @param gameExternalHost Index: head-src/com/l2jfrozen/loginserver/network/gameserverpackets/ChangePassword.java =================================================================== --- head-src/com/l2jfrozen/loginserver/network/gameserverpackets/ChangePassword.java (revision 0) +++ head-src/com/l2jfrozen/loginserver/network/gameserverpackets/ChangePassword.java (revision 0) @@ -0,0 +1,120 @@ +/* + * This program is free software: you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free Software + * Foundation, either version 3 of the License, or (at your option) any later + * version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + * details. + * + * You should have received a copy of the GNU General Public License along with + * this program. If not, see <http://www.gnu.org/licenses/>. + */ +package com.l2jfrozen.loginserver.network.gameserverpackets; + +import java.security.MessageDigest; +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.util.Collection; +import java.util.logging.Level; +import java.util.logging.Logger; + +import com.l2jfrozen.crypt.Base64; +import com.l2jfrozen.gameserver.datatables.GameServerTable; +import com.l2jfrozen.gameserver.datatables.GameServerTable.GameServerInfo; +import com.l2jfrozen.loginserver.GameServerThread; +import com.l2jfrozen.loginserver.network.clientpackets.ClientBasePacket; +import com.l2jfrozen.util.database.L2DatabaseFactory; + + + +/** + * @author Nik + */ +public class ChangePassword extends ClientBasePacket +{ + protected static Logger _log = Logger.getLogger(ChangePassword.class.getName()); + private static GameServerThread gst = null; + + public ChangePassword(byte[] decrypt) + { + super(decrypt); + + String accountName = readS(); + String characterName = readS(); + String curpass = readS(); + String newpass = readS(); + + //get the GameServerThread + Collection<GameServerInfo> serverList = GameServerTable.getInstance().getRegisteredGameServers().values(); + for (GameServerInfo gsi : serverList) + if (gsi.getGameServerThread() != null && gsi.getGameServerThread().hasAccountOnGameServer(accountName)) + gst = gsi.getGameServerThread(); + + if (gst == null) + return; + + if (curpass == null || newpass == null) + gst.ChangePasswordResponse((byte) 0, characterName, "Invalid password data! Try again."); + else + { + Connection con = null; + try + { + MessageDigest md = MessageDigest.getInstance("SHA"); + + byte[] raw = curpass.getBytes("UTF-8"); + raw = md.digest(raw); + String curpassEnc = Base64.encodeBytes(raw); + String pass = null; + int passUpdated = 0; + + // SQL connection + con = L2DatabaseFactory.getInstance().getConnection(); + PreparedStatement statement = con.prepareStatement("SELECT password FROM accounts WHERE login=?"); + statement.setString(1, accountName); + ResultSet rset = statement.executeQuery(); + if (rset.next()) + pass = rset.getString("password"); + rset.close(); + statement.close(); + + if (curpassEnc.equals(pass)) + { + byte[] password = newpass.getBytes("UTF-8"); + password = md.digest(password); + + // SQL connection + PreparedStatement ps = con.prepareStatement("UPDATE accounts SET password=? WHERE login=?"); + ps.setString(1, Base64.encodeBytes(password)); + ps.setString(2, accountName); + passUpdated = ps.executeUpdate(); + ps.close(); + + _log.log(Level.INFO, "The password for account " + accountName + " has been changed from " + curpassEnc + " to " + Base64.encodeBytes(password)); + if (passUpdated > 0) + gst.ChangePasswordResponse((byte) 1, characterName, "You have successfully changed your password!"); + else + { + gst.ChangePasswordResponse((byte) 0, characterName, "The password change was unsuccessful!"); + L2DatabaseFactory.close(con); + } + } + else + gst.ChangePasswordResponse((byte) 0, characterName, "The typed current password doesn't match with your current one."); + } + catch (Exception e) + { + _log.warning("Error while changing password for account " + accountName + " requested by player " + characterName + "! " + e); + } + finally + { + // close the database connection at the end + L2DatabaseFactory.close(con); + } + } + } +} \ No newline at end of file Index: head-src/com/l2jfrozen/loginserver/network/loginserverpackets/ChangePasswordResponse.java =================================================================== --- head-src/com/l2jfrozen/loginserver/network/loginserverpackets/ChangePasswordResponse.java (revision 0) +++ head-src/com/l2jfrozen/loginserver/network/loginserverpackets/ChangePasswordResponse.java (revision 0) @@ -0,0 +1,43 @@ +/* + * This program is free software: you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free Software + * Foundation, either version 3 of the License, or (at your option) any later + * version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + * details. + * + * You should have received a copy of the GNU General Public License along with + * this program. If not, see <http://www.gnu.org/licenses/>. + */ +package com.l2jfrozen.loginserver.network.loginserverpackets; + +import java.io.IOException; + +import com.l2jfrozen.loginserver.network.serverpackets.ServerBasePacket; + + + + +/** + * @author Nik + */ +public class ChangePasswordResponse extends ServerBasePacket +{ + public ChangePasswordResponse(byte successful, String characterName, String msgToSend) + { + writeC(0xF8); + //writeC(successful); //0 false, 1 true + writeS(characterName); + writeS(msgToSend); + } + + @Override + public byte[] getContent() throws IOException + { + return getBytes(); + } + +} \ No newline at end of file but dunno where to put it in source
0 `Sword Posted April 14, 2013 Posted April 14, 2013 In your sources.... Btw, did you open the server during making a compile or taking a ready pack from here or somewhere?
0 SweeTs Posted April 14, 2013 Posted April 14, 2013 On 4/13/2013 at 11:56 PM, DarknessVoice said: but dunno where to put it in source Index: head-src/com/l2jfrozen/gameserver/handler/voicedcommandhandlers/ChangePassword.java Index: head-src/com/l2jfrozen/gameserver/thread/LoginServerThread.java and so on Quote Btw, did you open the server during making a compile or taking a ready pack from here or somewhere? I think it's obvious he's using precompiled, since he don't know what's the sources.
0 DarknessVoice Posted April 15, 2013 Author Posted April 15, 2013 On 4/14/2013 at 12:05 AM, `Sword said: In your sources.... Btw, did you open the server during making a compile or taking a ready pack from here or somewhere? compiled by a friend ...
0 SweeTs Posted April 16, 2013 Posted April 16, 2013 On 4/15/2013 at 5:03 AM, DarknessVoice said: compiled by a friend ... So, you're not able to add this code. Read any tutorial, check frozen's forum, surely there is one. Download sources and add it.
Question
DarknessVoice
hello ,cheaters devlopers O0
i just had a costume mode "changepassword" ingame and and the folder have in it core.patch someone can tell me where to past ...?
6 answers to this question
Recommended Posts