Пример #1
0
        public WinPCapObject(SnifferUI.DICOMSniffer mainObj, string Filename, TCP.TCPParser TCP)
        {
            tcp = TCP;
            snifferObj = mainObj;

            file = new FileStream(Filename,FileMode.Open,FileAccess.Read);

            uint magicNumber = Function.Get4BytesFromStream(file,Const.NORMAL);
            BaseTime = new DateTime(1970,1,1,1,2,3,123);
            switch(magicNumber)
            {
                case 0xD4C3B2A1:
                    FileFormat = Format.WINPCAP;
                    file.Position = 24;
                    break;

                case 0x58435000: // "XCP"
                    file.Position = 6;
                    ushort versionNumber = Function.Get2BytesFromStream(file,Const.NORMAL);
                    if(versionNumber == 0x312E)
                    {
                        FileFormat = Format.XCP001;
                    }
                    else
                    {
                        FileFormat = Format.XCP002;
                    }

                    file.Position = 12;
                    BaseTime += new TimeSpan(((long)Function.Get4BytesFromStream( file , Const.VALUE ))*10000000);

                    file.Position = 52;
                    BaseTime -= new TimeSpan(((long)Function.Get8BytesFromStream( file , Const.VALUE ))*10);

                    file.Position = 128;
                    break;

                case 0x736E6F6F: // Sun snoop
                    FileFormat = Format.SUNSNOOP;
                    file.Position = 16;
                    break;

                default:
                    throw new Exception("Only the winpcap format (NA sniffer (windows 1.1) is supported. Unable to load capture file.");
            }

            // Sets the progress bar's minimum value to a number
            // representing the current position in file before the files are read in.
            snifferObj.Invoke(snifferObj.MinProgressHandler, new object[] { (int)file.Position });
            // Sets the progress bar's maximum value to a number
            // representing the total length of the file.
            snifferObj.Invoke(snifferObj.MaxProgressHandler, new object[] { (int)file.Length });
        }
Пример #2
0
 public DICOMAnalyser(SnifferUI.DICOMSniffer mainObj )
 {
     snifferObj = mainObj;
 }