Skip to content

Commit 267d9d0

Browse files
committed
update20181214
2018-12-14: 修复由于mstscax.dll使用了win10平台的dll,导致在非win10系统运行时,rdp报错。
1 parent aa6686e commit 267d9d0

5 files changed

Lines changed: 123 additions & 121 deletions

File tree

SNETCracker/Main.Designer.cs

Lines changed: 20 additions & 17 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

SNETCracker/Main.cs

Lines changed: 100 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using Amib.Threading;
2+
using Microsoft.Win32;
23
using Mono.Security.Cryptography;
34
using MyRDP;
45
using SNETCracker.Model;
@@ -269,118 +270,119 @@ private void crackerService(string crakerstring,string username,string password)
269270
while (count <= this.retryCount)
270271
{
271272
count++;
272-
try
273-
{ //跳过检查,多线程安全
274-
bool cconce = false;
275-
lock (list_success_username)
276-
{
277-
cconce = list_success_username.Contains(ip + serviceName + port);
278-
}
279-
if (this.crackerOneCount && cconce)
280-
{
281-
break;
282-
}
283-
Stopwatch sw = new Stopwatch();
284-
sw.Start();
285-
if (serviceName.Equals("RDP"))
286-
{
287-
server=creackRDP(ip, port, username, password, timeOut);
288-
}
289-
else
290-
{
291-
CrackService cs = null;
292-
Type type = Type.GetType("SNETCracker.Model.Crack" + serviceName);
293-
if (type != null)
273+
try
274+
{ //跳过检查,多线程安全
275+
bool cconce = false;
276+
lock (list_success_username)
277+
{
278+
cconce = list_success_username.Contains(ip + serviceName + port);
279+
}
280+
if (this.crackerOneCount && cconce)
281+
{
282+
break;
283+
}
284+
Stopwatch sw = new Stopwatch();
285+
sw.Start();
286+
if (serviceName.Equals("RDP"))
287+
{
288+
server=creackRDP(ip, port, username, password, timeOut);
289+
}
290+
else
294291
{
295-
cs = (CrackService)Activator.CreateInstance(type);
292+
CrackService cs = null;
293+
Type type = Type.GetType("SNETCracker.Model.Crack" + serviceName);
294+
if (type != null)
295+
{
296+
cs = (CrackService)Activator.CreateInstance(type);
297+
}
298+
server = cs.creack(ip, port, username, password, timeOut);
299+
296300
}
297-
server = cs.creack(ip, port, username, password, timeOut);
301+
sw.Stop();
302+
server.userTime = sw.ElapsedMilliseconds;
298303

299304
}
300-
sw.Stop();
301-
server.userTime = sw.ElapsedMilliseconds;
302-
303-
}
304-
catch (IPBreakException ie)
305-
{
306-
string breakip = ie.Message;
307-
lock (list_ip_break)
305+
catch (IPBreakException ie)
308306
{
309-
if (!list_ip_break.Contains(breakip))
307+
string breakip = ie.Message;
308+
lock (list_ip_break)
310309
{
311-
list_ip_break.Add(breakip);
310+
if (!list_ip_break.Contains(breakip))
311+
{
312+
list_ip_break.Add(breakip);
313+
}
312314
}
313315
}
314-
}
315-
catch (IPUserBreakException ie)
316-
{
317-
lock (list_ip_break)
316+
catch (IPUserBreakException ie)
318317
{
319-
string breakipuser = ie.Message;
320-
if (!list_ip_break.Contains(breakipuser))
318+
lock (list_ip_break)
321319
{
322-
list_ip_user_break.Add(breakipuser);
320+
string breakipuser = ie.Message;
321+
if (!list_ip_break.Contains(breakipuser))
322+
{
323+
list_ip_user_break.Add(breakipuser);
324+
}
323325
}
324326
}
325-
}
326-
catch (TimeoutException te) {
327-
continue;
328-
}
329-
catch (Exception e)
330-
{
331-
string logInfo = "检查" + ip + ":" + serviceName + "登录发生异常!" + e.Message;
332-
LogWarning(logInfo);
333-
FileTool.log(logInfo + e.StackTrace);
334-
}
335-
break;
336-
}
337-
if (server.isSuccess)
338-
{
339-
bool success = false;
340-
lock (list_success_username)
327+
catch (TimeoutException te) {
328+
continue;
329+
}
330+
catch (Exception e)
341331
{
342-
success = list_success_username.Contains(ip + serviceName + port + username);
332+
string logInfo = "检查" + ip + ":" + serviceName + "登录发生异常!" + e.Message;
333+
LogWarning(logInfo);
334+
FileTool.log(logInfo + e.StackTrace);
335+
}
336+
break;
343337
}
344-
if (!success)
338+
if (server.isSuccess)
345339
{
346-
if (this.crackerOneCount)
340+
bool success = false;
341+
lock (list_success_username)
347342
{
348-
//多线程安全
349-
lock (list_success_username)
350-
{
351-
success = list_success_username.Contains(ip + serviceName + port);
352-
}
343+
success = list_success_username.Contains(ip + serviceName + port + username);
353344
}
354345
if (!success)
355346
{
356-
//多线程安全
357-
lock (list_success_username)
347+
if (this.crackerOneCount)
358348
{
359-
list_success_username.Add(ip + serviceName + port);
360-
list_success_username.Add(ip + serviceName + port + username);
349+
//多线程安全
350+
lock (list_success_username)
351+
{
352+
success = list_success_username.Contains(ip + serviceName + port);
353+
}
361354
}
362-
Interlocked.Increment(ref successCount);
363-
addItemToListView(successCount, ip, serviceName, port, username, password, server.banner, server.userTime);
364-
string sinfo = ip + "-----" + serviceName + "----" + username + "----" + password +"----"+ server.banner +"----成功!";
365-
LogInfo(sinfo);
366-
FileTool.AppendLogToFile(Directory.GetCurrentDirectory() + "/cracker_result.log", sinfo);
355+
if (!success)
356+
{
357+
//多线程安全
358+
lock (list_success_username)
359+
{
360+
list_success_username.Add(ip + serviceName + port);
361+
list_success_username.Add(ip + serviceName + port + username);
362+
}
363+
Interlocked.Increment(ref successCount);
364+
addItemToListView(successCount, ip, serviceName, port, username, password, server.banner, server.userTime);
365+
String sinfo = ip + "-----" + serviceName + "----" + username + "----" + password +"----"+ server.banner +"----成功!";
366+
LogInfo(sinfo);
367+
FileTool.AppendLogToFile(Directory.GetCurrentDirectory() + "/cracker_result.log", sinfo);
367368

368-
}
369+
}
369370

370-
}
371+
}
371372

