예제 #1
0
 static void StartPinger()
 {
     _timert = new System.Threading.Timer((obj) =>
     {
         MasterThread.Instance.AddCallback(a =>
         {
             var tmp = new List <ClientConnection>(Clients);
             foreach (var client in tmp)
             {
                 if (!client.Pong)
                 {
                     client.Logger_WriteLine("Connection Timeout");
                     client.Disconnect();
                 }
                 else
                 {
                     client.Pong = false;
                     using (MaplePacket mp = new MaplePacket(MaplePacket.CommunicationType.ServerPacket, 0xEE01))
                     {
                         client.SendPacket(mp);
                     }
                 }
             }
         });
     }, null, 0, 20000);
 }
예제 #2
0
        public void Decode(MaplePacket pPacket)
        {
            pPacket.ReadByte(); // ?


            Running = new Dictionary <ushort, string>();
            Done    = new Dictionary <ushort, long>();

            for (int i = pPacket.ReadShort(); i > 0; i--)
            {
                Running.Add(pPacket.ReadUShort(), pPacket.ReadString());
            }

            for (int i = pPacket.ReadShort(); i > 0; i--)
            {
                pPacket.ReadString();
                pPacket.ReadString();
            }

            pPacket.ReadByte(); // ?

            for (int i = pPacket.ReadShort(); i > 0; i--)
            {
                Done.Add(pPacket.ReadUShort(), pPacket.ReadLong());
            }
        }
예제 #3
0
        public void RefreshPackets()
        {
            ListView.BeginUpdate();

            MaplePacket previous = ListView.SelectedIndices.Count > 0
                ? FilteredPackets[ListView.SelectedIndices[0]]
                : null;

            Opcodes.Clear();
            ListView.Clear();

            MainForm.DataForm.ClearHexBox();
            MainForm.StructureForm.Tree.Nodes.Clear();
            MainForm.PropertyForm.Properties.SelectedObject = null;

            if (!mViewOutboundMenu.Checked && !mViewInboundMenu.Checked)
            {
                return;
            }
            int previousIndex = -1;

            foreach (MaplePacket packet in mPackets)
            {
                if (packet.Outbound && !mViewOutboundMenu.Checked)
                {
                    continue;
                }
                if (!packet.Outbound && !mViewInboundMenu.Checked)
                {
                    continue;
                }
                if (!Opcodes.Exists(op => op.Outbound == packet.Outbound && op.Header == packet.Opcode))
                {
                    Opcodes.Add(new Opcode(packet.Outbound, packet.Opcode));
                }

                Definition definition = Config.Instance.GetDefinition(packet);
                if (definition != null && !mViewIgnoredMenu.Checked && definition.Ignore)
                {
                    continue;
                }

                int index = ListView.AddPacket(packet);
                if (packet == previous)
                {
                    previousIndex = index;
                }
            }

            MainForm.SearchForm.RefreshOpcodes(true);

            ListView.EndUpdate();

            // This should be called after EndUpdate so VirtualListSize is set properly
            if (previous != null && previousIndex >= 0)
            {
                ListView.Items[previousIndex].Selected = true;
                ListView.Items[previousIndex].EnsureVisible();
            }
        }
예제 #4
0
        public static ItemBase DecodeItemData(ClientConnection pConnection, MaplePacket pPacket)
        {
            byte     type = pPacket.ReadByte();
            ItemBase ret  = null;

            switch (type)
            {
            case 1:
                ret        = new ItemEquip();
                ret.Amount = 1;
                break;

            case 2: ret = new ItemRechargable(); break;

            case 3:
                ret        = new ItemPet();
                ret.Amount = 1;
                break;

            default:
            {
                Logger.WriteLine("Unkown ItemType: {0}", type);
                return(null);
            }
            }

            ret.Decode(pConnection, pPacket);

            return(ret);
        }
예제 #5
0
        public void ParseMaplePacket(MaplePacket pPacket)
        {
            mTree.Nodes.Clear();
            mSubNodes.Clear();
            pPacket.Rewind();

            string scriptPath = Application.StartupPath + Path.DirectorySeparatorChar + "Scripts" + Path.DirectorySeparatorChar + pPacket.Locale.ToString() + Path.DirectorySeparatorChar + pPacket.Build.ToString() + Path.DirectorySeparatorChar + (pPacket.Outbound ? "Outbound" : "Inbound") + Path.DirectorySeparatorChar + "0x" + pPacket.Opcode.ToString("X4") + ".txt";
            string commonPath = Application.StartupPath + Path.DirectorySeparatorChar + "Scripts" + Path.DirectorySeparatorChar + pPacket.Locale.ToString() + Path.DirectorySeparatorChar + pPacket.Build.ToString() + Path.DirectorySeparatorChar + "Common.txt";
            if (File.Exists(scriptPath))
            {
                mParsing = pPacket;

                try
                {
                    StringBuilder scriptCode = new StringBuilder();
                    scriptCode.Append(File.ReadAllText(scriptPath));
                    if (File.Exists(commonPath)) scriptCode.Append(File.ReadAllText(commonPath));
                    Script script = Script.Compile(scriptCode.ToString());
                    script.Context.SetItem("ScriptAPI", new ScriptAPI(this));
                    script.Execute();
                }
                catch (Exception exc)
                {
                    OutputForm output = new OutputForm("Script Error");
                    output.Append(exc.ToString());
                    output.Show(DockPanel, new Rectangle(MainForm.Location, new Size(400, 400)));
                }

                mParsing = null;
            }
            if (pPacket.Remaining > 0) mTree.Nodes.Add(new StructureNode("Undefined", pPacket.Buffer, pPacket.Cursor, pPacket.Remaining));
        }
예제 #6
0
        private void NextSequence()
        {
            if (!(DockPanel.ActiveDocument is SessionForm session))
            {
                return;
            }

            int initialIndex = session.ListView.SelectedIndices.Count == 0 ? 0 : session.ListView.SelectedIndices[0];

            byte[] pattern    = ((DynamicByteProvider)hexInput.ByteProvider).Bytes.ToArray();
            long   startIndex = MainForm.DataForm.SelectionLength > 0 ? MainForm.DataForm.SelectionStart : -1;

            for (int index = initialIndex; index < session.ListView.Count; ++index)
            {
                MaplePacket packetItem = session.FilteredPackets[index];
                long        matchIndex = packetItem.Search(pattern, startIndex + 1);

                if (matchIndex >= 0)
                {
                    session.ListView.Select(index);
                    MainForm.DataForm.SelectHexBoxRange(matchIndex, pattern.Length);
                    session.ListView.Focus();
                    return;
                }

                startIndex = -1;
            }

            const string message = "No further sequences found.";

            MessageBox.Show(message, "End Of Search", MessageBoxButtons.OK, MessageBoxIcon.Information);
            session.ListView.Focus();
        }
