frmUPnPBrowser:
Source Code for [KnC_cg_bfg_exploit_PoC]ManagedUPnPTest.frmUPnPBrowser
// Decompiled by Salamander version 2.0.0
// Copyright 2002-2006 Remotesoft Inc. All rights reserved.
// http://www.remotesoft.com/salamander
using ManagedUPnP;
using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
namespace ManagedUPnPTest
{
public class frmUPnPBrowser : Form
{
private ManagedUPnP.AutoEventedDiscoveryServices mdsServices;
private ctlUPnPInfo miInfo = null;
private IContainer components = null;
private ctlUPnPTreeBrowser tvUPnP;
private ImageList ilIcons;
private Panel pnlInfo;
private SplitContainer scMain;
private TabControl tcMain;
private TabPage tpInfo;
private TabPage tpLog;
private ctlLogBox txtLog;
public frmUPnPBrowser()
{
InitializeComponent();
}
private void frmManagedUPnPTest_Load(object sender, EventArgs e)
{
Logging.LogLines += new LogLinesEventHandler(this, Logging_LogLines);
Logging.Enabled = true;
mdsServices = new ManagedUPnP.AutoEventedDiscoveryServices(null);
mdsServices.ResolveNetworkInterfaces = true;
mdsServices.CanCreateServiceFor += new AutoEventedDiscoveryServicesB1.CanCreateServiceForEventHandler(this, dsServices_CanCreateServiceFor);
mdsServices.CreateServiceFor += new AutoEventedDiscoveryServicesB1.CreateServiceForEventHandler(this, dsServices_CreateServiceFor);
mdsServices.StatusNotifyAction += new AutoEventedDiscoveryServicesB1.StatusNotifyActionEventHandler(this, dsServices_StatusNotifyAction);
WindowsFirewall.CheckUPnPFirewallRules(null);
mdsServices.ReStartAsync();
}
private void frmUPnPBrowser_FormClosing(object sender, FormClosingEventArgs e)
{
Logging.Enabled = false;
Logging.LogLines -= new LogLinesEventHandler(this, Logging_LogLines);
}
private void Logging_LogLines(object sender, LogLinesEventArgs a)
{
string str2 = String.Concat(DateTime.Now.ToString("[yyyy/MM/dd HH:mm:ss.fff] "), new String(' ', a.Indent * 4));
txtLog.AppendLog(String.Concat(str2, a.Lines.Replace("\r\n", String.Concat("\r\n", str2)), "\r\n"));
}
private void dsServices_StatusNotifyAction(object sender, AutoEventedDiscoveryServicesB1.StatusNotifyActionEventArgs a)
{
AutoDiscoveryServicesB1.NotifyAction autoDiscoveryServicesB1_NotifyAction = a.NotifyAction;
switch (autoDiscoveryServicesB1_NotifyAction)
{
case 1:
tvUPnP.RemoveDevice((String)a.Data);
break;
case 2:
tvUPnP.RemoveService((Service)a.Data);
break;
default:
if (autoDiscoveryServicesB1_NotifyAction == 10)
{
tvUPnP.AddService((Service)a.Data);
}
break;
}
}
private void dsServices_CreateServiceFor(object sender, AutoEventedDiscoveryServicesB1.CreateServiceForEventArgs a)
{
a.CreatedAutoService = a.Service;
}
private void dsServices_CanCreateServiceFor(object sender, AutoEventedDiscoveryServicesB1.CanCreateServiceForEventArgs a)
{
a.CanCreate = true;
}
private void tvUPnP_AfterSelect(object sender, TreeViewEventArgs e)
{
IUPnPTreeItem iUPnPTreeItem = tvUPnP.SelectedItem;
ctlUPnPInfo CtlUPnPInfo = miInfo;
miInfo = null;
try
{
bool flag = iUPnPTreeItem == null;
if (!flag)
{
miInfo = iUPnPTreeItem.InfoControl;
flag = miInfo == null;
if (!flag)
{
miInfo.Dock = DockStyle.Fill;
pnlInfo.Controls.Add(miInfo);
}
}
}
finally
{
bool flag = CtlUPnPInfo == null;
if (!flag)
{
pnlInfo.Controls.Remove(CtlUPnPInfo);
CtlUPnPInfo.Dispose();
}
}
}
protected override void Dispose(bool disposing)
{
if (!(disposing ? (components == null) : 1))
{
components.Dispose();
}
base.Dispose(disposing);
}
private void InitializeComponent()
{
components = new Container();
ilIcons = new ImageList(components);
pnlInfo = new Panel();
scMain = new SplitContainer();
tcMain = new TabControl();
tpInfo = new TabPage();
tpLog = new TabPage();
tvUPnP = new ctlUPnPTreeBrowser();
txtLog = new ctlLogBox();
((ISupportInitialize)scMain).BeginInit();
scMain.Panel1.SuspendLayout();
scMain.Panel2.SuspendLayout();
scMain.SuspendLayout();
tcMain.SuspendLayout();
tpInfo.SuspendLayout();
tpLog.SuspendLayout();
base.SuspendLayout();
ilIcons.ColorDepth = ColorDepth.Depth8Bit;
ilIcons.ImageSize = new Size(16, 16);
ilIcons.TransparentColor = Color.Transparent;
pnlInfo.Dock = DockStyle.Fill;
pnlInfo.Location = new Point(3, 3);
pnlInfo.Name = "pnlInfo";
pnlInfo.Size = new Size(645, 646);
pnlInfo.TabIndex = 1;
scMain.Dock = DockStyle.Fill;
scMain.Location = new Point(0, 0);
scMain.Name = "scMain";
scMain.Panel1.Controls.Add(tvUPnP);
scMain.Panel2.Controls.Add(tcMain);
scMain.Size = new Size(1055, 678);
scMain.SplitterDistance = 392;
scMain.TabIndex = 2;
tcMain.Controls.Add(tpInfo);
tcMain.Controls.Add(tpLog);
tcMain.Dock = DockStyle.Fill;
tcMain.Location = new Point(0, 0);
tcMain.Name = "tcMain";
tcMain.SelectedIndex = 0;
tcMain.Size = new Size(659, 678);
tcMain.TabIndex = 1;
tpInfo.Controls.Add(pnlInfo);
tpInfo.Location = new Point(4, 22);
tpInfo.Name = "tpInfo";
tpInfo.Padding = new Padding(3);
tpInfo.Size = new Size(651, 652);
tpInfo.TabIndex = 0;
tpInfo.Text = "Selected Item Info";
tpInfo.UseVisualStyleBackColor = true;
tpLog.Controls.Add(txtLog);
tpLog.Location = new Point(4, 22);
tpLog.Name = "tpLog";
tpLog.Padding = new Padding(3);
tpLog.Size = new Size(496, 502);
tpLog.TabIndex = 1;
tpLog.Text = "UPnP Log";
tpLog.UseVisualStyleBackColor = true;
tvUPnP.Dock = DockStyle.Fill;
tvUPnP.ImageIndex = 1;
tvUPnP.Location = new Point(0, 0);
tvUPnP.Name = "tvUPnP";
tvUPnP.SelectedImageIndex = 0;
tvUPnP.Size = new Size(392, 678);
tvUPnP.TabIndex = 0;
tvUPnP.AfterSelect += new TreeViewEventHandler(this.tvUPnP_AfterSelect);
txtLog.BackColor = SystemColors.Window;
txtLog.Dock = DockStyle.Fill;
txtLog.Font = new Font("Courier New", 8.25F);
txtLog.Location = new Point(3, 3);
txtLog.Name = "txtLog";
txtLog.ReadOnly = true;
txtLog.Size = new Size(490, 496);
txtLog.TabIndex = 0;
txtLog.Text = "";
txtLog.WordWrap = false;
base.AutoScaleDimensions = new SizeF(6.0F, 13.0F);
base.AutoScaleMode = AutoScaleMode.Font;
base.ClientSize = new Size(1055, 678);
base.Controls.Add(scMain);
base.Name = "frmUPnPBrowser";
Text = "KnC Miner - CGminer - BFGminer exploiter PoC";
base.FormClosing += new FormClosingEventHandler(this.frmUPnPBrowser_FormClosing);
base.Load += new EventHandler(this.frmManagedUPnPTest_Load);
scMain.Panel1.ResumeLayout(false);
scMain.Panel2.ResumeLayout(false);
((ISupportInitialize)scMain).EndInit();
scMain.ResumeLayout(false);
tcMain.ResumeLayout(false);
tpInfo.ResumeLayout(false);
tpLog.ResumeLayout(false);
base.ResumeLayout(false);
}
}
}
Am I right? Should I paste what it does?