C#版查杀本地/远程进程工具
xkill [原创]
Author: R&S
E-mail: yrwithsh@vip.sina.com
HomePage: fz5fz.yeah.net
Date: 10/04/2003
using System;
using System.Management;
using System.Threading;
class xkill
{
public static void usage()
{
Console.WriteLine();
Console.WriteLine("xkill v1.0 Beta, By R&S");
Console.WriteLine("E-mail: yrwithsh@vip.sina.com");
Console.WriteLine("H-Page: Http://fz5fz.yeah.net");
Console.WriteLine();
Console.WriteLine("Usage: xkill [ip] [account] [password] [programme] [time(s)]");
Console.WriteLine("If its the localhost,dont need account and password");
Console.WriteLine("Example: xkill 218.194.X.X administrator 123 qq.exe 60");
Console.WriteLine(" xkill 218.194.X.X administrator NULL qq.exe 60");
Console.WriteLine(" xkill 127.0.0.1 qq.exe 60 (for localhost)");
}
public static void Main(string[] args)
{
if((args.Length!=5)&&(args.Length!=3))
{
usage();
Environment.Exit(0);
}
while((args[0]=="127.0.0.1")││(args[0]=="192.168.0.1"))
{
string KillName=args[1];
ManagementObjectSearcher link = new ManagementObjectSearcher("SELECT * From Win32_Process");
ManagementObjectCollection Collection = link.Get();
foreach (ManagementObject Process in Collection)
{
Console.WriteLine("{0} {1}",Convert.ToString(Process["Name"]).PadRight(15),Process["ExecutablePath"]);
if (Convert.ToString(Process["Name"])==KillName)
{
string[] Tparas = {"1"};
Process.InvokeMethod("Terminate", Tparas);
}
}
Console.WriteLine();
Console.WriteLine("Terminate it yet");
Thread.Sleep(Convert.ToInt32(args[2])*1000);
}
try{
do
{
string KillName=args[3];
ConnectionOptions Conn = new ConnectionOptions();
Conn.Username =args[1];
if(args[2]=="NULL")
{
Conn.Password ="";
}
else Conn.Password =args[2];
ManagementPath p = new ManagementPath("\\"+args[0]+"\root\cimv2");
ManagementScope ms = new ManagementScope(p,Conn);
ObjectQuery oq = new ObjectQuery("SELECT * FROM Win32_Process");
ManagementObjectSearcher link = new ManagementObjectSearcher(ms,oq);
ManagementObjectCollection Collection = link.Get();
Console.WriteLine("--------------------------------------------------------");
foreach (ManagementObject Process in Collection)
{
Console.WriteLine("{0}{1}",Convert.ToString(Process["Name"]).PadRight(15),Process["ExecutablePath"]);
if (Convert.ToString(Process["Name"])==KillName)
{
string[] Tparas = {"1"};
Process.InvokeMethod("Terminate", Tparas);
}
}
Thread.Sleep(Convert.ToInt32(args[4])*1000);
}while(true);
}
catch(Exception exObj)
{
Console.WriteLine();
Console.WriteLine("failed!");
Console.WriteLine(exObj.Message);
}
}
}
xkill [原创]
Author: R&S
E-mail: yrwithsh@vip.sina.com
HomePage: fz5fz.yeah.net
Date: 10/04/2003
using System;
using System.Management;
using System.Threading;
class xkill
{
public static void usage()
{
Console.WriteLine();
Console.WriteLine("xkill v1.0 Beta, By R&S");
Console.WriteLine("E-mail: yrwithsh@vip.sina.com");
Console.WriteLine("H-Page: Http://fz5fz.yeah.net");
Console.WriteLine();
Console.WriteLine("Usage: xkill [ip] [account] [password] [programme] [time(s)]");
Console.WriteLine("If its the localhost,dont need account and password");
Console.WriteLine("Example: xkill 218.194.X.X administrator 123 qq.exe 60");
Console.WriteLine(" xkill 218.194.X.X administrator NULL qq.exe 60");
Console.WriteLine(" xkill 127.0.0.1 qq.exe 60 (for localhost)");
}
public static void Main(string[] args)
{
if((args.Length!=5)&&(args.Length!=3))
{
usage();
Environment.Exit(0);
}
while((args[0]=="127.0.0.1")││(args[0]=="192.168.0.1"))
{
string KillName=args[1];
ManagementObjectSearcher link = new ManagementObjectSearcher("SELECT * From Win32_Process");
ManagementObjectCollection Collection = link.Get();
foreach (ManagementObject Process in Collection)
{
Console.WriteLine("{0} {1}",Convert.ToString(Process["Name"]).PadRight(15),Process["ExecutablePath"]);
if (Convert.ToString(Process["Name"])==KillName)
{
string[] Tparas = {"1"};
Process.InvokeMethod("Terminate", Tparas);
}
}
Console.WriteLine();
Console.WriteLine("Terminate it yet");
Thread.Sleep(Convert.ToInt32(args[2])*1000);
}
try{
do
{
string KillName=args[3];
ConnectionOptions Conn = new ConnectionOptions();
Conn.Username =args[1];
if(args[2]=="NULL")
{
Conn.Password ="";
}
else Conn.Password =args[2];
ManagementPath p = new ManagementPath("\\"+args[0]+"\root\cimv2");
ManagementScope ms = new ManagementScope(p,Conn);
ObjectQuery oq = new ObjectQuery("SELECT * FROM Win32_Process");
ManagementObjectSearcher link = new ManagementObjectSearcher(ms,oq);
ManagementObjectCollection Collection = link.Get();
Console.WriteLine("--------------------------------------------------------");
foreach (ManagementObject Process in Collection)
{
Console.WriteLine("{0}{1}",Convert.ToString(Process["Name"]).PadRight(15),Process["ExecutablePath"]);
if (Convert.ToString(Process["Name"])==KillName)
{
string[] Tparas = {"1"};
Process.InvokeMethod("Terminate", Tparas);
}
}
Thread.Sleep(Convert.ToInt32(args[4])*1000);
}while(true);
}
catch(Exception exObj)
{
Console.WriteLine();
Console.WriteLine("failed!");
Console.WriteLine(exObj.Message);
}
}
}
C#版查杀本地/远程进程工具的更多相关文章
- 查杀进程小工具——WPF和MVVM初体验
最近因为工作需要,研究了一下桌面应用程序.在winform.WPF.Electron等几种技术里,最终选择了WPF作为最后的选型.WPF最吸引我的地方,就是MVVM模式了.MVVM模式完全把界面和业务 ...
- linux下python版webshell后门查杀工具
使用说明: 1.查杀指定路径:python webshell.py 路径 2.按时间查找文件:python webshell.py 路径 “2013-09-28 00:00:00″ # -*- cod ...
- 病毒木马查杀实战第017篇:U盘病毒之专杀工具的编写
前言 经过前几次的讨论,我们对于这次的U盘病毒已经有了一定的了解,那么这次我们就依据病毒的行为特征,来编写针对于这次U盘病毒的专杀工具. 专杀工具功能说明 因为这次是一个U盘病毒,所以我打算把这次的专 ...
- 病毒木马查杀实战第011篇:QQ盗号木马之专杀工具的编写
前言 由于我已经在<病毒木马查杀第004篇:熊猫烧香之专杀工具的编写>中编写了一个比较通用的专杀工具的框架,而这个框架对于本病毒来说,经过简单修改也是基本适用的,所以本文就不讨论那些重叠的 ...
- Linux 僵尸进程查杀
僵尸进程概念 僵尸进程(Zombie process)通俗来说指那些虽然已经终止的进程,但仍然保留一些信息,等待其父进程为其收尸. 书面形式一点:一个进程结束了,但是他的父进程没有等待(调用wait ...
- shell脚本执行查找进程,然后查杀进程
shell 执行查找进程,然后查杀进程脚本如下: ps -ef | grep 'IOE' |grep -v 'grep'| awk '{print \$2}' |while read pid; do ...
- windows查看端口占用情况及查杀进程
我们平时在做web开发运行web服务器或运行某个应用时会报错,提示该应用的端口号已被占用,我们可以用以下的方法解决. 解决方法一:重新为应用配置端口. 解决方法二:找到占用端口的应用并关闭该应用释放占 ...
- Linux 僵尸进程的筛选和查杀
一.筛选 ps -A -o stat,ppid,pid,cmd | grep -e '^[Zz]' 二.查杀 ps -A -o stat,ppid,pid,cmd | grep -e '^[Zz]' ...
- db2 查杀死锁进程
db2 查杀死锁进命令 db2 get snapshot for locks on (需要snapshot的访问权限) db2 list applications db2 "force ap ...
随机推荐
- CSUOJ 1868 潜在好友
Description 小X在搬砖写一个论坛,这个时候老板突然想到一个功能,让小X今天赶快实现.大概就是如果某个人是你好友的好友那么他的头像上面会有特殊的标志.小X想不到较好的办法来解决如何验证两个人 ...
- NetStandard类库实现Log4Net集成
前面都是Log4Net集成到NetCore项目中,集成到NetStandard类库还是第一次,所以记录一下 小提示:NetStandard要想同时被NetCore和NetFramework调用,需要在 ...
- 1036 Boys vs Girls (25)(25 point(s))
problem This time you are asked to tell the difference between the lowest grade of all the male stud ...
- 机器学习之路:python 多项式特征生成PolynomialFeatures 欠拟合与过拟合
分享一下 线性回归中 欠拟合 和 过拟合 是怎么回事~为了解决欠拟合的情 经常要提高线性的次数建立模型拟合曲线, 次数过高会导致过拟合,次数不够会欠拟合.再建立高次函数时候,要利用多项式特征生成器 生 ...
- 数据预处理:规范化(Normalize)和二值化(Binarize)
注:本文是人工智能研究网的学习笔记 规范化(Normalization) Normalization: scaling individual to have unit norm 规范化是指,将单个的样 ...
- 【WIN10】我的第一個WIN10-UWP應用——古文觀止
已上架,下載地址:https://www.microsoft.com/store/apps/9nblggh6cc32 特點是:繁體豎排,隱藏/顯示標點符號. 截幾張圖來瞅瞅. 1.主界面 這張圖使用的 ...
- [BZOJ5109]大吉大利,晚上吃鸡!
[BZOJ5109]大吉大利,晚上吃鸡! 题目大意: 一张\(n(n\le5\times10^4)\)个点\(m(m\le5\times10^4)\)条边的无向图,节点编号为\(1\)到\(n\),边 ...
- HDOJ 4414 Finding crosses 暴力!
Finding crosses Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Tot ...
- IO流-递归遍历目录下指定后缀名结尾的文件名称
/* *自定义遍历目录下指定后缀名结尾文件的名称的方法: * * param file:指定目录 name:指定后缀名 */ 1 public static void FileName(File fi ...
- spring mvc 如何传递集合参数(list,数组)
spring mvc 可以自动的帮你封装参数成为对象,不用自己手动的通过request一个一个的获取参数,但是这样自动的参数封装碰碰到了集合参数可能就需要点小技巧才可以了. 一.基础类型和引用类型有什 ...