Anti-packet database

I'm sexy and I know it :)
Joined
Oct 21, 2008
Messages
811
Reaction score
351

Deagan ツ - Anti-packet database - RaGEZONE Forums


Are you done with packet editors spamming **** in your server, duping items, dc'ing maps or even worlds?
If you are, this thread might be something for you.
I have been working on this database for a bit now and it's basically a collection of all packets that are commonly used to annoy you to the limits and the way to patch them.
I decided to call it the Anti-packet database, and no, I don't know why, so shut up about it.
If you have any packets that you want to be patched leave them in a comment and i'll try to look at it when I have time.
The packets included in this thread are from v75.

Enjoy.

Green = optional
Purple = location
Grayish = extra info
Red = pay attention

Deagan ツ - Anti-packet database - RaGEZONE Forums

Most of the spam packets are actually already patched in most servers.
The way to patch them is logging how big the delay is between the latest used feature and the one you're using now.
This is done using a public long(currenttimemillis is a long) which imma call latestUse.

(Super)Megaphone spamming

Packet used :
PHP:
4E 00 02 00 80 64 4D 00 07 00 4D 75 61 68 61 68 61 01 44 42 61 0B

Patch :

MapleCharacter.java
Add :
Code:
public long latestUse = 0;
Under :
Code:
private MonsterBook monsterbook;


UseCashItemHandler.java
Add :
Code:
if ((System.currentTimeMillis() - c.getPlayer().latestUse) > 750) {
Under :
Code:
[COLOR="SlateGray"]case 1: // Megaphone(in case you can't find it)[/COLOR]
          if (player.getLevel() > 9)
And add :
Code:
c.getPlayer().latestUse = System.currentTimeMillis();
} [COLOR="YellowGreen"]else {
c.getPlayer().ban("Autoban '" + c.getPlayer().getName() + "': Packet Editing (Spamming smegas)", true);
}[/COLOR]
Under :
Code:
player.getClient().getChannelServer().broadcastPacket(MaplePacketCreator.serverNotice(2, medal + player.getName() + " : " + slea.readMapleAsciiString()));

(for supermegaphones) add :
Code:
if ((System.currentTimeMillis() - c.getPlayer().latestUse) > 750) {
Under :
Code:
case 2: // Super megaphone
And add :
Code:
c.getPlayer().latestUse = System.currentTimeMillis();
} [COLOR="YellowGreen"]else {
c.getPlayer().ban("Autoban '" + c.getPlayer().getName() + "': Packet Editing (Spamming smegas)", true);
} [/COLOR]
Under :
Code:
c.getChannelServer().getWorldInterface().broadcastMessage(null, MaplePacketCreator.serverNotice(3, c.getChannel(), medal + player.getName() + " : " + slea.readMapleAsciiString(), (slea.readByte() != 0)).getBytes());

(for MapleTV) add :
Code:
if ((System.currentTimeMillis() - c.getPlayer().latestUse) <= 750) {
c.getPlayer().ban("Autoban '" + c.getPlayer().getName() + "': Packet Editing (Spamming smegas)", true);
}
Under :
Code:
case 5: // Maple TV
And add :
Code:
c.getPlayer().latestUse = System.currentTimeMillis();
Above :
Code:
break;
[COLOR="SlateGray"]case 6: //item megaphone[/COLOR]


(for item megaphones) add :
Code:
if ((System.currentTimeMillis() - c.getPlayer().latestUse) > 750) {
Under :
Code:
case 6: //item megaphone
And add :
Code:
c.getPlayer().latestUse = System.currentTimeMillis();
} [COLOR="yellowgreen"]else {
c.getPlayer().ban("Autoban '" + c.getPlayer().getName() + "': Packet Editing (Spamming smegas)", true);
}[/COLOR]
Under :
Code:
c.getChannelServer().getWorldInterface().broadcastMessage(null, MaplePacketCreator.itemMegaphone(msg, whisper, c.getChannel(), item).getBytes());


