From 8841842f79f2e6c77ea1831d020953c7c655f8da Mon Sep 17 00:00:00 2001 From: Mag-nus Date: Sat, 18 Feb 2017 20:31:50 -0600 Subject: [PATCH 1/2] This adds search by opcode under tools menu. --- aclogview/App.config | 15 + aclogview/FindOpcodeInFilesForm.Designer.cs | 231 ++++++++ aclogview/FindOpcodeInFilesForm.cs | 215 +++++++ aclogview/FindOpcodeInFilesForm.resx | 135 +++++ aclogview/Form1.Designer.cs | 625 ++++++++++---------- aclogview/Form1.cs | 39 +- aclogview/Form1.resx | 262 ++++---- aclogview/PCapReader.cs | 409 +++++++++++++ aclogview/PacketRecord.cs | 18 + aclogview/Program.cs | 4 +- aclogview/Properties/Settings.Designer.cs | 76 ++- aclogview/Properties/Settings.settings | 19 +- aclogview/aclogview.csproj | 335 ++++++----- 13 files changed, 1733 insertions(+), 650 deletions(-) create mode 100644 aclogview/FindOpcodeInFilesForm.Designer.cs create mode 100644 aclogview/FindOpcodeInFilesForm.cs create mode 100644 aclogview/FindOpcodeInFilesForm.resx create mode 100644 aclogview/PCapReader.cs create mode 100644 aclogview/PacketRecord.cs diff --git a/aclogview/App.config b/aclogview/App.config index 88fa402..3b876bf 100644 --- a/aclogview/App.config +++ b/aclogview/App.config @@ -1,6 +1,21 @@  + + +
+ + + + + + + + + 0 + + + \ No newline at end of file diff --git a/aclogview/FindOpcodeInFilesForm.Designer.cs b/aclogview/FindOpcodeInFilesForm.Designer.cs new file mode 100644 index 0000000..29bb26b --- /dev/null +++ b/aclogview/FindOpcodeInFilesForm.Designer.cs @@ -0,0 +1,231 @@ +namespace aclogview +{ + partial class FindOpcodeInFilesForm + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.components = new System.ComponentModel.Container(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle7 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle8 = new System.Windows.Forms.DataGridViewCellStyle(); + this.txtSearchPathRoot = new System.Windows.Forms.TextBox(); + this.label1 = new System.Windows.Forms.Label(); + this.btnStartSearch = new System.Windows.Forms.Button(); + this.btnStopSearch = new System.Windows.Forms.Button(); + this.btnChangeSearchPathRoot = new System.Windows.Forms.Button(); + this.dataGridView1 = new System.Windows.Forms.DataGridView(); + this.label2 = new System.Windows.Forms.Label(); + this.txtOpcode = new System.Windows.Forms.TextBox(); + this.statusStrip1 = new System.Windows.Forms.StatusStrip(); + this.toolStripStatusLabel1 = new System.Windows.Forms.ToolStripStatusLabel(); + this.timer1 = new System.Windows.Forms.Timer(this.components); + this.columnHits = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.columnFileSize = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.columnFilePath = new System.Windows.Forms.DataGridViewTextBoxColumn(); + ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit(); + this.statusStrip1.SuspendLayout(); + this.SuspendLayout(); + // + // txtSearchPathRoot + // + this.txtSearchPathRoot.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.txtSearchPathRoot.Location = new System.Drawing.Point(15, 25); + this.txtSearchPathRoot.Name = "txtSearchPathRoot"; + this.txtSearchPathRoot.Size = new System.Drawing.Size(723, 20); + this.txtSearchPathRoot.TabIndex = 0; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(12, 9); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(92, 13); + this.label1.TabIndex = 1; + this.label1.Text = "Search Path Root"; + // + // btnStartSearch + // + this.btnStartSearch.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.btnStartSearch.Location = new System.Drawing.Point(524, 51); + this.btnStartSearch.Name = "btnStartSearch"; + this.btnStartSearch.Size = new System.Drawing.Size(121, 23); + this.btnStartSearch.TabIndex = 2; + this.btnStartSearch.Text = "Start Search"; + this.btnStartSearch.UseVisualStyleBackColor = true; + this.btnStartSearch.Click += new System.EventHandler(this.btnStartSearch_Click); + // + // btnStopSearch + // + this.btnStopSearch.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.btnStopSearch.Enabled = false; + this.btnStopSearch.Location = new System.Drawing.Point(651, 51); + this.btnStopSearch.Name = "btnStopSearch"; + this.btnStopSearch.Size = new System.Drawing.Size(121, 23); + this.btnStopSearch.TabIndex = 3; + this.btnStopSearch.Text = "Stop Search"; + this.btnStopSearch.UseVisualStyleBackColor = true; + this.btnStopSearch.Click += new System.EventHandler(this.btnStopSearch_Click); + // + // btnChangeSearchPathRoot + // + this.btnChangeSearchPathRoot.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.btnChangeSearchPathRoot.Location = new System.Drawing.Point(744, 23); + this.btnChangeSearchPathRoot.Name = "btnChangeSearchPathRoot"; + this.btnChangeSearchPathRoot.Size = new System.Drawing.Size(28, 23); + this.btnChangeSearchPathRoot.TabIndex = 4; + this.btnChangeSearchPathRoot.Text = "F"; + this.btnChangeSearchPathRoot.UseVisualStyleBackColor = true; + this.btnChangeSearchPathRoot.Click += new System.EventHandler(this.btnChangeSearchPathRoot_Click); + // + // dataGridView1 + // + this.dataGridView1.AllowUserToAddRows = false; + this.dataGridView1.AllowUserToDeleteRows = false; + this.dataGridView1.AllowUserToResizeColumns = false; + this.dataGridView1.AllowUserToResizeRows = false; + this.dataGridView1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; + this.dataGridView1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { + this.columnHits, + this.columnFileSize, + this.columnFilePath}); + this.dataGridView1.Location = new System.Drawing.Point(15, 80); + this.dataGridView1.Name = "dataGridView1"; + this.dataGridView1.ReadOnly = true; + this.dataGridView1.Size = new System.Drawing.Size(757, 456); + this.dataGridView1.TabIndex = 5; + this.dataGridView1.CellContentDoubleClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView1_CellContentDoubleClick); + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(12, 56); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(59, 13); + this.label2.TabIndex = 6; + this.label2.Text = "Opcode 0x"; + // + // txtOpcode + // + this.txtOpcode.Location = new System.Drawing.Point(77, 53); + this.txtOpcode.Name = "txtOpcode"; + this.txtOpcode.Size = new System.Drawing.Size(64, 20); + this.txtOpcode.TabIndex = 7; + this.txtOpcode.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; + // + // statusStrip1 + // + this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.toolStripStatusLabel1}); + this.statusStrip1.Location = new System.Drawing.Point(0, 539); + this.statusStrip1.Name = "statusStrip1"; + this.statusStrip1.Size = new System.Drawing.Size(784, 22); + this.statusStrip1.TabIndex = 8; + this.statusStrip1.Text = "statusStrip1"; + // + // toolStripStatusLabel1 + // + this.toolStripStatusLabel1.Name = "toolStripStatusLabel1"; + this.toolStripStatusLabel1.Size = new System.Drawing.Size(89, 17); + this.toolStripStatusLabel1.Text = "Files Processed:"; + // + // timer1 + // + this.timer1.Interval = 200; + this.timer1.Tick += new System.EventHandler(this.timer1_Tick); + // + // columnHits + // + dataGridViewCellStyle7.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight; + dataGridViewCellStyle7.Format = "N0"; + this.columnHits.DefaultCellStyle = dataGridViewCellStyle7; + this.columnHits.HeaderText = "Hits"; + this.columnHits.Name = "columnHits"; + this.columnHits.ReadOnly = true; + this.columnHits.Width = 60; + // + // columnFileSize + // + dataGridViewCellStyle8.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight; + dataGridViewCellStyle8.Format = "N0"; + this.columnFileSize.DefaultCellStyle = dataGridViewCellStyle8; + this.columnFileSize.HeaderText = "File Size"; + this.columnFileSize.Name = "columnFileSize"; + this.columnFileSize.ReadOnly = true; + this.columnFileSize.Width = 80; + // + // columnFilePath + // + this.columnFilePath.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; + this.columnFilePath.HeaderText = "File Path"; + this.columnFilePath.Name = "columnFilePath"; + this.columnFilePath.ReadOnly = true; + // + // FindOpcodeInFilesForm + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(784, 561); + this.Controls.Add(this.statusStrip1); + this.Controls.Add(this.txtOpcode); + this.Controls.Add(this.label2); + this.Controls.Add(this.dataGridView1); + this.Controls.Add(this.btnChangeSearchPathRoot); + this.Controls.Add(this.btnStopSearch); + this.Controls.Add(this.btnStartSearch); + this.Controls.Add(this.label1); + this.Controls.Add(this.txtSearchPathRoot); + this.Name = "FindOpcodeInFilesForm"; + this.Text = "Find Opcode In Files"; + ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit(); + this.statusStrip1.ResumeLayout(false); + this.statusStrip1.PerformLayout(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.TextBox txtSearchPathRoot; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Button btnStartSearch; + private System.Windows.Forms.Button btnStopSearch; + private System.Windows.Forms.Button btnChangeSearchPathRoot; + private System.Windows.Forms.DataGridView dataGridView1; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.TextBox txtOpcode; + private System.Windows.Forms.StatusStrip statusStrip1; + private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel1; + private System.Windows.Forms.Timer timer1; + private System.Windows.Forms.DataGridViewTextBoxColumn columnHits; + private System.Windows.Forms.DataGridViewTextBoxColumn columnFileSize; + private System.Windows.Forms.DataGridViewTextBoxColumn columnFilePath; + } +} \ No newline at end of file diff --git a/aclogview/FindOpcodeInFilesForm.cs b/aclogview/FindOpcodeInFilesForm.cs new file mode 100644 index 0000000..97dd2fa --- /dev/null +++ b/aclogview/FindOpcodeInFilesForm.cs @@ -0,0 +1,215 @@ +using System; +using System.Collections.Concurrent; +using System.Collections.Generic; +using System.ComponentModel; +using System.Globalization; +using System.IO; +using System.Reflection; +using System.Threading; +using System.Threading.Tasks; +using System.Windows.Forms; + +using aclogview.Properties; + +namespace aclogview +{ + public partial class FindOpcodeInFilesForm : Form + { + public FindOpcodeInFilesForm() + { + InitializeComponent(); + } + + protected override void OnLoad(EventArgs e) + { + base.OnLoad(e); + + txtSearchPathRoot.Text = Settings.Default.FindOpcodeInFilesRoot; + txtOpcode.Text = Settings.Default.FindOpcodeInFilesOpcode.ToString("X4"); + + typeof(DataGridView).InvokeMember("DoubleBuffered", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.SetProperty, null, dataGridView1, new object[] { true }); + dataGridView1.RowHeadersVisible = false; + dataGridView1.AllowUserToAddRows = false; + dataGridView1.SelectionMode = DataGridViewSelectionMode.FullRowSelect; + dataGridView1.Columns[0].ValueType = typeof(int); + dataGridView1.Columns[1].ValueType = typeof(int); + } + + protected override void OnClosing(CancelEventArgs e) + { + searchAborted = true; + + Settings.Default.FindOpcodeInFilesRoot = txtSearchPathRoot.Text; + Settings.Default.FindOpcodeInFilesOpcode = OpCode; + + base.OnClosing(e); + } + + int OpCode + { + get + { + int value; + + int.TryParse(txtOpcode.Text, NumberStyles.HexNumber, null, out value); + + return value; + } + } + + private void btnChangeSearchPathRoot_Click(object sender, EventArgs e) + { + using (FolderBrowserDialog openFolder = new FolderBrowserDialog()) + { + if (openFolder.ShowDialog() == DialogResult.OK) + txtSearchPathRoot.Text = openFolder.SelectedPath; + } + } + + + private readonly List filesToProcess = new List(); + private int opCodeToSearchFor; + private int filesProcessed; + private bool searchAborted; + + private class ProcessFileResut + { + public int Hits; + public string FileName; + } + + private readonly ConcurrentBag processFileResuts = new ConcurrentBag(); + + private void btnStartSearch_Click(object sender, EventArgs e) + { + dataGridView1.RowCount = 0; + + try + { + btnStartSearch.Enabled = false; + + filesToProcess.Clear(); + opCodeToSearchFor = OpCode; + filesProcessed = 0; + searchAborted = false; + + ProcessFileResut result; + while (!processFileResuts.IsEmpty) + processFileResuts.TryTake(out result); + + filesToProcess.AddRange(Directory.GetFiles(txtSearchPathRoot.Text, "*.pcap", SearchOption.AllDirectories)); + filesToProcess.AddRange(Directory.GetFiles(txtSearchPathRoot.Text, "*.pcapng", SearchOption.AllDirectories)); + + toolStripStatusLabel1.Text = "Files Processed: 0 of " + filesToProcess.Count; + + txtSearchPathRoot.Enabled = false; + txtOpcode.Enabled = false; + btnChangeSearchPathRoot.Enabled = false; + btnStopSearch.Enabled = true; + + timer1.Start(); + + new Thread(() => + { + // Do the actual search here + DoSearch(); + + if (!Disposing && !IsDisposed) + btnStopSearch.BeginInvoke((Action)(() => btnStopSearch_Click(null, null))); + }).Start(); + } + catch (Exception ex) + { + MessageBox.Show(ex.ToString()); + + btnStopSearch_Click(null, null); + } + } + + private void btnStopSearch_Click(object sender, EventArgs e) + { + searchAborted = true; + + timer1.Stop(); + + timer1_Tick(null, null); + + txtSearchPathRoot.Enabled = true; + txtOpcode.Enabled = true; + btnChangeSearchPathRoot.Enabled = true; + btnStartSearch.Enabled = true; + btnStopSearch.Enabled = false; + } + + + private void DoSearch() + { + Parallel.ForEach(filesToProcess, (currentFile) => + { + if (searchAborted || Disposing || IsDisposed) + return; + + try + { + ProcessFile(currentFile); + } + catch { } + }); + } + + private void ProcessFile(string fileName) + { + int hits = 0; + + var records = PCapReader.LoadPcap(fileName, ref searchAborted); + + if (searchAborted || Disposing || IsDisposed) + return; + + foreach (var record in records) + { + if (record.opcodes.Contains((PacketOpcode)opCodeToSearchFor)) + hits++; + + /*foreach (BlobFrag frag in record.netPacket.fragList_) + { + if (frag.dat_.Length > 20) + { + BinaryReader fragDataReader = new BinaryReader(new MemoryStream(frag.dat_)); + + // Custom search can go here + } + }*/ + } + + Interlocked.Increment(ref filesProcessed); + + processFileResuts.Add(new ProcessFileResut() { Hits = hits, FileName = fileName }); + } + + private void timer1_Tick(object sender, EventArgs e) + { + ProcessFileResut result; + while (!processFileResuts.IsEmpty) + { + if (processFileResuts.TryTake(out result)) + { + var length = new FileInfo(result.FileName).Length; + + if (result.Hits > 0) + dataGridView1.Rows.Add(result.Hits, length, result.FileName); + } + } + + toolStripStatusLabel1.Text = "Files Processed: " + filesProcessed + " of " + filesToProcess.Count; + } + + + private void dataGridView1_CellContentDoubleClick(object sender, DataGridViewCellEventArgs e) + { + var fileName = (string)dataGridView1.Rows[e.RowIndex].Cells[2].Value; + + System.Diagnostics.Process.Start(Application.ExecutablePath, '"' + fileName + '"'); + } + } +} diff --git a/aclogview/FindOpcodeInFilesForm.resx b/aclogview/FindOpcodeInFilesForm.resx new file mode 100644 index 0000000..846ffc6 --- /dev/null +++ b/aclogview/FindOpcodeInFilesForm.resx @@ -0,0 +1,135 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + True + + + True + + + True + + + 17, 17 + + + 133, 17 + + \ No newline at end of file diff --git a/aclogview/Form1.Designer.cs b/aclogview/Form1.Designer.cs index 41363c3..229f2e1 100644 --- a/aclogview/Form1.Designer.cs +++ b/aclogview/Form1.Designer.cs @@ -23,313 +23,321 @@ protected override void Dispose(bool disposing) { /// the contents of this method with the code editor. /// private void InitializeComponent() { - this.components = new System.ComponentModel.Container(); - this.splitContainer_Main = new System.Windows.Forms.SplitContainer(); - this.listView_Packets = new System.Windows.Forms.ListView(); - this.columnHeader1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); - this.columnHeader5 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); - this.columnHeader2 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); - this.columnHeader7 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); - this.columnHeader3 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); - this.columnHeader4 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); - this.columnHeader6 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); - this.splitContainer_Bottom = new System.Windows.Forms.SplitContainer(); - this.textBox_PacketData = new System.Windows.Forms.RichTextBox(); - this.treeView_ParsedData = new System.Windows.Forms.TreeView(); - this.mainMenu = new System.Windows.Forms.MainMenu(this.components); - this.menuItem_File = new System.Windows.Forms.MenuItem(); - this.menuItem_Open = new System.Windows.Forms.MenuItem(); - this.menuItem_Edit = new System.Windows.Forms.MenuItem(); - this.menuItem1 = new System.Windows.Forms.MenuItem(); - this.menuItem_ToolCount = new System.Windows.Forms.MenuItem(); - this.menuItem_ToolBad = new System.Windows.Forms.MenuItem(); - this.menuItem_ToolHeatmap = new System.Windows.Forms.MenuItem(); - this.menuItem_Help = new System.Windows.Forms.MenuItem(); - this.menuItem_About = new System.Windows.Forms.MenuItem(); - this.menuStrip = new System.Windows.Forms.MenuStrip(); - this.textBox_Search = new System.Windows.Forms.TextBox(); - this.pictureBox_Search = new System.Windows.Forms.PictureBox(); - this.statusStrip = new System.Windows.Forms.StatusStrip(); - this.checkBox_HideHeaderOnly = new System.Windows.Forms.CheckBox(); - this.checkBox_useHighlighting = new System.Windows.Forms.CheckBox(); - ((System.ComponentModel.ISupportInitialize)(this.splitContainer_Main)).BeginInit(); - this.splitContainer_Main.Panel1.SuspendLayout(); - this.splitContainer_Main.Panel2.SuspendLayout(); - this.splitContainer_Main.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.splitContainer_Bottom)).BeginInit(); - this.splitContainer_Bottom.Panel1.SuspendLayout(); - this.splitContainer_Bottom.Panel2.SuspendLayout(); - this.splitContainer_Bottom.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.pictureBox_Search)).BeginInit(); - this.SuspendLayout(); - // - // splitContainer_Main - // - this.splitContainer_Main.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; - this.splitContainer_Main.Dock = System.Windows.Forms.DockStyle.Fill; - this.splitContainer_Main.Location = new System.Drawing.Point(0, 24); - this.splitContainer_Main.Name = "splitContainer_Main"; - this.splitContainer_Main.Orientation = System.Windows.Forms.Orientation.Horizontal; - // - // splitContainer_Main.Panel1 - // - this.splitContainer_Main.Panel1.Controls.Add(this.listView_Packets); - this.splitContainer_Main.Panel1.RightToLeft = System.Windows.Forms.RightToLeft.No; - // - // splitContainer_Main.Panel2 - // - this.splitContainer_Main.Panel2.Controls.Add(this.splitContainer_Bottom); - this.splitContainer_Main.Panel2.RightToLeft = System.Windows.Forms.RightToLeft.No; - this.splitContainer_Main.Size = new System.Drawing.Size(1520, 918); - this.splitContainer_Main.SplitterDistance = 423; - this.splitContainer_Main.TabIndex = 0; - // - // listView_Packets - // - this.listView_Packets.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { - this.columnHeader1, - this.columnHeader5, - this.columnHeader2, - this.columnHeader7, - this.columnHeader3, - this.columnHeader4, - this.columnHeader6}); - this.listView_Packets.Dock = System.Windows.Forms.DockStyle.Fill; - this.listView_Packets.FullRowSelect = true; - this.listView_Packets.Location = new System.Drawing.Point(0, 0); - this.listView_Packets.MultiSelect = false; - this.listView_Packets.Name = "listView_Packets"; - this.listView_Packets.Size = new System.Drawing.Size(1516, 419); - this.listView_Packets.TabIndex = 0; - this.listView_Packets.UseCompatibleStateImageBehavior = false; - this.listView_Packets.View = System.Windows.Forms.View.Details; - this.listView_Packets.VirtualMode = true; - this.listView_Packets.ColumnClick += new System.Windows.Forms.ColumnClickEventHandler(this.listView_Packets_ColumnClick); - this.listView_Packets.RetrieveVirtualItem += new System.Windows.Forms.RetrieveVirtualItemEventHandler(this.listView_Packets_RetrieveVirtualItem); - this.listView_Packets.SelectedIndexChanged += new System.EventHandler(this.listView_Packets_SelectedIndexChanged); - // - // columnHeader1 - // - this.columnHeader1.Text = "#"; - this.columnHeader1.Width = 50; - // - // columnHeader5 - // - this.columnHeader5.Text = "S/R"; - // - // columnHeader2 - // - this.columnHeader2.Text = "Time"; - this.columnHeader2.Width = 100; - // - // columnHeader7 - // - this.columnHeader7.Text = "Headers"; - this.columnHeader7.Width = 150; - // - // columnHeader3 - // - this.columnHeader3.Text = "Type"; - this.columnHeader3.Width = 200; - // - // columnHeader4 - // - this.columnHeader4.Text = "Size"; - this.columnHeader4.Width = 100; - // - // columnHeader6 - // - this.columnHeader6.Text = "Extra Info"; - this.columnHeader6.Width = 250; - // - // splitContainer_Bottom - // - this.splitContainer_Bottom.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; - this.splitContainer_Bottom.Dock = System.Windows.Forms.DockStyle.Fill; - this.splitContainer_Bottom.Location = new System.Drawing.Point(0, 0); - this.splitContainer_Bottom.Name = "splitContainer_Bottom"; - // - // splitContainer_Bottom.Panel1 - // - this.splitContainer_Bottom.Panel1.Controls.Add(this.textBox_PacketData); - // - // splitContainer_Bottom.Panel2 - // - this.splitContainer_Bottom.Panel2.Controls.Add(this.treeView_ParsedData); - this.splitContainer_Bottom.Size = new System.Drawing.Size(1520, 491); - this.splitContainer_Bottom.SplitterDistance = 1130; - this.splitContainer_Bottom.TabIndex = 0; - // - // textBox_PacketData - // - this.textBox_PacketData.Dock = System.Windows.Forms.DockStyle.Fill; - this.textBox_PacketData.Font = new System.Drawing.Font("Courier New", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.textBox_PacketData.Location = new System.Drawing.Point(0, 0); - this.textBox_PacketData.Name = "textBox_PacketData"; - this.textBox_PacketData.Size = new System.Drawing.Size(1126, 487); - this.textBox_PacketData.TabIndex = 0; - this.textBox_PacketData.Text = ""; - // - // treeView_ParsedData - // - this.treeView_ParsedData.Dock = System.Windows.Forms.DockStyle.Fill; - this.treeView_ParsedData.Location = new System.Drawing.Point(0, 0); - this.treeView_ParsedData.Name = "treeView_ParsedData"; - this.treeView_ParsedData.Size = new System.Drawing.Size(382, 487); - this.treeView_ParsedData.TabIndex = 0; - this.treeView_ParsedData.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.treeView_ParsedData_AfterSelect); - // - // mainMenu - // - this.mainMenu.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { - this.menuItem_File, - this.menuItem_Edit, - this.menuItem1, - this.menuItem_Help}); - // - // menuItem_File - // - this.menuItem_File.Index = 0; - this.menuItem_File.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { - this.menuItem_Open}); - this.menuItem_File.Text = "File"; - // - // menuItem_Open - // - this.menuItem_Open.Index = 0; - this.menuItem_Open.Text = "Open"; - this.menuItem_Open.Click += new System.EventHandler(this.menuItem5_Click); - // - // menuItem_Edit - // - this.menuItem_Edit.Index = 1; - this.menuItem_Edit.Text = "Edit"; - // - // menuItem1 - // - this.menuItem1.Index = 2; - this.menuItem1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { - this.menuItem_ToolCount, - this.menuItem_ToolBad, - this.menuItem_ToolHeatmap}); - this.menuItem1.Text = "Tools"; - // - // menuItem_ToolCount - // - this.menuItem_ToolCount.Index = 0; - this.menuItem_ToolCount.Text = "Count Packet Types"; - this.menuItem_ToolCount.Click += new System.EventHandler(this.menuItem_ToolCount_Click); - // - // menuItem_ToolBad - // - this.menuItem_ToolBad.Index = 1; - this.menuItem_ToolBad.Text = "Find Bad Parsers"; - this.menuItem_ToolBad.Click += new System.EventHandler(this.menuItem_ToolBad_Click); - // - // menuItem_ToolHeatmap - // - this.menuItem_ToolHeatmap.Index = 2; - this.menuItem_ToolHeatmap.Text = "Heatmap"; - this.menuItem_ToolHeatmap.Click += new System.EventHandler(this.menuItem_ToolHeatmap_Click); - // - // menuItem_Help - // - this.menuItem_Help.Index = 3; - this.menuItem_Help.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { - this.menuItem_About}); - this.menuItem_Help.Text = "Help"; - // - // menuItem_About - // - this.menuItem_About.Index = 0; - this.menuItem_About.Text = "About"; - this.menuItem_About.Click += new System.EventHandler(this.menuItem_About_Click); - // - // menuStrip - // - this.menuStrip.Location = new System.Drawing.Point(0, 0); - this.menuStrip.Name = "menuStrip"; - this.menuStrip.Size = new System.Drawing.Size(1520, 24); - this.menuStrip.TabIndex = 1; - this.menuStrip.Text = "menuStrip1"; - // - // textBox_Search - // - this.textBox_Search.Location = new System.Drawing.Point(566, 0); - this.textBox_Search.Name = "textBox_Search"; - this.textBox_Search.Size = new System.Drawing.Size(165, 20); - this.textBox_Search.TabIndex = 2; - this.textBox_Search.Visible = false; - // - // pictureBox_Search - // - this.pictureBox_Search.Location = new System.Drawing.Point(539, 0); - this.pictureBox_Search.Name = "pictureBox_Search"; - this.pictureBox_Search.Size = new System.Drawing.Size(20, 20); - this.pictureBox_Search.TabIndex = 3; - this.pictureBox_Search.TabStop = false; - this.pictureBox_Search.Visible = false; - // - // statusStrip - // - this.statusStrip.Location = new System.Drawing.Point(0, 942); - this.statusStrip.Name = "statusStrip"; - this.statusStrip.Size = new System.Drawing.Size(1520, 22); - this.statusStrip.TabIndex = 1; - this.statusStrip.Text = "statusStrip1"; - // - // checkBox_HideHeaderOnly - // - this.checkBox_HideHeaderOnly.Location = new System.Drawing.Point(805, 3); - this.checkBox_HideHeaderOnly.Name = "checkBox_HideHeaderOnly"; - this.checkBox_HideHeaderOnly.Size = new System.Drawing.Size(138, 17); - this.checkBox_HideHeaderOnly.TabIndex = 0; - this.checkBox_HideHeaderOnly.Text = "Hide Header Only"; - this.checkBox_HideHeaderOnly.UseVisualStyleBackColor = true; - this.checkBox_HideHeaderOnly.Visible = false; - this.checkBox_HideHeaderOnly.CheckedChanged += new System.EventHandler(this.checkBox_HideHeaderOnly_CheckedChanged); - // - // checkBox_useHighlighting - // - this.checkBox_useHighlighting.Checked = true; - this.checkBox_useHighlighting.CheckState = System.Windows.Forms.CheckState.Checked; - this.checkBox_useHighlighting.Location = new System.Drawing.Point(949, 2); - this.checkBox_useHighlighting.Name = "checkBox_useHighlighting"; - this.checkBox_useHighlighting.Size = new System.Drawing.Size(156, 17); - this.checkBox_useHighlighting.TabIndex = 4; - this.checkBox_useHighlighting.Text = "Use Highlighting (Slower!)"; - this.checkBox_useHighlighting.UseVisualStyleBackColor = true; - this.checkBox_useHighlighting.CheckedChanged += new System.EventHandler(this.checkBox_useHighlighting_CheckedChanged); - // - // Form1 - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(1520, 964); - this.Controls.Add(this.checkBox_useHighlighting); - this.Controls.Add(this.checkBox_HideHeaderOnly); - this.Controls.Add(this.splitContainer_Main); - this.Controls.Add(this.textBox_Search); - this.Controls.Add(this.pictureBox_Search); - this.Controls.Add(this.menuStrip); - this.Controls.Add(this.statusStrip); - this.DoubleBuffered = true; - this.Menu = this.mainMenu; - this.Name = "Form1"; - this.Text = "AC Log View"; - this.Load += new System.EventHandler(this.Form1_Load); - this.splitContainer_Main.Panel1.ResumeLayout(false); - this.splitContainer_Main.Panel2.ResumeLayout(false); - ((System.ComponentModel.ISupportInitialize)(this.splitContainer_Main)).EndInit(); - this.splitContainer_Main.ResumeLayout(false); - this.splitContainer_Bottom.Panel1.ResumeLayout(false); - this.splitContainer_Bottom.Panel2.ResumeLayout(false); - ((System.ComponentModel.ISupportInitialize)(this.splitContainer_Bottom)).EndInit(); - this.splitContainer_Bottom.ResumeLayout(false); - ((System.ComponentModel.ISupportInitialize)(this.pictureBox_Search)).EndInit(); - this.ResumeLayout(false); - this.PerformLayout(); - + this.components = new System.ComponentModel.Container(); + this.splitContainer_Main = new System.Windows.Forms.SplitContainer(); + this.listView_Packets = new System.Windows.Forms.ListView(); + this.columnHeader1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.columnHeader5 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.columnHeader2 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.columnHeader7 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.columnHeader3 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.columnHeader4 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.columnHeader6 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.splitContainer_Bottom = new System.Windows.Forms.SplitContainer(); + this.textBox_PacketData = new System.Windows.Forms.RichTextBox(); + this.treeView_ParsedData = new System.Windows.Forms.TreeView(); + this.mainMenu = new System.Windows.Forms.MainMenu(this.components); + this.menuItem_File = new System.Windows.Forms.MenuItem(); + this.menuItem_Open = new System.Windows.Forms.MenuItem(); + this.menuItem_Edit = new System.Windows.Forms.MenuItem(); + this.menuItem1 = new System.Windows.Forms.MenuItem(); + this.menuItem_ToolCount = new System.Windows.Forms.MenuItem(); + this.menuItem_ToolBad = new System.Windows.Forms.MenuItem(); + this.menuItem_ToolHeatmap = new System.Windows.Forms.MenuItem(); + this.mnuItem_ToolFindOpcodeInFiles = new System.Windows.Forms.MenuItem(); + this.menuItem_Help = new System.Windows.Forms.MenuItem(); + this.menuItem_About = new System.Windows.Forms.MenuItem(); + this.menuStrip = new System.Windows.Forms.MenuStrip(); + this.textBox_Search = new System.Windows.Forms.TextBox(); + this.pictureBox_Search = new System.Windows.Forms.PictureBox(); + this.statusStrip = new System.Windows.Forms.StatusStrip(); + this.checkBox_HideHeaderOnly = new System.Windows.Forms.CheckBox(); + this.checkBox_useHighlighting = new System.Windows.Forms.CheckBox(); + ((System.ComponentModel.ISupportInitialize)(this.splitContainer_Main)).BeginInit(); + this.splitContainer_Main.Panel1.SuspendLayout(); + this.splitContainer_Main.Panel2.SuspendLayout(); + this.splitContainer_Main.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.splitContainer_Bottom)).BeginInit(); + this.splitContainer_Bottom.Panel1.SuspendLayout(); + this.splitContainer_Bottom.Panel2.SuspendLayout(); + this.splitContainer_Bottom.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox_Search)).BeginInit(); + this.SuspendLayout(); + // + // splitContainer_Main + // + this.splitContainer_Main.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; + this.splitContainer_Main.Dock = System.Windows.Forms.DockStyle.Fill; + this.splitContainer_Main.Location = new System.Drawing.Point(0, 24); + this.splitContainer_Main.Name = "splitContainer_Main"; + this.splitContainer_Main.Orientation = System.Windows.Forms.Orientation.Horizontal; + // + // splitContainer_Main.Panel1 + // + this.splitContainer_Main.Panel1.Controls.Add(this.listView_Packets); + this.splitContainer_Main.Panel1.RightToLeft = System.Windows.Forms.RightToLeft.No; + // + // splitContainer_Main.Panel2 + // + this.splitContainer_Main.Panel2.Controls.Add(this.splitContainer_Bottom); + this.splitContainer_Main.Panel2.RightToLeft = System.Windows.Forms.RightToLeft.No; + this.splitContainer_Main.Size = new System.Drawing.Size(1520, 918); + this.splitContainer_Main.SplitterDistance = 423; + this.splitContainer_Main.TabIndex = 0; + // + // listView_Packets + // + this.listView_Packets.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { + this.columnHeader1, + this.columnHeader5, + this.columnHeader2, + this.columnHeader7, + this.columnHeader3, + this.columnHeader4, + this.columnHeader6}); + this.listView_Packets.Dock = System.Windows.Forms.DockStyle.Fill; + this.listView_Packets.FullRowSelect = true; + this.listView_Packets.Location = new System.Drawing.Point(0, 0); + this.listView_Packets.MultiSelect = false; + this.listView_Packets.Name = "listView_Packets"; + this.listView_Packets.Size = new System.Drawing.Size(1516, 419); + this.listView_Packets.TabIndex = 0; + this.listView_Packets.UseCompatibleStateImageBehavior = false; + this.listView_Packets.View = System.Windows.Forms.View.Details; + this.listView_Packets.VirtualMode = true; + this.listView_Packets.ColumnClick += new System.Windows.Forms.ColumnClickEventHandler(this.listView_Packets_ColumnClick); + this.listView_Packets.RetrieveVirtualItem += new System.Windows.Forms.RetrieveVirtualItemEventHandler(this.listView_Packets_RetrieveVirtualItem); + this.listView_Packets.SelectedIndexChanged += new System.EventHandler(this.listView_Packets_SelectedIndexChanged); + // + // columnHeader1 + // + this.columnHeader1.Text = "#"; + this.columnHeader1.Width = 50; + // + // columnHeader5 + // + this.columnHeader5.Text = "S/R"; + // + // columnHeader2 + // + this.columnHeader2.Text = "Time"; + this.columnHeader2.Width = 100; + // + // columnHeader7 + // + this.columnHeader7.Text = "Headers"; + this.columnHeader7.Width = 150; + // + // columnHeader3 + // + this.columnHeader3.Text = "Type"; + this.columnHeader3.Width = 200; + // + // columnHeader4 + // + this.columnHeader4.Text = "Size"; + this.columnHeader4.Width = 100; + // + // columnHeader6 + // + this.columnHeader6.Text = "Extra Info"; + this.columnHeader6.Width = 250; + // + // splitContainer_Bottom + // + this.splitContainer_Bottom.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; + this.splitContainer_Bottom.Dock = System.Windows.Forms.DockStyle.Fill; + this.splitContainer_Bottom.Location = new System.Drawing.Point(0, 0); + this.splitContainer_Bottom.Name = "splitContainer_Bottom"; + // + // splitContainer_Bottom.Panel1 + // + this.splitContainer_Bottom.Panel1.Controls.Add(this.textBox_PacketData); + // + // splitContainer_Bottom.Panel2 + // + this.splitContainer_Bottom.Panel2.Controls.Add(this.treeView_ParsedData); + this.splitContainer_Bottom.Size = new System.Drawing.Size(1520, 491); + this.splitContainer_Bottom.SplitterDistance = 1130; + this.splitContainer_Bottom.TabIndex = 0; + // + // textBox_PacketData + // + this.textBox_PacketData.Dock = System.Windows.Forms.DockStyle.Fill; + this.textBox_PacketData.Font = new System.Drawing.Font("Courier New", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.textBox_PacketData.Location = new System.Drawing.Point(0, 0); + this.textBox_PacketData.Name = "textBox_PacketData"; + this.textBox_PacketData.Size = new System.Drawing.Size(1126, 487); + this.textBox_PacketData.TabIndex = 0; + this.textBox_PacketData.Text = ""; + // + // treeView_ParsedData + // + this.treeView_ParsedData.Dock = System.Windows.Forms.DockStyle.Fill; + this.treeView_ParsedData.Location = new System.Drawing.Point(0, 0); + this.treeView_ParsedData.Name = "treeView_ParsedData"; + this.treeView_ParsedData.Size = new System.Drawing.Size(382, 487); + this.treeView_ParsedData.TabIndex = 0; + this.treeView_ParsedData.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.treeView_ParsedData_AfterSelect); + // + // mainMenu + // + this.mainMenu.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { + this.menuItem_File, + this.menuItem_Edit, + this.menuItem1, + this.menuItem_Help}); + // + // menuItem_File + // + this.menuItem_File.Index = 0; + this.menuItem_File.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { + this.menuItem_Open}); + this.menuItem_File.Text = "File"; + // + // menuItem_Open + // + this.menuItem_Open.Index = 0; + this.menuItem_Open.Text = "Open"; + this.menuItem_Open.Click += new System.EventHandler(this.menuItem5_Click); + // + // menuItem_Edit + // + this.menuItem_Edit.Index = 1; + this.menuItem_Edit.Text = "Edit"; + // + // menuItem1 + // + this.menuItem1.Index = 2; + this.menuItem1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { + this.menuItem_ToolCount, + this.menuItem_ToolBad, + this.menuItem_ToolHeatmap, + this.mnuItem_ToolFindOpcodeInFiles}); + this.menuItem1.Text = "Tools"; + // + // menuItem_ToolCount + // + this.menuItem_ToolCount.Index = 0; + this.menuItem_ToolCount.Text = "Count Packet Types"; + this.menuItem_ToolCount.Click += new System.EventHandler(this.menuItem_ToolCount_Click); + // + // menuItem_ToolBad + // + this.menuItem_ToolBad.Index = 1; + this.menuItem_ToolBad.Text = "Find Bad Parsers"; + this.menuItem_ToolBad.Click += new System.EventHandler(this.menuItem_ToolBad_Click); + // + // menuItem_ToolHeatmap + // + this.menuItem_ToolHeatmap.Index = 2; + this.menuItem_ToolHeatmap.Text = "Heatmap"; + this.menuItem_ToolHeatmap.Click += new System.EventHandler(this.menuItem_ToolHeatmap_Click); + // + // mnuItem_ToolFindOpcodeInFiles + // + this.mnuItem_ToolFindOpcodeInFiles.Index = 3; + this.mnuItem_ToolFindOpcodeInFiles.Text = "Find Opcode In Files"; + this.mnuItem_ToolFindOpcodeInFiles.Click += new System.EventHandler(this.mnuItem_ToolFindOpcodeInFiles_Click); + // + // menuItem_Help + // + this.menuItem_Help.Index = 3; + this.menuItem_Help.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { + this.menuItem_About}); + this.menuItem_Help.Text = "Help"; + // + // menuItem_About + // + this.menuItem_About.Index = 0; + this.menuItem_About.Text = "About"; + this.menuItem_About.Click += new System.EventHandler(this.menuItem_About_Click); + // + // menuStrip + // + this.menuStrip.Location = new System.Drawing.Point(0, 0); + this.menuStrip.Name = "menuStrip"; + this.menuStrip.Size = new System.Drawing.Size(1520, 24); + this.menuStrip.TabIndex = 1; + this.menuStrip.Text = "menuStrip1"; + // + // textBox_Search + // + this.textBox_Search.Location = new System.Drawing.Point(566, 0); + this.textBox_Search.Name = "textBox_Search"; + this.textBox_Search.Size = new System.Drawing.Size(165, 20); + this.textBox_Search.TabIndex = 2; + this.textBox_Search.Visible = false; + // + // pictureBox_Search + // + this.pictureBox_Search.Location = new System.Drawing.Point(539, 0); + this.pictureBox_Search.Name = "pictureBox_Search"; + this.pictureBox_Search.Size = new System.Drawing.Size(20, 20); + this.pictureBox_Search.TabIndex = 3; + this.pictureBox_Search.TabStop = false; + this.pictureBox_Search.Visible = false; + // + // statusStrip + // + this.statusStrip.Location = new System.Drawing.Point(0, 942); + this.statusStrip.Name = "statusStrip"; + this.statusStrip.Size = new System.Drawing.Size(1520, 22); + this.statusStrip.TabIndex = 1; + this.statusStrip.Text = "statusStrip1"; + // + // checkBox_HideHeaderOnly + // + this.checkBox_HideHeaderOnly.Location = new System.Drawing.Point(805, 3); + this.checkBox_HideHeaderOnly.Name = "checkBox_HideHeaderOnly"; + this.checkBox_HideHeaderOnly.Size = new System.Drawing.Size(138, 17); + this.checkBox_HideHeaderOnly.TabIndex = 0; + this.checkBox_HideHeaderOnly.Text = "Hide Header Only"; + this.checkBox_HideHeaderOnly.UseVisualStyleBackColor = true; + this.checkBox_HideHeaderOnly.Visible = false; + this.checkBox_HideHeaderOnly.CheckedChanged += new System.EventHandler(this.checkBox_HideHeaderOnly_CheckedChanged); + // + // checkBox_useHighlighting + // + this.checkBox_useHighlighting.Checked = true; + this.checkBox_useHighlighting.CheckState = System.Windows.Forms.CheckState.Checked; + this.checkBox_useHighlighting.Location = new System.Drawing.Point(949, 2); + this.checkBox_useHighlighting.Name = "checkBox_useHighlighting"; + this.checkBox_useHighlighting.Size = new System.Drawing.Size(156, 17); + this.checkBox_useHighlighting.TabIndex = 4; + this.checkBox_useHighlighting.Text = "Use Highlighting (Slower!)"; + this.checkBox_useHighlighting.UseVisualStyleBackColor = true; + this.checkBox_useHighlighting.CheckedChanged += new System.EventHandler(this.checkBox_useHighlighting_CheckedChanged); + // + // Form1 + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(1520, 964); + this.Controls.Add(this.checkBox_useHighlighting); + this.Controls.Add(this.checkBox_HideHeaderOnly); + this.Controls.Add(this.splitContainer_Main); + this.Controls.Add(this.textBox_Search); + this.Controls.Add(this.pictureBox_Search); + this.Controls.Add(this.menuStrip); + this.Controls.Add(this.statusStrip); + this.DoubleBuffered = true; + this.Menu = this.mainMenu; + this.Name = "Form1"; + this.Text = "AC Log View"; + this.Load += new System.EventHandler(this.Form1_Load); + this.splitContainer_Main.Panel1.ResumeLayout(false); + this.splitContainer_Main.Panel2.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.splitContainer_Main)).EndInit(); + this.splitContainer_Main.ResumeLayout(false); + this.splitContainer_Bottom.Panel1.ResumeLayout(false); + this.splitContainer_Bottom.Panel2.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.splitContainer_Bottom)).EndInit(); + this.splitContainer_Bottom.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox_Search)).EndInit(); + this.ResumeLayout(false); + this.PerformLayout(); + } #endregion @@ -361,7 +369,8 @@ private void InitializeComponent() { private System.Windows.Forms.MenuItem menuItem1; private System.Windows.Forms.MenuItem menuItem_ToolCount; private System.Windows.Forms.MenuItem menuItem_ToolBad; - private System.Windows.Forms.MenuItem menuItem_ToolHeatmap; + private System.Windows.Forms.MenuItem menuItem_ToolHeatmap; + private System.Windows.Forms.MenuItem mnuItem_ToolFindOpcodeInFiles; } } diff --git a/aclogview/Form1.cs b/aclogview/Form1.cs index 28622a2..4eab7a1 100644 --- a/aclogview/Form1.cs +++ b/aclogview/Form1.cs @@ -11,14 +11,20 @@ using System.Threading.Tasks; using System.Windows.Forms; +using aclogview.Properties; + namespace aclogview { public partial class Form1 : Form { private ListViewItemComparer comparer = new ListViewItemComparer(); public List messageProcessors = new List(); private long curPacket; - public Form1() { + private string[] args; + + public Form1(string[] args) { InitializeComponent(); + + this.args = args; } private void Form1_Load(object sender, EventArgs e) { @@ -47,6 +53,16 @@ private void Form1_Load(object sender, EventArgs e) { messageProcessors.Add(new CM_Vendor()); messageProcessors.Add(new CM_Writing()); messageProcessors.Add(new Proto_UI()); + + if (args != null && args.Length == 1) + loadPcap(args[0]); + } + + protected override void OnClosing(CancelEventArgs e) + { + base.OnClosing(e); + + Settings.Default.Save(); } private void menuItem5_Click(object sender, EventArgs e) { @@ -61,19 +77,6 @@ private void menuItem5_Click(object sender, EventArgs e) { loadPcap(openFile.FileName); } - class PacketRecord { - public int index; - public bool isSend; - public uint tsSec; - public string packetHeadersStr; - public string packetTypeStr; - public byte[] data; - public int optionalHeadersLen; - public NetPacket netPacket; - public List opcodes = new List(); - public string extraInfo; - } - private void readPacket(PacketRecord packet, StringBuilder packetTypeStr, BinaryReader packetReader) { BlobFrag newFrag = new BlobFrag(); newFrag.memberHeader_ = BlobFragHeader_t.read(packetReader); @@ -924,6 +927,12 @@ private void menuItem_ToolHeatmap_Click(object sender, EventArgs e) { popup.ClientSize = new Size(512, 512); popup.setImage(heatmapImg); popup.ShowDialog(); - } + } + + private void mnuItem_ToolFindOpcodeInFiles_Click(object sender, EventArgs e) + { + var form = new FindOpcodeInFilesForm(); + form.Show(); + } } } diff --git a/aclogview/Form1.resx b/aclogview/Form1.resx index 72c8844..6df96c8 100644 --- a/aclogview/Form1.resx +++ b/aclogview/Form1.resx @@ -1,132 +1,132 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - 17, 17 - - - 134, 17 - - - 249, 17 - - - 56 - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 17, 17 + + + 134, 17 + + + 249, 17 + + + 56 + \ No newline at end of file diff --git a/aclogview/PCapReader.cs b/aclogview/PCapReader.cs new file mode 100644 index 0000000..7c7cd28 --- /dev/null +++ b/aclogview/PCapReader.cs @@ -0,0 +1,409 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Text; + +namespace aclogview +{ + static class PCapReader + { + public static List LoadPcap(string fileName, ref bool abort) + { + using (FileStream fileStream = new FileStream(fileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)) + { + using (BinaryReader binaryReader = new BinaryReader(fileStream)) + { + uint magicNumber = binaryReader.ReadUInt32(); + + binaryReader.BaseStream.Position = 0; + + if (magicNumber == 0xA1B2C3D4 || magicNumber == 0xD4C3B2A1) + return loadPcapContent(binaryReader, ref abort); + + return loadPcapngContent(binaryReader, ref abort); + } + } + } + + private static List loadPcapContent(BinaryReader binaryReader, ref bool abort) + { + List results = new List(); + + /*PcapHeader pcapHeader = */ + PcapHeader.read(binaryReader); + + int curPacket = 0; + + while (binaryReader.BaseStream.Position != binaryReader.BaseStream.Length) + { + if (abort) + break; + + curPacket++; + + if (binaryReader.BaseStream.Length - binaryReader.BaseStream.Position < 16) + { + //MessageBox.Show("Stream cut short (packet " + curPacket + "), stopping read: " + (binaryReader.BaseStream.Length - binaryReader.BaseStream.Position)); + break; + } + + PcapRecordHeader recordHeader = PcapRecordHeader.read(binaryReader); + + if (recordHeader.inclLen > 50000) + { + //MessageBox.Show("Enormous packet (packet " + curPacket + "), stopping read: " + recordHeader.inclLen); + break; + } + + // Make sure there's enough room for an ethernet header + if (recordHeader.inclLen < 14) + { + binaryReader.BaseStream.Position += recordHeader.inclLen; + continue; + } + + var packetRecord = readPacketRecordData(binaryReader, recordHeader.inclLen, recordHeader.tsSec, curPacket); + + if (packetRecord == null) + break; + + results.Add(packetRecord); + } + + return results; + } + + private static List loadPcapngContent(BinaryReader binaryReader, ref bool abort) + { + List results = new List(); + + int curPacket = 0; + + while (binaryReader.BaseStream.Position != binaryReader.BaseStream.Length) + { + if (abort) + break; + + curPacket++; + + if (binaryReader.BaseStream.Length - binaryReader.BaseStream.Position < 8) + { + //MessageBox.Show("Stream cut short (packet " + curPacket + "), stopping read: " + (binaryReader.BaseStream.Length - binaryReader.BaseStream.Position)); + break; + } + + long recordStartPos = binaryReader.BaseStream.Position; + + uint blockType = binaryReader.ReadUInt32(); + uint blockTotalLength = binaryReader.ReadUInt32(); + + if (blockType == 6) + { + /*uint interfaceID = */binaryReader.ReadUInt32(); + /*uint tsHigh = */binaryReader.ReadUInt32(); + uint tsLow = binaryReader.ReadUInt32(); + uint capturedLen = binaryReader.ReadUInt32(); + /*uint packetLen = */binaryReader.ReadUInt32(); + + var packetRecord = readPacketRecordData(binaryReader, capturedLen, tsLow, curPacket); + + if (packetRecord == null) + break; + + results.Add(packetRecord); + } + else if (blockType == 3) + { + /*uint packetLen = */binaryReader.ReadUInt32(); + uint capturedLen = blockTotalLength - 16; + + var packetRecord = readPacketRecordData(binaryReader, capturedLen, 0, curPacket); + + if (packetRecord == null) + break; + + results.Add(packetRecord); + } + + binaryReader.BaseStream.Position += blockTotalLength - (binaryReader.BaseStream.Position - recordStartPos); + } + + return results; + } + + private static PacketRecord readPacketRecordData(BinaryReader binaryReader, long len, uint tsSec, int curPacket) + { + // Begin reading headers + long packetStartPos = binaryReader.BaseStream.Position; + + EthernetHeader ethernetHeader = EthernetHeader.read(binaryReader); + + // Skip non-IP packets + if (ethernetHeader.proto != 8) + { + binaryReader.BaseStream.Position += len - (binaryReader.BaseStream.Position - packetStartPos); + return null; + } + + IpHeader ipHeader = IpHeader.read(binaryReader); + + // Skip non-UDP packets + if (ipHeader.proto != 17) + { + binaryReader.BaseStream.Position += len - (binaryReader.BaseStream.Position - packetStartPos); + return null; + } + + UdpHeader udpHeader = UdpHeader.read(binaryReader); + + bool isSend = (udpHeader.dPort >= 9000 && udpHeader.dPort <= 9013); + bool isRecv = (udpHeader.sPort >= 9000 && udpHeader.sPort <= 9013); + + // Skip non-AC-port packets + if (!isSend && !isRecv) + { + binaryReader.BaseStream.Position += len - (binaryReader.BaseStream.Position - packetStartPos); + return null; + } + + long headersSize = binaryReader.BaseStream.Position - packetStartPos; + + // Begin reading non-header packet content + StringBuilder packetHeadersStr = new StringBuilder(); + StringBuilder packetTypeStr = new StringBuilder(); + + PacketRecord packet = new PacketRecord(); + packet.index = (curPacket - 1); + packet.isSend = isSend; + packet.tsSec = tsSec; + packet.netPacket = new NetPacket(); + packet.data = binaryReader.ReadBytes((int)(len - headersSize)); + packet.extraInfo = ""; + BinaryReader packetReader = new BinaryReader(new MemoryStream(packet.data)); + try + { + ProtoHeader pHeader = ProtoHeader.read(packetReader); + + readOptionalHeaders(packet, pHeader.header_, packetHeadersStr, packetReader); + + if (packetReader.BaseStream.Position == packetReader.BaseStream.Length) + packetTypeStr.Append("
"); + + uint HAS_FRAGS_MASK = 0x4; // See SharedNet::SplitPacketData + + if ((pHeader.header_ & HAS_FRAGS_MASK) != 0) + { + bool first = true; + + while (packetReader.BaseStream.Position != packetReader.BaseStream.Length) + { + if (!first) + packetTypeStr.Append(" + "); + + readPacket(packet, packetTypeStr, packetReader); + first = false; + } + } + + if (packetReader.BaseStream.Position != packetReader.BaseStream.Length) + packet.extraInfo = "Didnt read entire packet! " + packet.extraInfo; + } + catch (OutOfMemoryException e) + { + //MessageBox.Show("Out of memory (packet " + curPacket + "), stopping read: " + e); + return null; + } + catch (Exception e) + { + packet.extraInfo += "EXCEPTION: " + e.Message + " " + e.StackTrace; + } + + packet.packetHeadersStr = packetHeadersStr.ToString(); + packet.packetTypeStr = packetTypeStr.ToString(); + + return packet; + } + + private static void readPacket(PacketRecord packet, StringBuilder packetTypeStr, BinaryReader packetReader) + { + BlobFrag newFrag = new BlobFrag(); + newFrag.memberHeader_ = BlobFragHeader_t.read(packetReader); + newFrag.dat_ = packetReader.ReadBytes(newFrag.memberHeader_.blobFragSize - 16); // 16 == size of frag header + + packet.netPacket.fragList_.Add(newFrag); + + BinaryReader fragDataReader = new BinaryReader(new MemoryStream(newFrag.dat_)); + + if (newFrag.memberHeader_.blobNum != 0) + { + packetTypeStr.Append("FragData["); + packetTypeStr.Append(newFrag.memberHeader_.blobNum); + packetTypeStr.Append("]"); + } + else + { + PacketOpcode opcode = Util.readOpcode(fragDataReader); + packet.opcodes.Add(opcode); + packetTypeStr.Append(opcode); + } + } + + private static void readOptionalHeaders(PacketRecord packet, uint header_, StringBuilder packetHeadersStr, BinaryReader packetReader) + { + long readStartPos = packetReader.BaseStream.Position; + + if ((header_ & CServerSwitchStructHeader.mask) != 0) + { + /*CServerSwitchStruct serverSwitchStruct = */CServerSwitchStruct.read(packetReader); + if (packetHeadersStr.Length != 0) + packetHeadersStr.Append(" | "); + packetHeadersStr.Append("Server Switch"); + } + + if ((header_ & LogonServerAddrHeader.mask) != 0) + { + /*sockaddr_in serverAddr = */sockaddr_in.read(packetReader); + if (packetHeadersStr.Length != 0) + packetHeadersStr.Append(" | "); + packetHeadersStr.Append("Logon Server Addr"); + } + + if ((header_ & CEmptyHeader1.mask) != 0) + { + if (packetHeadersStr.Length != 0) + packetHeadersStr.Append(" | "); + packetHeadersStr.Append("Empty Header 1"); + } + + if ((header_ & CReferralStructHeader.mask) != 0) + { + /*CReferralStruct referralStruct = */CReferralStruct.read(packetReader); + if (packetHeadersStr.Length != 0) + packetHeadersStr.Append(" | "); + packetHeadersStr.Append("Referral"); + } + + if ((header_ & NakHeader.mask) != 0) + { + /*CSeqIDListHeader nakSeqIDs = */NakHeader.read(packetReader); + if (packetHeadersStr.Length != 0) + packetHeadersStr.Append(" | "); + packetHeadersStr.Append("Nak"); + } + + if ((header_ & EmptyAckHeader.mask) != 0) + { + /*CSeqIDListHeader ackSeqIDs = */EmptyAckHeader.read(packetReader); + if (packetHeadersStr.Length != 0) + packetHeadersStr.Append(" | "); + packetHeadersStr.Append("Empty Ack"); + } + + if ((header_ & PakHeader.mask) != 0) + { + /*PakHeader pakHeader = */PakHeader.read(packetReader); + if (packetHeadersStr.Length != 0) + packetHeadersStr.Append(" | "); + packetHeadersStr.Append("Pak"); + } + + if ((header_ & CEmptyHeader2.mask) != 0) + { + if (packetHeadersStr.Length != 0) + packetHeadersStr.Append(" | "); + packetHeadersStr.Append("Empty Header 2"); + } + + if ((header_ & CLogonHeader.mask) != 0) + { + CLogonHeader.HandshakeWireData handshakeData = CLogonHeader.HandshakeWireData.read(packetReader); + /*byte[] authData = */packetReader.ReadBytes((int)handshakeData.cbAuthData); + if (packetHeadersStr.Length != 0) + packetHeadersStr.Append(" | "); + packetHeadersStr.Append("Logon"); + } + + if ((header_ & ULongHeader.mask) != 0) + { + /*ULongHeader ulongHeader = */ULongHeader.read(packetReader); + if (packetHeadersStr.Length != 0) + packetHeadersStr.Append(" | "); + packetHeadersStr.Append("ULong 1"); + } + + if ((header_ & CConnectHeader.mask) != 0) + { + /*CConnectHeader.HandshakeWireData handshakeData = */CConnectHeader.HandshakeWireData.read(packetReader); + if (packetHeadersStr.Length != 0) + packetHeadersStr.Append(" | "); + packetHeadersStr.Append("Connect"); + } + + if ((header_ & ULongHeader2.mask) != 0) + { + /*ULongHeader2 ulongHeader = */ULongHeader2.read(packetReader); + if (packetHeadersStr.Length != 0) + packetHeadersStr.Append(" | "); + packetHeadersStr.Append("ULong 2"); + } + + if ((header_ & NetErrorHeader.mask) != 0) + { + /*NetError netError = */NetError.read(packetReader); + if (packetHeadersStr.Length != 0) + packetHeadersStr.Append(" | "); + packetHeadersStr.Append("Net Error"); + } + + if ((header_ & NetErrorHeader_cs_DisconnectReceived.mask) != 0) + { + /*NetError netError = */NetError.read(packetReader); + if (packetHeadersStr.Length != 0) + packetHeadersStr.Append(" | "); + packetHeadersStr.Append("Net Error Disconnect"); + } + + if ((header_ & CICMDCommandStructHeader.mask) != 0) + { + /*CICMDCommandStruct icmdStruct = */CICMDCommandStruct.read(packetReader); + if (packetHeadersStr.Length != 0) + packetHeadersStr.Append(" | "); + packetHeadersStr.Append("ICmd"); + } + + if ((header_ & CTimeSyncHeader.mask) != 0) + { + /*CTimeSyncHeader timeSyncHeader = */CTimeSyncHeader.read(packetReader); + if (packetHeadersStr.Length != 0) + packetHeadersStr.Append(" | "); + packetHeadersStr.Append("Time Sync"); + } + + if ((header_ & CEchoRequestHeader.mask) != 0) + { + /*CEchoRequestHeader echoRequestHeader = */CEchoRequestHeader.read(packetReader); + if (packetHeadersStr.Length != 0) + packetHeadersStr.Append(" | "); + packetHeadersStr.Append("Echo Request"); + } + + if ((header_ & CEchoResponseHeader.mask) != 0) + { + /*CEchoResponseHeader.CEchoResponseHeaderWireData echoResponseData = */CEchoResponseHeader.CEchoResponseHeaderWireData.read(packetReader); + if (packetHeadersStr.Length != 0) + packetHeadersStr.Append(" | "); + packetHeadersStr.Append("Echo Response"); + } + + if ((header_ & CFlowStructHeader.mask) != 0) + { + /*CFlowStruct flowStruct = */CFlowStruct.read(packetReader); + if (packetHeadersStr.Length != 0) + packetHeadersStr.Append(" | "); + packetHeadersStr.Append("Flow"); + } + + packet.optionalHeadersLen = (int)(packetReader.BaseStream.Position - readStartPos); + } + } +} diff --git a/aclogview/PacketRecord.cs b/aclogview/PacketRecord.cs new file mode 100644 index 0000000..4bf6b6c --- /dev/null +++ b/aclogview/PacketRecord.cs @@ -0,0 +1,18 @@ +using System.Collections.Generic; + +namespace aclogview +{ + class PacketRecord + { + public int index; + public bool isSend; + public uint tsSec; + public string packetHeadersStr; + public string packetTypeStr; + public byte[] data; + public int optionalHeadersLen; + public NetPacket netPacket; + public List opcodes = new List(); + public string extraInfo; + } +} diff --git a/aclogview/Program.cs b/aclogview/Program.cs index f6e8268..bf889f0 100644 --- a/aclogview/Program.cs +++ b/aclogview/Program.cs @@ -10,10 +10,10 @@ static class Program { /// The main entry point for the application. /// [STAThread] - static void Main() { + static void Main(string[] args) { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); - Application.Run(new Form1()); + Application.Run(new Form1(args)); } } } diff --git a/aclogview/Properties/Settings.Designer.cs b/aclogview/Properties/Settings.Designer.cs index 7fbd5ef..dc3b113 100644 --- a/aclogview/Properties/Settings.Designer.cs +++ b/aclogview/Properties/Settings.Designer.cs @@ -1,26 +1,50 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.42000 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace aclogview.Properties { - - - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] - internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { - - private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); - - public static Settings Default { - get { - return defaultInstance; - } - } - } -} +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace aclogview.Properties { + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default { + get { + return defaultInstance; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("")] + public string FindOpcodeInFilesRoot { + get { + return ((string)(this["FindOpcodeInFilesRoot"])); + } + set { + this["FindOpcodeInFilesRoot"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("0")] + public int FindOpcodeInFilesOpcode { + get { + return ((int)(this["FindOpcodeInFilesOpcode"])); + } + set { + this["FindOpcodeInFilesOpcode"] = value; + } + } + } +} diff --git a/aclogview/Properties/Settings.settings b/aclogview/Properties/Settings.settings index 3964565..b6fe278 100644 --- a/aclogview/Properties/Settings.settings +++ b/aclogview/Properties/Settings.settings @@ -1,7 +1,12 @@ - - - - - - - + + + + + + + + + 0 + + + \ No newline at end of file diff --git a/aclogview/aclogview.csproj b/aclogview/aclogview.csproj index 5f7ae7a..776dc0f 100644 --- a/aclogview/aclogview.csproj +++ b/aclogview/aclogview.csproj @@ -1,168 +1,181 @@ - - - - - Debug - AnyCPU - {E0F3D649-BD24-4A37-8BD5-4F421263E0F2} - WinExe - Properties - aclogview - aclogview - v4.5.2 - 512 - true - - - x64 - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - x64 - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Form - - - Form1.cs - - - Form - - - ImagePopup.cs - - - - - - - - - - - - Form - - - TextPopup.cs - - - Form1.cs - - - ImagePopup.cs - - - ResXFileCodeGenerator - Resources.Designer.cs - Designer - - - True - Resources.resx - - - TextPopup.cs - - - SettingsSingleFileGenerator - Settings.Designer.cs - - - True - Settings.settings - True - - - - - - - - - + + + + + Debug + AnyCPU + {E0F3D649-BD24-4A37-8BD5-4F421263E0F2} + WinExe + Properties + aclogview + aclogview + v4.5.2 + 512 + true + + + x64 + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + x64 + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Form + + + FindOpcodeInFilesForm.cs + + + Form + + + Form1.cs + + + Form + + + ImagePopup.cs + + + + + + + + + + + + + + Form + + + TextPopup.cs + + + FindOpcodeInFilesForm.cs + + + Form1.cs + + + ImagePopup.cs + + + ResXFileCodeGenerator + Resources.Designer.cs + Designer + + + True + Resources.resx + + + TextPopup.cs + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + True + Settings.settings + True + + + + + Designer + + + + + + + --> \ No newline at end of file From 6b32081fa0d8618af6ee081477de64a6d212755f Mon Sep 17 00:00:00 2001 From: Mag-nus Date: Sun, 19 Feb 2017 07:54:16 -0600 Subject: [PATCH 2/2] Added row highlighting by opcode Added a bunch of opcode decode info into CM_Communication.cs --- aclogview/CM_Communication.cs | 233 +++++++++++++++++++- aclogview/FindOpcodeInFilesForm.Designer.cs | 64 +++--- aclogview/FindOpcodeInFilesForm.cs | 10 +- aclogview/Form1.cs | 42 +++- 4 files changed, 311 insertions(+), 38 deletions(-) diff --git a/aclogview/CM_Communication.cs b/aclogview/CM_Communication.cs index bcaf1be..f8d9a03 100644 --- a/aclogview/CM_Communication.cs +++ b/aclogview/CM_Communication.cs @@ -13,15 +13,59 @@ public override bool acceptMessageData(BinaryReader messageDataReader, TreeView PacketOpcode opcode = Util.readOpcode(messageDataReader); switch (opcode) { - case PacketOpcode.Evt_Communication__WeenieError_ID: { + case PacketOpcode.Evt_Communication__TalkDirectByName_ID: // 0x005D + { + var message = TalkDirectByName.read(messageDataReader); + message.contributeToTreeView(outputTreeView); + break; + } + case PacketOpcode.Evt_Communication__ChannelBroadcast_ID: // 0x0147 + { + var message = ChannelBroadcast.read(messageDataReader); + message.contributeToTreeView(outputTreeView); + break; + } + /*case PacketOpcode.Evt_Communication__SetSquelchDB_ID: // 0x01F4 + { + var message = SetSquelchDB.read(messageDataReader); + message.contributeToTreeView(outputTreeView); + break; + }*/ + case PacketOpcode.Evt_Communication__WeenieError_ID: // 0x028A + { WeenieError message = WeenieError.read(messageDataReader); message.contributeToTreeView(outputTreeView); break; - } - case PacketOpcode.Evt_Communication__WeenieErrorWithString_ID: { + } + case PacketOpcode.Evt_Communication__WeenieErrorWithString_ID: // 0x028B + { WeenieErrorWithString message = WeenieErrorWithString.read(messageDataReader); message.contributeToTreeView(outputTreeView); break; + } + case PacketOpcode.Evt_Communication__HearSpeech_ID: // 0x02BB + { + var message = HearSpeech.read(messageDataReader); + message.contributeToTreeView(outputTreeView); + break; + } + case PacketOpcode.Evt_Communication__HearRangedSpeech_ID: // 0x02BC + { + var message = HearRangedSpeech.read(messageDataReader); + message.contributeToTreeView(outputTreeView); + break; + } + case PacketOpcode.Evt_Communication__HearDirectSpeech_ID: // 0x2BD + { + var message = HearDirectSpeech.read(messageDataReader); + message.contributeToTreeView(outputTreeView); + break; + } + case PacketOpcode.Evt_Communication__TextboxString_ID: // 0xF7E0 + { + var message = TextBoxString.read(messageDataReader); + message.contributeToTreeView(outputTreeView); + break; } default: { handled = false; @@ -32,6 +76,70 @@ public override bool acceptMessageData(BinaryReader messageDataReader, TreeView return handled; } + public class TalkDirectByName : Message + { + public PStringChar MessageText; + public PStringChar TargetName; + + public static TalkDirectByName read(BinaryReader binaryReader) + { + var newObj = new TalkDirectByName(); + newObj.MessageText = PStringChar.read(binaryReader); + newObj.TargetName = PStringChar.read(binaryReader); + return newObj; + } + + public override void contributeToTreeView(TreeView treeView) + { + TreeNode rootNode = new TreeNode(this.GetType().Name); + rootNode.Expand(); + rootNode.Nodes.Add("MessageText = " + MessageText.m_buffer); + rootNode.Nodes.Add("TargetName = " + TargetName.m_buffer); + treeView.Nodes.Add(rootNode); + } + } + + public class ChannelBroadcast : Message + { + public uint GroupChatType; + public uint Unknown; + public PStringChar MessageText; + + public static ChannelBroadcast read(BinaryReader binaryReader) + { + var newObj = new ChannelBroadcast(); + newObj.GroupChatType = binaryReader.ReadUInt32(); + newObj.Unknown = binaryReader.ReadUInt32(); + newObj.MessageText = PStringChar.read(binaryReader); + return newObj; + } + + public override void contributeToTreeView(TreeView treeView) + { + TreeNode rootNode = new TreeNode(this.GetType().Name); + rootNode.Expand(); + rootNode.Nodes.Add("GroupChatType = " + GroupChatType); + rootNode.Nodes.Add("Unknown = " + Unknown); + rootNode.Nodes.Add("MessageText = " + MessageText.m_buffer); + treeView.Nodes.Add(rootNode); + } + } + + /*public class SetSquelchDB : Message + { + public static SetSquelchDB read(BinaryReader binaryReader) + { + var newObj = new SetSquelchDB(); + + return newObj; + } + + public override void contributeToTreeView(TreeView treeView) + { + throw new NotImplementedException(); + } + }*/ + public class WeenieError : Message { public WERROR etype; @@ -68,4 +176,123 @@ public override void contributeToTreeView(TreeView treeView) { treeView.Nodes.Add(rootNode); } } + + public class HearSpeech : Message + { + public PStringChar MessageText; + public PStringChar SenderName; + public uint SenderID; + public uint ChatMessageType; + + public static HearSpeech read(BinaryReader binaryReader) + { + var newObj = new HearSpeech(); + newObj.MessageText = PStringChar.read(binaryReader); + newObj.SenderName = PStringChar.read(binaryReader); + newObj.SenderID = binaryReader.ReadUInt32(); + newObj.ChatMessageType = binaryReader.ReadUInt32(); + return newObj; + } + + public override void contributeToTreeView(TreeView treeView) + { + TreeNode rootNode = new TreeNode(this.GetType().Name); + rootNode.Expand(); + rootNode.Nodes.Add("MessageText = " + MessageText.m_buffer); + rootNode.Nodes.Add("SenderName = " + SenderName.m_buffer); + rootNode.Nodes.Add("SenderID = " + SenderID); + rootNode.Nodes.Add("ChatMessageType = " + ChatMessageType); + treeView.Nodes.Add(rootNode); + } + } + + public class HearRangedSpeech : Message + { + public PStringChar MessageText; + public PStringChar SenderName; + public uint SenderID; + public float Range; + public uint ChatMessageType; + + public static HearRangedSpeech read(BinaryReader binaryReader) + { + var newObj = new HearRangedSpeech(); + newObj.MessageText = PStringChar.read(binaryReader); + newObj.SenderName = PStringChar.read(binaryReader); + newObj.SenderID = binaryReader.ReadUInt32(); + newObj.Range = binaryReader.ReadSingle(); + newObj.ChatMessageType = binaryReader.ReadUInt32(); + return newObj; + } + + public override void contributeToTreeView(TreeView treeView) + { + TreeNode rootNode = new TreeNode(this.GetType().Name); + rootNode.Expand(); + rootNode.Nodes.Add("MessageText = " + MessageText.m_buffer); + rootNode.Nodes.Add("SenderName = " + SenderName.m_buffer); + rootNode.Nodes.Add("SenderID = " + SenderID); + rootNode.Nodes.Add("Range = " + Range); + rootNode.Nodes.Add("ChatMessageType = " + ChatMessageType); + treeView.Nodes.Add(rootNode); + } + } + + public class HearDirectSpeech : Message + { + public PStringChar MessageText; + public PStringChar SenderName; + public uint SenderID; + public uint TargetID; + public uint ChatMessageType; + public uint Unknown; + + public static HearDirectSpeech read(BinaryReader binaryReader) + { + var newObj = new HearDirectSpeech(); + newObj.MessageText = PStringChar.read(binaryReader); + newObj.SenderName = PStringChar.read(binaryReader); + newObj.SenderID = binaryReader.ReadUInt32(); + newObj.TargetID = binaryReader.ReadUInt32(); + newObj.ChatMessageType = binaryReader.ReadUInt32(); + newObj.Unknown = binaryReader.ReadUInt32(); + return newObj; + } + + public override void contributeToTreeView(TreeView treeView) + { + TreeNode rootNode = new TreeNode(this.GetType().Name); + rootNode.Expand(); + rootNode.Nodes.Add("MessageText = " + MessageText.m_buffer); + rootNode.Nodes.Add("SenderName = " + SenderName.m_buffer); + rootNode.Nodes.Add("SenderID = " + SenderID); + rootNode.Nodes.Add("TargetID = " + TargetID); + rootNode.Nodes.Add("ChatMessageType = " + ChatMessageType); + rootNode.Nodes.Add("Unknown = " + Unknown); + treeView.Nodes.Add(rootNode); + } + } + + public class TextBoxString : Message + { + public PStringChar MessageText; + public uint ChatMessageType; + + public static TextBoxString read(BinaryReader binaryReader) + { + var newObj = new TextBoxString(); + newObj.MessageText = PStringChar.read(binaryReader); + newObj.ChatMessageType = binaryReader.ReadUInt32(); + return newObj; + } + + public override void contributeToTreeView(TreeView treeView) + { + TreeNode rootNode = new TreeNode(this.GetType().Name); + rootNode.Expand(); + rootNode.Nodes.Add("MessageText = " + MessageText.m_buffer); + rootNode.Nodes.Add("ChatMessageType = " + ChatMessageType); + treeView.Nodes.Add(rootNode); + } + } } diff --git a/aclogview/FindOpcodeInFilesForm.Designer.cs b/aclogview/FindOpcodeInFilesForm.Designer.cs index 29bb26b..1a189c9 100644 --- a/aclogview/FindOpcodeInFilesForm.Designer.cs +++ b/aclogview/FindOpcodeInFilesForm.Designer.cs @@ -29,22 +29,22 @@ protected override void Dispose(bool disposing) private void InitializeComponent() { this.components = new System.ComponentModel.Container(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle7 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle8 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle(); this.txtSearchPathRoot = new System.Windows.Forms.TextBox(); this.label1 = new System.Windows.Forms.Label(); this.btnStartSearch = new System.Windows.Forms.Button(); this.btnStopSearch = new System.Windows.Forms.Button(); this.btnChangeSearchPathRoot = new System.Windows.Forms.Button(); this.dataGridView1 = new System.Windows.Forms.DataGridView(); + this.columnHits = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.columnFileSize = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.columnFilePath = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.label2 = new System.Windows.Forms.Label(); this.txtOpcode = new System.Windows.Forms.TextBox(); this.statusStrip1 = new System.Windows.Forms.StatusStrip(); this.toolStripStatusLabel1 = new System.Windows.Forms.ToolStripStatusLabel(); this.timer1 = new System.Windows.Forms.Timer(this.components); - this.columnHits = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.columnFileSize = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.columnFilePath = new System.Windows.Forms.DataGridViewTextBoxColumn(); ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit(); this.statusStrip1.SuspendLayout(); this.SuspendLayout(); @@ -122,6 +122,33 @@ private void InitializeComponent() this.dataGridView1.TabIndex = 5; this.dataGridView1.CellContentDoubleClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView1_CellContentDoubleClick); // + // columnHits + // + dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight; + dataGridViewCellStyle1.Format = "N0"; + this.columnHits.DefaultCellStyle = dataGridViewCellStyle1; + this.columnHits.HeaderText = "Hits"; + this.columnHits.Name = "columnHits"; + this.columnHits.ReadOnly = true; + this.columnHits.Width = 60; + // + // columnFileSize + // + dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight; + dataGridViewCellStyle2.Format = "N0"; + this.columnFileSize.DefaultCellStyle = dataGridViewCellStyle2; + this.columnFileSize.HeaderText = "File Size"; + this.columnFileSize.Name = "columnFileSize"; + this.columnFileSize.ReadOnly = true; + this.columnFileSize.Width = 80; + // + // columnFilePath + // + this.columnFilePath.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; + this.columnFilePath.HeaderText = "File Path"; + this.columnFilePath.Name = "columnFilePath"; + this.columnFilePath.ReadOnly = true; + // // label2 // this.label2.AutoSize = true; @@ -160,33 +187,6 @@ private void InitializeComponent() this.timer1.Interval = 200; this.timer1.Tick += new System.EventHandler(this.timer1_Tick); // - // columnHits - // - dataGridViewCellStyle7.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight; - dataGridViewCellStyle7.Format = "N0"; - this.columnHits.DefaultCellStyle = dataGridViewCellStyle7; - this.columnHits.HeaderText = "Hits"; - this.columnHits.Name = "columnHits"; - this.columnHits.ReadOnly = true; - this.columnHits.Width = 60; - // - // columnFileSize - // - dataGridViewCellStyle8.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight; - dataGridViewCellStyle8.Format = "N0"; - this.columnFileSize.DefaultCellStyle = dataGridViewCellStyle8; - this.columnFileSize.HeaderText = "File Size"; - this.columnFileSize.Name = "columnFileSize"; - this.columnFileSize.ReadOnly = true; - this.columnFileSize.Width = 80; - // - // columnFilePath - // - this.columnFilePath.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; - this.columnFilePath.HeaderText = "File Path"; - this.columnFilePath.Name = "columnFilePath"; - this.columnFilePath.ReadOnly = true; - // // FindOpcodeInFilesForm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); diff --git a/aclogview/FindOpcodeInFilesForm.cs b/aclogview/FindOpcodeInFilesForm.cs index 97dd2fa..f8e1aa5 100644 --- a/aclogview/FindOpcodeInFilesForm.cs +++ b/aclogview/FindOpcodeInFilesForm.cs @@ -2,6 +2,7 @@ using System.Collections.Concurrent; using System.Collections.Generic; using System.ComponentModel; +using System.Drawing; using System.Globalization; using System.IO; using System.Reflection; @@ -33,6 +34,10 @@ protected override void OnLoad(EventArgs e) dataGridView1.SelectionMode = DataGridViewSelectionMode.FullRowSelect; dataGridView1.Columns[0].ValueType = typeof(int); dataGridView1.Columns[1].ValueType = typeof(int); + + // Center to our owner, if we have one + if (Owner != null) + Location = new Point(Owner.Location.X + Owner.Width / 2 - Width / 2, Owner.Location.Y + Owner.Height / 2 - Height / 2); } protected override void OnClosing(CancelEventArgs e) @@ -207,9 +212,12 @@ private void timer1_Tick(object sender, EventArgs e) private void dataGridView1_CellContentDoubleClick(object sender, DataGridViewCellEventArgs e) { + if (e.RowIndex == -1) + return; + var fileName = (string)dataGridView1.Rows[e.RowIndex].Cells[2].Value; - System.Diagnostics.Process.Start(Application.ExecutablePath, '"' + fileName + '"'); + System.Diagnostics.Process.Start(Application.ExecutablePath, '"' + fileName + '"' + " " + opCodeToSearchFor); } } } diff --git a/aclogview/Form1.cs b/aclogview/Form1.cs index 4eab7a1..9152884 100644 --- a/aclogview/Form1.cs +++ b/aclogview/Form1.cs @@ -21,6 +21,12 @@ public partial class Form1 : Form { private string[] args; + /// + /// Add multiple opcodes to highlight to this list. + /// Each opcode will have a different row highlight color. + /// + private readonly List opCodesToHighlight = new List(); + public Form1(string[] args) { InitializeComponent(); @@ -54,7 +60,13 @@ private void Form1_Load(object sender, EventArgs e) { messageProcessors.Add(new CM_Writing()); messageProcessors.Add(new Proto_UI()); - if (args != null && args.Length == 1) + if (args != null && args.Length >= 2) + { + int opcode; + if (int.TryParse(args[1], out opcode)) + opCodesToHighlight.Add(opcode); + } + if (args != null && args.Length >= 1) loadPcap(args[0]); } @@ -421,6 +433,13 @@ private void loadPcapngContent(BinaryReader binaryReader, bool dontList) { private void loadPcap(string fileName, bool dontList = false) { this.Text = "AC Log View - " + Path.GetFileName(fileName); + if (opCodesToHighlight.Count > 0) + { + this.Text += " Highlighted OpCodes: "; + foreach (var opcode in opCodesToHighlight) + Text += opcode + " (" + opcode.ToString("X4") + "),"; + } + records.Clear(); listItems.Clear(); @@ -741,6 +760,25 @@ private void checkBox_HideHeaderOnly_CheckedChanged(object sender, EventArgs e) private void listView_Packets_RetrieveVirtualItem(object sender, RetrieveVirtualItemEventArgs e) { if (e.ItemIndex < listItems.Count) { e.Item = listItems[e.ItemIndex]; + + // Apply highlights here + if (opCodesToHighlight.Count > 0) + { + var record = records[Int32.Parse(e.Item.SubItems[0].Text)]; + + for (int i = 0 ; i < opCodesToHighlight.Count ; i++) + { + if (record.opcodes.Contains((PacketOpcode)opCodesToHighlight[i])) + { + if (i == 0) e.Item.BackColor = Color.LightBlue; + else if (i == 1) e.Item.BackColor = Color.LightPink; + else if (i == 2) e.Item.BackColor = Color.LightGreen; + else if (i == 3) e.Item.BackColor = Color.GreenYellow; + else e.Item.BackColor = Color.MediumVioletRed; + break; + } + } + } } } @@ -932,7 +970,7 @@ private void menuItem_ToolHeatmap_Click(object sender, EventArgs e) { private void mnuItem_ToolFindOpcodeInFiles_Click(object sender, EventArgs e) { var form = new FindOpcodeInFilesForm(); - form.Show(); + form.Show(this); } } }