예제 #7
0
        public virtual void HandleVersion(ClientConnection pConnection, MaplePacket pPacket)
        {
            byte   locale     = pPacket.ReadByte();
            ushort version    = pPacket.ReadUShort();
            ushort subversion = pPacket.ReadUShort();

            pConnection.Logger_WriteLine("Detected MapleStory version of client: {1}.{2} (locale: {0})", locale, version, subversion);
            pConnection.MapleVersion = version;

            pConnection.CharData = null; // Back to the LoginServer!!!
            if (locale != ServerMapleInfo.LOCALE)
            {
                pConnection.Logger_WriteLine("Incompatible MapleStory locale detected!!!!");
                pConnection.SendInfoText("Unsupported MapleStory client detected. Mapler.me only supports MapleStory Global version {0} at the moment.", ServerMapleInfo.VERSION); // This should _never_ happen XD (different encryption and such)
                pConnection.Disconnect();
            }
            else if (version > ServerMapleInfo.VERSION)
            {
                pConnection.Logger_WriteLine("MapleStory client of user is outdated/incorrect. Disconnect.");
                pConnection.SendInfoText("Your MapleStory client seems outdated. Update your client in order to use the Mapler.me service.\r\nVersion identified: {0}\r\nSupported version: {1}", version, ServerMapleInfo.VERSION);
                pConnection.Disconnect();
            }
            else if (version < ServerMapleInfo.VERSION)
            {
                pConnection.Logger_WriteLine("MapleStory client of user is more up-to-date than Mapler.me service!!!");
                pConnection.SendInfoText("As your client is more up-to-date than the Mapler.me service, you are unable to use the Mapler.me service at this time.\r\nCheck the Mapler.me website and/or Twitter (@maplerme) for updates!\r\n\r\nCurrently supported version: {0}\r\nYour version: {1}", ServerMapleInfo.VERSION, version);
                pConnection.Disconnect();
            }
        }
예제 #8
0
        private void mPacketContextNameBox_KeyDown(object pSender, KeyEventArgs pArgs)
        {
            if (pArgs.Modifiers == Keys.None && pArgs.KeyCode == Keys.Enter && ListView.SelectedIndices.Count > 0)
            {
                int         index      = ListView.SelectedIndices[0];
                MaplePacket packet     = ListView.Selected;
                Definition  definition = Config.Instance.GetDefinition(packet);
                if (definition == null)
                {
                    definition = new Definition {
                        Outbound = packet.Outbound,
                        Opcode   = packet.Opcode,
                    };
                }

                definition.Name = mPacketContextNameBox.Text;
                SaveDefinition(Locale, Build, definition);

                pArgs.SuppressKeyPress = true;
                mPacketContextMenu.Close();
                RefreshPackets();

                ListView.Items[index]?.EnsureVisible();
            }
        }
예제 #9
0
        private void btnPrevOpcode_Click(object sender, EventArgs e)
        {
            if (!(DockPanel.ActiveDocument is SessionForm session) || dropdownOpcode.SelectedIndex == -1)
            {
                return;
            }

            Opcode search       = session.Opcodes[dropdownOpcode.SelectedIndex];
            int    initialIndex = session.ListView.SelectedIndices.Count == 0 ? 0 : session.ListView.SelectedIndices[0];

            for (int index = initialIndex - 1; index > 0; --index)
            {
                MaplePacket packetItem = session.FilteredPackets[index];
                if (packetItem.Outbound == search.Outbound && packetItem.Opcode == search.Header)
                {
                    session.ListView.Select(index);
                    session.ListView.Focus();
                    return;
                }
            }

            const string message = "No further packets found with the selected opcode.";

            MessageBox.Show(message, "End Of Search", MessageBoxButtons.OK, MessageBoxIcon.Information);
            session.ListView.Focus();
        }
예제 #10
0
        private void CheckForPackets(PacketStream pStream, bool pInbound)
        {
            while (true)
            {
                MaplePacket packet = pStream.Read();
                if (packet == null)
                {
                    break;
                }

                if (pInbound)
                {
                    Program.RECV_DATA += packet.Length;
                    Program.RECV_PACKETS++;
                }
                else
                {
                    Program.SENT_DATA += packet.Length;
                    Program.SENT_PACKETS++;
                }

                MasterThread.Instance.AddCallback((a) =>
                {
                    ServerConnection.Instance.ForwardPacket(pInbound ? MaplePacket.CommunicationType.ServerPacket : MaplePacket.CommunicationType.ClientPacket, packet);

                    packet.Dispose();
                    packet = null;
                });
            }
        }
예제 #11
0
        internal bool BufferTCPPacket(TcpPacket pTCPPacket, bool pInbound)
        {
            if (pTCPPacket.Syn && pTCPPacket.Ack)
            {
                mInboundSequence = (uint)(pTCPPacket.SequenceNumber + 1);
                return(true);
            }
            if (pTCPPacket.PayloadData.Length == 0)
            {
                return(true);
            }
            if (_mapleVersion == 0)
            {
                if (pTCPPacket.PayloadData.Length < 13)
                {
                    return(false);
                }
                byte[] tcpData = pTCPPacket.PayloadData;

                MaplePacket pr = new MaplePacket(tcpData);
                pr.ReadShort();
                _mapleVersion = pr.ReadUShort();
                var pos = pr.Position;
                {
                    var shrt = pr.ReadShort();
                    if (shrt < 0 || shrt > 0x0020)
                    {
                        return(false);
                    }
                }
                pr.Reset(pos);
                _maplePatchLocation = pr.ReadString();
                byte[] localIV  = pr.ReadBytes(4);
                byte[] remoteIV = pr.ReadBytes(4);
                _mapleLocale = pr.ReadByte();

                if (pr.Length > pr.Position || _mapleLocale > 0x12)
                {
                    return(false);
                }

                pr.Dispose();
                pr = null;

                mOutboundStream   = new PacketStream(localIV, _mapleLocale, _mapleVersion, !pInbound);
                mInboundStream    = new PacketStream(remoteIV, _mapleLocale, (ushort)(0xFFFF - _mapleVersion), pInbound);
                mInboundSequence += (uint)tcpData.Length;
            }
            if (!pInbound)
            {
                ProcessTCPPacket(pTCPPacket, ref mOutboundSequence, mOutboundBuffer, mOutboundStream, pInbound);
            }
            else
            {
                ProcessTCPPacket(pTCPPacket, ref mInboundSequence, mInboundBuffer, mInboundStream, pInbound);
            }

            return(true);
        }