(for triples, pfft...) add :
Code:
if ((System.currentTimeMillis() - c.getPlayer().latestUse) > 750) {
Under :
Code:
case 7: //triple megaphone
And add :
Code:
c.getPlayer().latestUse = System.currentTimeMillis();
} [COLOR="YellowGreen"]else {
c.getPlayer().ban("Autoban '" + c.getPlayer().getName() + "': Packet Editing (Spamming smegas)", true);
}[/COLOR]
Under :
Code:
c.getChannelServer().getWorldInterface().broadcastMessage(null, MaplePacketCreator.getMultiMegaphone(msg2, c.getChannel(), whisper).getBytes());


Summoning bag spamming


Packet used :
PHP:
4A 00 EF E8 5E 00 1D 00 93 0F 20 00

Patch :

UseSummonBag.java
Add :
Code:
if (System.currentTimeMillis() - c.getPlayer().latestUse > 100) {
Under(yes, you should have this already added.) :
Code:
if (toUse != null && toUse.getQuantity() > 0 && toUse.getItemId() == itemId) {
And add :
Code:
c.getPlayer().latestUse = System.currentTimeMillis();
Under :
Code:
c.getPlayer().getMap().spawnMonsterOnGroudBelow(MapleLifeFactory.getMonster(toSpawnChild[0]), c.getPlayer().getPosition());
Finally add :
Code:
} [COLOR="YellowGreen"]else {
c.getPlayer().ban("Autoban '" + c.getPlayer().getName() + "': Packet Editing (Spamming summoningbags)", true);
c.getPlayer().getMap().killAllMonsters();
}[/COLOR]
Under :
Code:
for (int z = 0; z < toSpawn.length; z++) {
   int[] toSpawnChild = toSpawn[z];
   if (Randomizer.getInstance().nextInt(101) <= toSpawnChild[1])
      c.getPlayer().getMap().spawnMonsterOnGroudBelow(MapleLifeFactory.getMonster(toSpawnChild[0]), c.getPlayer().getPosition());
   c.getPlayer().latestUse = System.currentTimeMillis();
}


Playercommand spamming

For the packet just use a playercommand and log it.

Patches :
I don't really know what playercommands you are willing to protect, but you can always go with the standard method of latestUse :

Code:
} else if (splitted[0].equals("[COLOR="YellowGreen"]whatevercommandyou'regoingtobeusing[/COLOR]")) {
if ((System.currentTimeMillis() - c.getPlayer().latestUse) > 50) {
blabladosomething();
c.getPlayer().latestUse = System.currentTimeMillis();
 } [COLOR="yellowgreen"]else {
c.getPlayer().ban("Autoban '" + c.getPlayer().getName() + "': Packet Editing (Spamming playercommands)", true);
 }[/COLOR]
}

Now if you are smart you can also use this to time your playercommands over a longer while, just notice that you'll have to add a new long to MapleCharacter then because using latestUse wouldn't work out to well ;)


Deagan ツ - Anti-packet database - RaGEZONE Forums

There are all kinds of ways to dc maps or even channels, worlds, with simple packets.
I hate every single way when being abused, so I am going to try and patch as many of these 'dc packets' as I can.
Here's a few.

Worldwide megaphone DC

