private void tsmiOpenPacket_Click(object sender, EventArgs e) { ListView list = (ListView)tabControlMain.TabPages[tabControlMain.SelectedIndex].Controls[0]; var index = list.SelectedIndices[0]; var id = GetPacketIdFromTableItemIndex(list, index); var packet = PacketManager.PacketList[id]; Form showPacketForm = new ShowPacketForm(id, packet); showPacketForm.Show(); }
/// <summary> /// Al hacer click sobre una fila de la tabla, se abre el detalle del packet /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void OnMouseDoubleClick(object sender, MouseEventArgs e) { var list = (ListView)sender; if (list.SelectedIndices.Count <= 0) { return; } var index = list.SelectedIndices[0]; var id = GetPacketIdFromTableItemIndex(sender, index); var packet = PacketManager.PacketList[id]; Form showPacketForm = new ShowPacketForm(id, packet); showPacketForm.Show(); }
public static void PacketReceived(PacketInfo packetInfo, ref byte[] data /*, ref ServerCommand serverResponse*/) { Packet.Directions direction; int ID; TotalSize += packetInfo.Size; switch (packetInfo.FunctionID) { case Functions.CODE_RECV: case Functions.CODE_RECVFROM: case Functions.CODE_WS2RECV: case Functions.CODE_WS2RECVFROM: case Functions.CODE_WSARECV: case Functions.CODE_WSARECVFROM: case Functions.CODE_PR_RECV: case Functions.CODE_PR_READ: case Functions.CODE_SSLDECRYPTPACKET: case Functions.CODE_DECRYPTMESSAGE: case Functions.CODE_SSL_READ: direction = Packet.Directions.In; TotalSizeReceived += packetInfo.Size; break; case Functions.CODE_SEND: case Functions.CODE_SENDTO: case Functions.CODE_WS2SEND: case Functions.CODE_WS2SENDTO: case Functions.CODE_WSASEND: case Functions.CODE_WSASENDTO: case Functions.CODE_PR_SEND: case Functions.CODE_PR_WRITE: case Functions.CODE_SSLENCRYPTPACKET: case Functions.CODE_ENCRYPTMESSAGE: case Functions.CODE_SSL_WRITE: direction = Packet.Directions.Out; TotalSizeSent += packetInfo.Size; break; default: throw new IndexOutOfRangeException(); } var functionFlag = FilterManager.GetFilterActionFlagForFunction(packetInfo.FunctionID); // If a matching breakpoint type filter is active, we open a new window to edit the data if (IsFilteringActived && FilterManager.CheckPacketBreak(data, packetInfo.Size, functionFlag)) { var pckt = new Packet(packetInfo.FunctionID, packetInfo.SocketId, packetInfo.LocalIp, packetInfo.LocalPort, packetInfo.RemoteIp, packetInfo.RemotePort, data, direction); var showPacketForm = new ShowPacketForm(0, pckt, true); showPacketForm.ShowDialog(); if (showPacketForm.DialogResult == System.Windows.Forms.DialogResult.OK) { data = showPacketForm.NewPacketData; packetInfo.Size = showPacketForm.NewPacketSize; } // Send the new data to the DLL DllCommunication.WriteCommandToCmdMMF(ServerCodes.SCODE_SETPACKET, data, packetInfo.Size); } if (!IsCaptureEnabled) // Capture disabled, return { return; } // Don't log Functions, Ips, or Ports that are not activated in the program's settings menu if (!LogFunctions.HasFlag(FilterManager.GetFilterActionFlagForFunction(packetInfo.FunctionID))) { return; } if ((Settings.LocalIpChecked && packetInfo.LocalIp != (uint)Settings.LocalIp) || (Settings.LocalPortChecked && packetInfo.LocalPort != Settings.LocalPort) || (Settings.RemoteIpChecked && packetInfo.RemoteIp != (uint)Settings.RemoteIp) || (Settings.RemotePortChecked && packetInfo.RemotePort != Settings.RemotePort)) { return; } IsModifiedList = true; var packet = new Packet(packetInfo.FunctionID, packetInfo.SocketId, packetInfo.LocalIp, packetInfo.LocalPort, packetInfo.RemoteIp, packetInfo.RemotePort, data, direction); lock (LockingVar) { ID = PacketList.Count; PacketList.Add(packet); Program.mainForm.AddPacket(packet); } if (IsFilteringActived && FilterManager.CheckPacketWatch(data, packetInfo.Size, functionFlag)) { Watch.Add(ID); } // Don't log ignored packets if (IsFilteringActived && FilterManager.CheckPacketIgnore(data, packetInfo.Size, functionFlag)) { return; } Both.Add(ID); switch (direction) { case Packet.Directions.In: Received.Add(ID); break; case Packet.Directions.Out: Sent.Add(ID); break; } SmartRefresh(); }