From 267d9d0c380acc535bf01aaba44684fe8f2918f0 Mon Sep 17 00:00:00 2001 From: shack2 <1341413415@qq.com> Date: Fri, 14 Dec 2018 10:36:09 +0800 Subject: [PATCH] update20181214 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 2018-12-14: 修复由于mstscax.dll使用了win10平台的dll,导致在非win10系统运行时,rdp报错。 --- SNETCracker/Main.Designer.cs | 37 ++--- SNETCracker/Main.cs | 190 +++++++++++++------------ SNETCracker/Properties/AssemblyInfo.cs | 4 +- SNETCracker/SNETCracker.csproj | 11 -- SNETCracker/rdp/RdpClient.cs | 2 +- 5 files changed, 123 insertions(+), 121 deletions(-) diff --git a/SNETCracker/Main.Designer.cs b/SNETCracker/Main.Designer.cs index 1cd0cf3..7e77320 100644 --- a/SNETCracker/Main.Designer.cs +++ b/SNETCracker/Main.Designer.cs @@ -86,6 +86,8 @@ private void InitializeComponent() this.stxt_crackerSuccessCount = new System.Windows.Forms.ToolStripStatusLabel(); this.toolStripStatusLabel5 = new System.Windows.Forms.ToolStripStatusLabel(); this.stxt_speed = new System.Windows.Forms.ToolStripStatusLabel(); + this.toolStripStatusLabel4 = new System.Windows.Forms.ToolStripStatusLabel(); + this.tssl_notScanPortsSumCount = new System.Windows.Forms.ToolStripStatusLabel(); this.bt_timer = new System.Windows.Forms.Timer(this.components); this.menuStrip1 = new System.Windows.Forms.MenuStrip(); this.tsmi_options = new System.Windows.Forms.ToolStripMenuItem(); @@ -99,8 +101,6 @@ private void InitializeComponent() this.tsmi_help_version = new System.Windows.Forms.ToolStripMenuItem(); this.tsmi_help_support = new System.Windows.Forms.ToolStripMenuItem(); this.tsmi_tools = new System.Windows.Forms.ToolStripMenuItem(); - this.toolStripStatusLabel4 = new System.Windows.Forms.ToolStripStatusLabel(); - this.tssl_notScanPortsSumCount = new System.Windows.Forms.ToolStripStatusLabel(); this.groupBox1.SuspendLayout(); this.groupBox2.SuspendLayout(); this.cms_lvw.SuspendLayout(); @@ -437,6 +437,7 @@ private void InitializeComponent() this.list_lvw.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.list_lvw.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.list_lvw.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { this.col_id, this.col_ip, @@ -449,7 +450,7 @@ private void InitializeComponent() this.list_lvw.ContextMenuStrip = this.cms_lvw; this.list_lvw.FullRowSelect = true; this.list_lvw.GridLines = true; - this.list_lvw.Location = new System.Drawing.Point(3, 15); + this.list_lvw.Location = new System.Drawing.Point(6, 15); this.list_lvw.Name = "list_lvw"; this.list_lvw.Size = new System.Drawing.Size(870, 394); this.list_lvw.TabIndex = 0; @@ -473,6 +474,7 @@ private void InitializeComponent() // col_port // this.col_port.Text = "端口"; + this.col_port.Width = 80; // // col_username // @@ -492,6 +494,7 @@ private void InitializeComponent() // col_useTime // this.col_useTime.Text = "用时[毫秒]"; + this.col_useTime.Width = 100; // // cms_lvw // @@ -580,7 +583,7 @@ private void InitializeComponent() // tools_proBar // this.tools_proBar.Name = "tools_proBar"; - this.tools_proBar.Size = new System.Drawing.Size(200, 16); + this.tools_proBar.Size = new System.Drawing.Size(150, 16); // // stxt_percent // @@ -648,6 +651,18 @@ private void InitializeComponent() this.stxt_speed.Size = new System.Drawing.Size(15, 17); this.stxt_speed.Text = "0"; // + // toolStripStatusLabel4 + // + this.toolStripStatusLabel4.Name = "toolStripStatusLabel4"; + this.toolStripStatusLabel4.Size = new System.Drawing.Size(116, 17); + this.toolStripStatusLabel4.Text = "剩余端口扫描次数:"; + // + // tssl_notScanPortsSumCount + // + this.tssl_notScanPortsSumCount.Name = "tssl_notScanPortsSumCount"; + this.tssl_notScanPortsSumCount.Size = new System.Drawing.Size(15, 17); + this.tssl_notScanPortsSumCount.Text = "0"; + // // bt_timer // this.bt_timer.Interval = 1000; @@ -749,18 +764,6 @@ private void InitializeComponent() this.tsmi_tools.Size = new System.Drawing.Size(48, 21); this.tsmi_tools.Text = "工 具"; // - // toolStripStatusLabel4 - // - this.toolStripStatusLabel4.Name = "toolStripStatusLabel4"; - this.toolStripStatusLabel4.Size = new System.Drawing.Size(116, 17); - this.toolStripStatusLabel4.Text = "剩余端口扫描次数:"; - // - // tssl_notScanPortsSumCount - // - this.tssl_notScanPortsSumCount.Name = "tssl_notScanPortsSumCount"; - this.tssl_notScanPortsSumCount.Size = new System.Drawing.Size(15, 17); - this.tssl_notScanPortsSumCount.Text = "0"; - // // Main // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); @@ -774,7 +777,7 @@ private void InitializeComponent() this.MainMenuStrip = this.menuStrip1; this.Name = "Main"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; - this.Text = "超级弱口令检查工具 V1.0 测试版 Beta20 by shack2"; + this.Text = "超级弱口令检查工具 V1.0 测试版 Beta21 by shack2"; this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Main_FormClosing); this.Shown += new System.EventHandler(this.Main_Shown); this.groupBox1.ResumeLayout(false); diff --git a/SNETCracker/Main.cs b/SNETCracker/Main.cs index 5088211..a35d38f 100644 --- a/SNETCracker/Main.cs +++ b/SNETCracker/Main.cs @@ -1,4 +1,5 @@ using Amib.Threading; +using Microsoft.Win32; using Mono.Security.Cryptography; using MyRDP; using SNETCracker.Model; @@ -269,118 +270,119 @@ private void crackerService(string crakerstring,string username,string password) while (count <= this.retryCount) { count++; - try - { //跳过检查,多线程安全 - bool cconce = false; - lock (list_success_username) - { - cconce = list_success_username.Contains(ip + serviceName + port); - } - if (this.crackerOneCount && cconce) - { - break; - } - Stopwatch sw = new Stopwatch(); - sw.Start(); - if (serviceName.Equals("RDP")) - { - server=creackRDP(ip, port, username, password, timeOut); - } - else - { - CrackService cs = null; - Type type = Type.GetType("SNETCracker.Model.Crack" + serviceName); - if (type != null) + try + { //跳过检查,多线程安全 + bool cconce = false; + lock (list_success_username) + { + cconce = list_success_username.Contains(ip + serviceName + port); + } + if (this.crackerOneCount && cconce) + { + break; + } + Stopwatch sw = new Stopwatch(); + sw.Start(); + if (serviceName.Equals("RDP")) + { + server=creackRDP(ip, port, username, password, timeOut); + } + else { - cs = (CrackService)Activator.CreateInstance(type); + CrackService cs = null; + Type type = Type.GetType("SNETCracker.Model.Crack" + serviceName); + if (type != null) + { + cs = (CrackService)Activator.CreateInstance(type); + } + server = cs.creack(ip, port, username, password, timeOut); + } - server = cs.creack(ip, port, username, password, timeOut); + sw.Stop(); + server.userTime = sw.ElapsedMilliseconds; } - sw.Stop(); - server.userTime = sw.ElapsedMilliseconds; - - } - catch (IPBreakException ie) - { - string breakip = ie.Message; - lock (list_ip_break) + catch (IPBreakException ie) { - if (!list_ip_break.Contains(breakip)) + string breakip = ie.Message; + lock (list_ip_break) { - list_ip_break.Add(breakip); + if (!list_ip_break.Contains(breakip)) + { + list_ip_break.Add(breakip); + } } } - } - catch (IPUserBreakException ie) - { - lock (list_ip_break) + catch (IPUserBreakException ie) { - string breakipuser = ie.Message; - if (!list_ip_break.Contains(breakipuser)) + lock (list_ip_break) { - list_ip_user_break.Add(breakipuser); + string breakipuser = ie.Message; + if (!list_ip_break.Contains(breakipuser)) + { + list_ip_user_break.Add(breakipuser); + } } } - } - catch (TimeoutException te) { - continue; - } - catch (Exception e) - { - string logInfo = "检查" + ip + ":" + serviceName + "登录发生异常!" + e.Message; - LogWarning(logInfo); - FileTool.log(logInfo + e.StackTrace); - } - break; - } - if (server.isSuccess) - { - bool success = false; - lock (list_success_username) + catch (TimeoutException te) { + continue; + } + catch (Exception e) { - success = list_success_username.Contains(ip + serviceName + port + username); + string logInfo = "检查" + ip + ":" + serviceName + "登录发生异常!" + e.Message; + LogWarning(logInfo); + FileTool.log(logInfo + e.StackTrace); + } + break; } - if (!success) + if (server.isSuccess) { - if (this.crackerOneCount) + bool success = false; + lock (list_success_username) { - //多线程安全 - lock (list_success_username) - { - success = list_success_username.Contains(ip + serviceName + port); - } + success = list_success_username.Contains(ip + serviceName + port + username); } if (!success) { - //多线程安全 - lock (list_success_username) + if (this.crackerOneCount) { - list_success_username.Add(ip + serviceName + port); - list_success_username.Add(ip + serviceName + port + username); + //多线程安全 + lock (list_success_username) + { + success = list_success_username.Contains(ip + serviceName + port); + } } - Interlocked.Increment(ref successCount); - addItemToListView(successCount, ip, serviceName, port, username, password, server.banner, server.userTime); - string sinfo = ip + "-----" + serviceName + "----" + username + "----" + password +"----"+ server.banner +"----成功!"; - LogInfo(sinfo); - FileTool.AppendLogToFile(Directory.GetCurrentDirectory() + "/cracker_result.log", sinfo); + if (!success) + { + //多线程安全 + lock (list_success_username) + { + list_success_username.Add(ip + serviceName + port); + list_success_username.Add(ip + serviceName + port + username); + } + Interlocked.Increment(ref successCount); + addItemToListView(successCount, ip, serviceName, port, username, password, server.banner, server.userTime); + String sinfo = ip + "-----" + serviceName + "----" + username + "----" + password +"----"+ server.banner +"----成功!"; + LogInfo(sinfo); + FileTool.AppendLogToFile(Directory.GetCurrentDirectory() + "/cracker_result.log", sinfo); - } + } - } + } - } - else - { - //LogWarning(ip + "-----" + serviceName + "----" + username + "----" + password + "失败!"); - } + } + else + { + //LogWarning(ip + "-----" + serviceName + "----" + username + "----" + password + "失败!"); + } } - Interlocked.Increment(ref allCrackCount); + } catch (Exception e) { LogError(e.Message+e.StackTrace); } + Interlocked.Increment(ref allCrackCount); } private void addItemToListView(int successCount,string ip,String serviceName,int port,String username,String password,String banner,long userTime) { @@ -1041,19 +1043,27 @@ private void tsmi_openURL_Click(object sender, EventArgs e) public static String getSid() { - //获得系统唯一号,系统安装id和mac组合 - - String sid = Environment.OSVersion + "_"; + + String sid = ""; try { + //获得系统名称 + RegistryKey rk = Registry.LocalMachine.OpenSubKey("Software\\Microsoft\\Windows NT\\CurrentVersion"); + sid = rk.GetValue("ProductName").ToString(); + rk.Close(); + //获得系统唯一号,系统安装id和mac组合 + sid += "_"; + var officeSoftware = new ManagementObjectSearcher("SELECT ID, ApplicationId, PartialProductKey, LicenseIsAddon, Description, Name, OfflineInstallationId FROM SoftwareLicensingProduct where PartialProductKey <> null"); var result = officeSoftware.Get(); foreach (var item in result) { + String c = item.GetPropertyValue("name").ToString(); + if (item.GetPropertyValue("name").ToString().StartsWith("Windows")) { - sid += item.GetPropertyValue("OfflineInstallationId").ToString() + "__"; + sid += item.GetPropertyValue("OfflineInstallationId").ToString() + "_"; break; } } @@ -1061,7 +1071,7 @@ public static String getSid() } catch (Exception e) { - sid += "ex__"; + sid += "ex_"; } try { @@ -1079,12 +1089,12 @@ public static String getSid() } catch { - sid += "ex__" + System.Guid.NewGuid(); + sid += "ex_" + System.Guid.NewGuid(); } return sid; } - - private static int version = 20181125; + + private static int version = 20181214; public static string versionURL = "http://www.shack2.org/soft/getNewVersion?ENNAME=SNETCracker&NO="+ Uri.EscapeDataString(getSid())+ "&VERSION="+ version; private void tsmi_help_version_Click(object sender, EventArgs e) { diff --git a/SNETCracker/Properties/AssemblyInfo.cs b/SNETCracker/Properties/AssemblyInfo.cs index 1014041..c1225cc 100644 --- a/SNETCracker/Properties/AssemblyInfo.cs +++ b/SNETCracker/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, // 方法是按如下所示使用“*”: : // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.2018.11.13")] -[assembly: AssemblyFileVersion("1.2018.11.13")] +[assembly: AssemblyVersion("1.2018.12.14")] +[assembly: AssemblyFileVersion("1.2018.12.14")] diff --git a/SNETCracker/SNETCracker.csproj b/SNETCracker/SNETCracker.csproj index b5dd6ee..f001b03 100644 --- a/SNETCracker/SNETCracker.csproj +++ b/SNETCracker/SNETCracker.csproj @@ -267,17 +267,6 @@ - - - - - - - - - - - diff --git a/SNETCracker/rdp/RdpClient.cs b/SNETCracker/rdp/RdpClient.cs index 87929af..451e0fd 100644 --- a/SNETCracker/rdp/RdpClient.cs +++ b/SNETCracker/rdp/RdpClient.cs @@ -51,7 +51,7 @@ public void Connect(string ip,int port,string user,string pass) this.Height =1; this.Width = 1; this.Password = pass; - this.ColorDepth =4 ; + this.ColorDepth =8 ; this.Server = ip; this.UserName = user; this.AdvancedSettings4.EnableMouse = 0;