📄 packetsmbmailslot.cs
字号:
using System;
using System.Windows.Forms;
namespace MyClasses
{
public class PacketSMBMAILSLOT
{
public const int NORMAL = 0;
public const int VALUE = 1;
public struct PACKET_SMB_MAIL_SLOT
{
public ushort OpCode;
public ushort Priority;
public ushort Class;
public string ClassStr;
public ushort Size;
public string MailSlotName;
}
public PacketSMBMAILSLOT()
{
}
private string GetClassString( ushort cmd )
{
string Tmp = "";
switch( cmd )
{
case 2 : Tmp = "Unreliable & Broadcast"; break;
}
return Tmp;
}
public TreeNode GetSMBMAILSLOTNode( PACKET_SMB_MAIL_SLOT PSmbMailSlot )
{
TreeNode mNode;
string Tmp = "";
mNode = new TreeNode();
mNode.Text = "SMB Mail Slot Protocol";
Tmp = "Operation Code :" + Function.ReFormatString( PSmbMailSlot.OpCode , null );
mNode.Nodes.Add( Tmp );
Tmp = "Priority :" + Function.ReFormatString( PSmbMailSlot.Priority , null );
mNode.Nodes.Add( Tmp );
Tmp = "Class :" + Function.ReFormatString( PSmbMailSlot.Class , PSmbMailSlot.ClassStr );
mNode.Nodes.Add( Tmp );
Tmp = "Size :" + Function.ReFormatString( PSmbMailSlot.Size , null );
mNode.Nodes.Add( Tmp );
Tmp = "Mail Slot Name :" + PSmbMailSlot.MailSlotName;
mNode.Nodes.Add( Tmp );
return mNode;
}
public PACKET_SMB_MAIL_SLOT GetSMBMAILSLOTPart( byte [] PacketData , ref int Index )
{
ushort u = 0;
string Tmp = "";
PACKET_SMB_MAIL_SLOT PSmbMailSlot;
u = Function.Get2Bytes( PacketData , ref Index , VALUE );
PSmbMailSlot.OpCode = u;
u = Function.Get2Bytes( PacketData , ref Index , VALUE );
PSmbMailSlot.Priority = u;
u = Function.Get2Bytes( PacketData , ref Index , VALUE );
PSmbMailSlot.Class = u;
PSmbMailSlot.ClassStr = GetClassString( u );
u = Function.Get2Bytes( PacketData , ref Index , VALUE );
PSmbMailSlot.Size = u;
Tmp = "";
while( PacketData[ Index ] != 0 )
Tmp += (char) PacketData[ Index ++ ];
PSmbMailSlot.MailSlotName = Tmp;
return PSmbMailSlot;
}
public bool Parser( ref TreeNodeCollection mNode,
byte [] PacketData ,
ref int Index ,
ref ListViewItem LItem )
{
TreeNode mNodex;
string Tmp = "";
//int k = 0;
mNodex = new TreeNode();
mNodex.Text = "SMB Mail Slot ( Server Message Block Mail Slot Resolution Protocol )";
//Function.SetPosition( ref mNodex , Index - 2 , 2 , false );
/*if( ( Index + Const.LENGTH_OF_ARP ) >= PacketData.Length )
{
mNode.Add( mNodex );
Tmp = "[ Malformed ARP packet. Remaining bytes don't fit an ARP packet. Possibly due to bad decoding ]";
mNode.Add( Tmp );
LItem.SubItems[ Const.LIST_VIEW_INFO_INDEX ].Text = Tmp;
return false;
}*/
try
{
//Function.SetPosition( ref mNodex , Index - 2 , 2 , false );
LItem.SubItems[ Const.LIST_VIEW_PROTOCOL_INDEX ].Text = "SMB";
LItem.SubItems[ Const.LIST_VIEW_INFO_INDEX ].Text = "SMB Mail Slot protocol";
mNode.Add( mNodex );
}
catch( Exception Ex )
{
mNode.Add( mNodex );
Tmp = "[ Malformed SMB Mail Slot packet. Remaining bytes don't fit an SMB Mail Slot packet. Possibly due to bad decoding ]";
mNode.Add( Tmp );
Tmp = "[ Exception raised is <" + Ex.GetType().ToString() + "> at packet index <" + Index.ToString() + "> ]";
mNode.Add( Tmp );
LItem.SubItems[ Const.LIST_VIEW_INFO_INDEX ].Text = Tmp;
return false;
}
return true;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -