Skip to content

Commit

Permalink
update20181125
Browse files Browse the repository at this point in the history
修复计算总数错误,性能优化
  • Loading branch information
shack2 committed Nov 25, 2018
1 parent e7b719b commit aa6686e
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 18 deletions.
30 changes: 24 additions & 6 deletions SNETCracker/Main.Designer.cs

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

27 changes: 19 additions & 8 deletions SNETCracker/Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ public partial class Main : Form
public string[] servicesName = { };
public string[] servicesPort = { };

public long scanPortsSumCount = 0;

private Dictionary<string, ServiceModel> services = new Dictionary<string, ServiceModel>();//服务列表
private Dictionary<string, HashSet<string>> dics = new Dictionary<string, HashSet<string>>();//字典列表
public ConcurrentBag<string> list_cracker = new ConcurrentBag<string>();
Expand Down Expand Up @@ -92,7 +94,7 @@ public void LogAppend(Color color, string text)
}
this.txt_log.SelectionColor = color;
this.txt_log.HideSelection = false;
this.txt_log.AppendText(text+"\r\n");
this.txt_log.AppendText(text+Environment.NewLine);
}
/// <summary>
/// 显示错误日志
Expand Down Expand Up @@ -161,7 +163,7 @@ public void LogInfo(string text)
}
this.stxt_crackerSuccessCount.Text = successCount + "";
this.stxt_useTime.Text = runTime + "";

this.tssl_notScanPortsSumCount.Text = this.scanPortsSumCount+"";
}
catch (Exception e) {
LogWarning(e.Message);
Expand Down Expand Up @@ -221,6 +223,7 @@ private void bt_timer_Tick(object sender, EventArgs e)
tc.Close();

}
Interlocked.Decrement(ref scanPortsSumCount);
}

private void crackerService(string crakerstring,string username,string password)
Expand Down Expand Up @@ -412,16 +415,21 @@ private void cracker()
stp =new SmartThreadPool();
stp.MaxThreads = maxThread;
creackerSumCount = 0;
//计算总数
scanPortsSumCount = 0;


//计算端口扫描总数
if (isScanport)
{
foreach (string serviceName in this.services_list.CheckedItems)
{
string[] ports = this.services[serviceName].Port.Split(',');
creackerSumCount += this.list_target.Count * ports.Length;
scanPortsSumCount += this.list_target.Count * ports.Length;
}
}

//更新状态
this.Invoke(new update(updateStatus));

foreach (string serviceName in this.services_list.CheckedItems) {
string[] ports = this.services[serviceName].Port.Split(',');
foreach (string sport in ports)
Expand Down Expand Up @@ -455,7 +463,7 @@ private void cracker()
{
foreach (string serviceName in this.services_list.CheckedItems)
{
creackerSumCount += list_cracker.Count*this.services_list.CheckedItems.Count*this.services[serviceName].ListUserName.Count*this.services[serviceName].ListPassword.Count;
creackerSumCount += list_cracker.Count*this.services[serviceName].ListUserName.Count*this.services[serviceName].ListPassword.Count;
}
}
else
Expand Down Expand Up @@ -756,6 +764,7 @@ private void crakerKey()
catch (Exception e)
{
FileTool.log(ip + ":" + port + "-RDP操作异常-" + e.Message);
LogWarning(ip + ":" + port + "-RDP操作异常-" + e.Message);
server.isDisConnected = true;
server.isEndMRE.Set();
}
Expand All @@ -767,14 +776,16 @@ private void crakerKey()
private void ClearRDP(RdpClient rdp){
try
{
this.rdp_panle.Controls.Remove(rdp);
if (rdp.IsDisposed == false)
{
rdp.Dispose();
}
this.rdp_panle.Controls.Remove(rdp);

}
catch (Exception e) {
FileTool.log("RDP资源清理异常-" + e.Message);
LogWarning("RDP资源清理异常-" + e.Message);
}
}

Expand Down Expand Up @@ -1073,7 +1084,7 @@ public static String getSid()
return sid;
}

private static int version = 20181113;
private static int version = 20181125;
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/Model/CrackMySQL.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public CrackMySQL()
public override Server creack(String ip, int port, String username, String password, int timeOut)
{
MySqlConnection conn = new MySqlConnection();

MySqlConnectionStringBuilder ms = new MySqlConnectionStringBuilder();
Server server = new Server();

try
Expand All @@ -27,7 +27,7 @@ public override Server creack(String ip, int port, String username, String passw
password = "";
}
conn.ConnectionString = "server=" + ip + ";user id=" + username + ";password=" + password + ";pooling=false;ConnectionTimeout=" + timeOut;

conn.Open();

server.isSuccess = ConnectionState.Open.Equals(conn.State);
Expand Down
20 changes: 18 additions & 2 deletions SNETCracker/rdp/RdpClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ public RdpClient(Server cserver)
this.OnLogonError += Rdp_OnLogonError;
this.OnFatalError += Rdp_OnFatalError;
this.OnDisconnected += Rdp_OnDisconnected;
this.OnAuthenticationWarningDisplayed += Rdp_OnAuthenticationWarningDisplayed;
this.OnAuthenticationWarningDismissed += Rdp_OnAuthenticationWarningDismissed;


}

Expand All @@ -44,11 +47,11 @@ public void Connect(string ip,int port,string user,string pass)
try
{
this.timeOutLog.Start();
this.AdvancedSettings4.Compress = 1;
this.AdvancedSettings.Compress = 1;
this.Height =1;
this.Width = 1;
this.Password = pass;
this.ColorDepth =8 ;
this.ColorDepth =4 ;
this.Server = ip;
this.UserName = user;
this.AdvancedSettings4.EnableMouse = 0;
Expand All @@ -57,6 +60,7 @@ public void Connect(string ip,int port,string user,string pass)
IMsTscNonScriptable secured = (IMsTscNonScriptable)this.GetOcx();
secured.ClearTextPassword = pass;
this.Connect();

}
catch (Exception e)
{
Expand Down Expand Up @@ -91,5 +95,17 @@ private void Rdp_OnConnected(object sender, EventArgs e)
this.server.isConnected = true;

}

private void Rdp_OnAuthenticationWarningDismissed(object sender, EventArgs e)
{
Finished();

}

private void Rdp_OnAuthenticationWarningDisplayed(object sender, EventArgs e)
{
Finished();

}
}
}

0 comments on commit aa6686e

Please sign in to comment.