예제 #12
0
 public void SendToken(string pToken)
 {
     using (MaplePacket mp = new MaplePacket(MaplePacket.CommunicationType.ClientPacket, 0xEE03))
     {
         mp.WriteString(pToken);
         SendPacket(mp);
     }
 }
예제 #13
0
        public void Decode(MaplePacket pPacket)
        {
            this.Gender = pPacket.ReadByte(); // Gender
            this.Skin   = pPacket.ReadByte(); // Skin
            this.Face   = pPacket.ReadInt();  // Face

            this.JobID = pPacket.ReadInt();   // Job ID

            pPacket.ReadByte();               // First slot; hair
            this.Hair = pPacket.ReadInt();    // Hair ID

            Equips    = new Dictionary <byte, int> [3];
            Equips[0] = new Dictionary <byte, int>();
            Equips[1] = new Dictionary <byte, int>();
            Equips[2] = new Dictionary <byte, int>();

            while (true)
            {
                byte slot = pPacket.ReadByte();
                if (slot == 0xFF)
                {
                    break;
                }
                Equips[0].Add(slot, pPacket.ReadInt());
            }
            while (true)
            {
                byte slot = pPacket.ReadByte();
                if (slot == 0xFF)
                {
                    break;
                }
                Equips[1].Add(slot, pPacket.ReadInt());
            }
            while (true)
            {
                byte slot = pPacket.ReadByte();
                if (slot == 0xFF)
                {
                    break;
                }
                Equips[2].Add(slot, pPacket.ReadInt());
            }

            pPacket.ReadInt();
            pPacket.ReadInt();
            pPacket.ReadInt();

            pPacket.ReadByte();
            pPacket.ReadInt();
            pPacket.ReadInt();
            pPacket.ReadInt();

            if (this.JobID / 100 == 31 || this.JobID / 100 == 36 || this.JobID == 3001 || this.JobID == 3002)
            {
                this.Wings = pPacket.ReadInt();
            }
        }
        public override void Decode(MaplePacket pPacket)
        {
            base.Decode(pPacket);


            this.Slots   = pPacket.ReadByte();
            this.Scrolls = pPacket.ReadByte();
            this.Str     = pPacket.ReadShort();
            this.Dex     = pPacket.ReadShort();
            this.Int     = pPacket.ReadShort();
            this.Luk     = pPacket.ReadShort();
            this.HP      = pPacket.ReadShort();
            this.MP      = pPacket.ReadShort();
            this.Watk    = pPacket.ReadShort();
            this.Matk    = pPacket.ReadShort();
            this.Wdef    = pPacket.ReadShort();
            this.Mdef    = pPacket.ReadShort();
            this.Acc     = pPacket.ReadShort();
            this.Avo     = pPacket.ReadShort();
            this.Hands   = pPacket.ReadShort();
            this.Speed   = pPacket.ReadShort();
            this.Jump    = pPacket.ReadShort();

            this.Name  = pPacket.ReadString();
            this.Flags = pPacket.ReadShort();

            pPacket.ReadByte(); // Increases Skill
            this.Level = pPacket.ReadByte();

            pPacket.ReadInt();
            pPacket.ReadInt(); //
            this.ViciousHammer = pPacket.ReadInt();

            pPacket.ReadShort(); // PVP damage

            pPacket.ReadByte();
            pPacket.ReadByte();

            this.Potential1 = pPacket.ReadShort();
            this.Potential2 = pPacket.ReadShort();
            this.Potential3 = pPacket.ReadShort();
            this.Potential4 = pPacket.ReadShort();
            this.Potential5 = pPacket.ReadShort();

            pPacket.ReadShort(); // New?

            this.SocketState = pPacket.ReadShort();
            this.Socket1     = pPacket.ReadShort();
            this.Socket2     = pPacket.ReadShort();
            this.Socket3     = pPacket.ReadShort();

            pPacket.ReadLong();

            pPacket.ReadLong();

            pPacket.ReadInt();
        }
예제 #15
0
        public void Decode(ClientConnection pConnection, MaplePacket pPacket)
        {
            var v = pPacket.ReadByte(); // ?


            Running = new Dictionary <ushort, string>();
            Done    = new Dictionary <ushort, long>();

            for (int i = pPacket.ReadShort(); i > 0; i--)
            {
                Running.Add(pPacket.ReadUShort(), pPacket.ReadString());
            }

            if (v == 0)
            {
                for (int i = pPacket.ReadShort(); i > 0; i--)
                {
                    pPacket.ReadShort(); // UNK lol
                }
            }

            for (int i = pPacket.ReadShort(); i > 0; i--)
            {
                pPacket.ReadString(); // 1NX1702337
                pPacket.ReadString(); // '1' or '0 ' ?!
            }

            var hurr = pPacket.ReadByte(); // ?

            // ADDED IN v.128 !!!!
            for (int i = pPacket.ReadShort(); i > 0; i--)
            {
                // New method of creating dates...
                var id   = pPacket.ReadUShort();
                var date = pPacket.ReadUInt();

                long ft = DecodeTimeFromInt(pConnection, date);

                if (!Done.ContainsKey(id))
                {
                    Done.Add(id, ft);
                }
                else
                {
                    pConnection.Logger_WriteLine("Duplicate Quest (Done): {0}", id);
                }
            }

            if (hurr == 0)
            {
                for (int i = pPacket.ReadShort(); i > 0; i--)
                {
                    Done.Add(pPacket.ReadUShort(), pPacket.ReadLong());
                }
            }
        }
예제 #16
0
        public void DecodeTeleportRocks(MaplePacket pPacket)
        {
            TeleportRocks = new int[NORMAL_ROCKS + VIP_ROCKS + HYPER_ROCKS + HYPER_ROCKS2];
            int i = 0;

            for (; i < TeleportRocks.Length; i++)
            {
                TeleportRocks[i] = pPacket.ReadInt();
            }
        }
