Skip to content

Commit

Permalink
update20181214
Browse files Browse the repository at this point in the history
2018-12-14:
修复由于mstscax.dll使用了win10平台的dll,导致在非win10系统运行时,rdp报错。
  • Loading branch information
shack2 committed Dec 14, 2018
1 parent aa6686e commit 267d9d0
Show file tree
Hide file tree
Showing 5 changed files with 123 additions and 121 deletions.
37 changes: 20 additions & 17 deletions SNETCracker/Main.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

190 changes: 100 additions & 90 deletions SNETCracker/Main.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Amib.Threading;
using Microsoft.Win32;
using Mono.Security.Cryptography;
using MyRDP;
using SNETCracker.Model;
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -1041,27 +1043,35 @@ 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;
}
}

}
catch (Exception e)
{
sid += "ex__";
sid += "ex_";
}
try
{
Expand All @@ -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)
{
Expand Down
4 changes: 2 additions & 2 deletions SNETCracker/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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")]
11 changes: 0 additions & 11 deletions SNETCracker/SNETCracker.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -267,17 +267,6 @@
</Compile>
</ItemGroup>
<ItemGroup>
<Content Include="docs\MySqlCommand.xml" />
<Content Include="docs\MySqlCommandBuilder.xml" />
<Content Include="docs\MySqlConnection.xml" />
<Content Include="docs\MySqlConnectionStringBuilder.xml" />
<Content Include="docs\MySqlDataAdapter.xml" />
<Content Include="docs\MySqlDataReader.xml" />
<Content Include="docs\MySqlException.xml" />
<Content Include="docs\MySqlHelper.xml" />
<Content Include="docs\MySqlParameter.xml" />
<Content Include="docs\MySqlParameterCollection.xml" />
<Content Include="docs\MySqlTransaction.xml" />
<Content Include="libs\LumiSoft.Net.dll" />
<Content Include="libs\memcached\Enyim.Caching.dll" />
<Content Include="libs\memcached\Enyim.Caching.Log4NetAdapter.dll" />
Expand Down
Loading

0 comments on commit 267d9d0

Please sign in to comment.