From 201eaf833ee495dba0eef78fff305328c1be4de2 Mon Sep 17 00:00:00 2001 From: Eviatar Gerzi Date: Thu, 29 Dec 2022 12:00:46 +0200 Subject: [PATCH] Init --- PipeViewer.sln | 25 + PipeViewer/App.config | 6 + PipeViewer/ColumnSelection.Designer.cs | 480 +++++++++++ PipeViewer/ColumnSelection.cs | 77 ++ PipeViewer/ColumnSelection.resx | 120 +++ PipeViewer/Control/Engine.cs | 192 +++++ PipeViewer/Form1.Designer.cs | 503 +++++++++++ PipeViewer/Form1.cs | 909 ++++++++++++++++++++ PipeViewer/Form1.resx | 201 +++++ PipeViewer/FormAbout.Designer.cs | 77 ++ PipeViewer/FormAbout.cs | 20 + PipeViewer/FormAbout.resx | 120 +++ PipeViewer/FormColumnFilter.Designer.cs | 266 ++++++ PipeViewer/FormColumnFilter.cs | 139 +++ PipeViewer/FormColumnFilter.resx | 120 +++ PipeViewer/FormHighlighting.Designer.cs | 267 ++++++ PipeViewer/FormHighlighting.cs | 122 +++ PipeViewer/FormHighlighting.resx | 120 +++ PipeViewer/FormSearch.Designer.cs | 142 +++ PipeViewer/FormSearch.cs | 35 + PipeViewer/PermissionDialog.cs | 144 ++++ PipeViewer/PipeViewer.csproj | 153 ++++ PipeViewer/Program.cs | 19 + PipeViewer/Properties/AssemblyInfo.cs | 36 + PipeViewer/Properties/Resources.Designer.cs | 133 +++ PipeViewer/Properties/Resources.resx | 142 +++ PipeViewer/Properties/Settings.Designer.cs | 26 + PipeViewer/Properties/Settings.settings | 7 + PipeViewer/Resources/eraser.png | Bin 0 -> 915 bytes PipeViewer/Resources/filter.png | Bin 0 -> 727 bytes PipeViewer/Resources/find.png | Bin 0 -> 747 bytes PipeViewer/Resources/grid-disable.png | Bin 0 -> 919 bytes PipeViewer/Resources/grid.png | Bin 0 -> 805 bytes PipeViewer/Resources/highlighter.png | Bin 0 -> 1240 bytes PipeViewer/Resources/refresh.png | Bin 0 -> 1250 bytes PipeViewer/Utils.cs | 404 +++++++++ 36 files changed, 5005 insertions(+) create mode 100644 PipeViewer.sln create mode 100644 PipeViewer/App.config create mode 100644 PipeViewer/ColumnSelection.Designer.cs create mode 100644 PipeViewer/ColumnSelection.cs create mode 100644 PipeViewer/ColumnSelection.resx create mode 100644 PipeViewer/Control/Engine.cs create mode 100644 PipeViewer/Form1.Designer.cs create mode 100644 PipeViewer/Form1.cs create mode 100644 PipeViewer/Form1.resx create mode 100644 PipeViewer/FormAbout.Designer.cs create mode 100644 PipeViewer/FormAbout.cs create mode 100644 PipeViewer/FormAbout.resx create mode 100644 PipeViewer/FormColumnFilter.Designer.cs create mode 100644 PipeViewer/FormColumnFilter.cs create mode 100644 PipeViewer/FormColumnFilter.resx create mode 100644 PipeViewer/FormHighlighting.Designer.cs create mode 100644 PipeViewer/FormHighlighting.cs create mode 100644 PipeViewer/FormHighlighting.resx create mode 100644 PipeViewer/FormSearch.Designer.cs create mode 100644 PipeViewer/FormSearch.cs create mode 100644 PipeViewer/PermissionDialog.cs create mode 100644 PipeViewer/PipeViewer.csproj create mode 100644 PipeViewer/Program.cs create mode 100644 PipeViewer/Properties/AssemblyInfo.cs create mode 100644 PipeViewer/Properties/Resources.Designer.cs create mode 100644 PipeViewer/Properties/Resources.resx create mode 100644 PipeViewer/Properties/Settings.Designer.cs create mode 100644 PipeViewer/Properties/Settings.settings create mode 100644 PipeViewer/Resources/eraser.png create mode 100644 PipeViewer/Resources/filter.png create mode 100644 PipeViewer/Resources/find.png create mode 100644 PipeViewer/Resources/grid-disable.png create mode 100644 PipeViewer/Resources/grid.png create mode 100644 PipeViewer/Resources/highlighter.png create mode 100644 PipeViewer/Resources/refresh.png create mode 100644 PipeViewer/Utils.cs diff --git a/PipeViewer.sln b/PipeViewer.sln new file mode 100644 index 0000000..df9a313 --- /dev/null +++ b/PipeViewer.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.28307.1259 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PipeViewer", "PipeViewer\PipeViewer.csproj", "{2419CEDC-BF3A-4D8D-98F7-6403415BEEA4}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {2419CEDC-BF3A-4D8D-98F7-6403415BEEA4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {2419CEDC-BF3A-4D8D-98F7-6403415BEEA4}.Debug|Any CPU.Build.0 = Debug|Any CPU + {2419CEDC-BF3A-4D8D-98F7-6403415BEEA4}.Release|Any CPU.ActiveCfg = Release|Any CPU + {2419CEDC-BF3A-4D8D-98F7-6403415BEEA4}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {14DCBED7-3363-40B7-854B-4C74885ACBA5} + EndGlobalSection +EndGlobal diff --git a/PipeViewer/App.config b/PipeViewer/App.config new file mode 100644 index 0000000..731f6de --- /dev/null +++ b/PipeViewer/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/PipeViewer/ColumnSelection.Designer.cs b/PipeViewer/ColumnSelection.Designer.cs new file mode 100644 index 0000000..165f936 --- /dev/null +++ b/PipeViewer/ColumnSelection.Designer.cs @@ -0,0 +1,480 @@ +namespace PipeViewer +{ + partial class ColumnSelection + { + /// + /// 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.groupBoxNamedPipe = new System.Windows.Forms.GroupBox(); + this.checkBoxReadMode = new System.Windows.Forms.CheckBox(); + this.checkBoxNumberOfLinks = new System.Windows.Forms.CheckBox(); + this.checkBoxPipeType = new System.Windows.Forms.CheckBox(); + this.checkBoxConfiguration = new System.Windows.Forms.CheckBox(); + this.checkBoxClientProcessId = new System.Windows.Forms.CheckBox(); + this.checkBoxEndpointType = new System.Windows.Forms.CheckBox(); + this.checkBoxSddl = new System.Windows.Forms.CheckBox(); + this.checkBoxName = new System.Windows.Forms.CheckBox(); + this.label1 = new System.Windows.Forms.Label(); + this.groupBoxTimeStamp = new System.Windows.Forms.GroupBox(); + this.checkBoxCreationTime = new System.Windows.Forms.CheckBox(); + this.checkBoxChangeTime = new System.Windows.Forms.CheckBox(); + this.checkBoxLastWriteTime = new System.Windows.Forms.CheckBox(); + this.checkBoxLastAccessTime = new System.Windows.Forms.CheckBox(); + this.checkBoxFileCreationTime = new System.Windows.Forms.CheckBox(); + this.checkBoxIntegrityLevel = new System.Windows.Forms.CheckBox(); + this.checkBoxPermissions = new System.Windows.Forms.CheckBox(); + this.buttonOK = new System.Windows.Forms.Button(); + this.buttonCancel = new System.Windows.Forms.Button(); + this.groupBoxSecurityDescriptor = new System.Windows.Forms.GroupBox(); + this.checkBoxGroupSid = new System.Windows.Forms.CheckBox(); + this.checkBoxOwnerSid = new System.Windows.Forms.CheckBox(); + this.checkBoxOwnerName = new System.Windows.Forms.CheckBox(); + this.checkBoxGroupName = new System.Windows.Forms.CheckBox(); + this.checkBoxDirectoryGrantedAccess = new System.Windows.Forms.CheckBox(); + this.groupBoxAccess = new System.Windows.Forms.GroupBox(); + this.checkBoxGrantedAccess = new System.Windows.Forms.CheckBox(); + this.checkBoxGrantedAccessGeneric = new System.Windows.Forms.CheckBox(); + this.checkBoxHandle = new System.Windows.Forms.CheckBox(); + this.groupBoxNamedPipe.SuspendLayout(); + this.groupBoxTimeStamp.SuspendLayout(); + this.groupBoxSecurityDescriptor.SuspendLayout(); + this.groupBoxAccess.SuspendLayout(); + this.SuspendLayout(); + // + // groupBoxNamedPipe + // + this.groupBoxNamedPipe.Controls.Add(this.checkBoxHandle); + this.groupBoxNamedPipe.Controls.Add(this.checkBoxReadMode); + this.groupBoxNamedPipe.Controls.Add(this.checkBoxNumberOfLinks); + this.groupBoxNamedPipe.Controls.Add(this.checkBoxPipeType); + this.groupBoxNamedPipe.Controls.Add(this.checkBoxConfiguration); + this.groupBoxNamedPipe.Controls.Add(this.checkBoxClientProcessId); + this.groupBoxNamedPipe.Controls.Add(this.checkBoxEndpointType); + this.groupBoxNamedPipe.Controls.Add(this.checkBoxSddl); + this.groupBoxNamedPipe.Controls.Add(this.checkBoxName); + this.groupBoxNamedPipe.Location = new System.Drawing.Point(12, 47); + this.groupBoxNamedPipe.Name = "groupBoxNamedPipe"; + this.groupBoxNamedPipe.Size = new System.Drawing.Size(272, 145); + this.groupBoxNamedPipe.TabIndex = 0; + this.groupBoxNamedPipe.TabStop = false; + this.groupBoxNamedPipe.Text = "Named Pipe"; + // + // checkBoxReadMode + // + this.checkBoxReadMode.AutoSize = true; + this.checkBoxReadMode.Checked = true; + this.checkBoxReadMode.CheckState = System.Windows.Forms.CheckState.Checked; + this.checkBoxReadMode.Location = new System.Drawing.Point(6, 99); + this.checkBoxReadMode.Name = "checkBoxReadMode"; + this.checkBoxReadMode.Size = new System.Drawing.Size(82, 17); + this.checkBoxReadMode.TabIndex = 7; + this.checkBoxReadMode.Text = "Read Mode"; + this.checkBoxReadMode.UseVisualStyleBackColor = true; + // + // checkBoxNumberOfLinks + // + this.checkBoxNumberOfLinks.AutoSize = true; + this.checkBoxNumberOfLinks.Checked = true; + this.checkBoxNumberOfLinks.CheckState = System.Windows.Forms.CheckState.Checked; + this.checkBoxNumberOfLinks.Location = new System.Drawing.Point(132, 99); + this.checkBoxNumberOfLinks.Name = "checkBoxNumberOfLinks"; + this.checkBoxNumberOfLinks.Size = new System.Drawing.Size(103, 17); + this.checkBoxNumberOfLinks.TabIndex = 6; + this.checkBoxNumberOfLinks.Text = "Number of Links"; + this.checkBoxNumberOfLinks.UseVisualStyleBackColor = true; + // + // checkBoxPipeType + // + this.checkBoxPipeType.AutoSize = true; + this.checkBoxPipeType.Checked = true; + this.checkBoxPipeType.CheckState = System.Windows.Forms.CheckState.Checked; + this.checkBoxPipeType.Location = new System.Drawing.Point(132, 76); + this.checkBoxPipeType.Name = "checkBoxPipeType"; + this.checkBoxPipeType.Size = new System.Drawing.Size(74, 17); + this.checkBoxPipeType.TabIndex = 5; + this.checkBoxPipeType.Text = "Pipe Type"; + this.checkBoxPipeType.UseVisualStyleBackColor = true; + // + // checkBoxConfiguration + // + this.checkBoxConfiguration.AutoSize = true; + this.checkBoxConfiguration.Checked = true; + this.checkBoxConfiguration.CheckState = System.Windows.Forms.CheckState.Checked; + this.checkBoxConfiguration.Location = new System.Drawing.Point(6, 76); + this.checkBoxConfiguration.Name = "checkBoxConfiguration"; + this.checkBoxConfiguration.Size = new System.Drawing.Size(88, 17); + this.checkBoxConfiguration.TabIndex = 4; + this.checkBoxConfiguration.Text = "Configuration"; + this.checkBoxConfiguration.UseVisualStyleBackColor = true; + // + // checkBoxClientProcessId + // + this.checkBoxClientProcessId.AutoSize = true; + this.checkBoxClientProcessId.Checked = true; + this.checkBoxClientProcessId.CheckState = System.Windows.Forms.CheckState.Checked; + this.checkBoxClientProcessId.Location = new System.Drawing.Point(132, 53); + this.checkBoxClientProcessId.Name = "checkBoxClientProcessId"; + this.checkBoxClientProcessId.Size = new System.Drawing.Size(78, 17); + this.checkBoxClientProcessId.TabIndex = 3; + this.checkBoxClientProcessId.Text = "Client PIDs"; + this.checkBoxClientProcessId.UseVisualStyleBackColor = true; + // + // checkBoxEndpointType + // + this.checkBoxEndpointType.AutoSize = true; + this.checkBoxEndpointType.Checked = true; + this.checkBoxEndpointType.CheckState = System.Windows.Forms.CheckState.Checked; + this.checkBoxEndpointType.Location = new System.Drawing.Point(6, 53); + this.checkBoxEndpointType.Name = "checkBoxEndpointType"; + this.checkBoxEndpointType.Size = new System.Drawing.Size(95, 17); + this.checkBoxEndpointType.TabIndex = 2; + this.checkBoxEndpointType.Text = "Endpoint Type"; + this.checkBoxEndpointType.UseVisualStyleBackColor = true; + // + // checkBoxSddl + // + this.checkBoxSddl.AutoSize = true; + this.checkBoxSddl.Checked = true; + this.checkBoxSddl.CheckState = System.Windows.Forms.CheckState.Checked; + this.checkBoxSddl.Location = new System.Drawing.Point(132, 30); + this.checkBoxSddl.Name = "checkBoxSddl"; + this.checkBoxSddl.Size = new System.Drawing.Size(47, 17); + this.checkBoxSddl.TabIndex = 1; + this.checkBoxSddl.Text = "Sddl"; + this.checkBoxSddl.UseVisualStyleBackColor = true; + // + // checkBoxName + // + this.checkBoxName.AutoSize = true; + this.checkBoxName.Checked = true; + this.checkBoxName.CheckState = System.Windows.Forms.CheckState.Checked; + this.checkBoxName.Location = new System.Drawing.Point(7, 30); + this.checkBoxName.Name = "checkBoxName"; + this.checkBoxName.Size = new System.Drawing.Size(54, 17); + this.checkBoxName.TabIndex = 0; + this.checkBoxName.Text = "Name"; + this.checkBoxName.UseVisualStyleBackColor = true; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(12, 19); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(243, 13); + this.label1.TabIndex = 1; + this.label1.Text = "Select columns to appear in the Procnoid window:"; + // + // groupBoxTimeStamp + // + this.groupBoxTimeStamp.Controls.Add(this.checkBoxCreationTime); + this.groupBoxTimeStamp.Controls.Add(this.checkBoxChangeTime); + this.groupBoxTimeStamp.Controls.Add(this.checkBoxLastWriteTime); + this.groupBoxTimeStamp.Controls.Add(this.checkBoxLastAccessTime); + this.groupBoxTimeStamp.Controls.Add(this.checkBoxFileCreationTime); + this.groupBoxTimeStamp.Location = new System.Drawing.Point(12, 410); + this.groupBoxTimeStamp.Name = "groupBoxTimeStamp"; + this.groupBoxTimeStamp.Size = new System.Drawing.Size(272, 95); + this.groupBoxTimeStamp.TabIndex = 3; + this.groupBoxTimeStamp.TabStop = false; + this.groupBoxTimeStamp.Text = "Time Stamp"; + // + // checkBoxCreationTime + // + this.checkBoxCreationTime.AutoSize = true; + this.checkBoxCreationTime.Checked = true; + this.checkBoxCreationTime.CheckState = System.Windows.Forms.CheckState.Checked; + this.checkBoxCreationTime.Location = new System.Drawing.Point(7, 28); + this.checkBoxCreationTime.Name = "checkBoxCreationTime"; + this.checkBoxCreationTime.Size = new System.Drawing.Size(91, 17); + this.checkBoxCreationTime.TabIndex = 3; + this.checkBoxCreationTime.Text = "Creation Time"; + this.checkBoxCreationTime.UseVisualStyleBackColor = true; + // + // checkBoxChangeTime + // + this.checkBoxChangeTime.AutoSize = true; + this.checkBoxChangeTime.Location = new System.Drawing.Point(7, 72); + this.checkBoxChangeTime.Name = "checkBoxChangeTime"; + this.checkBoxChangeTime.Size = new System.Drawing.Size(89, 17); + this.checkBoxChangeTime.TabIndex = 6; + this.checkBoxChangeTime.Text = "Change Time"; + this.checkBoxChangeTime.UseVisualStyleBackColor = true; + // + // checkBoxLastWriteTime + // + this.checkBoxLastWriteTime.AutoSize = true; + this.checkBoxLastWriteTime.Location = new System.Drawing.Point(133, 51); + this.checkBoxLastWriteTime.Name = "checkBoxLastWriteTime"; + this.checkBoxLastWriteTime.Size = new System.Drawing.Size(100, 17); + this.checkBoxLastWriteTime.TabIndex = 5; + this.checkBoxLastWriteTime.Text = "Last Write Time"; + this.checkBoxLastWriteTime.UseVisualStyleBackColor = true; + // + // checkBoxLastAccessTime + // + this.checkBoxLastAccessTime.AutoSize = true; + this.checkBoxLastAccessTime.Location = new System.Drawing.Point(7, 51); + this.checkBoxLastAccessTime.Name = "checkBoxLastAccessTime"; + this.checkBoxLastAccessTime.Size = new System.Drawing.Size(110, 17); + this.checkBoxLastAccessTime.TabIndex = 4; + this.checkBoxLastAccessTime.Text = "Last Access Time"; + this.checkBoxLastAccessTime.UseVisualStyleBackColor = true; + // + // checkBoxFileCreationTime + // + this.checkBoxFileCreationTime.AutoSize = true; + this.checkBoxFileCreationTime.Location = new System.Drawing.Point(133, 28); + this.checkBoxFileCreationTime.Name = "checkBoxFileCreationTime"; + this.checkBoxFileCreationTime.Size = new System.Drawing.Size(110, 17); + this.checkBoxFileCreationTime.TabIndex = 3; + this.checkBoxFileCreationTime.Text = "File Creation Time"; + this.checkBoxFileCreationTime.UseVisualStyleBackColor = true; + // + // checkBoxIntegrityLevel + // + this.checkBoxIntegrityLevel.AutoSize = true; + this.checkBoxIntegrityLevel.Checked = true; + this.checkBoxIntegrityLevel.CheckState = System.Windows.Forms.CheckState.Checked; + this.checkBoxIntegrityLevel.Location = new System.Drawing.Point(132, 76); + this.checkBoxIntegrityLevel.Name = "checkBoxIntegrityLevel"; + this.checkBoxIntegrityLevel.Size = new System.Drawing.Size(92, 17); + this.checkBoxIntegrityLevel.TabIndex = 1; + this.checkBoxIntegrityLevel.Text = "Integrity Level"; + this.checkBoxIntegrityLevel.UseVisualStyleBackColor = true; + // + // checkBoxPermissions + // + this.checkBoxPermissions.AutoSize = true; + this.checkBoxPermissions.Checked = true; + this.checkBoxPermissions.CheckState = System.Windows.Forms.CheckState.Checked; + this.checkBoxPermissions.Location = new System.Drawing.Point(6, 30); + this.checkBoxPermissions.Name = "checkBoxPermissions"; + this.checkBoxPermissions.Size = new System.Drawing.Size(81, 17); + this.checkBoxPermissions.TabIndex = 0; + this.checkBoxPermissions.Text = "Permissions"; + this.checkBoxPermissions.UseVisualStyleBackColor = true; + // + // buttonOK + // + this.buttonOK.Location = new System.Drawing.Point(113, 521); + this.buttonOK.Name = "buttonOK"; + this.buttonOK.Size = new System.Drawing.Size(75, 23); + this.buttonOK.TabIndex = 4; + this.buttonOK.Text = "OK"; + this.buttonOK.UseVisualStyleBackColor = true; + this.buttonOK.Click += new System.EventHandler(this.buttonOK_Click); + // + // buttonCancel + // + this.buttonCancel.Location = new System.Drawing.Point(209, 521); + this.buttonCancel.Name = "buttonCancel"; + this.buttonCancel.Size = new System.Drawing.Size(75, 23); + this.buttonCancel.TabIndex = 5; + this.buttonCancel.Text = "Cancel"; + this.buttonCancel.UseVisualStyleBackColor = true; + this.buttonCancel.Click += new System.EventHandler(this.buttonCancel_Click); + // + // groupBoxSecurityDescriptor + // + this.groupBoxSecurityDescriptor.Controls.Add(this.checkBoxGroupSid); + this.groupBoxSecurityDescriptor.Controls.Add(this.checkBoxOwnerSid); + this.groupBoxSecurityDescriptor.Controls.Add(this.checkBoxOwnerName); + this.groupBoxSecurityDescriptor.Controls.Add(this.checkBoxGroupName); + this.groupBoxSecurityDescriptor.Controls.Add(this.checkBoxPermissions); + this.groupBoxSecurityDescriptor.Controls.Add(this.checkBoxIntegrityLevel); + this.groupBoxSecurityDescriptor.Location = new System.Drawing.Point(12, 294); + this.groupBoxSecurityDescriptor.Name = "groupBoxSecurityDescriptor"; + this.groupBoxSecurityDescriptor.Size = new System.Drawing.Size(272, 108); + this.groupBoxSecurityDescriptor.TabIndex = 3; + this.groupBoxSecurityDescriptor.TabStop = false; + this.groupBoxSecurityDescriptor.Text = "Security Descriptor"; + // + // checkBoxGroupSid + // + this.checkBoxGroupSid.AutoSize = true; + this.checkBoxGroupSid.Location = new System.Drawing.Point(7, 76); + this.checkBoxGroupSid.Name = "checkBoxGroupSid"; + this.checkBoxGroupSid.Size = new System.Drawing.Size(73, 17); + this.checkBoxGroupSid.TabIndex = 3; + this.checkBoxGroupSid.Text = "Group Sid"; + this.checkBoxGroupSid.UseVisualStyleBackColor = true; + // + // checkBoxOwnerSid + // + this.checkBoxOwnerSid.AutoSize = true; + this.checkBoxOwnerSid.Location = new System.Drawing.Point(6, 53); + this.checkBoxOwnerSid.Name = "checkBoxOwnerSid"; + this.checkBoxOwnerSid.Size = new System.Drawing.Size(75, 17); + this.checkBoxOwnerSid.TabIndex = 2; + this.checkBoxOwnerSid.Text = "Owner Sid"; + this.checkBoxOwnerSid.UseVisualStyleBackColor = true; + // + // checkBoxOwnerName + // + this.checkBoxOwnerName.AutoSize = true; + this.checkBoxOwnerName.Checked = true; + this.checkBoxOwnerName.CheckState = System.Windows.Forms.CheckState.Checked; + this.checkBoxOwnerName.Location = new System.Drawing.Point(132, 30); + this.checkBoxOwnerName.Name = "checkBoxOwnerName"; + this.checkBoxOwnerName.Size = new System.Drawing.Size(88, 17); + this.checkBoxOwnerName.TabIndex = 1; + this.checkBoxOwnerName.Text = "Owner Name"; + this.checkBoxOwnerName.UseVisualStyleBackColor = true; + // + // checkBoxGroupName + // + this.checkBoxGroupName.AutoSize = true; + this.checkBoxGroupName.Location = new System.Drawing.Point(132, 53); + this.checkBoxGroupName.Name = "checkBoxGroupName"; + this.checkBoxGroupName.Size = new System.Drawing.Size(86, 17); + this.checkBoxGroupName.TabIndex = 0; + this.checkBoxGroupName.Text = "Group Name"; + this.checkBoxGroupName.UseVisualStyleBackColor = true; + // + // checkBoxDirectoryGrantedAccess + // + this.checkBoxDirectoryGrantedAccess.AutoSize = true; + this.checkBoxDirectoryGrantedAccess.Checked = true; + this.checkBoxDirectoryGrantedAccess.CheckState = System.Windows.Forms.CheckState.Checked; + this.checkBoxDirectoryGrantedAccess.Location = new System.Drawing.Point(11, 30); + this.checkBoxDirectoryGrantedAccess.Name = "checkBoxDirectoryGrantedAccess"; + this.checkBoxDirectoryGrantedAccess.Size = new System.Drawing.Size(147, 17); + this.checkBoxDirectoryGrantedAccess.TabIndex = 8; + this.checkBoxDirectoryGrantedAccess.Text = "Directory Granted Access"; + this.checkBoxDirectoryGrantedAccess.UseVisualStyleBackColor = true; + // + // groupBoxAccess + // + this.groupBoxAccess.Controls.Add(this.checkBoxGrantedAccess); + this.groupBoxAccess.Controls.Add(this.checkBoxDirectoryGrantedAccess); + this.groupBoxAccess.Controls.Add(this.checkBoxGrantedAccessGeneric); + this.groupBoxAccess.Location = new System.Drawing.Point(12, 198); + this.groupBoxAccess.Name = "groupBoxAccess"; + this.groupBoxAccess.Size = new System.Drawing.Size(272, 91); + this.groupBoxAccess.TabIndex = 4; + this.groupBoxAccess.TabStop = false; + this.groupBoxAccess.Text = "Access"; + // + // checkBoxGrantedAccess + // + this.checkBoxGrantedAccess.AutoSize = true; + this.checkBoxGrantedAccess.Checked = true; + this.checkBoxGrantedAccess.CheckState = System.Windows.Forms.CheckState.Checked; + this.checkBoxGrantedAccess.Location = new System.Drawing.Point(164, 30); + this.checkBoxGrantedAccess.Name = "checkBoxGrantedAccess"; + this.checkBoxGrantedAccess.Size = new System.Drawing.Size(102, 17); + this.checkBoxGrantedAccess.TabIndex = 1; + this.checkBoxGrantedAccess.Text = "Granted Access"; + this.checkBoxGrantedAccess.UseVisualStyleBackColor = true; + // + // checkBoxGrantedAccessGeneric + // + this.checkBoxGrantedAccessGeneric.AutoSize = true; + this.checkBoxGrantedAccessGeneric.Checked = true; + this.checkBoxGrantedAccessGeneric.CheckState = System.Windows.Forms.CheckState.Checked; + this.checkBoxGrantedAccessGeneric.Location = new System.Drawing.Point(11, 53); + this.checkBoxGrantedAccessGeneric.Name = "checkBoxGrantedAccessGeneric"; + this.checkBoxGrantedAccessGeneric.Size = new System.Drawing.Size(142, 17); + this.checkBoxGrantedAccessGeneric.TabIndex = 0; + this.checkBoxGrantedAccessGeneric.Text = "Granted Access Generic"; + this.checkBoxGrantedAccessGeneric.UseVisualStyleBackColor = true; + // + // checkBoxHandle + // + this.checkBoxHandle.AutoSize = true; + this.checkBoxHandle.Checked = true; + this.checkBoxHandle.CheckState = System.Windows.Forms.CheckState.Checked; + this.checkBoxHandle.Location = new System.Drawing.Point(5, 122); + this.checkBoxHandle.Name = "checkBoxHandle"; + this.checkBoxHandle.Size = new System.Drawing.Size(60, 17); + this.checkBoxHandle.TabIndex = 8; + this.checkBoxHandle.Text = "Handle"; + this.checkBoxHandle.UseVisualStyleBackColor = true; + // + // ColumnSelection + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(296, 557); + this.Controls.Add(this.groupBoxAccess); + this.Controls.Add(this.groupBoxSecurityDescriptor); + this.Controls.Add(this.buttonCancel); + this.Controls.Add(this.buttonOK); + this.Controls.Add(this.groupBoxTimeStamp); + this.Controls.Add(this.label1); + this.Controls.Add(this.groupBoxNamedPipe); + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "ColumnSelection"; + this.ShowIcon = false; + this.Text = "PipeViewer Column Selection"; + this.groupBoxNamedPipe.ResumeLayout(false); + this.groupBoxNamedPipe.PerformLayout(); + this.groupBoxTimeStamp.ResumeLayout(false); + this.groupBoxTimeStamp.PerformLayout(); + this.groupBoxSecurityDescriptor.ResumeLayout(false); + this.groupBoxSecurityDescriptor.PerformLayout(); + this.groupBoxAccess.ResumeLayout(false); + this.groupBoxAccess.PerformLayout(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.GroupBox groupBoxNamedPipe; + private System.Windows.Forms.CheckBox checkBoxEndpointType; + private System.Windows.Forms.CheckBox checkBoxSddl; + private System.Windows.Forms.CheckBox checkBoxName; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.GroupBox groupBoxTimeStamp; + private System.Windows.Forms.CheckBox checkBoxChangeTime; + private System.Windows.Forms.CheckBox checkBoxLastWriteTime; + private System.Windows.Forms.CheckBox checkBoxLastAccessTime; + private System.Windows.Forms.CheckBox checkBoxFileCreationTime; + private System.Windows.Forms.CheckBox checkBoxIntegrityLevel; + private System.Windows.Forms.CheckBox checkBoxPermissions; + private System.Windows.Forms.Button buttonOK; + private System.Windows.Forms.Button buttonCancel; + private System.Windows.Forms.GroupBox groupBoxSecurityDescriptor; + private System.Windows.Forms.CheckBox checkBoxGroupSid; + private System.Windows.Forms.CheckBox checkBoxOwnerSid; + private System.Windows.Forms.CheckBox checkBoxOwnerName; + private System.Windows.Forms.CheckBox checkBoxGroupName; + private System.Windows.Forms.CheckBox checkBoxCreationTime; + private System.Windows.Forms.CheckBox checkBoxClientProcessId; + private System.Windows.Forms.CheckBox checkBoxConfiguration; + private System.Windows.Forms.CheckBox checkBoxPipeType; + private System.Windows.Forms.CheckBox checkBoxDirectoryGrantedAccess; + private System.Windows.Forms.CheckBox checkBoxReadMode; + private System.Windows.Forms.CheckBox checkBoxNumberOfLinks; + private System.Windows.Forms.GroupBox groupBoxAccess; + private System.Windows.Forms.CheckBox checkBoxGrantedAccess; + private System.Windows.Forms.CheckBox checkBoxGrantedAccessGeneric; + private System.Windows.Forms.CheckBox checkBoxHandle; + } +} \ No newline at end of file diff --git a/PipeViewer/ColumnSelection.cs b/PipeViewer/ColumnSelection.cs new file mode 100644 index 0000000..97bbfc0 --- /dev/null +++ b/PipeViewer/ColumnSelection.cs @@ -0,0 +1,77 @@ +using System; +using System.Collections.Generic; +using System.Windows.Forms; + +namespace PipeViewer +{ + + public delegate void selectColumnsEventHandler(GroupBox i_NamedPipe, GroupBox i_Access, GroupBox i_SecurityDescriptor, GroupBox TimeStamp); + public partial class ColumnSelection : Form + { + public event selectColumnsEventHandler selectColumnsUpdate; + public ColumnSelection(System.Windows.Forms.DataGridView dataGridView1) + { + InitializeComponent(); + + List visableColumns = new List(); + foreach (DataGridViewColumn column in dataGridView1.Columns) + { + + if (column.Visible) + { + visableColumns.Add(column.HeaderText); + } + } + + initializeCheckboxes(visableColumns); + } + + // The name of the CheckBox header MUST be the same as the Column header. + private void initializeCheckboxes(List visableColumns) + { + this.checkBoxEndpointType.Checked = visableColumns.Contains(this.checkBoxEndpointType.Text); + this.checkBoxSddl.Checked = visableColumns.Contains(this.checkBoxSddl.Text); + this.checkBoxName.Checked = visableColumns.Contains(this.checkBoxName.Text); + this.checkBoxChangeTime.Checked = visableColumns.Contains(this.checkBoxChangeTime.Text); + this.checkBoxLastWriteTime.Checked = visableColumns.Contains(this.checkBoxLastWriteTime.Text); + this.checkBoxLastAccessTime.Checked = visableColumns.Contains(this.checkBoxLastAccessTime.Text); + this.checkBoxFileCreationTime.Checked = visableColumns.Contains(this.checkBoxFileCreationTime.Text); + this.checkBoxIntegrityLevel.Checked = visableColumns.Contains(this.checkBoxIntegrityLevel.Text); + this.checkBoxPermissions.Checked = visableColumns.Contains(this.checkBoxPermissions.Text); + this.checkBoxGroupSid.Checked = visableColumns.Contains(this.checkBoxGroupSid.Text); + this.checkBoxOwnerSid.Checked = visableColumns.Contains(this.checkBoxOwnerSid.Text); + this.checkBoxOwnerName.Checked = visableColumns.Contains(this.checkBoxOwnerName.Text); + this.checkBoxGroupName.Checked = visableColumns.Contains(this.checkBoxGroupName.Text); + this.checkBoxCreationTime.Checked = visableColumns.Contains(this.checkBoxCreationTime.Text); + this.checkBoxClientProcessId.Checked = visableColumns.Contains(this.checkBoxClientProcessId.Text); + this.checkBoxConfiguration.Checked = visableColumns.Contains(this.checkBoxConfiguration.Text); + this.checkBoxPipeType.Checked = visableColumns.Contains(this.checkBoxPipeType.Text); + this.checkBoxDirectoryGrantedAccess.Checked = visableColumns.Contains(this.checkBoxDirectoryGrantedAccess.Text); + this.checkBoxReadMode.Checked = visableColumns.Contains(this.checkBoxReadMode.Text); + this.checkBoxNumberOfLinks.Checked = visableColumns.Contains(this.checkBoxNumberOfLinks.Text); + this.checkBoxGrantedAccess.Checked = visableColumns.Contains(this.checkBoxGrantedAccess.Text); + this.checkBoxGrantedAccessGeneric.Checked = visableColumns.Contains(this.checkBoxGrantedAccessGeneric.Text); + this.checkBoxHandle.Checked = visableColumns.Contains(this.checkBoxHandle.Text); + } + + + public virtual void OnselectColumnsUpdate(GroupBox i_NamedPipe, GroupBox i_Access, GroupBox i_SecurityDescriptor, GroupBox i_TimeStamp) + { + if (selectColumnsUpdate != null) + { + selectColumnsUpdate.Invoke(i_NamedPipe, i_Access, i_SecurityDescriptor, i_TimeStamp); + } + } + + private void buttonCancel_Click(object sender, EventArgs e) + { + this.Close(); + } + + private void buttonOK_Click(object sender, EventArgs e) + { + OnselectColumnsUpdate(groupBoxNamedPipe, groupBoxAccess, groupBoxSecurityDescriptor, groupBoxTimeStamp); + this.Close(); + } + } +} diff --git a/PipeViewer/ColumnSelection.resx b/PipeViewer/ColumnSelection.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/PipeViewer/ColumnSelection.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + \ No newline at end of file diff --git a/PipeViewer/Control/Engine.cs b/PipeViewer/Control/Engine.cs new file mode 100644 index 0000000..88b0d52 --- /dev/null +++ b/PipeViewer/Control/Engine.cs @@ -0,0 +1,192 @@ +using System; +using System.Linq; +using NtApiDotNet; +namespace PipeViewer.Control +{ + static class Engine + { + public enum NamedPipeFunctionEndType + { + Server, + Client + } + + public static NtNamedPipeFileBase GetNamedPipeObject(string i_NamedPipe, NamedPipeFunctionEndType e_EndType) + { + NtNamedPipeFileBase namedPipeFileObject = null; + + i_NamedPipe = i_NamedPipe.Replace(@"\\.\pipe\", @"\Device\NamedPipe\"); + FileShareMode ShareMode = FileShareMode.Read | FileShareMode.Write; + FileOpenOptions Options = FileOpenOptions.SynchronousIoNonAlert; + FileAccessRights Access = FileAccessRights.GenericRead | FileAccessRights.GenericWrite | FileAccessRights.Synchronize; + + if (e_EndType == NamedPipeFunctionEndType.Client) + { + namedPipeFileObject = GetNamedPipeClientObject(i_NamedPipe, ShareMode, Options, Access); + } else { + namedPipeFileObject = GetNamedPipeServerObject(i_NamedPipe, ShareMode, Options, Access); + } + + return namedPipeFileObject; + } + + // https://github.com/googleprojectzero/sandbox-attacksurface-analysis-tools/blob/c02ed8ba04324e54a0a188ab9877ee6aa372dfac/NtObjectManager/Cmdlets/Object/GetNtNamedPipeFileCmdlet.cs + public static NtNamedPipeFileBase GetNamedPipeClientObject(string i_NamedPipe, FileShareMode i_ShareMode, FileOpenOptions i_Options, FileAccessRights i_Access) + { + NtNamedPipeFileBase namedPipeFileObject = null; + + //i_NamedPipe = @"\Device\NamedPipe\Winsock2\CatalogChangeListener-5c0-0"; + //i_NamedPipe = @"\Device\NamedPipe\WiFiNetworkManagerTask"; + //i_NamedPipe = @"\Device\NamedPipe\initShutdown"; + + using (ObjectAttributes obj_attributes = new ObjectAttributes(i_NamedPipe)) + { + try + { + // https://github.com/googleprojectzero/sandbox-attacksurface-analysis-tools/issues/65 + // https://github.com/googleprojectzero/sandbox-attacksurface-analysis-tools/blob/c02ed8ba04324e54a0a188ab9877ee6aa372dfac/NtObjectManager/Cmdlets/Object/GetNtNamedPipeFileCmdlet.cs + // https://github.com/googleprojectzero/sandbox-attacksurface-analysis-tools/blob/c02ed8ba04324e54a0a188ab9877ee6aa372dfac/NtObjectManager/Cmdlets/Object/GetNtFileCmdlet.cs + namedPipeFileObject = (NtNamedPipeFileBase)NtFile.Open(obj_attributes, i_Access, i_ShareMode, i_Options); + + } + catch (Exception) + { + // In the future we can write to log + } + + }; + + return namedPipeFileObject; + } + + public static NtNamedPipeFileBase GetNamedPipeServerObject(string i_NamedPipe, FileShareMode i_ShareMode, FileOpenOptions i_Options, FileAccessRights i_Access) + { + NtNamedPipeFileBase namedPipeFileObject = null; + + using (ObjectAttributes obj_attributes = new ObjectAttributes(i_NamedPipe)) + { + try + { + namedPipeFileObject = NtFile.CreateNamedPipe(obj_attributes, i_Access, i_ShareMode, i_Options, FileDisposition.Open, NamedPipeType.Bytestream, + NamedPipeReadMode.ByteStream, NamedPipeCompletionMode.CompleteOperation, 0, 0, 0, NtWaitTimeout.FromMilliseconds(0)); + + } + catch (Exception) + { + // In the future we can write to log + } + }; + + return namedPipeFileObject; + } + + + /* + * These permissions are based on tests we did on files + * https://learn.microsoft.com/en-us/windows/win32/secauthz/standard-access-rights + * https://blog.cjwdev.co.uk/2011/06/28/permissions-not-included-in-net-accessrule-filesystemrights-enum/ + * https://www.installsetupconfig.com/win32programming/accesscontrollistacl2_1.html + * https://superuser.com/questions/1752766/what-are-the-access-rules-of-standard-access-rights-and-object-specific-acces + * + Read: 00000000 00010010 00000000 10001001 : 00120089 + Read & Execute: 00000000 00010010 00000000 10101001 : 001200A9 + Write: 00000000 00010000 00000001 00010110 : 00100116 + Read & Write 00000000 00010010 00000001 10011111 : 0012019F + Read & Write & Execute 00000000 00010010 00000001 10111111 : 001201BF + Modify 00000000 00010011 00000001 10111111 : 001301BF + Full 00000000 00011111 00000001 11111111 : 001F01FF + + Read ("Traverse folder / execute", "List folder / Read data", + "Read Attribute", "Read Extended Attributes", "Read permissions") + + All advanced permissions separated: + List folder / Read data 00000000 00010000 00000000 00000001 : 00100001 -> R (accesschk.exe) + Read Attribute 00000000 00010000 00000000 10000000 : 00100080 -> no R (accesschk.exe) + Read Extended Attributes 00000000 00010000 00000000 00001000 : 00100008 -> no R (accesschk.exe) + Read permissions 00000000 00010010 00000000 00000000 : 00120000 -> no R (accesschk.exe) + Traverse folder / execute 00000000 00010000 00000000 00100000 : 00100020 -> R (accesschk.exe) + Create files / write data 00000000 00010000 00000000 00000010 : 00100002 -> W (accesschk.exe) + Create folders / append data 00000000 00010000 00000000 00000100 : 00100004 -> W (accesschk.exe) + Write attributes 00000000 00010000 00000001 00000000 : 00100100 -> no W (accesschk.exe) + Write Extended eattributes 00000000 00010000 00000000 00010000 : 00100010 -> no W (accesschk.exe) + Delete 00000000 00010001 00000000 00000000 : 00110000 -> W (accesschk.exe) + Change permissions 00000000 00010100 00000000 00000000 : 00140000 -> RW (accesschk.exe) + Change ownership 00000000 00011000 00000000 00000000 : 00180000 -> RW (accesschk.exe) + + + R ("List folder / Read data", "Traverse folder / execute") -> 00000000 00010000 00000000 00100001 : 0x100021 (bits 0, 5, and 20) + W ("Create files / write data", "Create folders / append data", "Delete") -> 00000000 00010001 00000000 00000110 : 0x110006 (bits 1, 2, 16, and 20) + RW ("Change permissions", "Change ownership") -> 00000000 00011100 00000000 00000000 : 0x1c0000 (bits 18, 19, and 20) + + * */ + enum PermissionsAccessMask + { + Read = 0x00120089, + ReadAndExecute = 0x001200A9, + Write = 0x00100116, + ReadWrite = 0x0012019F, + ReadWriteExecute = 0x001201BF, + Modify = 0x001301BF, + Full = 0x001F01FF, + ListFolderReadData = 0x00100001, + ReadAttribute = 0x00100080, + ReadExtendedAttributes = 0x00100008, + ReadPermissions = 0x00120000, + TraverseFolderExecute = 0x00100020, + CreateFilesWriteData = 0x00100002, + CreateFoldersAppendData = 0x00100004, + WriteAttributes = 0x00100100, + WriteExtendedAttributes = 0x00100010, + Delete = 0x00110000, + ChangePermissions = 0x00140000, + ChangeOwnership = 0x00180000 + } + + + public static string ConvertAccessMaskToSimplePermissions(uint i_AccessMask) + { + // Eviatar: Should we consider bit number 20 ? On files it always set to 1 but on named pipe it's not. + // We currently left it 0. + string permissions = ""; + + //byte[] byteArray = BitConverter.GetBytes(i_AccessMask); + byte[] binaryArray = Convert.ToString(i_AccessMask, 2) + .PadLeft(32, '0') + .Select(c => byte.Parse(c.ToString())) + .Reverse() + .ToArray(); + + if ((binaryArray[0] == 1 || binaryArray[5] == 1))// && binaryArray[20] == 1) + { + permissions += "R"; + } + + if ((binaryArray[1] == 1 || binaryArray[2] == 1 || binaryArray[16] == 1))// && binaryArray[20] == 1) + { + permissions += "W"; + } + + if ((binaryArray[18] == 1 || binaryArray[19] == 1) )//&& binaryArray[20] == 1) + { + permissions = "RW"; + } + + //uint readPermissions = ((uint)PermissionsAccessMask.ListFolderReadData | (uint)PermissionsAccessMask.TraverseFolderExecute) & i_AccessMask; + + return permissions; + } + + //public static NtFile CreateNamedPipe(string name, NtObject root, FileAccessRights desired_access, + // FileShareMode share_access, FileOpenOptions open_options, FileDisposition disposition, NamedPipeType pipe_type, + // NamedPipeReadMode read_mode, NamedPipeCompletionMode completion_mode, int maximum_instances, int input_quota, + // int output_quota, NtWaitTimeout default_timeout) + //{ + // using (ObjectAttributes obj_attributes = new ObjectAttributes(name, AttributeFlags.CaseInsensitive, root)) + // { + // return NtFile.CreateNamedPipe(obj_attributes, desired_access, share_access, open_options, disposition, pipe_type, + // read_mode, completion_mode, maximum_instances, input_quota, output_quota, default_timeout); + // } + //} + + } +} diff --git a/PipeViewer/Form1.Designer.cs b/PipeViewer/Form1.Designer.cs new file mode 100644 index 0000000..53af7bc --- /dev/null +++ b/PipeViewer/Form1.Designer.cs @@ -0,0 +1,503 @@ +namespace PipeViewer +{ + partial class Form1 + { + /// + /// 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(); + this.dataGridView1 = new System.Windows.Forms.DataGridView(); + this.menuStrip1 = new System.Windows.Forms.MenuStrip(); + this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.helpToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.aboutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.statusStrip1 = new System.Windows.Forms.StatusStrip(); + this.toolStripStatusLabelTotalNamedPipes = new System.Windows.Forms.ToolStripStatusLabel(); + this.toolStrip1 = new System.Windows.Forms.ToolStrip(); + this.toolStripButtonRefresh = new System.Windows.Forms.ToolStripButton(); + this.toolStripButtonClear = new System.Windows.Forms.ToolStripButton(); + this.toolStripButtonFilter = new System.Windows.Forms.ToolStripButton(); + this.toolStripButtonFind = new System.Windows.Forms.ToolStripButton(); + this.toolStripButtonHighLight = new System.Windows.Forms.ToolStripButton(); + this.toolStripButtonGrid = new System.Windows.Forms.ToolStripButton(); + this.hScrollBar1 = new System.Windows.Forms.HScrollBar(); + this.contextMenuStripRightClickGridView = new System.Windows.Forms.ContextMenuStrip(this.components); + this.copyRowToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.copyCellToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.saveToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.ColumnName = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.ColumnIntegrityLevel = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.ColumnPermissions = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.ColumnSddl = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.ColumnClientPID = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.ColumnPipeType = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.ColumnConfiguration = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.ColumnReadMode = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.ColumnNumberOfLinks = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.ColumnDirectoryGrantedAccess = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.ColumnGrantedAccess = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.ColumnGrantedAccessGeneric = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.ColumnCreationTime = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.ColumnOwnerSid = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.ColumnOwnerName = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.ColumnGroupSid = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.ColumnGroupName = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.ColumnEndPointType = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.ColumnHandle = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.ColumnFileCreationTime = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.ColumnLastAccessTime = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.ColumnLastWriteTime = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.ColumnChangeTime = new System.Windows.Forms.DataGridViewTextBoxColumn(); + ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit(); + this.menuStrip1.SuspendLayout(); + this.statusStrip1.SuspendLayout(); + this.toolStrip1.SuspendLayout(); + this.contextMenuStripRightClickGridView.SuspendLayout(); + this.SuspendLayout(); + // + // dataGridView1 + // + this.dataGridView1.AllowUserToAddRows = 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.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill; + this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; + this.dataGridView1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { + this.ColumnName, + this.ColumnIntegrityLevel, + this.ColumnPermissions, + this.ColumnSddl, + this.ColumnClientPID, + this.ColumnPipeType, + this.ColumnConfiguration, + this.ColumnReadMode, + this.ColumnNumberOfLinks, + this.ColumnDirectoryGrantedAccess, + this.ColumnGrantedAccess, + this.ColumnGrantedAccessGeneric, + this.ColumnCreationTime, + this.ColumnOwnerSid, + this.ColumnOwnerName, + this.ColumnGroupSid, + this.ColumnGroupName, + this.ColumnEndPointType, + this.ColumnHandle, + this.ColumnFileCreationTime, + this.ColumnLastAccessTime, + this.ColumnLastWriteTime, + this.ColumnChangeTime}); + this.dataGridView1.Location = new System.Drawing.Point(3, 52); + this.dataGridView1.Name = "dataGridView1"; + this.dataGridView1.ReadOnly = true; + this.dataGridView1.Size = new System.Drawing.Size(951, 400); + this.dataGridView1.TabIndex = 0; + this.dataGridView1.CellMouseClick += new System.Windows.Forms.DataGridViewCellMouseEventHandler(this.dataGridView1_CellMouseClick); + this.dataGridView1.ColumnHeaderMouseClick += new System.Windows.Forms.DataGridViewCellMouseEventHandler(this.dataGridView1_ColumnHeaderMouseClick); + // + // menuStrip1 + // + this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.fileToolStripMenuItem, + this.helpToolStripMenuItem}); + this.menuStrip1.Location = new System.Drawing.Point(0, 0); + this.menuStrip1.Name = "menuStrip1"; + this.menuStrip1.Size = new System.Drawing.Size(955, 24); + this.menuStrip1.TabIndex = 1; + this.menuStrip1.Text = "menuStrip1"; + // + // fileToolStripMenuItem + // + this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.saveToolStripMenuItem}); + this.fileToolStripMenuItem.Name = "fileToolStripMenuItem"; + this.fileToolStripMenuItem.Size = new System.Drawing.Size(37, 20); + this.fileToolStripMenuItem.Text = "File"; + // + // helpToolStripMenuItem + // + this.helpToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.aboutToolStripMenuItem}); + this.helpToolStripMenuItem.Name = "helpToolStripMenuItem"; + this.helpToolStripMenuItem.Size = new System.Drawing.Size(44, 20); + this.helpToolStripMenuItem.Text = "Help"; + // + // aboutToolStripMenuItem + // + this.aboutToolStripMenuItem.Name = "aboutToolStripMenuItem"; + this.aboutToolStripMenuItem.Size = new System.Drawing.Size(116, 22); + this.aboutToolStripMenuItem.Text = "About..."; + this.aboutToolStripMenuItem.Click += new System.EventHandler(this.aboutToolStripMenuItem_Click); + // + // statusStrip1 + // + this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.toolStripStatusLabelTotalNamedPipes}); + this.statusStrip1.Location = new System.Drawing.Point(0, 432); + this.statusStrip1.Name = "statusStrip1"; + this.statusStrip1.Size = new System.Drawing.Size(955, 22); + this.statusStrip1.TabIndex = 2; + this.statusStrip1.Text = "statusStrip1"; + // + // toolStripStatusLabelTotalNamedPipes + // + this.toolStripStatusLabelTotalNamedPipes.Name = "toolStripStatusLabelTotalNamedPipes"; + this.toolStripStatusLabelTotalNamedPipes.Size = new System.Drawing.Size(118, 17); + this.toolStripStatusLabelTotalNamedPipes.Text = "toolStripStatusLabel1"; + // + // toolStrip1 + // + this.toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.toolStripButtonRefresh, + this.toolStripButtonClear, + this.toolStripButtonFilter, + this.toolStripButtonFind, + this.toolStripButtonHighLight, + this.toolStripButtonGrid}); + this.toolStrip1.Location = new System.Drawing.Point(0, 24); + this.toolStrip1.Name = "toolStrip1"; + this.toolStrip1.Size = new System.Drawing.Size(955, 25); + this.toolStrip1.TabIndex = 3; + this.toolStrip1.Text = "toolStrip1"; + // + // toolStripButtonRefresh + // + this.toolStripButtonRefresh.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; + this.toolStripButtonRefresh.Image = global::PipeViewer.Properties.Resources.refresh; + this.toolStripButtonRefresh.ImageTransparentColor = System.Drawing.Color.Magenta; + this.toolStripButtonRefresh.Name = "toolStripButtonRefresh"; + this.toolStripButtonRefresh.Size = new System.Drawing.Size(23, 22); + this.toolStripButtonRefresh.Text = "Refresh"; + this.toolStripButtonRefresh.Click += new System.EventHandler(this.toolStripButtonRefresh_Click); + // + // toolStripButtonClear + // + this.toolStripButtonClear.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; + this.toolStripButtonClear.Image = global::PipeViewer.Properties.Resources.eraser; + this.toolStripButtonClear.ImageTransparentColor = System.Drawing.Color.Magenta; + this.toolStripButtonClear.Name = "toolStripButtonClear"; + this.toolStripButtonClear.Size = new System.Drawing.Size(23, 22); + this.toolStripButtonClear.Text = "Clear (Ctrl+X)"; + this.toolStripButtonClear.Click += new System.EventHandler(this.toolStripButtonClear_Click); + // + // toolStripButtonFilter + // + this.toolStripButtonFilter.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; + this.toolStripButtonFilter.Image = global::PipeViewer.Properties.Resources.filter; + this.toolStripButtonFilter.ImageTransparentColor = System.Drawing.Color.Magenta; + this.toolStripButtonFilter.Name = "toolStripButtonFilter"; + this.toolStripButtonFilter.Size = new System.Drawing.Size(23, 22); + this.toolStripButtonFilter.Text = "Filter (Ctrl+L)"; + this.toolStripButtonFilter.Click += new System.EventHandler(this.toolStripButtonFilter_Click); + // + // toolStripButtonFind + // + this.toolStripButtonFind.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; + this.toolStripButtonFind.Image = global::PipeViewer.Properties.Resources.find; + this.toolStripButtonFind.ImageTransparentColor = System.Drawing.Color.Magenta; + this.toolStripButtonFind.Name = "toolStripButtonFind"; + this.toolStripButtonFind.Size = new System.Drawing.Size(23, 22); + this.toolStripButtonFind.Text = "Find (Ctrl+F)"; + this.toolStripButtonFind.Click += new System.EventHandler(this.toolStripButtonFind_Click); + // + // toolStripButtonHighLight + // + this.toolStripButtonHighLight.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; + this.toolStripButtonHighLight.Image = global::PipeViewer.Properties.Resources.highlighter; + this.toolStripButtonHighLight.ImageTransparentColor = System.Drawing.Color.Magenta; + this.toolStripButtonHighLight.Name = "toolStripButtonHighLight"; + this.toolStripButtonHighLight.Size = new System.Drawing.Size(23, 22); + this.toolStripButtonHighLight.Text = "HighLight (Ctrk+H)"; + this.toolStripButtonHighLight.Click += new System.EventHandler(this.toolStripButtonHighLight_Click); + // + // toolStripButtonGrid + // + this.toolStripButtonGrid.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; + this.toolStripButtonGrid.Image = global::PipeViewer.Properties.Resources.grid_disable; + this.toolStripButtonGrid.ImageTransparentColor = System.Drawing.Color.Magenta; + this.toolStripButtonGrid.Name = "toolStripButtonGrid"; + this.toolStripButtonGrid.Size = new System.Drawing.Size(23, 22); + this.toolStripButtonGrid.Text = "Show Grid"; + this.toolStripButtonGrid.Click += new System.EventHandler(this.toolStripButtonGrid_Click); + // + // hScrollBar1 + // + this.hScrollBar1.Dock = System.Windows.Forms.DockStyle.Bottom; + this.hScrollBar1.Location = new System.Drawing.Point(0, 414); + this.hScrollBar1.Name = "hScrollBar1"; + this.hScrollBar1.Size = new System.Drawing.Size(955, 18); + this.hScrollBar1.TabIndex = 5; + this.hScrollBar1.Scroll += new System.Windows.Forms.ScrollEventHandler(this.hScrollBar1_Scroll); + // + // contextMenuStripRightClickGridView + // + this.contextMenuStripRightClickGridView.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.copyRowToolStripMenuItem, + this.copyCellToolStripMenuItem}); + this.contextMenuStripRightClickGridView.Name = "contextMenuStripRightClickGridView"; + this.contextMenuStripRightClickGridView.Size = new System.Drawing.Size(129, 48); + // + // copyRowToolStripMenuItem + // + this.copyRowToolStripMenuItem.Name = "copyRowToolStripMenuItem"; + this.copyRowToolStripMenuItem.Size = new System.Drawing.Size(128, 22); + this.copyRowToolStripMenuItem.Text = "Copy Row"; + this.copyRowToolStripMenuItem.Click += new System.EventHandler(this.copyRowToolStripMenuItem_Click); + // + // copyCellToolStripMenuItem + // + this.copyCellToolStripMenuItem.Name = "copyCellToolStripMenuItem"; + this.copyCellToolStripMenuItem.Size = new System.Drawing.Size(128, 22); + this.copyCellToolStripMenuItem.Text = "Copy Cell"; + this.copyCellToolStripMenuItem.Click += new System.EventHandler(this.copyCellToolStripMenuItem_Click); + // + // saveToolStripMenuItem + // + this.saveToolStripMenuItem.Name = "saveToolStripMenuItem"; + this.saveToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.saveToolStripMenuItem.Text = "Save..."; + this.saveToolStripMenuItem.Click += new System.EventHandler(this.saveToolStripMenuItem_Click); + // + // ColumnName + // + this.ColumnName.HeaderText = "Name"; + this.ColumnName.Name = "ColumnName"; + this.ColumnName.ReadOnly = true; + // + // ColumnIntegrityLevel + // + this.ColumnIntegrityLevel.HeaderText = "Integrity Level"; + this.ColumnIntegrityLevel.Name = "ColumnIntegrityLevel"; + this.ColumnIntegrityLevel.ReadOnly = true; + // + // ColumnPermissions + // + this.ColumnPermissions.HeaderText = "Permissions"; + this.ColumnPermissions.Name = "ColumnPermissions"; + this.ColumnPermissions.ReadOnly = true; + // + // ColumnSddl + // + this.ColumnSddl.HeaderText = "Sddl"; + this.ColumnSddl.Name = "ColumnSddl"; + this.ColumnSddl.ReadOnly = true; + this.ColumnSddl.Visible = false; + // + // ColumnClientPID + // + this.ColumnClientPID.HeaderText = "Client PIDs"; + this.ColumnClientPID.Name = "ColumnClientPID"; + this.ColumnClientPID.ReadOnly = true; + // + // ColumnPipeType + // + this.ColumnPipeType.HeaderText = "Pipe Type"; + this.ColumnPipeType.Name = "ColumnPipeType"; + this.ColumnPipeType.ReadOnly = true; + // + // ColumnConfiguration + // + this.ColumnConfiguration.HeaderText = "Configuration"; + this.ColumnConfiguration.Name = "ColumnConfiguration"; + this.ColumnConfiguration.ReadOnly = true; + // + // ColumnReadMode + // + this.ColumnReadMode.HeaderText = "Read Mode"; + this.ColumnReadMode.Name = "ColumnReadMode"; + this.ColumnReadMode.ReadOnly = true; + // + // ColumnNumberOfLinks + // + this.ColumnNumberOfLinks.HeaderText = "Number of Links"; + this.ColumnNumberOfLinks.Name = "ColumnNumberOfLinks"; + this.ColumnNumberOfLinks.ReadOnly = true; + // + // ColumnDirectoryGrantedAccess + // + this.ColumnDirectoryGrantedAccess.HeaderText = "Directory Granted Access"; + this.ColumnDirectoryGrantedAccess.Name = "ColumnDirectoryGrantedAccess"; + this.ColumnDirectoryGrantedAccess.ReadOnly = true; + // + // ColumnGrantedAccess + // + this.ColumnGrantedAccess.HeaderText = "Granted Access"; + this.ColumnGrantedAccess.Name = "ColumnGrantedAccess"; + this.ColumnGrantedAccess.ReadOnly = true; + // + // ColumnGrantedAccessGeneric + // + this.ColumnGrantedAccessGeneric.HeaderText = "Granted Access Generic"; + this.ColumnGrantedAccessGeneric.Name = "ColumnGrantedAccessGeneric"; + this.ColumnGrantedAccessGeneric.ReadOnly = true; + // + // ColumnCreationTime + // + this.ColumnCreationTime.HeaderText = "Creation Time"; + this.ColumnCreationTime.Name = "ColumnCreationTime"; + this.ColumnCreationTime.ReadOnly = true; + // + // ColumnOwnerSid + // + this.ColumnOwnerSid.HeaderText = "Owner Sid"; + this.ColumnOwnerSid.Name = "ColumnOwnerSid"; + this.ColumnOwnerSid.ReadOnly = true; + this.ColumnOwnerSid.Visible = false; + // + // ColumnOwnerName + // + this.ColumnOwnerName.HeaderText = "Owner Name"; + this.ColumnOwnerName.Name = "ColumnOwnerName"; + this.ColumnOwnerName.ReadOnly = true; + // + // ColumnGroupSid + // + this.ColumnGroupSid.HeaderText = "Group Sid"; + this.ColumnGroupSid.Name = "ColumnGroupSid"; + this.ColumnGroupSid.ReadOnly = true; + this.ColumnGroupSid.Visible = false; + // + // ColumnGroupName + // + this.ColumnGroupName.HeaderText = "Group Name"; + this.ColumnGroupName.Name = "ColumnGroupName"; + this.ColumnGroupName.ReadOnly = true; + this.ColumnGroupName.Visible = false; + // + // ColumnEndPointType + // + this.ColumnEndPointType.HeaderText = "Endpoint Type"; + this.ColumnEndPointType.Name = "ColumnEndPointType"; + this.ColumnEndPointType.ReadOnly = true; + // + // ColumnHandle + // + this.ColumnHandle.HeaderText = "Handle"; + this.ColumnHandle.Name = "ColumnHandle"; + this.ColumnHandle.ReadOnly = true; + // + // ColumnFileCreationTime + // + this.ColumnFileCreationTime.HeaderText = "File Creation Time"; + this.ColumnFileCreationTime.Name = "ColumnFileCreationTime"; + this.ColumnFileCreationTime.ReadOnly = true; + this.ColumnFileCreationTime.Visible = false; + // + // ColumnLastAccessTime + // + this.ColumnLastAccessTime.HeaderText = "Last Access Time"; + this.ColumnLastAccessTime.Name = "ColumnLastAccessTime"; + this.ColumnLastAccessTime.ReadOnly = true; + this.ColumnLastAccessTime.Visible = false; + // + // ColumnLastWriteTime + // + this.ColumnLastWriteTime.HeaderText = "Last Write Time"; + this.ColumnLastWriteTime.Name = "ColumnLastWriteTime"; + this.ColumnLastWriteTime.ReadOnly = true; + this.ColumnLastWriteTime.Visible = false; + // + // ColumnChangeTime + // + this.ColumnChangeTime.HeaderText = "Change Time"; + this.ColumnChangeTime.Name = "ColumnChangeTime"; + this.ColumnChangeTime.ReadOnly = true; + this.ColumnChangeTime.Visible = false; + // + // Form1 + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(955, 454); + this.Controls.Add(this.hScrollBar1); + this.Controls.Add(this.toolStrip1); + this.Controls.Add(this.statusStrip1); + this.Controls.Add(this.dataGridView1); + this.Controls.Add(this.menuStrip1); + this.MainMenuStrip = this.menuStrip1; + this.Name = "Form1"; + this.ShowIcon = false; + this.Text = "PipeViewer"; + ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit(); + this.menuStrip1.ResumeLayout(false); + this.menuStrip1.PerformLayout(); + this.statusStrip1.ResumeLayout(false); + this.statusStrip1.PerformLayout(); + this.toolStrip1.ResumeLayout(false); + this.toolStrip1.PerformLayout(); + this.contextMenuStripRightClickGridView.ResumeLayout(false); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.DataGridView dataGridView1; + private System.Windows.Forms.MenuStrip menuStrip1; + private System.Windows.Forms.ToolStripMenuItem fileToolStripMenuItem; + private System.Windows.Forms.StatusStrip statusStrip1; + private System.Windows.Forms.ToolStrip toolStrip1; + private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabelTotalNamedPipes; + private System.Windows.Forms.ToolStripButton toolStripButtonClear; + private System.Windows.Forms.ToolStripButton toolStripButtonFilter; + private System.Windows.Forms.ToolStripButton toolStripButtonFind; + private System.Windows.Forms.ToolStripButton toolStripButtonHighLight; + private System.Windows.Forms.ToolStripButton toolStripButtonGrid; + private System.Windows.Forms.ToolStripButton toolStripButtonRefresh; + private System.Windows.Forms.HScrollBar hScrollBar1; + private System.Windows.Forms.ToolStripMenuItem helpToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem aboutToolStripMenuItem; + private System.Windows.Forms.ContextMenuStrip contextMenuStripRightClickGridView; + private System.Windows.Forms.ToolStripMenuItem copyRowToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem copyCellToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem saveToolStripMenuItem; + private System.Windows.Forms.DataGridViewTextBoxColumn ColumnName; + private System.Windows.Forms.DataGridViewTextBoxColumn ColumnIntegrityLevel; + private System.Windows.Forms.DataGridViewTextBoxColumn ColumnPermissions; + private System.Windows.Forms.DataGridViewTextBoxColumn ColumnSddl; + private System.Windows.Forms.DataGridViewTextBoxColumn ColumnClientPID; + private System.Windows.Forms.DataGridViewTextBoxColumn ColumnPipeType; + private System.Windows.Forms.DataGridViewTextBoxColumn ColumnConfiguration; + private System.Windows.Forms.DataGridViewTextBoxColumn ColumnReadMode; + private System.Windows.Forms.DataGridViewTextBoxColumn ColumnNumberOfLinks; + private System.Windows.Forms.DataGridViewTextBoxColumn ColumnDirectoryGrantedAccess; + private System.Windows.Forms.DataGridViewTextBoxColumn ColumnGrantedAccess; + private System.Windows.Forms.DataGridViewTextBoxColumn ColumnGrantedAccessGeneric; + private System.Windows.Forms.DataGridViewTextBoxColumn ColumnCreationTime; + private System.Windows.Forms.DataGridViewTextBoxColumn ColumnOwnerSid; + private System.Windows.Forms.DataGridViewTextBoxColumn ColumnOwnerName; + private System.Windows.Forms.DataGridViewTextBoxColumn ColumnGroupSid; + private System.Windows.Forms.DataGridViewTextBoxColumn ColumnGroupName; + private System.Windows.Forms.DataGridViewTextBoxColumn ColumnEndPointType; + private System.Windows.Forms.DataGridViewTextBoxColumn ColumnHandle; + private System.Windows.Forms.DataGridViewTextBoxColumn ColumnFileCreationTime; + private System.Windows.Forms.DataGridViewTextBoxColumn ColumnLastAccessTime; + private System.Windows.Forms.DataGridViewTextBoxColumn ColumnLastWriteTime; + private System.Windows.Forms.DataGridViewTextBoxColumn ColumnChangeTime; + } +} + diff --git a/PipeViewer/Form1.cs b/PipeViewer/Form1.cs new file mode 100644 index 0000000..562c038 --- /dev/null +++ b/PipeViewer/Form1.cs @@ -0,0 +1,909 @@ +using System; +using System.Collections.Generic; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Reflection; +using System.Threading.Tasks; +using System.Windows.Forms; +using PipeViewer.Control; +using NtApiDotNet; +using System.Runtime.InteropServices; +using NamePipeViewer; +using System.IO.Pipes; +using System.IO; +using System.Security.AccessControl; +using System.Diagnostics; + +namespace PipeViewer +{ + public partial class Form1 : Form + { + + private int m_NamedPipesNumber; + private ListView m_LastListViewColumnFilter = new ListView(); + private ListView m_LastListViewHighlighFilter = new ListView(); + private const int SW_SHOW = 5; + private const uint SEE_MASK_INVOKEIDLIST = 12; + private string m_LastSearchValue; + private bool m_IsGridButtonPressed = false; + private static Dictionary m_ColumnIndexes = new Dictionary(); + private static Dictionary m_ProcessPIDsDictionary = new Dictionary(); + int m_CurrentRowIndexRightClick, m_CurrentColumnIndexRightClick; + private IDictionary> m_IncludeFilterDict = new Dictionary>(); + private IDictionary> m_ExcludeFilterDict = new Dictionary>(); + private IDictionary> m_IncludeHighlightDict = new Dictionary>(); + private IDictionary> m_ExcludeHighlightDict = new Dictionary>(); + + // https://stackoverflow.com/questions/1936682/how-do-i-display-a-files-properties-dialog-from-c + // https://stackoverflow.com/a/32503655/2153777 + // https://stackoverflow.com/a/28297300/2153777 + [DllImport("shell32.dll", CharSet = CharSet.Auto)] + static extern bool ShellExecuteEx(ref SHELLEXECUTEINFO lpExecInfo); + + [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] + public struct SHELLEXECUTEINFO + { + public int cbSize; + public uint fMask; + public IntPtr hwnd; + [MarshalAs(UnmanagedType.LPTStr)] + public string lpVerb; + [MarshalAs(UnmanagedType.LPTStr)] + public string lpFile; + [MarshalAs(UnmanagedType.LPTStr)] + public string lpParameters; + [MarshalAs(UnmanagedType.LPTStr)] + public string lpDirectory; + public int nShow; + public IntPtr hInstApp; + public IntPtr lpIDList; + [MarshalAs(UnmanagedType.LPTStr)] + public string lpClass; + public IntPtr hkeyClass; + public uint dwHotKey; + public IntPtr hIcon; + public IntPtr hProcess; + } + + + public static bool ShowFileProperties(string Filename) + { + SHELLEXECUTEINFO info = new SHELLEXECUTEINFO(); + info.cbSize = System.Runtime.InteropServices.Marshal.SizeOf(info); + info.lpVerb = "properties"; + info.lpFile = Filename; + info.nShow = SW_SHOW; + info.fMask = SEE_MASK_INVOKEIDLIST; + info.lpParameters = "Security"; + return ShellExecuteEx(ref info); + } + + public Form1() + { + InitializeComponent(); + InitalizeColumnsHeaderDictionary(); + + typeof(DataGridView).InvokeMember( + "DoubleBuffered", + BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.SetProperty, + null, + dataGridView1, + new object[] { true }); + + + //dummRowsForDebug(); + //dummyLoopRowsForDebug(); + // Task.Run(() => dummyLoopRowsForDebug()); + Task.Run(() => InitializePipeListWithProcesses()); + + //Thread t = new Thread(new ThreadStart(InitializePipeListWithProcesses)); + //t.Start(); + } + + + + //private delegate void InitializePipeListWithProcessesCallBack(); + //private void InitializePipeListWithProcesses() + //{ + // if (this.InvokeRequired) + // { + // InitializePipeListWithProcessesCallBack s = new InitializePipeListWithProcessesCallBack(InitializePipeListWithProcesses); + // this.Invoke(s); + // } + // else + // { + // Process[] processCollection = Process.GetProcesses(); + // foreach (Process p in processCollection) + // { + // m_ProcessPIDsDictionary.Add(p.Id, p.ProcessName); + // } + + // initializePipeList(); + // } + //} + + private void InitializePipeListWithProcesses() + { + Process[] processCollection = Process.GetProcesses(); + foreach (Process p in processCollection) + { + m_ProcessPIDsDictionary.Add(p.Id, p.ProcessName); + } + + initializePipeList(); + } + + private delegate void addNamedPipeToDataGridViewCallBack(string i_NamedPipe); + + private void InitalizeColumnsHeaderDictionary() + { + // Populate the dictionary with the column header text and its index + for (int i = 0; i < dataGridView1.Columns.Count; i++) + { + m_ColumnIndexes[dataGridView1.Columns[i].HeaderText] = i; + } + } + + private void initializePipeList() + { + String[] listOfPipes = System.IO.Directory.GetFiles(@"\\.\pipe\"); + foreach (var namedPipe in listOfPipes) + { + addNamedPipeToDataGridView(namedPipe); + } + } + + //private delegate void initializePipeListCallBack(); + //private void initializePipeList() + //{ + // if (this.InvokeRequired) + // { + // initializePipeListCallBack s = new initializePipeListCallBack(initializePipeList); + // this.Invoke(s); + // }else + // { + // String[] listOfPipes = System.IO.Directory.GetFiles(@"\\.\pipe\"); + // foreach (var namedPipe in listOfPipes) + // { + // addNamedPipeToDataGridView(namedPipe); + // } + // } + //} + + // https://blog.cjwdev.co.uk/2011/06/28/permissions-not-included-in-net-accessrule-filesystemrights-enum/ + private void addNamedPipeToDataGridView(string i_NamedPipe) + { + //i_NamedPipe = @"\\.\pipe\MyPipe"; + string permissions; + if (this.InvokeRequired) + { + addNamedPipeToDataGridViewCallBack s = new addNamedPipeToDataGridViewCallBack(addNamedPipeToDataGridView); + this.Invoke(s, i_NamedPipe); + } + else + { + DataGridViewRow row = new DataGridViewRow(); + row.CreateCells(dataGridView1); + row.Cells[m_ColumnIndexes[ColumnName.HeaderText]].Value = i_NamedPipe; + + row.DefaultCellStyle.Font = new Font(dataGridView1.DefaultCellStyle.Font, FontStyle.Regular); + NtNamedPipeFileBase namedPipeObject = Engine.GetNamedPipeObject(i_NamedPipe, Engine.NamedPipeFunctionEndType.Client); + if (namedPipeObject == null) + { + namedPipeObject = Engine.GetNamedPipeObject(i_NamedPipe, Engine.NamedPipeFunctionEndType.Server); + } + + // NtNamedPipeFileBase namedPipeObjectClient = Engine.GetNamedPipeClientObject(i_NamedPipe); + // We added a check for empty name because it caused an exception with named pipe \\.\pipe\dbxsvc which wasn't NULL + // but add partial value exist on one machine. + + // We added try\catch because one specific bug with \\.\pipe\dbxsvc (DropBox). Maybe there is a better way to handle it? + try + { + if (namedPipeObject != null) + { + row.Cells[m_ColumnIndexes[ColumnSddl.HeaderText]].Value = namedPipeObject.Sddl; + + if (namedPipeObject.SecurityDescriptor.Dacl.Count != 0) + { + permissions = ""; + foreach (Ace dacl in namedPipeObject.SecurityDescriptor.Dacl) + { + permissions += dacl.Type.ToString() + " "; + permissions += Engine.ConvertAccessMaskToSimplePermissions(dacl.Mask.Access); + permissions += " " + dacl.Sid.Name + "; \n"; + } + + row.Cells[m_ColumnIndexes[ColumnPermissions.HeaderText]].Value = permissions; + } + + row.Cells[m_ColumnIndexes[ColumnOwnerSid.HeaderText]].Value = namedPipeObject.SecurityDescriptor.Owner.Sid.ToString(); + row.Cells[m_ColumnIndexes[ColumnOwnerName.HeaderText]].Value = namedPipeObject.SecurityDescriptor.Owner.Sid.Name; + row.Cells[m_ColumnIndexes[ColumnGroupSid.HeaderText]].Value = namedPipeObject.SecurityDescriptor.Group.Sid.ToString(); + row.Cells[m_ColumnIndexes[ColumnGroupName.HeaderText]].Value = namedPipeObject.SecurityDescriptor.Group.Sid.Name; + row.Cells[m_ColumnIndexes[ColumnIntegrityLevel.HeaderText]].Value = namedPipeObject.SecurityDescriptor.IntegrityLevel; + row.Cells[m_ColumnIndexes[ColumnEndPointType.HeaderText]].Value = namedPipeObject.EndPointType; + row.Cells[m_ColumnIndexes[ColumnConfiguration.HeaderText]].Value = namedPipeObject.Configuration; + + row.Cells[m_ColumnIndexes[ColumnClientPID.HeaderText]].Value = getProcessNameWithProcessPIDs(namedPipeObject); + row.Cells[m_ColumnIndexes[ColumnPipeType.HeaderText]].Value = namedPipeObject.PipeType; + row.Cells[m_ColumnIndexes[ColumnReadMode.HeaderText]].Value = namedPipeObject.ReadMode; + row.Cells[m_ColumnIndexes[ColumnNumberOfLinks.HeaderText]].Value = namedPipeObject.NumberOfLinks; + row.Cells[m_ColumnIndexes[ColumnDirectoryGrantedAccess.HeaderText]].Value = namedPipeObject.DirectoryGrantedAccess; + row.Cells[m_ColumnIndexes[ColumnGrantedAccess.HeaderText]].Value = namedPipeObject.GrantedAccess; + row.Cells[m_ColumnIndexes[ColumnGrantedAccessGeneric.HeaderText]].Value = namedPipeObject.GrantedAccessGeneric; + + row.Cells[m_ColumnIndexes[ColumnHandle.HeaderText]].Value = namedPipeObject.Handle.ToString(); + row.Cells[m_ColumnIndexes[ColumnCreationTime.HeaderText]].Value = namedPipeObject.CreationTime; + row.Cells[m_ColumnIndexes[ColumnFileCreationTime.HeaderText]].Value = namedPipeObject.FileCreationTime; + row.Cells[m_ColumnIndexes[ColumnLastAccessTime.HeaderText]].Value = namedPipeObject.LastAccessTime; + row.Cells[m_ColumnIndexes[ColumnLastWriteTime.HeaderText]].Value = namedPipeObject.LastWriteTime; + row.Cells[m_ColumnIndexes[ColumnChangeTime.HeaderText]].Value = namedPipeObject.ChangeTime; + + } + } + catch (Exception) + { + + throw; + } + + + dataGridView1.Rows.Add(row); + this.m_NamedPipesNumber += 1; + this.toolStripStatusLabelTotalNamedPipes.Text = "Total Named Pipes: " + this.m_NamedPipesNumber; + } + } + + private string getProcessNameWithProcessPIDs(NtNamedPipeFileBase i_NamedPipe) + { + var processNames = i_NamedPipe.GetUsingProcessIds() + .Select(pid => + { + if (m_ProcessPIDsDictionary.TryGetValue(pid, out string processName)) + { + return processName + " ("+ pid.ToString() + ")"; + } + else + { + try + { + using (var p = Process.GetProcessById(pid)) + { + m_ProcessPIDsDictionary.Add(p.Id, p.ProcessName); + return p.ProcessName + " (" + pid.ToString() + ")"; + } + } + catch + { + m_ProcessPIDsDictionary.Add(pid, ""); + return "" + "(" + pid.ToString() + ")"; + } + } + }); + + return string.Join("; ", processNames.Select(nameAndPid => nameAndPid)); + } + + + //private string getProcessNameWithProcessPIDs(NtNamedPipeFileBase i_NamedPipe) + //{ + // string clientPids = ""; + // foreach (int pid in i_NamedPipe.GetUsingProcessIds()) + // { + + // if (m_ProcessPIDsDictionary.ContainsKey(pid)) + // { + // clientPids += m_ProcessPIDsDictionary[pid] + " (" + pid.ToString() + "); "; + // } + // else + // { + // try + // { + // using (var p = Process.GetProcessById(pid)) + // { + // clientPids += p.ProcessName + " (" + pid.ToString() + "); "; + // m_ProcessPIDsDictionary.Add(p.Id, p.ProcessName); + // } + // } + // catch + // { + // clientPids += "" + " (" + pid.ToString() + "); "; + // m_ProcessPIDsDictionary.Add(pid, ""); + // } + // } + // } + + // return clientPids; + //} + + // TODO: For testing right click on named pipe and display permissions + //private void button1_Click(object sender, EventArgs e) + //{ + // string path = @"\\.\pipe\InitShutdown"; + // //path = @"\Device\NamedPipe\InitShutdown"; + // //path = @"C:\tmp"; + // //ShowFileProperties(path); + // PermissionDialog.Show(IntPtr.Zero, path); + //} + + private void toolStripButtonClear_Click(object sender, EventArgs e) + { + dataGridView1.Rows.Clear(); + dataGridView1.Refresh(); + m_NamedPipesNumber = 0; + toolStripStatusLabelTotalNamedPipes.Text = "Total Named Pipes: 0"; + } + + private void toolStripButtonGrid_Click(object sender, EventArgs e) + { + if (!m_IsGridButtonPressed) + { + toolStripButtonGrid.Image = global::PipeViewer.Properties.Resources.grid; + m_IsGridButtonPressed = true; + this.dataGridView1.AdvancedCellBorderStyle.All = DataGridViewAdvancedCellBorderStyle.None; + + } + else + { + toolStripButtonGrid.Image = global::PipeViewer.Properties.Resources.grid_disable; + m_IsGridButtonPressed = false; + this.dataGridView1.AdvancedCellBorderStyle.All = DataGridViewAdvancedCellBorderStyle.Single; + } + } + + private void toolStripButtonFind_Click(object sender, EventArgs e) + { + openFindWindow(); + } + + protected override bool ProcessCmdKey(ref Message msg, Keys keyData) + { + bool result = false; + + if (keyData == (Keys.Control | Keys.L)) + { + openColumnFilterWindow(); + result = true; + } + else if (keyData == (Keys.Control | Keys.B)) + { + Font boldFont = new Font(dataGridView1.DefaultCellStyle.Font, FontStyle.Bold); + Font font = new Font(dataGridView1.DefaultCellStyle.Font, FontStyle.Regular); + + foreach (DataGridViewCell cell in dataGridView1.SelectedCells) + { + + if (!dataGridView1.Rows[cell.RowIndex].DefaultCellStyle.Font.Bold) + { + font = boldFont; + } + + dataGridView1.Rows[cell.RowIndex].DefaultCellStyle.Font = font; + } + + foreach (DataGridViewRow selectedRow in dataGridView1.SelectedRows) + { + + if (!selectedRow.DefaultCellStyle.Font.Bold) + { + font = boldFont; + } + + dataGridView1.Rows[selectedRow.Index].DefaultCellStyle.Font = font; + + } + result = true; + } + else if (keyData == (Keys.Control | Keys.F)) + { + openFindWindow(); + result = true; + } + else if (keyData == (Keys.Control | Keys.H)) + { + openHighlightWindows(); + result = true; + } + else if (keyData == (Keys.F3)) + { + // We need to implement the options for the search + FindWindow_searchForMatch(m_LastSearchValue, true, false, false); + } + else if (keyData == (Keys.Shift | Keys.F3)) + { + // We need to implement the options for the search + FindWindow_searchForMatch(m_LastSearchValue, false, false, false); + } + + return result; + } + + private void toolStripButtonRefresh_Click(object sender, EventArgs e) + { + dataGridView1.Rows.Clear(); + dataGridView1.Refresh(); + m_NamedPipesNumber = 0; + Task.Run(() => initializePipeList()); + } + + private void openFindWindow() + { + FormSearch findWindow = new FormSearch(); + findWindow.searchForMatch += new FormSearch.searchEventHandler(FindWindow_searchForMatch); + findWindow.ShowDialog(); + } + + private void FindWindow_searchForMatch(string i_SearchString, bool i_SearchDown, bool i_MatchWholeWord, bool i_MatchSensitive) + { + int startIndex = 0; + m_LastSearchValue = i_SearchString; + bool foundMatch = false; + int step = 1; + if (!i_SearchDown) + { + step = -1; + } + + if (dataGridView1.SelectedRows != null && dataGridView1.SelectedRows.Count > 0) + { + DataGridViewRow selectedRow = dataGridView1.SelectedRows[0]; + startIndex = selectedRow.Index; + } + + if (dataGridView1.SelectedCells != null && dataGridView1.SelectedCells.Count > 0) + { + DataGridViewCell selectedCell = dataGridView1.SelectedCells[0]; + startIndex = selectedCell.RowIndex; + } + + startIndex += step; + for (int i = startIndex; i < dataGridView1.Rows.Count; i += step) + { + + if (i < 0) + { + break; + } + + foreach (DataGridViewCell cell in dataGridView1.Rows[i].Cells) + { + // TODO: Add support in Case Sensitive, replicate to RPCMon. + if (dataGridView1.Rows[i].Visible && cell.Value != null && cell.Value.ToString().ToLower().Contains(i_SearchString.ToLower())) + { + cleanAllSelectedCells(); + dataGridView1.Rows[i].Selected = true; + foundMatch = true; + dataGridView1.CurrentCell = dataGridView1.Rows[i].Cells[0]; + break; + } + } + + if (foundMatch) + { + break; + } + + } + + if (!foundMatch) + { + MessageBox.Show(string.Format("Cannot find string \"{0}\"", i_SearchString), "PipeViewer", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); + } + } + + private void cleanAllSelectedCells() + { + for (int i = 0; i < dataGridView1.SelectedCells.Count; i++) + { + dataGridView1.SelectedCells[i].Selected = false; + } + } + + private void openColumnSelectionWindow() + { + ColumnSelection columnSelection = new ColumnSelection(dataGridView1); + columnSelection.selectColumnsUpdate += new selectColumnsEventHandler(this.ColumnSelection_selectColumnsUpdate); + columnSelection.ShowDialog(); + } + + private void ColumnSelection_selectColumnsUpdate(GroupBox i_NamedPipe, GroupBox i_Access, GroupBox i_SecurityDescriptor, GroupBox i_TimeStamp) + { + foreach (DataGridViewColumn column in dataGridView1.Columns) + { + modifyColumnSelection(column, i_NamedPipe); + modifyColumnSelection(column, i_Access); + modifyColumnSelection(column, i_SecurityDescriptor); + modifyColumnSelection(column, i_TimeStamp); + } + } + + private void modifyColumnSelection(DataGridViewColumn i_Column, GroupBox i_GroupBox) + { + foreach (CheckBox checkBox in i_GroupBox.Controls) + { + if (checkBox.Text == i_Column.HeaderText) + { + if (checkBox.Checked) + { + dataGridView1.Columns[i_Column.Index].Visible = true; + } + else + { + dataGridView1.Columns[i_Column.Index].Visible = false; + } + } + } + } + + private void dataGridView1_ColumnHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e) + { + if (e.Button == System.Windows.Forms.MouseButtons.Right) + { + openColumnSelectionWindow(); + } + } + + private void hScrollBar1_Scroll(object sender, ScrollEventArgs e) + { + // TODO: Whenimplement... + } + + #region Column Filter + + private void toolStripButtonFilter_Click(object sender, EventArgs e) + { + openColumnFilterWindow(); + } + + private void openColumnFilterWindow() + { + FormColumnFilter columnFilter = new FormColumnFilter(ref m_LastListViewColumnFilter); + columnFilter.FilterOKUpdate += new FilterOKEventHandler(ColumnFilter_OKFilter); + columnFilter.ShowDialog(); + } + + private void openHighlightWindows() + { + FormHighlighting hightlightWindow = new FormHighlighting(ref m_LastListViewHighlighFilter); + hightlightWindow.hightlightRowsUpdate += HightlightWindow_hightlightRowsUpdate; + hightlightWindow.ShowDialog(); + } + + private void HightlightWindow_hightlightRowsUpdate(ListView i_ListView) + { + m_LastListViewHighlighFilter = i_ListView; + updateFilterDicts(i_ListView, Utils.eFormNames.FormHighlighFilter); + if (m_IncludeHighlightDict.Count.Equals(0)) + { + foreach (DataGridViewRow row in this.dataGridView1.Rows) + { + this.dataGridView1.Rows[row.Index].DefaultCellStyle.BackColor = Color.White; + } + return; + } + filterRowsByFilterRules(Utils.eFormNames.FormHighlighFilter); + } + + private void ColumnFilter_OKFilter(ListView i_ListView) + { + m_LastListViewColumnFilter = i_ListView; + updateFilterDicts(i_ListView, Utils.eFormNames.FormColumnFilter); + if (m_IncludeFilterDict.Count.Equals(0)) + { + foreach (DataGridViewRow row in this.dataGridView1.Rows) + { + row.Visible = true; + } + } + filterRowsByFilterRules(Utils.eFormNames.FormColumnFilter); + } + + private void filterRowsByFilterRules(Utils.eFormNames i_FormName) + { + + // TODO: What happens if one row is already Filtered\Highlight? It will hide it. Need to fix it + // so there will be OR between the rules + foreach (DataGridViewRow row in this.dataGridView1.Rows) + { + filterSingleRowByFilterRules(i_FormName, row); + } + } + + private void filterSingleRowByFilterRules(Utils.eFormNames i_FormName, DataGridViewRow row) + { + if (i_FormName == Utils.eFormNames.FormColumnFilter) + { + filterRow(i_FormName, row, m_IncludeFilterDict, m_ExcludeFilterDict); + } + else + { + filterRow(i_FormName, row, m_IncludeHighlightDict, m_ExcludeHighlightDict); + } + } + private void filterRow(Utils.eFormNames i_FormName, DataGridViewRow row, IDictionary> includeDict, IDictionary> excludeDict) + { + bool visable = false; + foreach (var pair in excludeDict) + { + foreach (var rule in pair.Value) + { + if (checkIfShouldBeVisable(rule, row, pair.Key)) + { + hideFilterRowBasedOnForm(i_FormName, row.Index); + return; + } + } + } + if (!excludeDict.Count.Equals(0)) + { + filterRowBasedOnForm(i_FormName, row.Index, "Include"); + } + + + foreach (var pair in includeDict) + { + foreach (var rule in pair.Value) + { + if (checkIfShouldBeVisable(rule, row, pair.Key)) + { + visable = true; + break; + } + } + if (!visable) + { + hideFilterRowBasedOnForm(i_FormName, row.Index); + return; + } + visable = false; + } + if (!includeDict.Count.Equals(0)) + { + filterRowBasedOnForm(i_FormName, row.Index, "Include"); + } + } + + private bool checkIfShouldBeVisable(ListViewItem rule, DataGridViewRow row, String key) + { + DataGridViewCell cellValueFromGridViewCell = row.Cells["Column" + rule.SubItems[0].Text]; + string valueFromFilter = rule.SubItems[(int)Utils.eFilterNames.Value].Text; + if (rule.SubItems[(int)Utils.eFilterNames.Relation].Text == "contains") + { + if (row.Cells["Column" + key].Value != null && row.Cells["Column" + key].Value.ToString().Contains(rule.SubItems[(int)Utils.eFilterNames.Value].Text)) + { + if (cellValueFromGridViewCell.Value.ToString().Contains(valueFromFilter)) + { + return true; + } + } + } + else if (rule.SubItems[(int)Utils.eFilterNames.Relation].Text == "is") + { + if (cellValueFromGridViewCell.Value.ToString() == valueFromFilter) + { + return true; + } + } + else if (rule.SubItems[(int)Utils.eFilterNames.Relation].Text == "begins with") + { + if (cellValueFromGridViewCell.Value.ToString().StartsWith(valueFromFilter)) + { + return true; + } + } + else if (rule.SubItems[(int)Utils.eFilterNames.Relation].Text == "ends with") + { + + if (cellValueFromGridViewCell.Value.ToString().EndsWith(valueFromFilter)) + { + return true; + } + } + return false; + } + + private void updateFilterDicts(ListView i_ListView, Utils.eFormNames i_FormName) + { + if (i_FormName == Utils.eFormNames.FormColumnFilter) + { + m_IncludeFilterDict.Clear(); + m_ExcludeFilterDict.Clear(); + } + else + { + m_IncludeHighlightDict.Clear(); + m_ExcludeHighlightDict.Clear(); + } + foreach (ListViewItem rule in i_ListView.Items) + { + if (rule.Checked) + { + addItemToFilterDict(rule, rule.SubItems[(int)Utils.eFilterNames.Action].Text == "Exclude", i_FormName); + } + } + } + + private void addItemToFilterDict(ListViewItem rule, bool addToExcludeList, Utils.eFormNames i_FormName) + { + if (i_FormName == Utils.eFormNames.FormColumnFilter) + { + if (addToExcludeList) + { + if (!m_ExcludeFilterDict.ContainsKey(rule.SubItems[0].Text)) + { + m_ExcludeFilterDict.Add(rule.SubItems[0].Text, new List()); + } + m_ExcludeFilterDict[rule.SubItems[0].Text].Add(rule); + } + else + { + if (!m_IncludeFilterDict.ContainsKey(rule.SubItems[0].Text)) + { + m_IncludeFilterDict.Add(rule.SubItems[0].Text, new List()); + } + m_IncludeFilterDict[rule.SubItems[0].Text].Add(rule); + } + } + else + { + if (addToExcludeList) + { + if (!m_ExcludeHighlightDict.ContainsKey(rule.SubItems[0].Text)) + { + m_ExcludeHighlightDict.Add(rule.SubItems[0].Text, new List()); + } + m_ExcludeHighlightDict[rule.SubItems[0].Text].Add(rule); + } + else + { + if (!m_IncludeHighlightDict.ContainsKey(rule.SubItems[0].Text)) + { + m_IncludeHighlightDict.Add(rule.SubItems[0].Text, new List()); + } + m_IncludeHighlightDict[rule.SubItems[0].Text].Add(rule); + } + } + } + + + private void filterRowBasedOnForm(Utils.eFormNames i_FormName, int i_RowIndex, string i_Action) + { + if (i_FormName == Utils.eFormNames.FormColumnFilter) + { + this.dataGridView1.Rows[i_RowIndex].Visible = (i_Action == "Include"); + } + else + { + this.dataGridView1.Rows[i_RowIndex].DefaultCellStyle.BackColor = getHighlighColorIfRequired(i_Action); + } + } + + private void hideFilterRowBasedOnForm(Utils.eFormNames i_FormName, int i_RowIndex) + { + if (i_FormName == Utils.eFormNames.FormColumnFilter) + { + this.dataGridView1.Rows[i_RowIndex].Visible = false; + } + else + { + this.dataGridView1.Rows[i_RowIndex].DefaultCellStyle.BackColor = Color.White; + } + } + + private Color getHighlighColorIfRequired(string i_Action) + { + Color resultColor = Color.White; + if (i_Action == "Include") + { + resultColor = Color.Cyan; + } + + return resultColor; + } + + #endregion Column Filter + + private void toolStripButtonHighLight_Click(object sender, EventArgs e) + { + openHighlightWindows(); + } + + private void aboutToolStripMenuItem_Click(object sender, EventArgs e) + { + FormAbout about = new FormAbout(); + about.ShowDialog(); + // MessageBox.Show(@"Author: Eviatar Gerzi (@g3rzi) + //Contributers: Natan Tunik + //Version: 1.0 + //Link: https://github.com/cyberark/PipeViewer + //Copyright (c) 2022 CyberArk Software Ltd. All rights reserved", "About"); + } + + #region Cell Mouse Click + + + private void dataGridView1_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e) + { + if (e.Button == System.Windows.Forms.MouseButtons.Right) + { + m_CurrentRowIndexRightClick = e.RowIndex; + m_CurrentColumnIndexRightClick = e.ColumnIndex; + contextMenuStripRightClickGridView.Show(Cursor.Position.X, Cursor.Position.Y); + } + } + + private void copyRowToolStripMenuItem_Click(object sender, EventArgs e) + { + string copiedRow = ""; + + foreach (DataGridViewCell cell in dataGridView1.Rows[m_CurrentRowIndexRightClick].Cells) + { + copiedRow += cell.Value + " "; + } + + if (copiedRow != "") + { + System.Windows.Forms.Clipboard.SetText(copiedRow); + } + } + + #endregion + + #region Save + + private void saveToolStripMenuItem_Click(object sender, EventArgs e) + { + SaveFileDialog saveDialog = new SaveFileDialog(); + saveDialog.Title = "Save results as CSV"; + saveDialog.InitialDirectory = @"c:\"; + saveDialog.Filter = "CSV files (*.csv)|*.csv|All files (*.*)|*.*"; + saveDialog.FilterIndex = 2; + saveDialog.RestoreDirectory = true; + if (saveDialog.ShowDialog() == DialogResult.OK) + { + saveDataGridViewToCSV(saveDialog.FileName); + } + } + + // Taken from https://stackoverflow.com/a/26259909/2153777 + private void saveDataGridViewToCSV(string filename) + { + DataGridView tempDataGridView = dataGridView1; + foreach (DataGridViewColumn column in tempDataGridView.Columns) + { + tempDataGridView.Columns[column.Index].Visible = true; + } + // Choose whether to write header. Use EnableWithoutHeaderText instead to omit header. + tempDataGridView.ClipboardCopyMode = DataGridViewClipboardCopyMode.EnableAlwaysIncludeHeaderText; + // Select all the cells + tempDataGridView.SelectAll(); + // Copy selected cells to DataObject + DataObject dataObject = tempDataGridView.GetClipboardContent(); + // Get the text of the DataObject, and serialize it to a file + File.WriteAllText(filename, dataObject.GetText(TextDataFormat.CommaSeparatedValue).Replace("\n", "")); + } + + private void copyCellToolStripMenuItem_Click(object sender, EventArgs e) + { + string copiedCell = ""; + if (dataGridView1.Rows[m_CurrentRowIndexRightClick] != null) + { + if (dataGridView1.Rows[m_CurrentRowIndexRightClick].Cells[m_CurrentColumnIndexRightClick].Value != null) + { + copiedCell = dataGridView1.Rows[m_CurrentRowIndexRightClick].Cells[m_CurrentColumnIndexRightClick].Value.ToString(); + } + } + + if (copiedCell != "") + { + System.Windows.Forms.Clipboard.SetText(copiedCell); + } + } + + + #endregion + + } +} diff --git a/PipeViewer/Form1.resx b/PipeViewer/Form1.resx new file mode 100644 index 0000000..ac99fac --- /dev/null +++ b/PipeViewer/Form1.resx @@ -0,0 +1,201 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + 17, 17 + + + 132, 17 + + + 248, 17 + + + 353, 17 + + \ No newline at end of file diff --git a/PipeViewer/FormAbout.Designer.cs b/PipeViewer/FormAbout.Designer.cs new file mode 100644 index 0000000..269280c --- /dev/null +++ b/PipeViewer/FormAbout.Designer.cs @@ -0,0 +1,77 @@ +namespace PipeViewer +{ + partial class FormAbout + { + /// + /// 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.textBox1 = new System.Windows.Forms.TextBox(); + this.linkLabel1 = new System.Windows.Forms.LinkLabel(); + this.SuspendLayout(); + // + // textBox1 + // + this.textBox1.BorderStyle = System.Windows.Forms.BorderStyle.None; + this.textBox1.Location = new System.Drawing.Point(12, 19); + this.textBox1.Multiline = true; + this.textBox1.Name = "textBox1"; + this.textBox1.ReadOnly = true; + this.textBox1.Size = new System.Drawing.Size(346, 179); + this.textBox1.TabIndex = 0; + this.textBox1.Text = "Author: Eviatar Gerzi (@g3rzi)\r\n\r\nContributers: Natan Tunik\r\n\r\nVersion: 1.0\r\n\r\n\r\n" + + "\r\nCopyright (c) 2022 CyberArk Software Ltd. All rights reserved\r\n\r\n"; + // + // linkLabel1 + // + this.linkLabel1.AutoSize = true; + this.linkLabel1.Location = new System.Drawing.Point(12, 104); + this.linkLabel1.Name = "linkLabel1"; + this.linkLabel1.Size = new System.Drawing.Size(199, 13); + this.linkLabel1.TabIndex = 1; + this.linkLabel1.TabStop = true; + this.linkLabel1.Text = "https://github.com/cyberark/PipeViewer"; + // + // FormAbout + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(379, 210); + this.Controls.Add(this.linkLabel1); + this.Controls.Add(this.textBox1); + this.Name = "FormAbout"; + this.ShowIcon = false; + this.Text = "About"; + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.TextBox textBox1; + private System.Windows.Forms.LinkLabel linkLabel1; + } +} \ No newline at end of file diff --git a/PipeViewer/FormAbout.cs b/PipeViewer/FormAbout.cs new file mode 100644 index 0000000..e2ae94a --- /dev/null +++ b/PipeViewer/FormAbout.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace PipeViewer +{ + public partial class FormAbout : Form + { + public FormAbout() + { + InitializeComponent(); + } + } +} diff --git a/PipeViewer/FormAbout.resx b/PipeViewer/FormAbout.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/PipeViewer/FormAbout.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + \ No newline at end of file diff --git a/PipeViewer/FormColumnFilter.Designer.cs b/PipeViewer/FormColumnFilter.Designer.cs new file mode 100644 index 0000000..4ddab40 --- /dev/null +++ b/PipeViewer/FormColumnFilter.Designer.cs @@ -0,0 +1,266 @@ +namespace PipeViewer +{ + partial class FormColumnFilter + { + /// + /// 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.label1 = new System.Windows.Forms.Label(); + this.comboBoxSearchByColumn = new System.Windows.Forms.ComboBox(); + this.comboBoxRelation = new System.Windows.Forms.ComboBox(); + this.comboBoxValue = new System.Windows.Forms.ComboBox(); + this.listViewColumnFilters = new System.Windows.Forms.ListView(); + this.columnHeaderColumn = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.columnHeaderRelation = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.columnHeaderValue = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.columnHeaderAction = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.comboBoxAction = new System.Windows.Forms.ComboBox(); + this.buttonOK = new System.Windows.Forms.Button(); + this.buttonCancel = new System.Windows.Forms.Button(); + this.buttonAdd = new System.Windows.Forms.Button(); + this.buttonRemove = new System.Windows.Forms.Button(); + this.labelThen = new System.Windows.Forms.Label(); + this.buttonReset = new System.Windows.Forms.Button(); + this.buttonApply = new System.Windows.Forms.Button(); + this.SuspendLayout(); + // + // 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(205, 13); + this.label1.TabIndex = 0; + this.label1.Text = "Display entried matching these conditions:"; + // + // comboBoxSearchByColumn + // + this.comboBoxSearchByColumn.BackColor = System.Drawing.SystemColors.Window; + this.comboBoxSearchByColumn.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.comboBoxSearchByColumn.FormattingEnabled = true; + this.comboBoxSearchByColumn.Items.AddRange(Utils.ColumnNames); + this.comboBoxSearchByColumn.Location = new System.Drawing.Point(12, 25); + this.comboBoxSearchByColumn.Name = "comboBoxSearchByColumn"; + this.comboBoxSearchByColumn.Size = new System.Drawing.Size(121, 21); + this.comboBoxSearchByColumn.TabIndex = 1; + // + // comboBoxRelation + // + this.comboBoxRelation.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.comboBoxRelation.FormattingEnabled = true; + this.comboBoxRelation.Items.AddRange(new object[] { + "contains", + "is", + "begins with", + "ends with"}); + this.comboBoxRelation.Location = new System.Drawing.Point(140, 26); + this.comboBoxRelation.Name = "comboBoxRelation"; + this.comboBoxRelation.Size = new System.Drawing.Size(87, 21); + this.comboBoxRelation.TabIndex = 2; + // + // comboBoxValue + // + this.comboBoxValue.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.comboBoxValue.FormattingEnabled = true; + this.comboBoxValue.Location = new System.Drawing.Point(244, 25); + this.comboBoxValue.Name = "comboBoxValue"; + this.comboBoxValue.Size = new System.Drawing.Size(412, 21); + this.comboBoxValue.TabIndex = 3; + // + // listViewColumnFilters + // + this.listViewColumnFilters.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.listViewColumnFilters.CheckBoxes = true; + this.listViewColumnFilters.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { + this.columnHeaderColumn, + this.columnHeaderRelation, + this.columnHeaderValue, + this.columnHeaderAction}); + this.listViewColumnFilters.HideSelection = false; + this.listViewColumnFilters.Location = new System.Drawing.Point(15, 85); + this.listViewColumnFilters.Name = "listViewColumnFilters"; + this.listViewColumnFilters.Size = new System.Drawing.Size(776, 312); + this.listViewColumnFilters.TabIndex = 4; + this.listViewColumnFilters.UseCompatibleStateImageBehavior = false; + this.listViewColumnFilters.View = System.Windows.Forms.View.Details; + this.listViewColumnFilters.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.listViewColumnFilters_MouseDoubleClick); + // + // columnHeaderColumn + // + this.columnHeaderColumn.Text = "Column"; + this.columnHeaderColumn.Width = 92; + // + // columnHeaderRelation + // + this.columnHeaderRelation.Text = "Relation"; + // + // columnHeaderValue + // + this.columnHeaderValue.Text = "Value"; + // + // columnHeaderAction + // + this.columnHeaderAction.Text = "Action"; + // + // comboBoxAction + // + this.comboBoxAction.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.comboBoxAction.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.comboBoxAction.FormattingEnabled = true; + this.comboBoxAction.Items.AddRange(new object[] { + "Include", + "Exclude"}); + this.comboBoxAction.Location = new System.Drawing.Point(704, 25); + this.comboBoxAction.Name = "comboBoxAction"; + this.comboBoxAction.Size = new System.Drawing.Size(84, 21); + this.comboBoxAction.TabIndex = 5; + // + // buttonOK + // + this.buttonOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.buttonOK.Location = new System.Drawing.Point(551, 415); + this.buttonOK.Name = "buttonOK"; + this.buttonOK.Size = new System.Drawing.Size(75, 23); + this.buttonOK.TabIndex = 6; + this.buttonOK.Text = "OK"; + this.buttonOK.UseVisualStyleBackColor = true; + this.buttonOK.Click += new System.EventHandler(this.buttonOK_Click); + // + // buttonCancel + // + this.buttonCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.buttonCancel.Location = new System.Drawing.Point(632, 415); + this.buttonCancel.Name = "buttonCancel"; + this.buttonCancel.Size = new System.Drawing.Size(75, 23); + this.buttonCancel.TabIndex = 7; + this.buttonCancel.Text = "Cancel"; + this.buttonCancel.UseVisualStyleBackColor = true; + this.buttonCancel.Click += new System.EventHandler(this.buttonCancel_Click); + // + // buttonAdd + // + this.buttonAdd.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.buttonAdd.Location = new System.Drawing.Point(623, 56); + this.buttonAdd.Name = "buttonAdd"; + this.buttonAdd.Size = new System.Drawing.Size(75, 23); + this.buttonAdd.TabIndex = 8; + this.buttonAdd.Text = "Add"; + this.buttonAdd.UseVisualStyleBackColor = true; + this.buttonAdd.Click += new System.EventHandler(this.buttonAdd_Click); + // + // buttonRemove + // + this.buttonRemove.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.buttonRemove.Location = new System.Drawing.Point(713, 56); + this.buttonRemove.Name = "buttonRemove"; + this.buttonRemove.Size = new System.Drawing.Size(75, 23); + this.buttonRemove.TabIndex = 9; + this.buttonRemove.Text = "Remove"; + this.buttonRemove.UseVisualStyleBackColor = true; + this.buttonRemove.Click += new System.EventHandler(this.buttonRemove_Click); + // + // labelThen + // + this.labelThen.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.labelThen.AutoSize = true; + this.labelThen.Location = new System.Drawing.Point(662, 28); + this.labelThen.Name = "labelThen"; + this.labelThen.Size = new System.Drawing.Size(28, 13); + this.labelThen.TabIndex = 10; + this.labelThen.Text = "then"; + // + // buttonReset + // + this.buttonReset.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.buttonReset.Location = new System.Drawing.Point(15, 56); + this.buttonReset.Name = "buttonReset"; + this.buttonReset.Size = new System.Drawing.Size(75, 23); + this.buttonReset.TabIndex = 11; + this.buttonReset.Text = "Reset"; + this.buttonReset.UseVisualStyleBackColor = true; + this.buttonReset.Click += new System.EventHandler(this.buttonReset_Click); + // + // buttonApply + // + this.buttonApply.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.buttonApply.Location = new System.Drawing.Point(716, 415); + this.buttonApply.Name = "buttonApply"; + this.buttonApply.Size = new System.Drawing.Size(75, 23); + this.buttonApply.TabIndex = 13; + this.buttonApply.Text = "Apply"; + this.buttonApply.UseVisualStyleBackColor = true; + this.buttonApply.Click += new System.EventHandler(this.buttonApply_Click); + // + // FormColumnFilter + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(800, 450); + this.Controls.Add(this.buttonApply); + this.Controls.Add(this.buttonReset); + this.Controls.Add(this.labelThen); + this.Controls.Add(this.buttonRemove); + this.Controls.Add(this.buttonAdd); + this.Controls.Add(this.buttonCancel); + this.Controls.Add(this.buttonOK); + this.Controls.Add(this.comboBoxAction); + this.Controls.Add(this.listViewColumnFilters); + this.Controls.Add(this.comboBoxValue); + this.Controls.Add(this.comboBoxRelation); + this.Controls.Add(this.comboBoxSearchByColumn); + this.Controls.Add(this.label1); + this.Name = "FormColumnFilter"; + this.ShowIcon = false; + this.Text = "PipeViewer Filter"; + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Label label1; + private System.Windows.Forms.ComboBox comboBoxSearchByColumn; + private System.Windows.Forms.ComboBox comboBoxRelation; + private System.Windows.Forms.ComboBox comboBoxValue; + private System.Windows.Forms.ListView listViewColumnFilters; + private System.Windows.Forms.ColumnHeader columnHeaderColumn; + private System.Windows.Forms.ColumnHeader columnHeaderRelation; + private System.Windows.Forms.ColumnHeader columnHeaderValue; + private System.Windows.Forms.ColumnHeader columnHeaderAction; + private System.Windows.Forms.ComboBox comboBoxAction; + private System.Windows.Forms.Button buttonOK; + private System.Windows.Forms.Button buttonCancel; + private System.Windows.Forms.Button buttonAdd; + private System.Windows.Forms.Button buttonRemove; + private System.Windows.Forms.Label labelThen; + private System.Windows.Forms.Button buttonReset; + private System.Windows.Forms.Button buttonApply; + } +} \ No newline at end of file diff --git a/PipeViewer/FormColumnFilter.cs b/PipeViewer/FormColumnFilter.cs new file mode 100644 index 0000000..521ab0d --- /dev/null +++ b/PipeViewer/FormColumnFilter.cs @@ -0,0 +1,139 @@ +using System; +using System.Windows.Forms; +using static System.Windows.Forms.ListViewItem; + +namespace PipeViewer +{ + public delegate void FilterOKEventHandler(ListView i_listViewColumnFilter); + public partial class FormColumnFilter : Form + { + private DataGridView m_DataGridView; + public event FilterOKEventHandler FilterOKUpdate; + public FormColumnFilter(ref ListView i_ListViewColumnFilter) + { + InitializeComponentWrapper(); + + foreach (ListViewItem item in i_ListViewColumnFilter.Items) + { + ListViewItem clonedItem = (ListViewItem)item.Clone(); + this.listViewColumnFilters.Items.Add(clonedItem); + } + } + + public virtual void OnFilterOKUpdate(ListView i_listViewColumnFilter) + { + bool empty = true; + foreach (ListViewItem item in i_listViewColumnFilter.Items) + { + if (item.Checked) + { + empty = false; + } + } + if (empty) + { + i_listViewColumnFilter = new ListView(); + } + if (FilterOKUpdate != null) + { + FilterOKUpdate.Invoke(i_listViewColumnFilter); + } + } + + private void InitializeComponentWrapper() + { + InitializeComponent(); + this.comboBoxSearchByColumn.SelectedIndex = 0; + this.comboBoxRelation.SelectedIndex = 0; + this.comboBoxAction.SelectedIndex = 0; + this.listViewColumnFilters.FullRowSelect = true; + } + + public FormColumnFilter(ref DataGridView i_DataGridView) + { + m_DataGridView = i_DataGridView; + InitializeComponentWrapper(); + } + + private void buttonOK_Click(object sender, EventArgs e) + { + buttonAdd_Click(sender, e); + OnFilterOKUpdate(this.listViewColumnFilters); + this.Close(); + } + + private void buttonCancel_Click(object sender, EventArgs e) + { + this.Close(); + } + + // DUPLICATED function in FormHighlighting + // Maybe create a shared function in Utils but it threw an exception for "type initializer" + private bool isRowExist(string i_Column, string i_Relation, string i_Value, string i_Action) + { + bool isExist = false; + string newRow = i_Column + i_Relation + i_Value + i_Action; + foreach (ListViewItem item in listViewColumnFilters.Items) + { + string rawRow = ""; + foreach (ListViewSubItem subItem in item.SubItems) + { + rawRow += subItem.Text; + } + + if (newRow == rawRow) + { + isExist = true; + break; + } + + } + + return isExist; + } + + private void buttonAdd_Click(object sender, EventArgs e) + { + if (!isRowExist(comboBoxSearchByColumn.Text, comboBoxRelation.Text, comboBoxValue.Text, comboBoxAction.Text)) + { + ListViewItem item = new ListViewItem(comboBoxSearchByColumn.Text); + item.SubItems.Add(comboBoxRelation.Text); + item.SubItems.Add(comboBoxValue.Text); + item.SubItems.Add(comboBoxAction.Text); + item.Checked = true; + this.listViewColumnFilters.Items.Add(item); + } + } + + private void buttonRemove_Click(object sender, EventArgs e) + { + foreach (ListViewItem item in this.listViewColumnFilters.SelectedItems) + { + item.Remove(); + } + } + + private void listViewColumnFilters_MouseDoubleClick(object sender, MouseEventArgs e) + { + foreach (ListViewItem item in ((ListView)sender).SelectedItems) + { + this.comboBoxSearchByColumn.Text = item.SubItems[0].Text; + this.comboBoxRelation.Text = item.SubItems[1].Text; + this.comboBoxValue.Text = item.SubItems[2].Text; + this.comboBoxAction.Text = item.SubItems[3].Text; + item.Remove(); + } + } + + private void buttonReset_Click(object sender, EventArgs e) + { + listViewColumnFilters.Items.Clear(); + } + + private void buttonApply_Click(object sender, EventArgs e) + { + buttonAdd_Click(sender, e); + OnFilterOKUpdate(this.listViewColumnFilters); + } + } +} diff --git a/PipeViewer/FormColumnFilter.resx b/PipeViewer/FormColumnFilter.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/PipeViewer/FormColumnFilter.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + \ No newline at end of file diff --git a/PipeViewer/FormHighlighting.Designer.cs b/PipeViewer/FormHighlighting.Designer.cs new file mode 100644 index 0000000..6e6a3a4 --- /dev/null +++ b/PipeViewer/FormHighlighting.Designer.cs @@ -0,0 +1,267 @@ +namespace PipeViewer +{ + partial class FormHighlighting + { + /// + /// 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.labelHighlight = new System.Windows.Forms.Label(); + this.comboBoxColumn = new System.Windows.Forms.ComboBox(); + this.comboBoxRelation = new System.Windows.Forms.ComboBox(); + this.comboBoxValue = new System.Windows.Forms.ComboBox(); + this.labelThen = new System.Windows.Forms.Label(); + this.comboBoxAction = new System.Windows.Forms.ComboBox(); + this.listViewHighlights = new System.Windows.Forms.ListView(); + this.columnHeaderColumn = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.columnHeaderRelation = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.columnHeaderValue = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.columnHeaderAction = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.buttonOK = new System.Windows.Forms.Button(); + this.buttonCancel = new System.Windows.Forms.Button(); + this.buttonAdd = new System.Windows.Forms.Button(); + this.buttonRemove = new System.Windows.Forms.Button(); + this.buttonReset = new System.Windows.Forms.Button(); + this.buttonApply = new System.Windows.Forms.Button(); + this.SuspendLayout(); + // + // labelHighlight + // + this.labelHighlight.AutoSize = true; + this.labelHighlight.Location = new System.Drawing.Point(12, 9); + this.labelHighlight.Name = "labelHighlight"; + this.labelHighlight.Size = new System.Drawing.Size(211, 13); + this.labelHighlight.TabIndex = 0; + this.labelHighlight.Text = "Highlight entries matching these conditions:"; + // + // comboBoxColumn + // + this.comboBoxColumn.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.comboBoxColumn.FormattingEnabled = true; + this.comboBoxColumn.Items.AddRange(Utils.ColumnNames); + this.comboBoxColumn.Location = new System.Drawing.Point(12, 25); + this.comboBoxColumn.Name = "comboBoxColumn"; + this.comboBoxColumn.Size = new System.Drawing.Size(121, 21); + this.comboBoxColumn.TabIndex = 1; + // + // comboBoxRelation + // + this.comboBoxRelation.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.comboBoxRelation.FormattingEnabled = true; + this.comboBoxRelation.Items.AddRange(new object[] { + "contains", + "is", + "begins with", + "ends with"}); + this.comboBoxRelation.Location = new System.Drawing.Point(139, 25); + this.comboBoxRelation.Name = "comboBoxRelation"; + this.comboBoxRelation.Size = new System.Drawing.Size(71, 21); + this.comboBoxRelation.TabIndex = 2; + // + // comboBoxValue + // + this.comboBoxValue.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.comboBoxValue.FormattingEnabled = true; + this.comboBoxValue.Location = new System.Drawing.Point(216, 25); + this.comboBoxValue.Name = "comboBoxValue"; + this.comboBoxValue.Size = new System.Drawing.Size(297, 21); + this.comboBoxValue.TabIndex = 3; + // + // labelThen + // + this.labelThen.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.labelThen.AutoSize = true; + this.labelThen.Location = new System.Drawing.Point(519, 25); + this.labelThen.Name = "labelThen"; + this.labelThen.Size = new System.Drawing.Size(28, 13); + this.labelThen.TabIndex = 4; + this.labelThen.Text = "then"; + // + // comboBoxAction + // + this.comboBoxAction.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.comboBoxAction.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.comboBoxAction.FormattingEnabled = true; + this.comboBoxAction.Items.AddRange(new object[] { + "Include", + "Exclude"}); + this.comboBoxAction.Location = new System.Drawing.Point(557, 22); + this.comboBoxAction.Name = "comboBoxAction"; + this.comboBoxAction.Size = new System.Drawing.Size(71, 21); + this.comboBoxAction.TabIndex = 5; + // + // listViewHighlights + // + this.listViewHighlights.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.listViewHighlights.CheckBoxes = true; + this.listViewHighlights.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { + this.columnHeaderColumn, + this.columnHeaderRelation, + this.columnHeaderValue, + this.columnHeaderAction}); + this.listViewHighlights.HideSelection = false; + this.listViewHighlights.Location = new System.Drawing.Point(12, 85); + this.listViewHighlights.Name = "listViewHighlights"; + this.listViewHighlights.Size = new System.Drawing.Size(619, 267); + this.listViewHighlights.TabIndex = 6; + this.listViewHighlights.UseCompatibleStateImageBehavior = false; + this.listViewHighlights.View = System.Windows.Forms.View.Details; + this.listViewHighlights.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.listViewHighlights_MouseDoubleClick); + // + // columnHeaderColumn + // + this.columnHeaderColumn.Text = "Column"; + // + // columnHeaderRelation + // + this.columnHeaderRelation.Text = "Relation"; + // + // columnHeaderValue + // + this.columnHeaderValue.Text = "Value"; + // + // columnHeaderAction + // + this.columnHeaderAction.Text = "Action"; + // + // buttonOK + // + this.buttonOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.buttonOK.Location = new System.Drawing.Point(391, 358); + this.buttonOK.Name = "buttonOK"; + this.buttonOK.Size = new System.Drawing.Size(75, 23); + this.buttonOK.TabIndex = 7; + this.buttonOK.Text = "OK"; + this.buttonOK.UseVisualStyleBackColor = true; + this.buttonOK.Click += new System.EventHandler(this.buttonOK_Click); + // + // buttonCancel + // + this.buttonCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.buttonCancel.Location = new System.Drawing.Point(472, 358); + this.buttonCancel.Name = "buttonCancel"; + this.buttonCancel.Size = new System.Drawing.Size(75, 23); + this.buttonCancel.TabIndex = 8; + this.buttonCancel.Text = "Cancel"; + this.buttonCancel.UseVisualStyleBackColor = true; + this.buttonCancel.Click += new System.EventHandler(this.buttonCancel_Click); + // + // buttonAdd + // + this.buttonAdd.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.buttonAdd.Location = new System.Drawing.Point(472, 56); + this.buttonAdd.Name = "buttonAdd"; + this.buttonAdd.Size = new System.Drawing.Size(75, 23); + this.buttonAdd.TabIndex = 9; + this.buttonAdd.Text = "Add"; + this.buttonAdd.UseVisualStyleBackColor = true; + this.buttonAdd.Click += new System.EventHandler(this.buttonAdd_Click); + // + // buttonRemove + // + this.buttonRemove.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.buttonRemove.Location = new System.Drawing.Point(553, 56); + this.buttonRemove.Name = "buttonRemove"; + this.buttonRemove.Size = new System.Drawing.Size(75, 23); + this.buttonRemove.TabIndex = 10; + this.buttonRemove.Text = "Remove"; + this.buttonRemove.UseVisualStyleBackColor = true; + this.buttonRemove.Click += new System.EventHandler(this.buttonRemove_Click); + // + // buttonReset + // + this.buttonReset.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.buttonReset.Location = new System.Drawing.Point(12, 56); + this.buttonReset.Name = "buttonReset"; + this.buttonReset.Size = new System.Drawing.Size(75, 23); + this.buttonReset.TabIndex = 11; + this.buttonReset.Text = "Reset"; + this.buttonReset.UseVisualStyleBackColor = true; + this.buttonReset.Click += new System.EventHandler(this.buttonReset_Click); + // + // buttonApply + // + this.buttonApply.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.buttonApply.Location = new System.Drawing.Point(553, 358); + this.buttonApply.Name = "buttonApply"; + this.buttonApply.Size = new System.Drawing.Size(75, 23); + this.buttonApply.TabIndex = 12; + this.buttonApply.Text = "Apply"; + this.buttonApply.UseVisualStyleBackColor = true; + this.buttonApply.Click += new System.EventHandler(this.buttonApply_Click); + // + // FormHighlighting + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(643, 393); + this.Controls.Add(this.buttonApply); + this.Controls.Add(this.buttonReset); + this.Controls.Add(this.buttonRemove); + this.Controls.Add(this.buttonAdd); + this.Controls.Add(this.buttonCancel); + this.Controls.Add(this.buttonOK); + this.Controls.Add(this.listViewHighlights); + this.Controls.Add(this.comboBoxAction); + this.Controls.Add(this.labelThen); + this.Controls.Add(this.comboBoxValue); + this.Controls.Add(this.comboBoxRelation); + this.Controls.Add(this.comboBoxColumn); + this.Controls.Add(this.labelHighlight); + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "FormHighlighting"; + this.ShowIcon = false; + this.Text = "PipeViewer Highlighting"; + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Label labelHighlight; + private System.Windows.Forms.ComboBox comboBoxColumn; + private System.Windows.Forms.ComboBox comboBoxRelation; + private System.Windows.Forms.ComboBox comboBoxValue; + private System.Windows.Forms.Label labelThen; + private System.Windows.Forms.ComboBox comboBoxAction; + private System.Windows.Forms.ListView listViewHighlights; + private System.Windows.Forms.Button buttonOK; + private System.Windows.Forms.Button buttonCancel; + private System.Windows.Forms.Button buttonAdd; + private System.Windows.Forms.Button buttonRemove; + private System.Windows.Forms.ColumnHeader columnHeaderColumn; + private System.Windows.Forms.ColumnHeader columnHeaderRelation; + private System.Windows.Forms.ColumnHeader columnHeaderValue; + private System.Windows.Forms.ColumnHeader columnHeaderAction; + private System.Windows.Forms.Button buttonReset; + private System.Windows.Forms.Button buttonApply; + } +} \ No newline at end of file diff --git a/PipeViewer/FormHighlighting.cs b/PipeViewer/FormHighlighting.cs new file mode 100644 index 0000000..fcb3f10 --- /dev/null +++ b/PipeViewer/FormHighlighting.cs @@ -0,0 +1,122 @@ +using System; +using System.Windows.Forms; +using static System.Windows.Forms.ListViewItem; + +namespace PipeViewer +{ + public delegate void highlightRowsEventHandler(ListView i_ListView); + public partial class FormHighlighting : Form + { + public event highlightRowsEventHandler hightlightRowsUpdate; + + public FormHighlighting(ref ListView i_ListViewHighlighFilter) + { + InitializeComponentWrapper(); + + foreach (ListViewItem item in i_ListViewHighlighFilter.Items) + { + ListViewItem clonedItem = (ListViewItem)item.Clone(); + this.listViewHighlights.Items.Add(clonedItem); + } + } + + private void InitializeComponentWrapper() + { + InitializeComponent(); + this.comboBoxColumn.SelectedIndex = 0; + this.comboBoxRelation.SelectedIndex = 0; + this.comboBoxAction.SelectedIndex = 0; + this.listViewHighlights.FullRowSelect = true; + } + + + // DUPLICATED function in ColumnFilter + // Maybe create a shared function in Utils but it threw an exception for "type initializer" + private bool isRowExist(string i_Column, string i_Relation, string i_Value, string i_Action) + { + bool isExist = false; + string newRow = i_Column + i_Relation + i_Value + i_Action; + foreach (ListViewItem item in listViewHighlights.Items) + { + string rawRow = ""; + foreach (ListViewSubItem subItem in item.SubItems) + { + rawRow += subItem.Text; + } + + if (newRow == rawRow) + { + isExist = true; + break; + } + + } + + return isExist; + } + + private void buttonAdd_Click(object sender, EventArgs e) + { + if (!isRowExist(comboBoxColumn.Text, comboBoxRelation.Text, comboBoxValue.Text, comboBoxAction.Text) && !comboBoxValue.Text.Equals("")) + { + ListViewItem item = new ListViewItem(comboBoxColumn.Text); + item.SubItems.Add(comboBoxRelation.Text); + item.SubItems.Add(comboBoxValue.Text); + item.SubItems.Add(comboBoxAction.Text); + item.Checked = true; + this.listViewHighlights.Items.Add(item); + } + } + + private void buttonCancel_Click(object sender, EventArgs e) + { + this.Close(); + } + + private void buttonRemove_Click(object sender, EventArgs e) + { + foreach (ListViewItem item in this.listViewHighlights.SelectedItems) + { + item.Remove(); + } + } + + private void listViewHighlights_MouseDoubleClick(object sender, MouseEventArgs e) + { + foreach (ListViewItem item in ((ListView)sender).SelectedItems) + { + this.comboBoxColumn.Text = item.SubItems[0].Text; + this.comboBoxRelation.Text = item.SubItems[1].Text; + this.comboBoxValue.Text = item.SubItems[2].Text; + this.comboBoxAction.Text = item.SubItems[3].Text; + item.Remove(); + } + } + + public virtual void OnHighlightRowsUpdate(ListView i_ListView) + { + if (hightlightRowsUpdate != null) + { + hightlightRowsUpdate.Invoke(i_ListView); + } + } + + private void buttonOK_Click(object sender, EventArgs e) + { + buttonAdd_Click(sender, e); + OnHighlightRowsUpdate(listViewHighlights); + this.Close(); + } + + private void buttonReset_Click(object sender, EventArgs e) + { + this.listViewHighlights.Clear(); + } + + private void buttonApply_Click(object sender, EventArgs e) + { + buttonAdd_Click(sender, e); + OnHighlightRowsUpdate(listViewHighlights); + } + } +} diff --git a/PipeViewer/FormHighlighting.resx b/PipeViewer/FormHighlighting.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/PipeViewer/FormHighlighting.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + \ No newline at end of file diff --git a/PipeViewer/FormSearch.Designer.cs b/PipeViewer/FormSearch.Designer.cs new file mode 100644 index 0000000..2ce003f --- /dev/null +++ b/PipeViewer/FormSearch.Designer.cs @@ -0,0 +1,142 @@ +namespace PipeViewer +{ + partial class FormSearch + { + /// + /// 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.label1 = new System.Windows.Forms.Label(); + this.comboBox1 = new System.Windows.Forms.ComboBox(); + this.buttonFind = new System.Windows.Forms.Button(); + this.buttonCancel = new System.Windows.Forms.Button(); + this.groupBoxDirection = new System.Windows.Forms.GroupBox(); + this.radioButtonUp = new System.Windows.Forms.RadioButton(); + this.radioButtonDown = new System.Windows.Forms.RadioButton(); + this.groupBoxDirection.SuspendLayout(); + this.SuspendLayout(); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(13, 13); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(56, 13); + this.label1.TabIndex = 0; + this.label1.Text = "Find what:"; + // + // comboBox1 + // + this.comboBox1.FormattingEnabled = true; + this.comboBox1.Location = new System.Drawing.Point(76, 13); + this.comboBox1.Name = "comboBox1"; + this.comboBox1.Size = new System.Drawing.Size(215, 21); + this.comboBox1.TabIndex = 1; + // + // buttonFind + // + this.buttonFind.Location = new System.Drawing.Point(314, 11); + this.buttonFind.Name = "buttonFind"; + this.buttonFind.Size = new System.Drawing.Size(75, 23); + this.buttonFind.TabIndex = 2; + this.buttonFind.Text = "Find Next"; + this.buttonFind.UseVisualStyleBackColor = true; + this.buttonFind.Click += new System.EventHandler(this.buttonFind_Click); + // + // buttonCancel + // + this.buttonCancel.Location = new System.Drawing.Point(314, 53); + this.buttonCancel.Name = "buttonCancel"; + this.buttonCancel.Size = new System.Drawing.Size(75, 23); + this.buttonCancel.TabIndex = 3; + this.buttonCancel.Text = "Cancel"; + this.buttonCancel.UseVisualStyleBackColor = true; + this.buttonCancel.Click += new System.EventHandler(this.buttonCancel_Click); + // + // groupBoxDirection + // + this.groupBoxDirection.Controls.Add(this.radioButtonDown); + this.groupBoxDirection.Controls.Add(this.radioButtonUp); + this.groupBoxDirection.Location = new System.Drawing.Point(178, 53); + this.groupBoxDirection.Name = "groupBoxDirection"; + this.groupBoxDirection.Size = new System.Drawing.Size(113, 63); + this.groupBoxDirection.TabIndex = 4; + this.groupBoxDirection.TabStop = false; + this.groupBoxDirection.Text = "Direction"; + // + // radioButtonUp + // + this.radioButtonUp.AutoSize = true; + this.radioButtonUp.Location = new System.Drawing.Point(7, 29); + this.radioButtonUp.Name = "radioButtonUp"; + this.radioButtonUp.Size = new System.Drawing.Size(39, 17); + this.radioButtonUp.TabIndex = 0; + this.radioButtonUp.Text = "Up"; + this.radioButtonUp.UseVisualStyleBackColor = true; + // + // radioButtonDown + // + this.radioButtonDown.AutoSize = true; + this.radioButtonDown.Checked = true; + this.radioButtonDown.Location = new System.Drawing.Point(52, 29); + this.radioButtonDown.Name = "radioButtonDown"; + this.radioButtonDown.Size = new System.Drawing.Size(53, 17); + this.radioButtonDown.TabIndex = 1; + this.radioButtonDown.TabStop = true; + this.radioButtonDown.Text = "Down"; + this.radioButtonDown.UseVisualStyleBackColor = true; + // + // FormSearch + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(415, 144); + this.Controls.Add(this.groupBoxDirection); + this.Controls.Add(this.buttonCancel); + this.Controls.Add(this.buttonFind); + this.Controls.Add(this.comboBox1); + this.Controls.Add(this.label1); + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "FormSearch"; + this.ShowIcon = false; + this.Text = "Find"; + this.groupBoxDirection.ResumeLayout(false); + this.groupBoxDirection.PerformLayout(); + this.ResumeLayout(false); + this.PerformLayout(); + } + + #endregion + + private System.Windows.Forms.Label label1; + private System.Windows.Forms.ComboBox comboBox1; + private System.Windows.Forms.Button buttonFind; + private System.Windows.Forms.Button buttonCancel; + private System.Windows.Forms.GroupBox groupBoxDirection; + private System.Windows.Forms.RadioButton radioButtonDown; + private System.Windows.Forms.RadioButton radioButtonUp; + } +} \ No newline at end of file diff --git a/PipeViewer/FormSearch.cs b/PipeViewer/FormSearch.cs new file mode 100644 index 0000000..593edd3 --- /dev/null +++ b/PipeViewer/FormSearch.cs @@ -0,0 +1,35 @@ +using System; +using System.Windows.Forms; + +namespace PipeViewer +{ + public partial class FormSearch : Form + { + public delegate void searchEventHandler(string i_SearchString, bool i_SearchDown, bool i_MatchWholeWord, bool i_MatchSensitive); + + public event searchEventHandler searchForMatch; + + public FormSearch() + { + InitializeComponent(); + } + + private void buttonCancel_Click(object sender, EventArgs e) + { + this.Close(); + } + + public virtual void OnSearchForMatch(string i_SearchString, bool i_SearchDown, bool i_MatchWholeWord, bool i_MatchSensitive) + { + if (searchForMatch != null) + { + searchForMatch.Invoke(i_SearchString, i_SearchDown, i_MatchWholeWord, i_MatchSensitive); + } + } + + private void buttonFind_Click(object sender, EventArgs e) + { + OnSearchForMatch(comboBox1.Text, radioButtonDown.Checked, false, false); + } + } +} diff --git a/PipeViewer/PermissionDialog.cs b/PipeViewer/PermissionDialog.cs new file mode 100644 index 0000000..438a49a --- /dev/null +++ b/PipeViewer/PermissionDialog.cs @@ -0,0 +1,144 @@ +using System; +using System.ComponentModel; +using System.IO; +using System.Runtime.InteropServices; + +namespace NamePipeViewer +{ + + // TODO: not used yet, it might help to create the properties windows to view the security of the pipes + // and other details in a nice way. + // https://stackoverflow.com/questions/28035464/how-does-one-invoke-the-windows-permissions-dialog-programmatically + public static class PermissionDialog + { + public static bool Show(IntPtr hwndParent, string path) + { + if (path == null) + throw new ArgumentNullException("path"); + + SafePidlHandle folderPidl; + int hr; + var a = Path.GetDirectoryName(path); + hr = SHILCreateFromPath(Path.GetDirectoryName(path), out folderPidl, IntPtr.Zero); + if (hr != 0) + throw new Win32Exception(hr); + + SafePidlHandle filePidl; + hr = SHILCreateFromPath(path, out filePidl, IntPtr.Zero); + if (hr != 0) + throw new Win32Exception(hr); + + IntPtr file = ILFindLastID(filePidl); + + System.Runtime.InteropServices.ComTypes.IDataObject ido; + hr = SHCreateDataObject(folderPidl, 1, new IntPtr[] { file }, null, typeof(System.Runtime.InteropServices.ComTypes.IDataObject).GUID, out ido); + if (hr != 0) + throw new Win32Exception(hr); + + // if you get a 'no such interface' error here, make sure the running thread is STA + IShellExtInit sei = (IShellExtInit)new SecPropSheetExt(); + sei.Initialize(IntPtr.Zero, ido, IntPtr.Zero); + + IShellPropSheetExt spse = (IShellPropSheetExt)sei; + IntPtr securityPage = IntPtr.Zero; + spse.AddPages((p, lp) => + { + securityPage = p; + return true; + }, IntPtr.Zero); + + PROPSHEETHEADER psh = new PROPSHEETHEADER(); + psh.dwSize = Marshal.SizeOf(psh); + psh.hwndParent = hwndParent; + psh.nPages = 1; + psh.phpage = Marshal.AllocHGlobal(IntPtr.Size); + Marshal.WriteIntPtr(psh.phpage, securityPage); + + // TODO: adjust title & icon here, also check out the available flags + psh.pszCaption = "Permissions for '" + path + "'"; + + IntPtr res; + try + { + res = PropertySheet(ref psh); + } + finally + { + Marshal.FreeHGlobal(psh.phpage); + } + return res == IntPtr.Zero; + } + + private class SafePidlHandle : SafeHandle + { + public SafePidlHandle() + : base(IntPtr.Zero, true) + { + } + + public override bool IsInvalid + { + get { return handle == IntPtr.Zero; } + } + + protected override bool ReleaseHandle() + { + if (IsInvalid) + return false; + + Marshal.FreeCoTaskMem(handle); + return true; + } + } + + [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] + private struct PROPSHEETHEADER + { + public int dwSize; + public int dwFlags; + public IntPtr hwndParent; + public IntPtr hInstance; + public IntPtr hIcon; + public string pszCaption; + public int nPages; + public IntPtr nStartPage; + public IntPtr phpage; + public IntPtr pfnCallback; + } + + [DllImport("shell32.dll")] + private static extern IntPtr ILFindLastID(SafePidlHandle pidl); + + [DllImport("shell32.dll", CharSet = CharSet.Unicode)] + private static extern int SHILCreateFromPath(string pszPath, out SafePidlHandle ppidl, IntPtr rgflnOut); + + [DllImport("shell32.dll")] + private static extern int SHCreateDataObject(SafePidlHandle pidlFolder, int cidl, IntPtr[] apidl, System.Runtime.InteropServices.ComTypes.IDataObject pdtInner, [MarshalAs(UnmanagedType.LPStruct)] Guid riid, out System.Runtime.InteropServices.ComTypes.IDataObject ppv); + + [DllImport("comctl32.dll", CharSet = CharSet.Unicode)] + private static extern IntPtr PropertySheet(ref PROPSHEETHEADER lppsph); + + private delegate bool AddPropSheetPage(IntPtr page, IntPtr lParam); + + [ComImport] + [Guid("1f2e5c40-9550-11ce-99d2-00aa006e086c")] // this GUID points to the property sheet handler for permissions + private class SecPropSheetExt + { + } + + [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + [Guid("000214E8-0000-0000-C000-000000000046")] + private interface IShellExtInit + { + void Initialize(IntPtr pidlFolder, System.Runtime.InteropServices.ComTypes.IDataObject pdtobj, IntPtr hkeyProgID); + } + + [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + [Guid("000214E9-0000-0000-C000-000000000046")] + private interface IShellPropSheetExt + { + void AddPages([MarshalAs(UnmanagedType.FunctionPtr)] AddPropSheetPage pfnAddPage, IntPtr lParam); + void ReplacePage(); // not fully defined, we don't use it + } + } +} diff --git a/PipeViewer/PipeViewer.csproj b/PipeViewer/PipeViewer.csproj new file mode 100644 index 0000000..b9ab98d --- /dev/null +++ b/PipeViewer/PipeViewer.csproj @@ -0,0 +1,153 @@ + + + + + Debug + AnyCPU + {2419CEDC-BF3A-4D8D-98F7-6403415BEEA4} + WinExe + PipeViewer + PipeViewer + v4.6.1 + 512 + true + true + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + ..\..\..\..\karaken\cyberark\RPCMon\Packages\NtApiDotNet.1.1.33\lib\net461\NtApiDotNet.dll + + + + + + + + + + + + + + + + Form + + + ColumnSelection.cs + + + + Form + + + Form1.cs + + + Form + + + FormAbout.cs + + + Form + + + FormColumnFilter.cs + + + Form + + + FormHighlighting.cs + + + Form + + + FormSearch.cs + + + + + + + ColumnSelection.cs + + + Form1.cs + + + FormAbout.cs + + + FormColumnFilter.cs + + + FormHighlighting.cs + + + ResXFileCodeGenerator + Resources.Designer.cs + Designer + + + True + Resources.resx + True + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + True + Settings.settings + True + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/PipeViewer/Program.cs b/PipeViewer/Program.cs new file mode 100644 index 0000000..6f6de3a --- /dev/null +++ b/PipeViewer/Program.cs @@ -0,0 +1,19 @@ +using System; +using System.Windows.Forms; + +namespace PipeViewer +{ + static class Program + { + /// + /// The main entry point for the application. + /// + [STAThread] + static void Main() + { + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + Application.Run(new Form1()); + } + } +} diff --git a/PipeViewer/Properties/AssemblyInfo.cs b/PipeViewer/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..136a5cd --- /dev/null +++ b/PipeViewer/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("PipeViewer")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("PipeViewer")] +[assembly: AssemblyCopyright("Copyright © 2022")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("2419cedc-bf3a-4d8d-98f7-6403415beea4")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/PipeViewer/Properties/Resources.Designer.cs b/PipeViewer/Properties/Resources.Designer.cs new file mode 100644 index 0000000..fbba183 --- /dev/null +++ b/PipeViewer/Properties/Resources.Designer.cs @@ -0,0 +1,133 @@ +//------------------------------------------------------------------------------ +// +// 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 PipeViewer.Properties { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("PipeViewer.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap eraser { + get { + object obj = ResourceManager.GetObject("eraser", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap filter { + get { + object obj = ResourceManager.GetObject("filter", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap find { + get { + object obj = ResourceManager.GetObject("find", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap grid { + get { + object obj = ResourceManager.GetObject("grid", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap grid_disable { + get { + object obj = ResourceManager.GetObject("grid-disable", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap highlighter { + get { + object obj = ResourceManager.GetObject("highlighter", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap refresh { + get { + object obj = ResourceManager.GetObject("refresh", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + } +} diff --git a/PipeViewer/Properties/Resources.resx b/PipeViewer/Properties/Resources.resx new file mode 100644 index 0000000..bda86cf --- /dev/null +++ b/PipeViewer/Properties/Resources.resx @@ -0,0 +1,142 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + + + ..\Resources\eraser.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\filter.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\grid.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\grid-disable.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\highlighter.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\find.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\refresh.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + \ No newline at end of file diff --git a/PipeViewer/Properties/Settings.Designer.cs b/PipeViewer/Properties/Settings.Designer.cs new file mode 100644 index 0000000..569fdee --- /dev/null +++ b/PipeViewer/Properties/Settings.Designer.cs @@ -0,0 +1,26 @@ +//------------------------------------------------------------------------------ +// +// 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 PipeViewer.Properties { + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.9.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; + } + } + } +} diff --git a/PipeViewer/Properties/Settings.settings b/PipeViewer/Properties/Settings.settings new file mode 100644 index 0000000..3964565 --- /dev/null +++ b/PipeViewer/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + diff --git a/PipeViewer/Resources/eraser.png b/PipeViewer/Resources/eraser.png new file mode 100644 index 0000000000000000000000000000000000000000..31a1be327ec229b2aa6b2dc75733170d1ba527ef GIT binary patch literal 915 zcmV;E18n?>P)K~z|U?Uu`H6Hye0e>0ghiJhitQZ@Er=_{!%x>Kp7xKq&D zf(sQwtrZtOpo&ZX20;V`Ye5tjVu~x>6ciBzsnSi$P;4WW7E_xhP14uQBr|heOw;C_ ziHVOz56oh?=gjxrd(UMquoM3{s8W1{^LW@@D}i^lzNy1ey-}Ilf9OHGyYJRt5#T%? z*6RO0WB=*3!&DB)5)g}Gy5*?H*?;-`9~DS~TWo+{59k;m90Wu`lLTE7c%>C!7$E3Z zABznznBee^o%{Oi$;*-paPK+Rwm9om;Z^F)gML6!fLL@>!U`CSs>JiBFG?oB`3Y<7 zY?zTwoZbrn5Cs)T$ad0}giV#0{&XSRN)#mE;Ye9TAN^oANcLJs9e(r;0s@~5&nTg8 z$HegCk<>I@A@F50Uin4caZo^wL5A68hOfqfipejTixgR1A!{`tNiZ#V+s|IQW*L6{ zW;C9nX$9hNilDoU2F4>sjIS5~05xq5@VRefFHYzQnW9lWKXpBEIIln=oMiyhW<{YA zf^QyzD1s5z^qK{d;5vW-up(`bYn2dX8Q~2c01&EmOllHHgHu360#e&8pM)sO2=O8a zfUv!3X_d9P62~((p@$=7p$d#pz?od|cr1tv;*D8RZNZPa129jFCBY;1ra-XX>Fnz7 zkK`1H!vXYYfoGC1+sv5V(+uhJ$1QlE-s$LayF;mUNdjBTu5sqsBy8A#L@QX>*9v(# z99XZaYv~*q2xqEc5?{hB?&jO`d@;5}A*k>;$PySD8<&E?lg+MP*J`%>q`%?N99g3& zl(RZu^*7*BRK!Lk1VRWp%*sTiVsN?Ic4vhH>8HS_5cQ}P11A(lzj^s1`QT{+gy0Se zXQ#nUi|f6Er&>iVwP_cUp?Puz1VgEETHv7YmJ#Ki+sEp8t@0UfL|P?^g=ZDeB2fx> zPJvt!rGn=b$RrUH1@J53lE5_y0Kk1Nd=)hPP>#iDDJsS*i-rRlJN;&d}<3$7|blB zvG5VlAX?Z6f(SuSu&}XIG@#w0JDYtF1XEdv-~%Co;G+nHm_W?NV3D1jITpHMO?Gx> z*BSk*nS1|p|L?+?xmO0WgS*vgeRaKZCARI(T z@MJZUuC7XV-&HQZyg+S5Rn#{wsFX68{d;eh}Ej#)z%FjQ-9 zZXvPh_2^w2U~%dD8AWdZy*^7iz#DOm(=CB01zWZDTqS(ISlp?q_Xu{n#(;h`-0{#( z!iR{`-9(P!H6RM`u9EF7x)oCrY-xHr5sIVAqcAp#sc#O?+Ek z;p5EgA7k^2OW^{Dis$#=v$c~W2lrDdm)FKRH@9!_{SCm=mF14HdWPQaExwC11)y;M z>q6puQT2cV*9&H5%+DBV54g&65j~`?aiNg3(m`s1_CTPsAcz)=#bH%RHCh+i zk4ROWCd!=9034BbK-t$=E#*~c0Ndj6&md<(XZ_tcC@)2gk)KM4-!uwiLM;FQ002ov JPDHLkV1lOoLDm2O literal 0 HcmV?d00001 diff --git a/PipeViewer/Resources/find.png b/PipeViewer/Resources/find.png new file mode 100644 index 0000000000000000000000000000000000000000..bf35c01d51ee1331657e00506f3f35afd539f3c1 GIT binary patch literal 747 zcmVnCOg#lv;+T&tAVs79)ye?GjSc;k3>1W_kOp%?$L%Vny`0*bN`~=Eja}V_3cJ}`jl1NYR8pu3Qs|d5e zW8gh-Pz)Z3S>!cvSAH{?PIywS&m%{^maUJ*?<6FFG29>VsN~ql0&9wQ3}8@ATno9Q z1Tf=J{29S7Ie_bmI|#5K7asy#YqUEUXp7KD0w0CD0I(t#6A_63dsU%1pj%>2&6hgp zObT};0c^;m%NtGOCFaX$9C#Ho*Q>RW0N%<)1JU1ZC)9XRjo+wobA(2T)cUJ2z~fmfKz9HD002ovPDHLkV1o2hMJNCO literal 0 HcmV?d00001 diff --git a/PipeViewer/Resources/grid-disable.png b/PipeViewer/Resources/grid-disable.png new file mode 100644 index 0000000000000000000000000000000000000000..9d4ca2673a074bb67df3dde03d083f0cd0f6ee48 GIT binary patch literal 919 zcmV;I18Dq-P)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!~g&e!~vBn z4jTXf02y>eSaefwW^{L9a%BK_cXuvnZfkR6VQ^(GZ*pgw?mQX*00Q?(L_t(oN41wt zNK{c2$Ny7fn9>BP*}|fr7MeP0M)(m_NK}g;uw5W++O>#2Npn#Vk%maSHX#HBPOCyC zqFRKd+4z};29D(-b8KN`lFDoTZ_Y69y?O8X)HgqPymQaJ%sX?>J%8@OOwMja`;3P| ziWQ}06-q->vy2kq9M@RE-_F^&OZhT7CLTpu2Lry!DzOq7`841lMvD@~}hY!R8PFGi>pr{1(b=SqC=jQD@80-t8H4qSwp6;F? zZq?V~O6?6CtSCo*UM?VKL3a?1PmFZmX65+FQ!+|~b6jJ^^R{;Gw(_JkARf&jG|PDm zo{40ks{*^6Co71AGSueW$Twe>SniP!0NL_=Osqs62M5J+2h#wET@Y@j!$aw$dQm{; z=l&oyEgkE3|co z+ik?^Ot=~VvD1q3bLYj1<9YzZt~w&=5GzVj0w8ul9KCQ&tRx0Noalr%G%=xeEWLfv zZiQE8D_BP1a2PMzJH(@hb6lgFk6iK0a!>ee4|_GXOUcHVd*b&l!NW$8y&Bu4=Ei%t zT33%Ef1xbVbGD`ic?E^IeCeWi^fWZy$ME0)9<{WHM~^o5Yy;Suxhh0!x{xp$_G)Uo tWC5j9y+&EUIaOXQ;BWIA>OWTj{sSIb8`0r^ydVGo002ovPDHLkV1jJCouvQ( literal 0 HcmV?d00001 diff --git a/PipeViewer/Resources/grid.png b/PipeViewer/Resources/grid.png new file mode 100644 index 0000000000000000000000000000000000000000..24133b5c4a5fb9d7c4131ed47d26214fa56f8aeb GIT binary patch literal 805 zcmV+=1KRwFP)mmr(gLAS8 z01%MizU8<%(E*$>L}`$>9Ct^=DGlH4FYN#Tx3Ie%RYa+DCde;X`%yfUnIMW=*xd#IzKEB0 z{wcy~MJx~tB+NpoJsx=$XAF^ZA1N~`OCZEVn~DERmSmYrNhK8VFd$M$X+lxcRK%}- zBdh6MIi1tqN^)|G(jY(l-mB*3jE*EF2ciRpKl=C7O!iF8YM({iACFxBY@C@ju745= zhJiUa>e*S{=*n{PXG&G~;yDlt!~%)3jT;xff7yoSe5w7vZD`ymeiZRZ8ybbu!K4kR zK8WHu5DUZta?NpU22!1pU=85U)w$v<3paDdP#99P;w*2AcoP9y=r@s*K(_`=1*c)2&mFg1_ zr-ZKdI$xg@EB5Q;jPjm=)SUVtk|%Zyq^4$=CkVop$Q}S7tLfd8s_sScl&bD!HT_x? jM-a9&!#rUiH7B{>CXd?bRZz4*00000NkvXXu0mjfYb$IS literal 0 HcmV?d00001 diff --git a/PipeViewer/Resources/highlighter.png b/PipeViewer/Resources/highlighter.png new file mode 100644 index 0000000000000000000000000000000000000000..5f62dbd3bb4905df2156eca3c53e2cd0a7cf8aee GIT binary patch literal 1240 zcmV;}1Sk86P)SR8XpM$M zNK5!IM8m6?s1S)Ch7W!~W5D?1hcPAw2*$*OD41Y)G!{@$kwij>D2h=i&<;&W?NsW# z@7aEoPG{N~`gVWayZ50d+tG zG0SAeiJ$%#0li*7AC<$v%&hbf2{S41YxU2e^8FwfF zis=M&x0Vp?`cyC0u7wHw1gZ$}#vORNgGf~IZ0@_$3HbXec&Wa7ag^fnrU?;HeLg_k zw-0y`0MF7Vp^|}jT>+cUeb8}J&bZUb| zWx@IDW9kBptz3t25~#>KAZ?*L23EoNp<*^TzB_P7DZZyc9{cqYjIs??5sfvz1^Nl# zF9?ssz}kVF@k7P^-~^zke5=g6+}vLpaTnZK>3e`R1qbDWXGhT4Emg-~$xe+(KqD*4 z379WI>I)9?EObZvrafN-+;642<(a|hVL!p@^;;g;bFku)wc~*M+*Ybup3PUfYZt8E zuw{`NJ$~hSpsKyY#}kjlFoWl8IJjea@P}%p_;Q|Jyo-SpAX z>GJr37}75>JUof7WPwy3>L|p?E1-(ZojvnFXO~-kt!-ej-w6B3%!C~VZj2?wa+!MU zTp>7sn>QP6s1w8VO>4UVICZu-Q#yM-L@Z|6`oax-rT`qk@7pX>np^G$heC_cuo6H7 zHm&XA=|%r$N}lI&@`p4{?^Kga6=HAfxLQfoGiGf|M z{{aJgx82OlgfYgtKHpQXHhp$+wD638o?GYx9?q$x;&AmBVCcqT4D8uIOvj0!GswHfnLof?%_bQ2tOmar>Yw zZi`J6xIbJ(-v^AQJiN{x)U#j}=iVa4dV)XHj!oCf;_!sS0Sw3*()POy96?BKr>L}n zP}vuhn>kV!j!p(VCsNHNOVdXJN4;aA&65txivIv&dC=dfH$!m%00002WnRcO zUA8eJc)0Npg)4{#cZgA`2b3ycVuF$ljCdh32u2Bl2oW$EynqlFGGTyYV|Hw9x5C1uy)0GVf#@0s!9#e8ZR`6MB#H2zb;a!c#325;N?`k`&blP#5V2VCMZPWsELlo)kNu|!}& zny^bKY58WxiXA8=|CoRV|CTy1HX+=en_P9wp>+MOnJWX?B5e~n9~PHwy1#rgqE_Ta z9EU6p#AFGuJ6mMt84yt={<%98lOq>_p20B=ox1ul2iBEmi_h4B27kK?cp{x|ET)-a zOV#eX8l$r>OduEoD95nP13VK6NIL_K-u64Sl1`u?nc%nH5GBq6?wLRJZ+keRIo%hg z-ygYFRr&gm?TZcn>?O0UDEA1jy&_wO4 z7XfNVKAB;&Y;NE#ME2f2%k#cVxpdYJC}lm8NDk2Lx%Py}YN}f|0}TA&-igI3Q0LJ! z@mTZG#2mY2|45K$uNA%jly7c7@OgFthAa@dzA*zMQGk8ajFSVfq@@d(m7E`kAeD*# z{~U?FL5J&0mb)T}_S8{MIA#H&mJo>vh~AKiEE&tB!vV}qw2hk9e5N~JNRCYrAR^Z- zl|U#4U@~Xs&$$YS`uq<8jzn81q9M)kogyG`)zLN_w0cCwhp)3Y4B+A3mC>|p$?ppg zWi%(-1_MzL29oV5GjQa#=S>c{-!=^Onbz@rB0na_H4e8`YOOZlZ=Y{?+aLUT_Dfv= zOMUGx3sRLBI}(Z!8q=WUY*qmP91m~T4-}Py)T4}3I2^5U*W<%mE3}pmwU%WtF3>Wh za#`P|o``eWT0v5t{!G6KU^2x#ob1ba9ajx}F}28UwhF8PoQb|jOrLSs3Q9oAlJhQ) zL^<9)3b2!!mZy^a6K=ye8hq_fg1J#(UOKv0P0g5;b$hgp5-(H0W*3q z&>K6}GZNmIGj@YO0zK=3Osu9B?mUzq|h5C;qSCFAu@l@okNR+W-In M07*qoM6N<$g3d2FuK)l5 literal 0 HcmV?d00001 diff --git a/PipeViewer/Utils.cs b/PipeViewer/Utils.cs new file mode 100644 index 0000000..280db72 --- /dev/null +++ b/PipeViewer/Utils.cs @@ -0,0 +1,404 @@ +namespace PipeViewer +{ + public class Utils + { + public enum eFormNames + { + FormColumnFilter, + FormHighlighFilter + } + + public enum eFilterNames + { + Column, Relation, Value, Action + } + + //public enum eColumnNames + //{ + // Name = 0, + // IntegrityLevel, + // Permissions, + // Sddl, + // ClientPID, + // PipeType, + // Configuration, + // ReadMode, + // NumberOfLinks, + // DirectoryGrantedAccess, + // GrantedAccess, + // GrantedAccessGeneric, + // CreationTime, + // OwnerSid, + // OwnerName, + // GroupSid, + // GroupName, + // EndPointType, + // Handle, + // FileCreationTime, + // LastAccessTime, + // LastWriteTime, + // ChangeTime, + //} + + public static string[] ColumnNames = new string[] + { + "Name", + "IntegrityLevel", + "Permissions", + "SDDL", + "ClientPID", + "PipeType", + "Configuration", + "ReadMode", + "NumberOfLinks", + "DirectoryGrantedAccess", + "GrantedAccess", + "GrantedAccessGeneric", + "OwnerSid", + "OwnerName", + "GroupSid", + "GroupName", + "EndPointType", + "Handle", + "CreationTime", + "FileCreationTime", + "LastAccessTime", + "LastWriteTime", + "ChangeTime" + }; + + //static Utils() + //{ + // m_ColumnMapToIndex = new Dictionary(); + + // // Populate the dictionary with the values of the eColumnNames enum + // foreach (eColumnNames column in Enum.GetValues(typeof(eColumnNames))) + // { + // m_ColumnMapToIndex.Add(column.ToString(), (int)column); + // } + //} + + // TODO: Can we make it dynamic? like use a static constructor? + //public static readonly Dictionary m_ColumnMapToIndex = new Dictionary() + //{ + // { eColumnNames.Name.ToString(), (int)eColumnNames.Name }, + // { eColumnNames.IntegrityLevel.ToString(), (int)eColumnNames.IntegrityLevel }, + // { eColumnNames.Permissions.ToString(), (int)eColumnNames.Permissions }, + // { eColumnNames.Sddl.ToString(), (int)eColumnNames.Sddl }, + // { eColumnNames.ClientPID.ToString(), (int)eColumnNames.ClientPID }, + // { eColumnNames.PipeType.ToString(), (int)eColumnNames.PipeType }, + // { eColumnNames.Configuration.ToString(), (int)eColumnNames.Configuration }, + // { eColumnNames.ReadMode.ToString(), (int)eColumnNames.ReadMode }, + // { eColumnNames.NumberOfLinks.ToString(), (int)eColumnNames.NumberOfLinks }, + // { eColumnNames.DirectoryGrantedAccess.ToString(), (int)eColumnNames.DirectoryGrantedAccess }, + // { eColumnNames.GrantedAccess.ToString(), (int)eColumnNames.GrantedAccess }, + // { eColumnNames.GrantedAccessGeneric.ToString(), (int)eColumnNames.GrantedAccessGeneric }, + // { eColumnNames.CreationTime.ToString(), (int)eColumnNames.CreationTime }, + // { eColumnNames.OwnerSid.ToString(), (int)eColumnNames.OwnerSid }, + // { eColumnNames.OwnerName.ToString(), (int)eColumnNames.OwnerName }, + // { eColumnNames.GroupSid.ToString(), (int)eColumnNames.GroupSid }, + // { eColumnNames.GroupName.ToString(), (int)eColumnNames.GroupName }, + // { eColumnNames.EndPointType.ToString(), (int)eColumnNames.EndPointType }, + // { eColumnNames.Handle.ToString(), (int)eColumnNames.Handle }, + // { eColumnNames.FileCreationTime.ToString(), (int)eColumnNames.FileCreationTime }, + // { eColumnNames.LastAccessTime.ToString(), (int)eColumnNames.LastAccessTime }, + // { eColumnNames.LastWriteTime.ToString(), (int)eColumnNames.LastWriteTime}, + // { eColumnNames.ChangeTime.ToString(), (int)eColumnNames.ChangeTime} + //}; + + + //public static void CreateDummyPipeForTesting() + //{ + // // Create a new named pipe server + // //NamedPipeServerStream pipeServer = new NamedPipeServerStream("MyPipe", PipeDirection.InOut, 1, PipeTransmissionMode.Message, PipeOptions.Asynchronous); + // /** + // * This will create a named pipe with the name "myPipe" and full privileges for everyone. + // * The PipeAccessRights.FullControl flag grants full control over the named pipe to all users, + // * including the ability to read, write, and execute. + // * The PipeAccessRights.AccessSystemSecurity flag grants the ability to access the system security descriptor associated with the named pipe. + // * */ + + // // get the pipe security object and add an access rule granting full control to everyone + // PipeSecurity pipeSecurity = new PipeSecurity(); + // pipeSecurity.AddAccessRule(new PipeAccessRule("Everyone", PipeAccessRights.FullControl, AccessControlType.Allow)); + // // Set DACL to NULL. + // /* + // * The SetAccessRuleProtection method is used to set the DACL to NULL. + // * The first argument specifies whether to protect the DACL from inheriting access control entries (ACEs) from the parent object. + // * The second argument specifies whether to protect the DACL from being modified. + // * Setting both arguments to true will set the DACL to NULL. + // * */ + // pipeSecurity.SetAccessRuleProtection(true, true); + + // NamedPipeServerStream pipeServer = new NamedPipeServerStream("myPipe", PipeDirection.InOut, + // -1, PipeTransmissionMode.Byte, PipeOptions.None, 4096, 4096, pipeSecurity); + + // // Wait for a client to connect + // Console.WriteLine("Waiting for client connection..."); + // pipeServer.WaitForConnection(); + + // Console.WriteLine("Client connected."); + + // // Read and write to the pipe + // using (StreamReader reader = new StreamReader(pipeServer)) + // using (StreamWriter writer = new StreamWriter(pipeServer)) + // { + // while (true) + // { + // // Read a message from the client + // string message = reader.ReadLine(); + // Console.WriteLine("Received message: " + message); + + // // Write a message to the client + // writer.WriteLine("Hello from the server!"); + // writer.Flush(); + // } + // } + //} + + + //public static void dummyLoopRowsForDebug() + //{ + // for (int i = 0; i < 1000; i++) + // { + // Thread.Sleep(500); + // DataGridViewRow row = new DataGridViewRow(); + // row.CreateCells(dataGridView1); + + // row.Cells[m_ColumnIndexes[ColumnName.HeaderText]].Value = @"\\.\pipe\mypipe"; + // row.Cells[m_ColumnIndexes[ColumnSddl.HeaderText]].Value = ""; + // row.Cells[m_ColumnIndexes[ColumnOwnerSid.HeaderText]].Value = "1"; + // row.Cells[m_ColumnIndexes[ColumnOwnerName.HeaderText]].Value = "SidName"; + // row.Cells[m_ColumnIndexes[ColumnGroupSid.HeaderText]].Value = "1"; + // row.Cells[m_ColumnIndexes[ColumnGroupName.HeaderText]].Value = "GroupName"; + // row.Cells[m_ColumnIndexes[ColumnIntegrityLevel.HeaderText]].Value = "Medium"; + // row.Cells[m_ColumnIndexes[ColumnEndPointType.HeaderText]].Value = "Client"; + // row.Cells[m_ColumnIndexes[ColumnConfiguration.HeaderText]].Value = "FullDuplex"; + // row.Cells[m_ColumnIndexes[ColumnClientPID.HeaderText]].Value = "lsass (1)"; + // row.Cells[m_ColumnIndexes[ColumnPipeType.HeaderText]].Value = "Client"; + // row.Cells[m_ColumnIndexes[ColumnReadMode.HeaderText]].Value = ""; + // row.Cells[m_ColumnIndexes[ColumnNumberOfLinks.HeaderText]].Value = "1"; + // row.Cells[m_ColumnIndexes[ColumnDirectoryGrantedAccess.HeaderText]].Value = ""; + // row.Cells[m_ColumnIndexes[ColumnGrantedAccess.HeaderText]].Value = ""; + // row.Cells[m_ColumnIndexes[ColumnGrantedAccessGeneric.HeaderText]].Value = ""; + + // row.Cells[m_ColumnIndexes[ColumnHandle.HeaderText]].Value = "0x1"; + // row.Cells[m_ColumnIndexes[ColumnCreationTime.HeaderText]].Value = ""; + // row.Cells[m_ColumnIndexes[ColumnFileCreationTime.HeaderText]].Value = ""; + // row.Cells[m_ColumnIndexes[ColumnLastAccessTime.HeaderText]].Value = ""; + // row.Cells[m_ColumnIndexes[ColumnLastWriteTime.HeaderText]].Value = ""; + // row.Cells[m_ColumnIndexes[ColumnChangeTime.HeaderText]].Value = ""; + // row.DefaultCellStyle.Font = new Font(dataGridView1.DefaultCellStyle.Font, FontStyle.Regular); + // dataGridView1.Rows.Add(row); + // } + //} + //private void dummRowsForDebug() + //{ + // DataGridViewRow row = new DataGridViewRow(); + // row.CreateCells(dataGridView1); + + // row.Cells[m_ColumnIndexes[ColumnName.HeaderText]].Value = @"\\.\pipe\mypipe"; + // row.Cells[m_ColumnIndexes[ColumnSddl.HeaderText]].Value = ""; + // row.Cells[m_ColumnIndexes[ColumnOwnerSid.HeaderText]].Value = "1"; + // row.Cells[m_ColumnIndexes[ColumnOwnerName.HeaderText]].Value = "SidName"; + // row.Cells[m_ColumnIndexes[ColumnGroupSid.HeaderText]].Value = "1"; + // row.Cells[m_ColumnIndexes[ColumnGroupName.HeaderText]].Value = "GroupName"; + // row.Cells[m_ColumnIndexes[ColumnIntegrityLevel.HeaderText]].Value = "Medium"; + // row.Cells[m_ColumnIndexes[ColumnEndPointType.HeaderText]].Value = "Client"; + // row.Cells[m_ColumnIndexes[ColumnConfiguration.HeaderText]].Value = "FullDuplex"; + // row.Cells[m_ColumnIndexes[ColumnClientPID.HeaderText]].Value = "lsass (1)"; + // row.Cells[m_ColumnIndexes[ColumnPipeType.HeaderText]].Value = "Client"; + // row.Cells[m_ColumnIndexes[ColumnReadMode.HeaderText]].Value = ""; + // row.Cells[m_ColumnIndexes[ColumnNumberOfLinks.HeaderText]].Value = "1"; + // row.Cells[m_ColumnIndexes[ColumnDirectoryGrantedAccess.HeaderText]].Value = ""; + // row.Cells[m_ColumnIndexes[ColumnGrantedAccess.HeaderText]].Value = ""; + // row.Cells[m_ColumnIndexes[ColumnGrantedAccessGeneric.HeaderText]].Value = ""; + + // row.Cells[m_ColumnIndexes[ColumnHandle.HeaderText]].Value = "0x1"; + // row.Cells[m_ColumnIndexes[ColumnCreationTime.HeaderText]].Value = ""; + // row.Cells[m_ColumnIndexes[ColumnFileCreationTime.HeaderText]].Value = ""; + // row.Cells[m_ColumnIndexes[ColumnLastAccessTime.HeaderText]].Value = ""; + // row.Cells[m_ColumnIndexes[ColumnLastWriteTime.HeaderText]].Value = ""; + // row.Cells[m_ColumnIndexes[ColumnChangeTime.HeaderText]].Value = ""; + // row.DefaultCellStyle.Font = new Font(dataGridView1.DefaultCellStyle.Font, FontStyle.Regular); + // dataGridView1.Rows.Add(row); + + // row = new DataGridViewRow(); + // row.CreateCells(dataGridView1); + + // row.Cells[m_ColumnIndexes[ColumnName.HeaderText]].Value = @"\\.\pipe\mypipe"; + // row.Cells[m_ColumnIndexes[ColumnSddl.HeaderText]].Value = ""; + // row.Cells[m_ColumnIndexes[ColumnOwnerSid.HeaderText]].Value = "1"; + // row.Cells[m_ColumnIndexes[ColumnOwnerName.HeaderText]].Value = "SidName"; + // row.Cells[m_ColumnIndexes[ColumnGroupSid.HeaderText]].Value = "1"; + // row.Cells[m_ColumnIndexes[ColumnGroupName.HeaderText]].Value = "GroupName"; + // row.Cells[m_ColumnIndexes[ColumnIntegrityLevel.HeaderText]].Value = "Medium"; + // row.Cells[m_ColumnIndexes[ColumnEndPointType.HeaderText]].Value = "Client"; + // row.Cells[m_ColumnIndexes[ColumnConfiguration.HeaderText]].Value = "FullDuplex"; + // row.Cells[m_ColumnIndexes[ColumnClientPID.HeaderText]].Value = "lsass (1)"; + // row.Cells[m_ColumnIndexes[ColumnPipeType.HeaderText]].Value = "Client"; + // row.Cells[m_ColumnIndexes[ColumnReadMode.HeaderText]].Value = ""; + // row.Cells[m_ColumnIndexes[ColumnNumberOfLinks.HeaderText]].Value = "1"; + // row.Cells[m_ColumnIndexes[ColumnDirectoryGrantedAccess.HeaderText]].Value = ""; + // row.Cells[m_ColumnIndexes[ColumnGrantedAccess.HeaderText]].Value = ""; + // row.Cells[m_ColumnIndexes[ColumnGrantedAccessGeneric.HeaderText]].Value = ""; + // row.Cells[m_ColumnIndexes[ColumnHandle.HeaderText]].Value = "0x1"; + // row.Cells[m_ColumnIndexes[ColumnCreationTime.HeaderText]].Value = ""; + // row.Cells[m_ColumnIndexes[ColumnFileCreationTime.HeaderText]].Value = ""; + // row.Cells[m_ColumnIndexes[ColumnLastAccessTime.HeaderText]].Value = ""; + // row.Cells[m_ColumnIndexes[ColumnLastWriteTime.HeaderText]].Value = ""; + // row.Cells[m_ColumnIndexes[ColumnChangeTime.HeaderText]].Value = ""; + // row.DefaultCellStyle.Font = new Font(dataGridView1.DefaultCellStyle.Font, FontStyle.Regular); + // dataGridView1.Rows.Add(row); + + // row = new DataGridViewRow(); + // row.CreateCells(dataGridView1); + + // row.Cells[m_ColumnIndexes[ColumnName.HeaderText]].Value = @"\\.\pipe\mypipe"; + // row.Cells[m_ColumnIndexes[ColumnSddl.HeaderText]].Value = ""; + // row.Cells[m_ColumnIndexes[ColumnOwnerSid.HeaderText]].Value = "1"; + // row.Cells[m_ColumnIndexes[ColumnOwnerName.HeaderText]].Value = "SidName"; + // row.Cells[m_ColumnIndexes[ColumnGroupSid.HeaderText]].Value = "1"; + // row.Cells[m_ColumnIndexes[ColumnGroupName.HeaderText]].Value = "GroupName"; + // row.Cells[m_ColumnIndexes[ColumnIntegrityLevel.HeaderText]].Value = "Medium"; + // row.Cells[m_ColumnIndexes[ColumnEndPointType.HeaderText]].Value = "Client"; + // row.Cells[m_ColumnIndexes[ColumnConfiguration.HeaderText]].Value = "FullDuplex"; + // row.Cells[m_ColumnIndexes[ColumnClientPID.HeaderText]].Value = "lsass (1)"; + // row.Cells[m_ColumnIndexes[ColumnPipeType.HeaderText]].Value = "Client"; + // row.Cells[m_ColumnIndexes[ColumnReadMode.HeaderText]].Value = ""; + // row.Cells[m_ColumnIndexes[ColumnNumberOfLinks.HeaderText]].Value = "1"; + // row.Cells[m_ColumnIndexes[ColumnDirectoryGrantedAccess.HeaderText]].Value = ""; + // row.Cells[m_ColumnIndexes[ColumnGrantedAccess.HeaderText]].Value = ""; + // row.Cells[m_ColumnIndexes[ColumnGrantedAccessGeneric.HeaderText]].Value = ""; + // row.Cells[m_ColumnIndexes[ColumnHandle.HeaderText]].Value = "0x1"; + // row.Cells[m_ColumnIndexes[ColumnCreationTime.HeaderText]].Value = ""; + // row.Cells[m_ColumnIndexes[ColumnFileCreationTime.HeaderText]].Value = ""; + // row.Cells[m_ColumnIndexes[ColumnLastAccessTime.HeaderText]].Value = ""; + // row.Cells[m_ColumnIndexes[ColumnLastWriteTime.HeaderText]].Value = ""; + // row.Cells[m_ColumnIndexes[ColumnChangeTime.HeaderText]].Value = ""; + // row.DefaultCellStyle.Font = new Font(dataGridView1.DefaultCellStyle.Font, FontStyle.Regular); + // dataGridView1.Rows.Add(row); + + // row = new DataGridViewRow(); + // row.CreateCells(dataGridView1); + + // row.Cells[m_ColumnIndexes[ColumnName.HeaderText]].Value = @"\\.\pipe\mypipe"; + // row.Cells[m_ColumnIndexes[ColumnSddl.HeaderText]].Value = ""; + // row.Cells[m_ColumnIndexes[ColumnOwnerSid.HeaderText]].Value = "1"; + // row.Cells[m_ColumnIndexes[ColumnOwnerName.HeaderText]].Value = "SidName"; + // row.Cells[m_ColumnIndexes[ColumnGroupSid.HeaderText]].Value = "1"; + // row.Cells[m_ColumnIndexes[ColumnGroupName.HeaderText]].Value = "GroupName"; + // row.Cells[m_ColumnIndexes[ColumnIntegrityLevel.HeaderText]].Value = "Medium"; + // row.Cells[m_ColumnIndexes[ColumnEndPointType.HeaderText]].Value = "Client"; + // row.Cells[m_ColumnIndexes[ColumnConfiguration.HeaderText]].Value = "FullDuplex"; + // row.Cells[m_ColumnIndexes[ColumnClientPID.HeaderText]].Value = "lsass (1)"; + // row.Cells[m_ColumnIndexes[ColumnPipeType.HeaderText]].Value = "Client"; + // row.Cells[m_ColumnIndexes[ColumnReadMode.HeaderText]].Value = ""; + // row.Cells[m_ColumnIndexes[ColumnNumberOfLinks.HeaderText]].Value = "1"; + // row.Cells[m_ColumnIndexes[ColumnDirectoryGrantedAccess.HeaderText]].Value = ""; + // row.Cells[m_ColumnIndexes[ColumnGrantedAccess.HeaderText]].Value = ""; + // row.Cells[m_ColumnIndexes[ColumnGrantedAccessGeneric.HeaderText]].Value = ""; + // row.Cells[m_ColumnIndexes[ColumnHandle.HeaderText]].Value = "0x1"; + // row.Cells[m_ColumnIndexes[ColumnCreationTime.HeaderText]].Value = ""; + // row.Cells[m_ColumnIndexes[ColumnFileCreationTime.HeaderText]].Value = ""; + // row.Cells[m_ColumnIndexes[ColumnLastAccessTime.HeaderText]].Value = ""; + // row.Cells[m_ColumnIndexes[ColumnLastWriteTime.HeaderText]].Value = ""; + // row.Cells[m_ColumnIndexes[ColumnChangeTime.HeaderText]].Value = ""; + // row.DefaultCellStyle.Font = new Font(dataGridView1.DefaultCellStyle.Font, FontStyle.Regular); + // dataGridView1.Rows.Add(row); + + // row = new DataGridViewRow(); + // row.CreateCells(dataGridView1); + + // row.Cells[m_ColumnIndexes[ColumnName.HeaderText]].Value = @"\\.\pipe\mypipe"; + // row.Cells[m_ColumnIndexes[ColumnSddl.HeaderText]].Value = ""; + // row.Cells[m_ColumnIndexes[ColumnOwnerSid.HeaderText]].Value = "1"; + // row.Cells[m_ColumnIndexes[ColumnOwnerName.HeaderText]].Value = "SidName"; + // row.Cells[m_ColumnIndexes[ColumnGroupSid.HeaderText]].Value = "1"; + // row.Cells[m_ColumnIndexes[ColumnGroupName.HeaderText]].Value = "GroupName"; + // row.Cells[m_ColumnIndexes[ColumnIntegrityLevel.HeaderText]].Value = "Medium"; + // row.Cells[m_ColumnIndexes[ColumnEndPointType.HeaderText]].Value = "Client"; + // row.Cells[m_ColumnIndexes[ColumnConfiguration.HeaderText]].Value = ""; + + + // row.Cells[m_ColumnIndexes[ColumnClientPID.HeaderText]].Value = "lsass (1)"; + // row.Cells[m_ColumnIndexes[ColumnPipeType.HeaderText]].Value = "Client"; + // row.Cells[m_ColumnIndexes[ColumnReadMode.HeaderText]].Value = ""; + // row.Cells[m_ColumnIndexes[ColumnNumberOfLinks.HeaderText]].Value = "1"; + // row.Cells[m_ColumnIndexes[ColumnDirectoryGrantedAccess.HeaderText]].Value = ""; + // row.Cells[m_ColumnIndexes[ColumnGrantedAccess.HeaderText]].Value = ""; + // row.Cells[m_ColumnIndexes[ColumnGrantedAccessGeneric.HeaderText]].Value = ""; + + // row.Cells[m_ColumnIndexes[ColumnHandle.HeaderText]].Value = "0x1"; + // row.Cells[m_ColumnIndexes[ColumnCreationTime.HeaderText]].Value = ""; + // row.Cells[m_ColumnIndexes[ColumnFileCreationTime.HeaderText]].Value = ""; + // row.Cells[m_ColumnIndexes[ColumnLastAccessTime.HeaderText]].Value = ""; + // row.Cells[m_ColumnIndexes[ColumnLastWriteTime.HeaderText]].Value = ""; + // row.Cells[m_ColumnIndexes[ColumnChangeTime.HeaderText]].Value = ""; + // row.DefaultCellStyle.Font = new Font(dataGridView1.DefaultCellStyle.Font, FontStyle.Regular); + // dataGridView1.Rows.Add(row); + + // row = new DataGridViewRow(); + // row.CreateCells(dataGridView1); + + // row.Cells[m_ColumnIndexes[ColumnName.HeaderText]].Value = @"\\.\pipe\mypipe"; + // row.Cells[m_ColumnIndexes[ColumnSddl.HeaderText]].Value = ""; + // row.Cells[m_ColumnIndexes[ColumnOwnerSid.HeaderText]].Value = "1"; + // row.Cells[m_ColumnIndexes[ColumnOwnerName.HeaderText]].Value = "SidName"; + // row.Cells[m_ColumnIndexes[ColumnGroupSid.HeaderText]].Value = "1"; + // row.Cells[m_ColumnIndexes[ColumnGroupName.HeaderText]].Value = "GroupName"; + // row.Cells[m_ColumnIndexes[ColumnIntegrityLevel.HeaderText]].Value = "Medium"; + // row.Cells[m_ColumnIndexes[ColumnEndPointType.HeaderText]].Value = "Client"; + // row.Cells[m_ColumnIndexes[ColumnConfiguration.HeaderText]].Value = "FullDuplex"; + + + // row.Cells[m_ColumnIndexes[ColumnClientPID.HeaderText]].Value = "lsass (1)"; + // row.Cells[m_ColumnIndexes[ColumnPipeType.HeaderText]].Value = "Client"; + // row.Cells[m_ColumnIndexes[ColumnReadMode.HeaderText]].Value = ""; + // row.Cells[m_ColumnIndexes[ColumnNumberOfLinks.HeaderText]].Value = "1"; + // row.Cells[m_ColumnIndexes[ColumnDirectoryGrantedAccess.HeaderText]].Value = ""; + // row.Cells[m_ColumnIndexes[ColumnGrantedAccess.HeaderText]].Value = ""; + // row.Cells[m_ColumnIndexes[ColumnGrantedAccessGeneric.HeaderText]].Value = ""; + + // row.Cells[m_ColumnIndexes[ColumnHandle.HeaderText]].Value = "0x1"; + // row.Cells[m_ColumnIndexes[ColumnCreationTime.HeaderText]].Value = ""; + // row.Cells[m_ColumnIndexes[ColumnFileCreationTime.HeaderText]].Value = ""; + // row.Cells[m_ColumnIndexes[ColumnLastAccessTime.HeaderText]].Value = ""; + // row.Cells[m_ColumnIndexes[ColumnLastWriteTime.HeaderText]].Value = ""; + // row.Cells[m_ColumnIndexes[ColumnChangeTime.HeaderText]].Value = ""; + // row.DefaultCellStyle.Font = new Font(dataGridView1.DefaultCellStyle.Font, FontStyle.Regular); + // dataGridView1.Rows.Add(row); + + // row = new DataGridViewRow(); + // row.CreateCells(dataGridView1); + + // row.Cells[m_ColumnIndexes[ColumnName.HeaderText]].Value = @"\\.\pipe\mypipe"; + // row.Cells[m_ColumnIndexes[ColumnSddl.HeaderText]].Value = ""; + // row.Cells[m_ColumnIndexes[ColumnOwnerSid.HeaderText]].Value = "1"; + // row.Cells[m_ColumnIndexes[ColumnOwnerName.HeaderText]].Value = "SidName"; + // row.Cells[m_ColumnIndexes[ColumnGroupSid.HeaderText]].Value = "1"; + // row.Cells[m_ColumnIndexes[ColumnGroupName.HeaderText]].Value = "GroupName"; + // row.Cells[m_ColumnIndexes[ColumnIntegrityLevel.HeaderText]].Value = "Medium"; + // row.Cells[m_ColumnIndexes[ColumnEndPointType.HeaderText]].Value = "Client"; + // row.Cells[m_ColumnIndexes[ColumnConfiguration.HeaderText]].Value = "FullDuplex"; + + + // row.Cells[m_ColumnIndexes[ColumnClientPID.HeaderText]].Value = "lsass (1)"; + // row.Cells[m_ColumnIndexes[ColumnPipeType.HeaderText]].Value = "Client"; + // row.Cells[m_ColumnIndexes[ColumnReadMode.HeaderText]].Value = ""; + // row.Cells[m_ColumnIndexes[ColumnNumberOfLinks.HeaderText]].Value = "1"; + // row.Cells[m_ColumnIndexes[ColumnDirectoryGrantedAccess.HeaderText]].Value = ""; + // row.Cells[m_ColumnIndexes[ColumnGrantedAccess.HeaderText]].Value = ""; + // row.Cells[m_ColumnIndexes[ColumnGrantedAccessGeneric.HeaderText]].Value = ""; + + // row.Cells[m_ColumnIndexes[ColumnHandle.HeaderText]].Value = "0x1"; + // row.Cells[m_ColumnIndexes[ColumnCreationTime.HeaderText]].Value = ""; + // row.Cells[m_ColumnIndexes[ColumnFileCreationTime.HeaderText]].Value = ""; + // row.Cells[m_ColumnIndexes[ColumnLastAccessTime.HeaderText]].Value = ""; + // row.Cells[m_ColumnIndexes[ColumnLastWriteTime.HeaderText]].Value = ""; + // row.Cells[m_ColumnIndexes[ColumnChangeTime.HeaderText]].Value = ""; + // row.DefaultCellStyle.Font = new Font(dataGridView1.DefaultCellStyle.Font, FontStyle.Regular); + // dataGridView1.Rows.Add(row); + //} + } +}