예제 #17
0
 public ScriptForm(string pPath, MaplePacket pPacket)
 {
     mPath = pPath;
     mPacket = pPacket;
     InitializeComponent();
     if (pPacket != null)
         Text = "Script 0x" + pPacket.Opcode.ToString("X4") + ", " + (pPacket.Outbound ? "Outbound" : "Inbound");
     else
         Text = "Common Script";
 }
예제 #18
0
 internal MaplePacketItem(MaplePacket packet, string name) : base(new[] {
     packet.Timestamp.ToString("yyyy-MM-dd HH:mm:ss.fff"),
     packet.Outbound ? "Outbound" : "Inbound",
     packet.Length.ToString(),
     $"0x{packet.Opcode:X4}",
     name
 })
 {
     this.Name   = name;
     this.Packet = packet;
 }
예제 #19
0
        private void CommonScript_FormClosed(object pSender, FormClosedEventArgs pArgs)
        {
            if (ListView.SelectedIndices.Count == 0)
            {
                return;
            }
            MaplePacket packet = ListView.Selected;

            MainForm.StructureForm.ParseMaplePacket(packet);
            Activate();
        }
예제 #20
0
        private void allToolStripMenuItem_Click(object sender, EventArgs e)
        {
            MaplePacket packet = ListView.Selected;

            if (packet == default)
            {
                return;
            }

            mPackets.RemoveRange(0, mPackets.FindIndex((p) => p == packet));
            RefreshPackets();
        }
예제 #21
0
 public override void SendPacket(MaplePacket pPacket)
 {
     if (IsFake)
     {
         return;
     }
     using (MaplePacket tmp = new MaplePacket(pPacket.ToArray()))
     {
         _exporter.AddPacket(tmp);
     }
     base.SendPacket(pPacket);
 }
예제 #22
0
            public DumpPacket(MaplePacket pPacket)
            {
                pPacket.Reset();
                MaplePacket.CommunicationType type = (MaplePacket.CommunicationType)pPacket.ReadByte();
                Outboud = type == MaplePacket.CommunicationType.ClientPacket;
                Opcode  = pPacket.ReadUShort();

                Data = new byte[pPacket.Length - 3];
                Buffer.BlockCopy(pPacket.ToArray(), 3, Data, 0, Data.Length); // byte + short (header)
                ArrivalTime = MasterThread.CurrentDate;
                pPacket.Reset();
            }
예제 #23
0
        public ScriptForm(string path, MaplePacket packet)
        {
            this.path = path;
            Packet    = packet;

            InitializeComponent();
            ThemeApplier.ApplyTheme(Config.Instance.Theme, this);

            Text = packet != null
                ? $"Script 0x{packet.Opcode:X4}, {(packet.Outbound ? "Outbound" : "Inbound")}"
                : "Common Script";
        }
예제 #24
0
 public void SendTimeUpdate()
 {
     if (IsFake)
     {
         return;
     }
     using (MaplePacket packet = new MaplePacket(MaplePacket.CommunicationType.ServerPacket, 0xEEFD))
     {
         packet.WriteString(LastLoggedCharacterName);
         SendPacket(packet);
     }
 }
예제 #25
0
 public void SendInfoText(string pMessage, params object[] pParams)
 {
     if (IsFake)
     {
         return;
     }
     using (MaplePacket packet = new MaplePacket(MaplePacket.CommunicationType.ServerPacket, 0xEEFC))
     {
         packet.WriteString(string.Format(pMessage, pParams));
         SendPacket(packet);
     }
 }
        public override void Decode(MaplePacket pPacket)
        {
            base.Decode(pPacket);

            Petname   = pPacket.ReadString(13);
            Level     = pPacket.ReadByte();
            Closeness = pPacket.ReadShort();
            Fullness  = pPacket.ReadByte();


            pPacket.Skip(8 + 2 + 2 + 4 + 2 + 1 + 4 + 4);
        }
        public void Decode(MaplePacket pPacket)
        {
            InventorySlots = new byte[INVENTORIES];
            for (int i = 0; i < INVENTORIES; i++)
            {
                InventorySlots[i] = pPacket.ReadByte();
            }

            pPacket.ReadLong(); // 94354848000000000 | 1-1-1900



            EquipmentItems = new Dictionary <short, ItemEquip> [EQUIP_INVENTORIES];

            for (byte i = 0; i < EQUIP_INVENTORIES; i++)
            {
                EquipmentItems[i] = new Dictionary <short, ItemEquip>();

                while (true)
                {
                    short slot = pPacket.ReadShort();
                    if (slot == 0)
                    {
                        break;
                    }

                    ItemEquip equip = (ItemEquip)ItemBase.DecodeItemData(pPacket);

                    EquipmentItems[i].Add(slot, equip);
                }
            }

            InventoryItems = new Dictionary <byte, ItemBase> [NORMAL_INVENTORIES];

            for (byte i = 0; i < NORMAL_INVENTORIES; i++)
            {
                InventoryItems[i] = new Dictionary <byte, ItemBase>();

                while (true)
                {
                    byte slot = pPacket.ReadByte();
                    if (slot == 0)
                    {
                        break;
                    }

                    ItemBase item = ItemBase.DecodeItemData(pPacket);

                    InventoryItems[i].Add(slot, item);
                }
            }
        }
예제 #28
0
        public static void DecodeGuilds(MaplePacket pPacket, byte pWorldID)
        {
            pWorldID = GameHelper.GetAllianceWorldID(pWorldID);

            int guilds = pPacket.ReadInt();

            for (int i = 0; i < guilds; i++)
            {
                Guild guild = new Guild();
                guild.Decode(pPacket);
                guild.Save(pWorldID);
            }
        }
예제 #29
0
            public void Decode(MaplePacket pPacket)
            {
                Values = new int[AmountOfValues];

                string tmp = "";

                for (int i = 0; i < AmountOfValues; i++)
                {
                    Values[i] = pPacket.ReadInt();
                    tmp      += string.Format("{0} |", Values[i]);
                }

                Logger.WriteLine("ULOI: {0}", tmp);
            }
예제 #30
0
        protected MaplePacketItem CreateListItem(MaplePacket packet)
        {
            Definition definition = Config.Instance.GetDefinition(packet);
            string     name       = definition == null ? "" : definition.Name;

            var item = new MaplePacketItem(packet, name);

            if (item.Packet.Outbound)
            {
                item.BackColor = HighlightColor;
            }

            return(item);
        }
