C#制作小工具七黑客入侵工具效果图:刚开始学C#的时候,最大的动力就是想用C#开发出黑客工具啦,很是崇拜黑客,后来渐渐明白,用C#写黑客工具是比较不切合实际的事情,呵呵,你懂得!代码中封装了一个调用系统资源类,这个不作说明,代码中有,要介绍的是如何用C#模拟CMD命令。
用到的就是两个类,Process和ProcessStartInfo,我们需要的是隐藏着执行CMD命令罢了,呵呵,原来设置下ProcessStartInfo实例化类的属性即可,OK,就这么简单,看代码吧!核心函数:///<summary>///执行CMD命令///</summary>///<param name="dosCommand">CMD命令</param>///<param name="outTime">超时时间</param>///<returns>CMD命令执行结果</returns>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 = ">";}}///<summary>///执行CMD命令///</summary>///<param name="dosCommand">CMD命令</param>///<param name="outTime">超时时间</param>///<returns>CMD命令执行结果</returns>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;}private void Form1_Load(object sender, EventArgs e){this.Width = 472;this.FormBorderStyle = FormBorderStyle.FixedDialog;}private void btnDos1_Click(object sender, EventArgs e){Form2 frm = new Form2(1);frm.ShowDialog ();}private void btnDos3_Click(object sender, EventArgs e){Form2 frm = new Form2(2);frm.ShowDialog();}private void btnDos5_Click(object sender, EventArgs e){Form2 frm = new Form2(3);frm.ShowDialog();}private void btnDos4_Click(object sender, EventArgs e){MessageBox.Show("网上好多哦!自己找吧!","呵呵",MessageBoxButtons.OK, rmation);}private void btnShutdown60_Click(object sender, EventArgs e){调用系统资源.关闭计算机("60");}private void btnIpconfig_Click(object sender, EventArgs e){调用系统资源.IP地址侦测器();}private void btnShareFile_Click(object sender, EventArgs e){string s = "c:\\123";调用系统资源.创建共享文件(s);}private void btnFtp_Click(object sender, EventArgs e){调用系统资源.打开FTP("192.168.1.101");}private void btnCalc_Click(object sender, EventArgs e){调用系统资源.打开计算器();}private void btnkzmb_Click(object sender, EventArgs e){调用系统资源.打开控制面板();}private void btnMmc_Click(object sender, EventArgs e){调用系统资源.打开控制台();}private void btnTask_Click(object sender, EventArgs e){调用系统资源.打开任务管理器();}private void btnService_Click(object sender, EventArgs e) {调用系统资源.打开系统信息();}private void btnManage_Click(object sender, EventArgs e) {调用系统资源.打开控制台();}private void btnC_Click(object sender, EventArgs e){调用系统资源.打开C盘();}private void btnRegedit_Click(object sender, EventArgs e) {调用系统资源.打开注册表();}private void btnResouce_Click(object sender, EventArgs e) {调用系统资源.打开资源管理器();}private void btnzhuxiao_Click(object sender, EventArgs e) {调用系统资源.注销计算机();}private void btnRun_Click(object sender, EventArgs e){OpenFileDialog f = new OpenFileDialog();f.Filter = "可执行文件(*.exe)|*.exe";if (DialogResult.OK == f.ShowDialog()){调用系统资源.运行程序(f.FileName);}}private void pictureBox1_Click(object sender, EventArgs e) {调用系统资源.打开网址(""); }private void pictureBox2_Click(object sender, EventArgs e) {调用系统资源.打开网址(""); }private void pictureBox3_Click(object sender, EventArgs e) {调用系统资源.打开网址("");}private void pictureBox4_Click(object sender, EventArgs e) {调用系统资源.打开网址(""); }private void pictureBox5_Click(object sender, EventArgs e) {调用系统资源.打开网址("");}private void pictureBox6_Click(object sender, EventArgs e) {调用系统资源.打开网址("");}private void pictureBox7_Click(object sender, EventArgs e) {调用系统资源.打开网址("");}private void pictureBox8_Click(object sender, EventArgs e) {调用系统资源.打开网址("");}private void btnOk_Click(object sender, EventArgs e){string Command = txtKeys.Text;if (Command != ""){string Result = Execute(Command, 0);txtResult.Text = Result;}else{MessageBox.Show("晕,还没有输入命令,叫我怎么执行!", "呵呵", MessageBoxButtons.OK, rmation);txtKeys.Focus();}}}},。