Yes, I released this on kdev, I just didn't want anyone else to release it here again without credits. (you know how noobs these days are)
As most of you guys might have noticed there is a packet which dc's your whole server... I don't know if people released this already or if it is added to sources but the search button didn't show me anything.
The server dc packet someone told me was being used to dc the whole server is :
49 00 = 0x49 which was USE_CASH_ITEM meaning this packet leads to usecashitemhandler.java.Code:49 00 04 00 C0 3E 52 00 05 00 6F 6B 20 3B 64 00 00 00 00 00 00 01 00 00 89 4E 00 00 00 3A 76 00 00 01 5F 42 0F 00 05 BC 0D 10 00 06 19 2D 10 00 07 9A 5C 10 00 09 0F D1 10 00 0B 0C 28 16 00 0C 8A F8 10 00 FF FF E8 F8 19 0
Now I got confused about how I could find the itemid and moogra helped me out. he explained me some stuff which I will, since I think it might help people understand packets, share this with you.
Moogra told me the itemid used in this packet was 5390016 and he explained to me how he found it.
If you look into usecashitemhandler you see that there are several noticable things :
Moogra explained me that this meant that the first 2 bytes after 49 00 we're not important for the itemid, the next 4 bytes were. (int itemId = slea.readInt(); << 4 bytes).Code:slea.readByte(); slea.readByte(); int itemId = slea.readInt();
So he grabbed C0 3E 52 00 and told me to flip all the arrays.
C0 3E 52 00 became 00523EC0.
He told me to convert from hex to decimal and 00523EC0 became 5390016.
I now searched through my source and other places looking for this item, it didn't exist. Now the only thing that needed to be done was make sure usecashitemhandler.java checks if you actually have the item before you get to send the packet.
This is my solution :
Add :
Above :Code:if (player.haveItem(itemId)) {
and add :Code:try { if (itemType == 505) { // AP/SP reset
OR (you decide what you want to do) :Code:} else { c.disconnect(); return; }
Under :Code:} else { player.dropMessage(6, "You are packet editing aren't you."); return; }
Code:} catch (Exception e) { c.getChannelServer().reconnectWorld(); e.printStackTrace(); }
What this does is basically check for you having the item and then let's you move on.
Credits to me for the java part and writing this.
Credits to Moogra for explaining me more about packets and helping me find out more about this.
Part 2!
There is another packet, this one only dc's the map you're at, but is also very annoying :
0x2d is TAKE_DAMAGE, leads to takedamagehandler.java... now let's take a look at java there.Code:2D 00 84 A6 B5 05 FF 00 3F 02 00 00 84 CD 6D 00 90 85 05 00 00 00 00 00
Now let's seperate the packet into pieces :Code:MapleCharacter player = c.getPlayer(); slea.readInt(); // 4 bytes. int damagefrom = slea.readByte(); // 1 byte slea.readByte(); // 1 byte int damage = slea.readInt(); // 4 bytes. int oid = 0; int monsteridfrom = 0; int pgmr = 0; int direction = 0; int pos_x = 0; int pos_y = 0; int fake = 0; boolean is_pgmr = false; boolean is_pg = true; int mpattack = 0; MapleMonster attacker = null; if (damagefrom != -2) { monsteridfrom = slea.readInt(); // 4 bytes oid = slea.readInt(); // 4 bytes attacker = (MapleMonster) player.getMap().getMapObject(oid); direction = slea.readByte(); // 1 byte
Red = not used in this thread, cyan = further discussed.Code:[2D 00] [84 A6 B5 05] [FF] [00] [3F 02 00 00] [84 CD 6D 00] [90 85 05 00] [00] 00 00 00
[ff] = damagefrom
[3f 02 00 00] = damage
[84 CD 6D 00] = monsterid the attack came from.
Now if you flip these over damagefrom is unclear but we assume it's alright when you change it to decimals.
damage = 00 00 02 3f => 575 damage = alright.
monsteridfrom = 00 6d cd 84 => 7196036 < seems alright but the monster doesn't exist, hehe =)
This means in this packet the first thing that is messed the monsterid the attack came from.
Now to patch this packet, I did the following :
Add :
Under :Code:if (MapleLifeFactory.getMonster(monsteridfrom) != null) {
And add :Code:if (!player.isHidden() && !smokescreen) {
Under :Code:} else { //player.ban("Packet editing", true); player.dropMessage(6, "No packet editing my dear"); }
Add import :Code:player.updateSingleStat(MapleStat.HP, player.getHp()); player.updateSingleStat(MapleStat.MP, player.getMp()); player.checkBerserk();
Code:import server.life.MapleLifeFactory;
Thanks so much to Moogra for explaning me about this packet shit.
Also thanks to Anujan for showing me a better way to check for the monsterid in part 2!
Press the thanks button if this is usefull at all or helped you out!


Reply With Quote