예제 #31
0
        private void allToolStripMenuItem1_Click(object sender, EventArgs e)
        {
            MaplePacket packet = ListView.Selected;

            if (packet == default)
            {
                return;
            }

            int startIndex = mPackets.FindIndex((p) => p == packet) + 1;

            mPackets.RemoveRange(startIndex, mPackets.Count - startIndex);
            RefreshPackets();
        }
예제 #32
0
        private void mPacketContextIgnoreMenu_CheckedChanged(object pSender, EventArgs pArgs)
        {
            if (openingContextMenu || ListView.SelectedIndices.Count == 0)
            {
                return;
            }
            int         index      = ListView.SelectedIndices[0];
            MaplePacket packetItem = ListView.Selected;
            Definition  definition =
                Config.Instance.GetDefinition(Build, Locale, packetItem.Outbound, packetItem.Opcode);

            if (definition == null)
            {
                definition = new Definition {
                    Outbound = packetItem.Outbound,
                    Opcode   = packetItem.Opcode,
                };
            }

            definition.Ignore = mPacketContextIgnoreMenu.Checked;
            SaveDefinition(Locale, Build, definition);

            // If viewing ignored packets, ignoring a new packet does not change view
            if (mViewIgnoredMenu.Checked)
            {
                return;
            }

            int newIndex = index - 1;

            for (int i = index - 1; i > 0; i--)
            {
                MaplePacket pack = ListView.FilteredPackets[i];
                Definition  def  = Config.Instance.GetDefinition(Build, Locale, pack.Outbound, pack.Opcode);
                if (def == definition)
                {
                    newIndex--;
                }
            }

            RefreshPackets();

            if (newIndex != 0 && ListView.FilteredPackets[newIndex] != null)
            {
                ListViewItem listItem = ListView.Items[newIndex];
                listItem.Selected = true;
                listItem.EnsureVisible();
            }
        }
예제 #33
0
        public void OpenReadOnly(string pFilename)
        {
            // mFileSaveMenu.Enabled = false;

            mTerminated = true;
            using (FileStream stream = new FileStream(pFilename, FileMode.Open, FileAccess.Read))
            {
                BinaryReader reader = new BinaryReader(stream);
                mBuild = reader.ReadUInt16();
                if (mBuild == 0x2012)
                {
                    mLocale = (byte)reader.ReadUInt16();
                    mBuild = reader.ReadUInt16();
                    mLocalPort = reader.ReadUInt16();
                }
                else if (mBuild == 0x2014)
                {
                    mLocalEndpoint = reader.ReadString();
                    mLocalPort = reader.ReadUInt16();
                    mRemoteEndpoint = reader.ReadString();
                    mRemotePort = reader.ReadUInt16();

                    mLocale = (byte)reader.ReadUInt16();
                    mBuild = reader.ReadUInt16();
                }
                else if (mBuild == 0x2015)
                {
                    mLocalEndpoint = reader.ReadString();
                    mLocalPort = reader.ReadUInt16();
                    mRemoteEndpoint = reader.ReadString();
                    mRemotePort = reader.ReadUInt16();

                    mLocale = reader.ReadByte();
                    mBuild = reader.ReadUInt16();
                }
                else
                {
                    mLocalPort = reader.ReadUInt16();
                    // Old version
                    frmLocale loc = new frmLocale();
                    var res = loc.ShowDialog();
                    if (res == System.Windows.Forms.DialogResult.OK)
                    {
                        mLocale = loc.ChosenLocale;
                    }
                }
                mPacketList.BeginUpdate();
                while (stream.Position < stream.Length)
                {
                    long timestamp = reader.ReadInt64();
                    ushort size = reader.ReadUInt16();
                    ushort opcode = reader.ReadUInt16();
                    bool outbound = (size & 0x8000) != 0;
                    size = (ushort)(size & 0x7FFF);
                    byte[] buffer = reader.ReadBytes(size);
                    Definition definition = Config.Instance.GetDefinition(mBuild, mLocale, outbound, opcode);
                    MaplePacket packet = new MaplePacket(new DateTime(timestamp), outbound, mBuild, mLocale, opcode, definition == null ? "" : definition.Name, buffer);
                    mPackets.Add(packet);
                    if (!mOpcodes.Exists(kv => kv.First == packet.Outbound && kv.Second == packet.Opcode)) mOpcodes.Add(new Pair<bool, ushort>(packet.Outbound, packet.Opcode));
                    if (definition != null && definition.Ignore) continue;
                    mPacketList.Items.Add(packet);
                }
                mPacketList.EndUpdate();
                if (mPacketList.Items.Count > 0) mPacketList.EnsureVisible(0);
            }

            Text = string.Format("{0} (ReadOnly)", Path.GetFileName(pFilename));
            Console.WriteLine("Loaded file: {0}", pFilename);
        }
