-
Notifications
You must be signed in to change notification settings - Fork 490
Expand file tree
/
Copy pathCrackMySQL.cs
More file actions
69 lines (63 loc) · 2.23 KB
/
Copy pathCrackMySQL.cs
File metadata and controls
69 lines (63 loc) · 2.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
using MySql.Data.MySqlClient;
using System;
using System.Data;
using System.Data.SqlClient;
using System.Threading;
using Tools;
namespace SNETCracker.Model
{
class CrackMySQL : CrackService
{
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
{
if (password.Equals("空"))
{
password = "";
}
conn.ConnectionString = "server=" + ip + ";port=" + port + ";user id=" + username + ";password=" + password + ";pooling=true;ConnectionTimeout=" + timeOut;
conn.Open();
server.isSuccess = ConnectionState.Open.Equals(conn.State);
if (server.isSuccess)
{
server.banner = conn.ServerVersion;
}
}
catch (Exception e)
{
if (e.Message.IndexOf("not allowed to") != -1 || e.Message.IndexOf("many connection") != -1)
{
throw new IPBreakException(ip + port);
}
else if (e.Message.IndexOf("user not exist") != -1)
{
throw new IPUserBreakException(ip + port + username);
}
else if (e.Message.IndexOf("没有正确答复") != -1 || e.Message.IndexOf("Timeout in IO operation") != -1 || e.Message.IndexOf("Reading from") != -1 || e.Message.IndexOf("无法从传输连接中读取数据") != -1 || e.Message.IndexOf("Unable to") != -1)
{
new TimeoutException(e.Message);
}
else if (e.Message.IndexOf("using password: ") != -1)
{
return server;
}
else
{
throw e;
}
}
finally
{
conn.Close();
}
return server;
}
}
}