Beispiel #1
0
        private void MainForm_DragDrop(object sender, DragEventArgs e)
        {
            string[] files = (string[])e.Data.GetData(DataFormats.FileDrop);
            foreach (string file in files)
            {
                if (!File.Exists(file))
                {
                    continue;
                }

                switch (Path.GetExtension(file))
                {
                case ".msb": {
                    SessionForm session = NewSession();
                    session.OpenReadOnly(file);
                    StructureForm.InitEngine(session.Locale, session.Build);
                    session.Show(mDockPanel, DockState.Document);
                    break;
                }

                case ".pcap": {
                    LoadPcapFile(file);
                    break;
                }
                }
            }
        }
Beispiel #2
0
 private void CreateStandardControls()
 {
     LogForm       = new LogForm();
     SearchForm    = new SearchForm();
     DataForm      = new DataForm();
     StructureForm = new StructureForm();
     PropertyForm  = new PropertyForm();
 }
Beispiel #3
0
 private void mViewStructureMenu_CheckedChanged(object pSender, EventArgs pArgs)
 {
     if (mViewStructureMenu.Checked)
     {
         StructureForm.Show();
     }
     else
     {
         StructureForm.Hide();
     }
 }
Beispiel #4
0
        private void ProcessPacketQueue()
        {
            List <RawCapture> curQueue;

            lock (packetQueue) {
                curQueue    = packetQueue;
                packetQueue = new List <RawCapture>();
            }

            foreach (RawCapture packet in curQueue)
            {
                if (!sniffEnabled)
                {
                    continue;
                }

                var         tcpPacket = Packet.ParsePacket(packet.LinkLayerType, packet.Data).Extract <TcpPacket>();
                SessionForm session   = null;
                try {
                    SessionForm.Results?result;
                    if (tcpPacket.Synchronize && !tcpPacket.Acknowledgment && InPortRange(tcpPacket.DestinationPort))
                    {
                        session = NewSession();
                        result  = session.BufferTcpPacket(tcpPacket, packet.Timeval.Date);
                    }
                    else
                    {
                        session = sessions.FirstOrDefault(s => s.MatchTcpPacket(tcpPacket));
                        if (session == null)
                        {
                            continue;
                        }

                        result = session?.BufferTcpPacket(tcpPacket, packet.Timeval.Date);
                    }

                    switch (result)
                    {
                    case SessionForm.Results.Show:
                        StructureForm.InitEngine(session.Locale, session.Build);
                        session.Show(mDockPanel, DockState.Document);
                        break;

                    case SessionForm.Results.CloseMe:
                        session.Close();
                        break;
                    }
                } catch (Exception ex) {
                    logger.Fatal(ex, "Exception while processing packet queue");
                    session?.Close();
                }
            }
        }
Beispiel #5
0
        private void mFileOpenMenu_Click(object pSender, EventArgs pArgs)
        {
            if (mOpenDialog.ShowDialog(this) != DialogResult.OK)
            {
                return;
            }

            foreach (string path in mOpenDialog.FileNames)
            {
                SessionForm session = NewSession();
                session.OpenReadOnly(path);
                StructureForm.InitEngine(session.Locale, session.Build);
                session.Show(mDockPanel, DockState.Document);
            }
        }
Beispiel #6
0
        private void MainForm_Load(object pSender, EventArgs pArgs)
        {
            mDockPanel.Theme = Config.Instance.Theme.DockSuiteTheme;
            toolStripExtender.DefaultRenderer = new ToolStripProfessionalRenderer();
            toolStripExtender.SetStyle(mMenu, VisualStudioToolStripExtender.VsVersion.Vs2015, mDockPanel.Theme);
            toolStripExtender.SetStyle(toolStrip, VisualStudioToolStripExtender.VsVersion.Vs2015, mDockPanel.Theme);

            try {
                mDockPanel.LoadFromXml(LAYOUT_FILE, GetContentFromPersistString);
            } catch {
                // If we fail to load, it will just use the default layout.
                logger.Debug("Using default layout");
                LogForm.Show(mDockPanel);
                SearchForm.Show(mDockPanel);
                DataForm.Show(mDockPanel);
                StructureForm.Show(mDockPanel);
                PropertyForm.Show(mDockPanel);

                // Docking can only be done after adding to panel.
                StructureForm.DockState = DockState.DockRight;
                PropertyForm.DockState  = DockState.DockRight;
            }

            LogForm.ApplyTheme();
            SearchForm.ApplyTheme();
            DataForm.ApplyTheme();
            StructureForm.ApplyTheme();
            PropertyForm.ApplyTheme();

            SetupAdapter();
            mTimer.Enabled = true;

            foreach (string arg in startupArguments)
            {
                SessionForm session = NewSession();
                session.OpenReadOnly(arg);
                StructureForm.InitEngine(session.Locale, session.Build);
                session.Show(mDockPanel, DockState.Document);
            }
        }