예제 #34
0
        internal Results BufferTCPPacket(TcpPacket pTCPPacket, DateTime pArrivalTime)
        {
            if (pTCPPacket.Fin || pTCPPacket.Rst)
            {
                mTerminated = true;
                Text += " (Terminated)";
                if (mPackets.Count == 0)
                {
                    // f**k
                    return Results.CloseMe;
                }
                else
                {
                    return Results.Terminated;
                }
            }
            if (pTCPPacket.Syn && !pTCPPacket.Ack)
            {
                mLocalPort = (ushort)pTCPPacket.SourcePort;
                mRemotePort = (ushort)pTCPPacket.DestinationPort;
                mOutboundSequence = (uint)(pTCPPacket.SequenceNumber + 1);
                Text = "Port " + mLocalPort.ToString();
                startTime = DateTime.Now;

                mRemoteEndpoint = ((PacketDotNet.IPv4Packet)pTCPPacket.ParentPacket).SourceAddress.ToString() + ":" + pTCPPacket.SourcePort.ToString();
                mLocalEndpoint = ((PacketDotNet.IPv4Packet)pTCPPacket.ParentPacket).DestinationAddress.ToString() + ":" + pTCPPacket.DestinationPort.ToString();
                Console.WriteLine("[CONNECTION] From {0} to {1}", mLocalEndpoint, mRemoteEndpoint);

                return Results.Continue;
            }
            if (pTCPPacket.Syn && pTCPPacket.Ack) { mInboundSequence = (uint)(pTCPPacket.SequenceNumber + 1); return Results.Continue; }
            if (pTCPPacket.PayloadData.Length == 0) return Results.Continue;
            if (mBuild == 0)
            {
                if (pTCPPacket.PayloadData.Length < 13) return Results.CloseMe;
                byte[] tcpData = pTCPPacket.PayloadData;
                //mBuild = (ushort)(tcpData[2] | (tcpData[3] << 8));

                bool mIsKMS = false;

                PacketReader pr = new PacketReader(tcpData);
                pr.ReadShort();
                ushort version = pr.ReadUShort();
                var pos = pr.Position;
                {
                    var shrt = pr.ReadShort();
                    if (shrt < 0 || shrt > 0x0020)
                    {
                        return Results.CloseMe;
                    }
                }
                pr.Reset(pos);
                string patchLocation = pr.ReadMapleString();
                byte[] localIV = pr.ReadBytes(4);
                byte[] remoteIV = pr.ReadBytes(4);
                byte serverLocale = pr.ReadByte();

                if (pr.Remaining > 0 || serverLocale > 0x12)
                {
                    return Results.CloseMe;
                }

                if (serverLocale == 0x02 || (serverLocale == 0x01 && version > 255)) mIsKMS = true;
                else mIsKMS = false;

                if (mIsKMS)
                {
                    int test = int.Parse(patchLocation);
                    ushort t1 = (ushort)(test & 0x7FFF);
                    int t2 = (test >> 15) & 1;
                    int t3 = (test >> 16) & 0xFF;
                    Console.WriteLine("Logging KMS connection. Version {0} | {1} | {2}", t1, t2, t3);
                    mBuild = t1;
                }
                else
                {
                    mBuild = version;
                }

                mLocale = serverLocale;
                mPatchLocation = patchLocation;

                mOutboundStream = new MapleStream(true, mBuild, mLocale, localIV);
                mInboundStream = new MapleStream(false, (ushort)(0xFFFF - mBuild), mLocale, remoteIV);
                mInboundSequence += (uint)tcpData.Length;

                // Generate HandShake packet
                Definition definition = Config.Instance.GetDefinition(mBuild, mLocale, false, 0xFFFF);
                if (definition == null)
                {
                    definition = new Definition();
                    definition.Outbound = false;
                    definition.Locale = mLocale;
                    definition.Opcode = 0xFFFF;
                    definition.Name = "Maple Handshake";
                    definition.Build = mBuild;
                    Config.Instance.Definitions.Add(definition);
                }

                {
                    string filename = "Scripts" +
                        Path.DirectorySeparatorChar + mLocale.ToString() +
                        Path.DirectorySeparatorChar + mBuild.ToString() +
                        Path.DirectorySeparatorChar + "Inbound" +
                        Path.DirectorySeparatorChar + "0xFFFF.txt";
                    if (!Directory.Exists(Path.GetDirectoryName(filename))) Directory.CreateDirectory(Path.GetDirectoryName(filename));
                    if (!File.Exists(filename))
                    {
                        string contents = "";
                        contents += "using (ScriptAPI) {\r\n";
                        contents += "\tAddShort(\"Packet Size\");\r\n";
                        contents += "\tAddUShort(\"MapleStory Version\");\r\n";
                        contents += "\tAddString(\"MapleStory Patch Location\");\r\n";
                        contents += "\tAddField(\"Local Initializing Vector (IV)\", 4);\r\n";
                        contents += "\tAddField(\"Remote Initializing Vector (IV)\", 4);\r\n";
                        contents += "\tAddByte(\"MapleStory Locale\");\r\n";
                        contents += "}";
                        File.WriteAllText(filename, contents);
                    }
                }

                MaplePacket packet = new MaplePacket(pArrivalTime, false, mBuild, mLocale, 0xFFFF, definition == null ? "" : definition.Name, tcpData);
                if (!mOpcodes.Exists(kv => kv.First == packet.Outbound && kv.Second == packet.Opcode))
                { // Should be false, but w/e
                    mOpcodes.Add(new Pair<bool, ushort>(packet.Outbound, packet.Opcode));
                }

                mPacketList.Items.Add(packet);
                mPackets.Add(packet);
                MainForm.SearchForm.RefreshOpcodes(true);
                Console.WriteLine("[CONNECTION] MapleStory V{2}.{3} Locale {4}", mLocalEndpoint, mRemoteEndpoint, mBuild, patchLocation, serverLocale);
            }
            if (pTCPPacket.SourcePort == mLocalPort) ProcessTCPPacket(pTCPPacket, ref mOutboundSequence, mOutboundBuffer, mOutboundStream, pArrivalTime);
            else ProcessTCPPacket(pTCPPacket, ref mInboundSequence, mInboundBuffer, mInboundStream, pArrivalTime);
            return Results.Continue;
        }
예제 #35
0
        internal void ParseMSnifferLine(string packetLine)
        {
            var match = _packetRegex.Match(packetLine);
            if (match.Captures.Count == 0) return;
            DateTime date = new DateTime(
                2012,
                10,
                10,
                int.Parse(match.Groups[1].Value),
                int.Parse(match.Groups[2].Value),
                int.Parse(match.Groups[3].Value)
            );
            int packetLength = int.Parse(match.Groups[4].Value);
            byte[] buffer = new byte[packetLength - 2];
            bool outbound = match.Groups[5].Value == "Send";
            string[] bytesText = match.Groups[6].Value.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);

            ushort opcode = (ushort)(byte.Parse(bytesText[0], System.Globalization.NumberStyles.HexNumber) | byte.Parse(bytesText[1], System.Globalization.NumberStyles.HexNumber) << 8);

            for (var i = 2; i < packetLength; i++)
            {
                buffer[i - 2] = byte.Parse(bytesText[i], System.Globalization.NumberStyles.HexNumber);
            }

            Definition definition = Config.Instance.GetDefinition(mBuild, mLocale, outbound, opcode);
            MaplePacket packet = new MaplePacket(date, outbound, mBuild, mLocale, opcode, definition == null ? "" : definition.Name, buffer, 0, 0);
            mPackets.Add(packet);
            if (!mOpcodes.Exists(kv => kv.First == packet.Outbound && kv.Second == packet.Opcode)) mOpcodes.Add(new Pair<bool, ushort>(packet.Outbound, packet.Opcode));
            if (definition != null && definition.Ignore) return;
            mPacketList.Items.Add(packet);
        }