372-
}
373-
else
374-
{
375-
//LogWarning(ip + "-----" + serviceName + "----" + username + "----" + password + "失败!");
376-
}
373+
}
374+
else
375+
{
376+
//LogWarning(ip + "-----" + serviceName + "----" + username + "----" + password + "失败!");
377+
}
377378

378379
}
379-
Interlocked.Increment(ref allCrackCount);
380+
380381
}
381382
catch (Exception e) {
382383
LogError(e.Message+e.StackTrace);
383384
}
385+
Interlocked.Increment(ref allCrackCount);
384386
}
385387

386388
private void addItemToListView(int successCount,string ip,String serviceName,int port,String username,String password,String banner,long userTime) {
@@ -1041,27 +1043,35 @@ private void tsmi_openURL_Click(object sender, EventArgs e)
10411043

10421044
public static String getSid()
10431045
{
1044-
//获得系统唯一号,系统安装id和mac组合
1045-
1046-
String sid = Environment.OSVersion + "_";
1046+
1047+
String sid = "";
10471048
try
10481049
{
1050+
//获得系统名称
1051+
RegistryKey rk = Registry.LocalMachine.OpenSubKey("Software\\Microsoft\\Windows NT\\CurrentVersion");
1052+
sid = rk.GetValue("ProductName").ToString();
1053+
rk.Close();
1054+
//获得系统唯一号,系统安装id和mac组合
1055+
sid += "_";
1056+
10491057
var officeSoftware = new ManagementObjectSearcher("SELECT ID, ApplicationId, PartialProductKey, LicenseIsAddon, Description, Name, OfflineInstallationId FROM SoftwareLicensingProduct where PartialProductKey <> null");
10501058
var result = officeSoftware.Get();
10511059
foreach (var item in result)
10521060
{
1061+
String c = item.GetPropertyValue("name").ToString();
1062+
10531063
if (item.GetPropertyValue("name").ToString().StartsWith("Windows"))
10541064
{
10551065

1056-
sid += item.GetPropertyValue("OfflineInstallationId").ToString() + "__";
1066+
sid += item.GetPropertyValue("OfflineInstallationId").ToString() + "_";
10571067
break;
10581068
}
10591069
}
10601070

10611071
}
10621072
catch (Exception e)
10631073
{
1064-
sid += "ex__";
1074+
sid += "ex_";
10651075
}
10661076
try
10671077
{
@@ -1079,12 +1089,12 @@ public static String getSid()
10791089
}
10801090
catch
10811091
{
1082-
sid += "ex__" + System.Guid.NewGuid();
1092+
sid += "ex_" + System.Guid.NewGuid();
10831093
}
10841094
return sid;
10851095
}
1086-
1087-
private static int version = 20181125;
1096+
1097+
private static int version = 20181214;
10881098
public static string versionURL = "http://www.shack2.org/soft/getNewVersion?ENNAME=SNETCracker&NO="+ Uri.EscapeDataString(getSid())+ "&VERSION="+ version;
10891099
private void tsmi_help_version_Click(object sender, EventArgs e)
10901100
{

SNETCracker/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,5 @@
3232
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
3333
// 方法是按如下所示使用“*”: :
3434
// [assembly: AssemblyVersion("1.0.*")]
35-
[assembly: AssemblyVersion("1.2018.11.13")]
36-
[assembly: AssemblyFileVersion("1.2018.11.13")]
35+
[assembly: AssemblyVersion("1.2018.12.14")]
36+
[assembly: AssemblyFileVersion("1.2018.12.14")]

SNETCracker/SNETCracker.csproj

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -267,17 +267,6 @@
267267
</Compile>
268268
</ItemGroup>
269269
<ItemGroup>
270-
<Content Include="docs\MySqlCommand.xml" />
271-
<Content Include="docs\MySqlCommandBuilder.xml" />
272-
<Content Include="docs\MySqlConnection.xml" />
273-
<Content Include="docs\MySqlConnectionStringBuilder.xml" />
274-
<Content Include="docs\MySqlDataAdapter.xml" />
275-
<Content Include="docs\MySqlDataReader.xml" />
276-
<Content Include="docs\MySqlException.xml" />
277-
<Content Include="docs\MySqlHelper.xml" />
278-
<Content Include="docs\MySqlParameter.xml" />
279-
<Content Include="docs\MySqlParameterCollection.xml" />
280-
<Content Include="docs\MySqlTransaction.xml" />
281270
<Content Include="libs\LumiSoft.Net.dll" />
282271
<Content Include="libs\memcached\Enyim.Caching.dll" />
283272
<Content Include="libs\memcached\Enyim.Caching.Log4NetAdapter.dll" />

0 commit comments

Comments
 (0)