forked from shack2/SNETCracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCrackFTP.cs
More file actions
58 lines (49 loc) · 1.36 KB
/
CrackFTP.cs
File metadata and controls
58 lines (49 loc) · 1.36 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
using Chilkat;
using FluentFTP;
using LumiSoft.Net.FTP.Client;
using System;
using System.Net;
using Tools;
namespace SNETCracker.Model
{
class CrackFTP : CrackService
{
public CrackFTP() {
}
public override Server creack(String ip, int port,String username,String password,int timeOut) {
FtpClient ftp = new FtpClient();
Server server = new Server();
if ("空".Equals(password)) {
password = "";
}
try
{
ftp.Host = ip;
ftp.Port = port;
ftp.Credentials = new NetworkCredential(username, password);
ftp.ConnectTimeout = timeOut*1000;
ftp.ReadTimeout = timeOut*1000;
ftp.Connect();
if (ftp.IsConnected)
{
server.isSuccess = true;
server.banner = ftp.SystemType;
}
}
catch (Exception e)
{
if(e.Message.IndexOf("cannot log in") ==-1){
throw e;
}
}
finally
{
if (ftp != null)
{
ftp.Disconnect();
}
}
return server;
}
}
}