예제 #36
0
        internal Results BufferTCPPacket(TcpPacket pTCPPacket, DateTime pArrivalTime)
        {
            if (pTCPPacket.Fin || pTCPPacket.Rst)
            {
                mTerminated = true;
                Text += " (Terminated)";

                return mPackets.Count == 0 ? Results.CloseMe : Results.Terminated;
            }
            if (pTCPPacket.Syn && !pTCPPacket.Ack)
            {
                mLocalPort = (ushort)pTCPPacket.SourcePort;
                mRemotePort = (ushort)pTCPPacket.DestinationPort;
                mOutboundSequence = (uint)(pTCPPacket.SequenceNumber + 1);
                Text = "Port " + mLocalPort + " - " + mRemotePort;
                startTime = DateTime.Now;

                try
                {
                    mRemoteEndpoint = ((PacketDotNet.IPv4Packet)pTCPPacket.ParentPacket).SourceAddress.ToString() + ":" + pTCPPacket.SourcePort.ToString();
                    mLocalEndpoint = ((PacketDotNet.IPv4Packet)pTCPPacket.ParentPacket).DestinationAddress.ToString() + ":" + pTCPPacket.DestinationPort.ToString();
                    Console.WriteLine("[CONNECTION] From {0} to {1}", mRemoteEndpoint, mLocalEndpoint);

                    return Results.Continue;
                }
                catch
                {
                    return Results.CloseMe;
                }
            }
            if (pTCPPacket.Syn && pTCPPacket.Ack) { mInboundSequence = (uint)(pTCPPacket.SequenceNumber + 1); return Results.Continue; }
            if (pTCPPacket.PayloadData.Length == 0) return Results.Continue;
            if (mBuild == 0)
            {
                byte[] tcpData = pTCPPacket.PayloadData;

                if (pTCPPacket.SourcePort == mLocalPort) mOutboundSequence += (uint)tcpData.Length;
                else mInboundSequence += (uint)tcpData.Length;

                ushort length = (ushort)(BitConverter.ToUInt16(tcpData, 0) + 2);
                byte[] headerData = new byte[tcpData.Length];
                Buffer.BlockCopy(tcpData, 0, headerData, 0, tcpData.Length);

                bool mIsKMS = false;

                PacketReader pr = new PacketReader(headerData);

                if (length != tcpData.Length || tcpData.Length < 13)
                {
                    if (socks5 > 0 && socks5 < 7)
                    {
                        if (pr.ReadByte() == 5 && pr.ReadByte() == 1)
                        {
                            pr.ReadByte();
                            mProxyEndpoint = mLocalEndpoint;
                            mLocalEndpoint = "";
                            switch (pr.ReadByte())
                            {
                                case 1://IPv4
                                    for (int i = 0; i < 4; i++)
                                    {
                                        mLocalEndpoint += pr.ReadByte();
                                        if (i < 3)
                                        {
                                            mLocalEndpoint += ".";
                                        }
                                    }
                                    break;
                                case 3://Domain
                                    //readInt - String Length
                                    //readAsciiString - Address
                                    break;
                                case 4://IPv6
                                    for (int i = 0; i < 16; i++)
                                    {
                                        pr.ReadByte();
                                    }
                                    break;
                            }
                            byte[] ports = new byte[2];
                            for (int i = 1; i >= 0; i--)
                            {
                                ports[i] = pr.ReadByte();
                            }
                            PacketReader portr = new PacketReader(ports);
                            mProxyPort = mRemotePort;
                            mRemotePort = portr.ReadUShort();
                            mLocalEndpoint += ":" + mRemotePort;
                            Text = "Port " + mLocalPort + " - " + mRemotePort + "(Proxy" + mProxyPort + ")";
                            Console.WriteLine("[socks5] From {0} to {1} (Proxy {2})", mRemoteEndpoint, mLocalEndpoint, mProxyEndpoint);
                        }
                        socks5++;
                        return Results.Continue;
                    }
                    else if (tcpData.Length == 3 && pr.ReadByte() == 5)
                    {
                        socks5 = 1;
                        return Results.Continue;
                    }
                    Console.WriteLine("Connection on port {0} did not have a MapleStory Handshake", mLocalEndpoint);
                    return Results.CloseMe;
                }

                pr.ReadUShort();
                ushort version = pr.ReadUShort();
                byte subVersion = 1;
                string patchLocation = pr.ReadMapleString();
                byte[] localIV = pr.ReadBytes(4);
                byte[] remoteIV = pr.ReadBytes(4);
                byte serverLocale = pr.ReadByte();

                if (serverLocale > 0x12)
                {
                    return Results.CloseMe;
                }

                if (serverLocale == 0x02 || (serverLocale == 0x01 && version > 255)) mIsKMS = true;
                else mIsKMS = false;

                if (mIsKMS)
                {
                    int test = int.Parse(patchLocation);
                    version = (ushort)(test & 0x7FFF);
                    subVersion = (byte)((test >> 16) & 0xFF);
                }
                else if (patchLocation.All(character => { return character >= '0' && character <= '9'; }))
                {
                    if (!byte.TryParse(patchLocation, out subVersion))
                        Console.WriteLine("Failed to parse subVersion");
                }

                mBuild = version;

                mLocale = serverLocale;
                mPatchLocation = patchLocation;

                mOutboundStream = new MapleStream(true, mBuild, mLocale, localIV, subVersion);
                mInboundStream = new MapleStream(false, mBuild, mLocale, remoteIV, subVersion);

                // Generate HandShake packet
                Definition definition = Config.Instance.GetDefinition(mBuild, mLocale, false, 0xFFFF);
                if (definition == null)
                {
                    definition = new Definition();
                    definition.Outbound = false;
                    definition.Locale = mLocale;
                    definition.Opcode = 0xFFFF;
                    definition.Name = "Maple Handshake";
                    definition.Build = mBuild;
                    DefinitionsContainer.Instance.SaveDefinition(definition);
                }

                {
                    string filename = "Scripts" +
                        Path.DirectorySeparatorChar + mLocale.ToString() +
                        Path.DirectorySeparatorChar + mBuild.ToString() +
                        Path.DirectorySeparatorChar + "Inbound" +
                        Path.DirectorySeparatorChar + "0xFFFF.txt";
                    if (!Directory.Exists(Path.GetDirectoryName(filename))) Directory.CreateDirectory(Path.GetDirectoryName(filename));
                    if (!File.Exists(filename))
                    {
                        string contents = "";
                        contents += "using (ScriptAPI) {\r\n";
                        contents += "\tAddShort(\"Packet Size\");\r\n";
                        contents += "\tAddUShort(\"MapleStory Version\");\r\n";
                        contents += "\tAddString(\"MapleStory Patch Location/Subversion\");\r\n";
                        contents += "\tAddField(\"Local Initializing Vector (IV)\", 4);\r\n";
                        contents += "\tAddField(\"Remote Initializing Vector (IV)\", 4);\r\n";
                        contents += "\tAddByte(\"MapleStory Locale\");\r\n";
                        if (mRemotePort == 8484 && ((mLocale == MapleLocale.GLOBAL && version >= 160) ||
                                                    (mLocale == MapleLocale.TAIWAN && version >= 176) ||
                                                    (mLocale == MapleLocale.CHINA && version >= 122)))
                            contents += "\tAddByte(\"Unknown\");\r\n";
                        contents += "}";
                        File.WriteAllText(filename, contents);
                    }
                }

                MaplePacket packet = new MaplePacket(pArrivalTime, false, mBuild, mLocale, 0xFFFF, definition == null ? "" : definition.Name, tcpData, (uint)0, BitConverter.ToUInt32(remoteIV, 0));
                if (!mOpcodes.Exists(kv => kv.First == packet.Outbound && kv.Second == packet.Opcode)) // Should be false, but w/e
                {
                    mOpcodes.Add(new Pair<bool, ushort>(packet.Outbound, packet.Opcode));
                }

                mPacketList.Items.Add(packet);
                mPackets.Add(packet);
                MainForm.SearchForm.RefreshOpcodes(true);
                Console.WriteLine("[CONNECTION] MapleStory V{2}.{3} Locale {4}", mLocalEndpoint, mRemoteEndpoint, mBuild, subVersion, serverLocale);

            }
            if (pTCPPacket.SourcePort == mLocalPort) ProcessTCPPacket(pTCPPacket, ref mOutboundSequence, mOutboundBuffer, mOutboundStream, pArrivalTime);
            else ProcessTCPPacket(pTCPPacket, ref mInboundSequence, mInboundBuffer, mInboundStream, pArrivalTime);
            return Results.Continue;
        }