Packet used : 0x4E (it's just a usecashitemhandler packet)
(see my other thread about this packet to see what's the part that makes people dc. It's basically a non-existing itemId)

Patch :

UseCashItemHandler.java
Add (orange is what would be required if you leave the ban part out) :
Code:
if (!c.getPlayer().haveItem(itemId)) {
[COLOR="YellowGreen"]c.getPlayer().ban("Autoban '" + c.getPlayer().getName() + "': Packet Editing (using a non-existing item or quantity < 1)", true);[/COLOR]
[COLOR="DarkOrange"]c.getSession().write(MaplePacketCreator.enableActions());[/COLOR]
return;
}
OR (orange is what would be required if you leave the ban part out) :
Code:
if (toUse == null || toUse.getItemId() != itemId || toUse.getQuantity() < 1) {
  [COLOR="YellowGreen"]c.getPlayer().ban("Autoban '" + c.getPlayer().getName() + "': Packet Editing (using a non-existing item or quantity < 1)", true);[/COLOR]
  [COLOR="DarkOrange"]c.getSession().write(MaplePacketCreator.enableActions());[/COLOR]
  return;
}
Above :
Code:
try {
  [COLOR="SlateGray"]if (itemType == 505) { // AP/SP reset[/COLOR]


Mount map dc

Packet :
PHP:
5A 00 77 4F 78 01 EC 03 00 00 01 00 00
(using mount rider)

Patch :

MapleCharacter.java
Add :
Code:
public boolean haveItemEquipped(int itemid) {
        if (getInventory(MapleInventoryType.EQUIPPED).findById(itemid) != null) {
            return true;
        }
        return false;
}
Under :
Code:
public boolean haveItem(int itemid, int quantity, boolean checkEquipped, boolean greaterOrEquals) {
        int possesed = inventory[MapleItemInformationProvider.getInstance().getInventoryType(itemid).ordinal()].countById(itemid);
        if (checkEquipped)
            possesed += inventory[MapleInventoryType.EQUIPPED.ordinal()].countById(itemid);
        return greaterOrEquals ? possesed >= quantity : possesed == quantity;
}

MapleStatEffect.java
Add :
Code:
if (applyto.haveItemEquipped(applyto.getMount().getItemId())) {
Under :
Code:
if (applyto.getMount().getItemId() != 0)
And add :
Code:
} [COLOR="YellowGreen"]else {
applyto.ban("Autoban '" + applyto.getName() + "': Packet Editing (using mount without mount being equipped)", true);
}[/COLOR]
Under :
Code:
localDuration = duration;


Invalid monsterid map dc:mellow:

Basically the packet for this uses an invalid value for monsterid when receiving damage, which will cause a map being dc'ed.

Packet used : 0x2F, a packet using takedamagehandler.
(I have published this packet before so just check my other thread for all information about the packet!)

Patch :

TakeDamageHandler.java
Add (orange = requires if you don't use autoban) :
Code:
if (MapleLifeFactory.getMonster(monsteridfrom) == null) {
[COLOR="YellowGreen"]c.getPlayer().ban("Autoban '" + c.getPlayer().getName() + "': Packet Editing (taking damage from an invalid monster)", true);[/COLOR]
[COLOR="DarkOrange"]return;[/COLOR]
}
OR :
Code:
oid = slea.readInt();
attacker = (MapleMonster) player.getMap().getMapObject(oid);
if (player.getMap().getMonsterById(monsteridfrom) == null || attacker == null) {
      return;
}
Under :
Code:
monsteridfrom = slea.readInt();


Deagan ツ - Anti-packet database - RaGEZONE Forums

The name says it all, packets that work with hired merchants.
The time I have wasted on trying to fix everything with merchants just made me hate them so much I would easily say just delete them.
here are some packets though.

Duping with hired merchants

Packet used (bundles?) :
PHP:
79 00 [1F] [04] [27 00] ![01 00]! !> 255[FF 00]! [01 00 00 00]
I'm just going to let you know that I wasn't capable of fixing it 100%, but I improved it.

Patch :

PlayerInteractionHandler.java
Add :
Code:
if (!c.getPlayer().haveItem(c.getPlayer().getInventory(type).getItem(slot).getItemId(), [B][I][U][COLOR="Red"](perBundle * bundles)[/COLOR][/U][/I][/B], false, true)) {
                return;
            }
Under :
Code:
short perBundle = slea.readShort();

Oh btw, I have noticed alot of sources already have :
Code:
if (!c.getPlayer().haveItem(c.getPlayer().getInventory(type).getItem(slot).getItemId(), [B][I][U][COLOR="Red"]bundles[/COLOR][/U][/I][/B], false, true)) {
                return;
            }
You still have to replace bundles with (perBundle * bundles)


Stealing from merchants

Packet used :
PHP:
79 00 24 00 00

Patch :

PlayerInteractionHandler.java
Replace (take_item_back) :
Code:
if (merchant != null) {
With :
Code:
if (merchant != null && merchant.isOwner(c.getPlayer()) {
OR add (if you don't have merchant != null) :
Code:
HiredMerchant merchant = c.getPlayer().getHiredMerchant();
if (merchant != null && merchant.isOwner(c.getPlayer()) {
Under (take_item_back) :
Code:
int slot = slea.readShort();


Opening merchant without permit

Packet used :
PHP:
[79 00] [00] [05] 04 00 68 6D 6D 6D 00 16 00 76 C0 4C 00

Patch :

PlayerInteractionHandler.java
Add :
Code:
if (c.getPlayer().getInventory(MapleInventoryType.CASH).countById(itemId) <= 0) {
    return;
}
Under (createType == 5) :
Code:
int itemId = slea.readInt();


Deagan ツ - Anti-packet database - RaGEZONE Forums

Pat gave me these packets and the patches were already done by Moogra for me, therefor the credits for these patches are to them.


Storage item duping

Packet used :
Code:
[3D 00] [05] [01 00] [85 84 1E 00] [02 00]

Patch :

StorageHandler.java
Add :
Code:
if (quantity < 1 || !c.getPlayer().haveItem(itemId, quantity, false, true))
    return;
Under :
Code:
[COLOR="Gray"]int itemId = slea.readInt();[/COLOR]
    short quantity = slea.readShort();

Storage meso packet

Packet used :
Code:
[3D 00] [07] [ME EE SO OS](lol)

Patch :

StorageHandler.java
Just replace your mode 7 (meso) with :
Code:
        } else if (mode == 7) { // meso
            int meso = slea.readInt();
            int storageMesos = storage.getMeso();
            int playerMesos = c.getPlayer().getMeso();
            if ((meso > 0 && storageMesos >= meso) || (meso < 0 && playerMesos >= -meso)) {
                if (meso < 0 && (storageMesos - meso) < 0) {
                    meso = -2147483648 + storageMesos;
                    if (meso < playerMesos)
                        return;
                } else if (meso > 0 && (playerMesos + meso) < 0) {
                    meso = 2147483647 - playerMesos;
                    if (meso > storageMesos)
                        return;
                }
                storage.setMeso(storageMesos - meso);
                c.getPlayer().gainMeso(meso, false, true, false);
            } else
                return;
            storage.sendMeso(c);
        } else if (mode == 8) { // close
            storage.close();
        }


That's all I have for now, once again, just leave packets behind on this thread if you want them to be looked at or patched! I will try to look at them if i'm not too busy.
Hope you liked it.


​
 
Last edited:
fuuuuuuuuuuuuu deagan. :c
Oh come on, maplestory development shouldn't just die.

Good Job Deagan!
Thanks sonny.f3

U prao degan
deagan* did I just stun you soo hard or did you just forget my name like usual.

Whats a packet?
In this world : A chris brown

WOW, SO much work put on to this! AWESOME!!!!

Yea it was some work, but I like doing it.
 
Already had most of these, but the smega and summoning bag one o_o
 
using System.currentTimeInMillis() is bad for a 50 ms thing. it's inaccurate.

currentTimeInMillis() is actually better to use in this case.
1. The accuracy varies between systems.. most windows systems are 10 ms not 50
2. Older JVMs do not support nanoTime?() [forgot what it's named]
3. No one is going to be able to use super megaphone, or whatever it is, in a 50 ms period, legit.
 
Thanks for the summoning autoban, and a few crashing autobans :)
 
Do you have a fix for that double clicking NPC = dc thing? :D
Would love if you had that :D

This might not be the real fix, but it works for me

In NPCTalkHandler.java under ...
PHP:
if (npc.getId() == 9010009) {

Add ...
PHP:
NPCScriptManager.getInstance().dispose(c);
 
currentTimeInMillis() is actually better to use in this case.
1. The accuracy varies between systems.. most windows systems are 10 ms not 50
2. Older JVMs do not support nanoTime?() [forgot what it's named]
3. No one is going to be able to use super megaphone, or whatever it is, in a 50 ms period, legit.

i never said i supported nanoTime over that. i just said that this was inaccurate
 
np to those who said thanks to me for releasing, i'm just trying to keep maple development a little bit up.
 
Back