C#制作小工具七黑客入侵工具

  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

C#制作小工具七黑客入侵工具

效果图:

刚开始学C#的时候,最大的动力就是想用C#开发出黑客工具啦,很是崇拜黑客,后来渐渐明白,用C#写黑客工具是比较不切合实际的事情,呵呵,你懂得!

代码中封装了一个调用系统资源类,这个不作说明,代码中有,要介绍的是如何用C#模拟CMD命令。

用到的就是两个类,Process和ProcessStartInfo,我们需要的是隐藏着执行CMD命令罢了,呵呵,原来设置下ProcessStartInfo实例化类的属性即可,OK,就这么简单,看代码吧!

核心函数:

///

///执行CMD命令

///

///CMD命令

///超时时间

///CMD命令执行结果

private static string Execute(string dosCommand, int outTime)

{

string output = "";

if (dosCommand != null && dosCommand != "")

{

//创建进程对象

Process dos = new Process();

//创建进程时使用的一组值,如下面属性

ProcessStartInfo startinfo = new ProcessStartInfo();

//设定需要执行的命令窗口

startinfo.FileName = "cmd.exe";

//隐藏CMD窗口

//设定参数,要输入到命令程序的字符,其中"/c"表示执行完命令后马上退出

startinfo.Arguments = "/c" + dosCommand;

//不使用系统外壳程序启动

eShellExecute = false;

//不重定向输入

startinfo.RedirectStandardInput = false;

//重定向输出,而不是默认的显示在DOS控制台上面

startinfo.RedirectStandardOutput = true;

//不创建窗口

startinfo.CreateNoWindow = true;

dos.StartInfo = startinfo;

try

{

//开始进程

if (dos.Start())

{

if (outTime == 0)

{

dos.WaitForExit();

}

else

{

dos.WaitForExit(outTime);

}

//读取进程的输出

output = dos.StandardOutput.ReadToEnd();

}

}

catch (Exception ex)

{

MessageBox.Show(ex.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);

}

finally

{

if (dos != null)

{

dos.Close();

}

}

}

return output;

}

贴出代码:

using System;

using System.Collections.Generic;

using ponentModel;

using System.Data;

using System.Drawing;

using System.Text;

using System.Windows.Forms;

using System.Diagnostics;

namespace黑客入侵工具

{

public partial class Form1 : Form

{

public Form1()

{

InitializeComponent();

}

private void btnOpen_Click(object sender, EventArgs e)

{

if (btnOpen.Text == ">")

{

this.Width = 710;

btnOpen.Text = "<";

}

else

{

this.Width = 472;

btnOpen.Text = ">";

}

}

///

///执行CMD命令

///

///CMD命令

///超时时间

///CMD命令执行结果

private static string Execute(string dosCommand, int outTime)

{

string output = "";

if (dosCommand != null && dosCommand != "")

{

//创建进程对象

Process dos = new Process();

//创建进程时使用的一组值,如下面属性

ProcessStartInfo startinfo = new ProcessStartInfo();

//设定需要执行的命令窗口

startinfo.FileName = "cmd.exe";

//隐藏CMD窗口

//设定参数,要输入到命令程序的字符,其中"/c"表示执行完命令后马上退出

startinfo.Arguments = "/c" + dosCommand;

//不使用系统外壳程序启动

eShellExecute = false;

//不重定向输入

startinfo.RedirectStandardInput = false;

//重定向输出,而不是默认的显示在DOS控制台上面

startinfo.RedirectStandardOutput = true;

//不创建窗口

startinfo.CreateNoWindow = true;

dos.StartInfo = startinfo;

try

{

//开始进程

if (dos.Start())

{

if (outTime == 0)

{

dos.WaitForExit();

}

else

{

dos.WaitForExit(outTime);

}

//读取进程的输出

output = dos.StandardOutput.ReadToEnd();

}

相关文档
最新文档