예제 #37
0
        public void OpenReadOnly(string pFilename)
        {
            // mFileSaveMenu.Enabled = false;
            Saved = true;

            mTerminated = true;
            using (FileStream stream = new FileStream(pFilename, FileMode.Open, FileAccess.Read))
            {
                BinaryReader reader = new BinaryReader(stream);
                ushort MapleSharkVersion = reader.ReadUInt16();
                mBuild = MapleSharkVersion;
                if (MapleSharkVersion < 0x2000)
                {

                    mLocalPort = reader.ReadUInt16();
                    // Old version
                    frmLocale loc = new frmLocale();
                    var res = loc.ShowDialog();
                    if (res == System.Windows.Forms.DialogResult.OK)
                    {
                        mLocale = loc.ChosenLocale;
                    }
                }
                else
                {
                    byte v1 = (byte)((MapleSharkVersion >> 12) & 0xF),
                           v2 = (byte)((MapleSharkVersion >> 8) & 0xF),
                           v3 = (byte)((MapleSharkVersion >> 4) & 0xF),
                           v4 = (byte)((MapleSharkVersion >> 0) & 0xF);
                    Console.WriteLine("Loading MSB file, saved by MapleShark V{0}.{1}.{2}.{3}", v1, v2, v3, v4);

                    if (MapleSharkVersion == 0x2012)
                    {
                        mLocale = (byte)reader.ReadUInt16();
                        mBuild = reader.ReadUInt16();
                        mLocalPort = reader.ReadUInt16();
                    }
                    else if (MapleSharkVersion == 0x2014)
                    {
                        mLocalEndpoint = reader.ReadString();
                        mLocalPort = reader.ReadUInt16();
                        mRemoteEndpoint = reader.ReadString();
                        mRemotePort = reader.ReadUInt16();

                        mLocale = (byte)reader.ReadUInt16();
                        mBuild = reader.ReadUInt16();
                    }
                    else if (MapleSharkVersion == 0x2015 || MapleSharkVersion >= 0x2020)
                    {
                        mLocalEndpoint = reader.ReadString();
                        mLocalPort = reader.ReadUInt16();
                        mRemoteEndpoint = reader.ReadString();
                        mRemotePort = reader.ReadUInt16();

                        mLocale = reader.ReadByte();
                        mBuild = reader.ReadUInt16();

                        if (MapleSharkVersion >= 0x2021)
                        {
                            mPatchLocation = reader.ReadString();
                        }
                    }
                    else
                    {
                        MessageBox.Show("I have no idea how to open this MSB file. It looks to me as a version " + string.Format("{0}.{1}.{2}.{3}", v1, v2, v3, v4) + " MapleShark MSB file... O.o?!");
                        return;
                    }
                }

                mPacketList.BeginUpdate();
                while (stream.Position < stream.Length)
                {
                    long timestamp = reader.ReadInt64();
                    ushort size = reader.ReadUInt16();
                    ushort opcode = reader.ReadUInt16();
                    bool outbound;

                    if (MapleSharkVersion >= 0x2020)
                    {
                        outbound = reader.ReadBoolean();
                    }
                    else
                    {
                        outbound = (size & 0x8000) != 0;
                        size = (ushort)(size & 0x7FFF);
                    }

                    byte[] buffer = reader.ReadBytes(size);

                    uint preDecodeIV = 0, postDecodeIV = 0;
                    if (MapleSharkVersion >= 0x2025)
                    {
                        preDecodeIV = reader.ReadUInt32();
                        postDecodeIV = reader.ReadUInt32();
                    }

                    Definition definition = Config.Instance.GetDefinition(mBuild, mLocale, outbound, opcode);
                    MaplePacket packet = new MaplePacket(new DateTime(timestamp), outbound, mBuild, mLocale, opcode, definition == null ? "" : definition.Name, buffer, preDecodeIV, postDecodeIV);
                    mPackets.Add(packet);
                    if (!mOpcodes.Exists(kv => kv.First == packet.Outbound && kv.Second == packet.Opcode)) mOpcodes.Add(new Pair<bool, ushort>(packet.Outbound, packet.Opcode));
                    if (definition != null && definition.Ignore) continue;
                    mPacketList.Items.Add(packet);
                }
                mPacketList.EndUpdate();
                if (mPacketList.Items.Count > 0) mPacketList.EnsureVisible(0);
            }

            Text = string.Format("{0} (ReadOnly)", Path.GetFileName(pFilename));
            Console.WriteLine("Loaded file: {0}", pFilename);
        }