Hello all,
Some idiots players are abusing a bug that I don't know the solution. They can use GM commands without gm's rank in MYSQL.
Could someone help me?
Thank you.
Printable View
Hello all,
Some idiots players are abusing a bug that I don't know the solution. They can use GM commands without gm's rank in MYSQL.
Could someone help me?
Thank you.
This isn't quite possible. Which repack do you use?
Maybe you didn't define the GM commands to level 1 or higher, maybe it's defined to level 0.
I use moopledev, this is my GeneralchatHendler:
#EDITPHP Code:public final void handlePacket(SeekableLittleEndianAccessor slea, MapleClient c) {
String s = slea.readMapleAsciiString();
MapleCharacter chr = c.getPlayer();
char heading = s.charAt(0);
String[] sp = s.split(" ");
sp[0] = sp[0].toLowerCase().substring(1);
if (heading == '@') {
Commands.executarComandoJogador(c, sp, heading);
}
else if (heading == '!') {
if (chr.gmLevel() == 1) {
Commands.executarComandoViP(c, sp, heading);
}
else if (chr.gmLevel() == 2) {
if(!Commands.executarComandoViP(c, sp, heading)){
Commands.executarComandoJr(c, sp, heading);
}
}
else if (chr.gmLevel() == 3) {
if(!Commands.executarComandoViP(c, sp, heading)){
if(!Commands.executarComandoJr(c, sp, heading)){
Commands.executarComandoGM(c, sp, heading);
}
}
}
else if (chr.gmLevel() >= 4) {
if(!Commands.executarComandoViP(c, sp, heading)){
if(!Commands.executarComandoJr(c, sp, heading)){
if(!Commands.executarComandoGM(c, sp, heading)){
Commands.executarComandoSuperGM(c, sp, heading);
}
}
}
} else{
chr.message("Voce nao tem permissao para efetuar este comando.");
}
}
else if (heading == '#') {
if (chr.gmLevel() == 5) {
Commands.executarComandoADM(c, sp, heading);
}
else if (chr.gmLevel() == 6) {
if(!Commands.executarComandoADM(c, sp, heading)){
Commands.executarComandoSuperADM(c, sp, heading);
}
}
else if (chr.gmLevel() >= 7) {
if(!Commands.executarComandoADM(c, sp, heading)){
if(!Commands.executarComandoSuperADM(c, sp, heading)){
Commands.executarComandoOwner(c, sp, heading);
}
}
}
else{
chr.message("Voce nao tem permissao para efetuar este comando.");
}
}
else if (heading == '/') {
if (chr.gmLevel() >= 7) {
Commands.executarComandoOwner(c, sp, heading);
}else{
chr.message("Voce nao tem permissao para efetuar este comando.");
}
} else {
if (!chr.isHidden()){
chr.getMap().broadcastMessage(MaplePacketCreator.getChatText(chr.getId(), s, chr.isGM(), slea.readByte()));
}else{
chr.getMap().broadcastGMMessage(MaplePacketCreator.getChatText(chr.getId(), s, chr.isGM(), slea.readByte()));
}
}
}
This player can drop itens that GM Hat and ZHelm.
Try replacing your commandprocesssor.java with this:
This is from my source. Also make a backup of yours, incase this doesn't work.Code:/*
This file is part of the OdinMS Maple Story Server
Copyright (C) 2008 Patrick Huy <patrick.huy@frz.cc>
Matthias Butz <matze@odinms.de>
Jan Christian Meyer <vimes@odinms.de>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation version 3 as published by
the Free Software Foundation. You may not use, modify or distribute
this program under any other version of the GNU Affero General Public
License.
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 Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package client.command;
import client.MapleCharacter;
import client.MapleClient;
import com.mysql.jdbc.Connection;
import com.mysql.jdbc.PreparedStatement;
import java.rmi.RemoteException;
import java.sql.SQLException;
import java.util.List;
import provider.MapleData;
import provider.MapleDataProvider;
import provider.MapleDataProviderFactory;
import provider.MapleDataTool;
import tools.Pair;
import java.util.ArrayList;
import java.util.LinkedList;
import java.io.File;
import server.TimerManager;
import server.life.MapleLifeFactory;
import tools.DatabaseConnection;
public final class CommandProcessor {
private static Runnable persister;
private static List<Pair<MapleCharacter, String>> gmlog = new LinkedList<Pair<MapleCharacter, String>>();
public static final boolean processCommand(final MapleClient c, final String s) {
MapleCharacter chr = c.getPlayer();
if (s.charAt(0) == '!' && c.getPlayer().isGM()) {
String[] sp = s.split(" ");
sp[0] = sp[0].toLowerCase().substring(1);
chr.addCommandToList(s);
if (chr.gmLevel() >= 1) {
if (DonatorCommand.execute(c, sp, '!')) {
return true;
}
}
if (chr.gmLevel() >= 2) {
if (InternCommand.execute(c, sp, '!')) {
return true;
}
}
if (chr.gmLevel() >= 3) {
if (GMCommand.execute(c, sp, '!')) {
return true;
}
}
if (chr.gmLevel() >= 4) {
if (SuperCommand.execute(c, sp, '!')) {
return true;
}
}
if (chr.gmLevel() >= 5) {
if (AdminCommand.execute(c, sp, '!')) {
return true;
}
}
return true;
}
if (s.charAt(0) == '@') {
String[] sp = s.split(" ");
sp[0] = sp[0].toLowerCase().substring(1);
if (!chr.inBlockedMap() || chr.gmLevel() > 2)
PlayerCommand.execute(c, sp, '@');
else
chr.dropMessage(chr.getMapId() == 970000101 || chr.getMapId() == 970000102 || chr.getMapId() == 970000103 ? "You are in the Starter Quest, and can't use commands." : "You can't use commands in Jail. ");
return true;
}
return false;
}
public static void forcePersisting() {
persister.run();
}
static {
persister = new PersistingTask();
TimerManager.getInstance().register(persister, 62000);
}
public static class PersistingTask implements Runnable {
@Override
public void run() {
synchronized (gmlog) {
Connection con = (Connection) DatabaseConnection.getConnection();
try {
PreparedStatement ps = (PreparedStatement) con.prepareStatement("INSERT INTO gmlog (cid, command) VALUES (?, ?)");
for (Pair<MapleCharacter, String> logentry : gmlog) {
ps.setInt(1, logentry.getLeft().getId());
ps.setString(2, logentry.getRight());
ps.executeUpdate();
}
ps.close();
} catch (SQLException e) {
System.out.println("Error persisting cheatlog" + e);
}
gmlog.clear();
}
}
}
public static ArrayList<Pair<Integer, String>> getMobsIDsFromName(String search) {
MapleDataProvider dataProvider = MapleDataProviderFactory.getDataProvider(new File("wz/String.wz"));
ArrayList<Pair<Integer, String>> retMobs = new ArrayList<Pair<Integer, String>>();
MapleData data = dataProvider.getData("Mob.img");
List<Pair<Integer, String>> mobPairList = new LinkedList<Pair<Integer, String>>();
for (MapleData mobIdData : data.getChildren()) {
int mobIdFromData = Integer.parseInt(mobIdData.getName());
String mobNameFromData = MapleDataTool.getString(mobIdData.getChildByPath("name"), "NO-NAME");
mobPairList.add(new Pair<Integer, String>(mobIdFromData, mobNameFromData));
}
for (Pair<Integer, String> mobPair : mobPairList) {
if (mobPair.getRight().toLowerCase().contains(search.toLowerCase())) {
retMobs.add(mobPair);
}
}
return retMobs;
}
public static String getMobNameFromID(int id) {
try {
return MapleLifeFactory.getMonster(id).getName();
} catch (Exception e) {
return null; //nonexistant mob
}
}
}
^ That won't work, don't just copy+paste yours saying: Here. Try this.
Without even looking at the code given to you, you could see that the commands and stuff are in Spanish, if he copies yours over, it'll all be broken.
Looks like it's a problem within the Command execution methods.
Can you share those as well?
Also, I'm sure you're probably spanish speaking natively, but it is generally regarded as bad practice to program in other languages. All the keywords and whatnot are in English. This is especially problematic when you're seeking help from a predominantly English-speaking forum.
Thanks to all.
Frist, I'm brazillian and I'll change the scripts to english.
What is the file that contains the command execution methods?
The Commands class. That's where you're calling all the execute (executar) methods.
First of all, his code is in Portugese. I'm sorry, I did not look at the code he posted earlier but ethier way, he said he's going to convert it to English. If he does that, the code that I posted may work. Furthermore, atleast I tried to help. When I make a help-thread, I still like replies which could potentially work. It's more than what you did.
First of all, you're talking to a person who only speaks English and Chinese.
Portuguese and Spanish look the same to a non-Spanish/Portuguese speaking person.
He said he was going to convert it into English only after aaronweiss told him that it would be better to do it in English. If aaronweiss didn't reply, your post wouldn't have helped.
Yes, you did try to help but you said you didn't look at the code. A person who actually helps would look at the code and would take it into account with the code they are about to reply with. Your code wouldn't have worked if he didn't convert it.
Duh, of course you did more than what I did. I didn't come to this thread to help him, it was to tell you that you posted code that wouldn't have helped him.
It isn't fixed. :(
I'll finish convert commands to english and I'll post here.
#EDIT
After the attacks began the VPS's IP creates session in maple but did't login.
#EDIT 2
Where is the file CommandProcessor?