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#版查杀本地/远程进程工具的更多相关文章

  1. 查杀进程小工具——WPF和MVVM初体验

    最近因为工作需要,研究了一下桌面应用程序.在winform.WPF.Electron等几种技术里,最终选择了WPF作为最后的选型.WPF最吸引我的地方,就是MVVM模式了.MVVM模式完全把界面和业务 ...

  2. linux下python版webshell后门查杀工具

    使用说明: 1.查杀指定路径:python webshell.py 路径 2.按时间查找文件:python webshell.py 路径 “2013-09-28 00:00:00″ # -*- cod ...

  3. 病毒木马查杀实战第017篇:U盘病毒之专杀工具的编写

    前言 经过前几次的讨论,我们对于这次的U盘病毒已经有了一定的了解,那么这次我们就依据病毒的行为特征,来编写针对于这次U盘病毒的专杀工具. 专杀工具功能说明 因为这次是一个U盘病毒,所以我打算把这次的专 ...

  4. 病毒木马查杀实战第011篇:QQ盗号木马之专杀工具的编写

    前言 由于我已经在<病毒木马查杀第004篇:熊猫烧香之专杀工具的编写>中编写了一个比较通用的专杀工具的框架,而这个框架对于本病毒来说,经过简单修改也是基本适用的,所以本文就不讨论那些重叠的 ...

  5. Linux 僵尸进程查杀

    僵尸进程概念 僵尸进程(Zombie process)通俗来说指那些虽然已经终止的进程,但仍然保留一些信息,等待其父进程为其收尸. 书面形式一点:一个进程结束了,但是他的父进程没有等待(调用wait ...

  6. shell脚本执行查找进程,然后查杀进程

    shell 执行查找进程,然后查杀进程脚本如下: ps -ef | grep 'IOE' |grep -v 'grep'| awk '{print \$2}' |while read pid; do ...

  7. windows查看端口占用情况及查杀进程

    我们平时在做web开发运行web服务器或运行某个应用时会报错,提示该应用的端口号已被占用,我们可以用以下的方法解决. 解决方法一:重新为应用配置端口. 解决方法二:找到占用端口的应用并关闭该应用释放占 ...

  8. Linux 僵尸进程的筛选和查杀

    一.筛选 ps -A -o stat,ppid,pid,cmd | grep -e '^[Zz]' 二.查杀 ps -A -o stat,ppid,pid,cmd | grep -e '^[Zz]' ...

  9. db2 查杀死锁进程

    db2 查杀死锁进命令 db2 get snapshot for locks on (需要snapshot的访问权限) db2 list applications db2 "force ap ...

随机推荐

  1. Javap -c 字节码解析

              栈和局部变量操作 将常量压入栈的指令 aconst_null         将null对象引用压入栈   iconst_m1         将int类型常量-1压入栈 icon ...

  2. 【SQL】177. Nth Highest Salary

    Write a SQL query to get the nth highest salary from the Employee table. +----+--------+ | Id | Sala ...

  3. 【Naive Splay Template】

    写小作业的时候重新复习了一下splay 只支持插入,删除,查k大,查节点数.没有迭代器. T类型需要重载==和<,要调用拷贝构造函数. template<class T> class ...

  4. 【数论】Codeforces Round #483 (Div. 2) [Thanks, Botan Investments and Victor Shaburov!] C. Finite or not?

    题意:给你一个分数,问你在b进制下能否化成有限小数. 条件:p/q假如已是既约分数,那么如果q的质因数分解集合是b的子集,就可以化成有限小数,否则不能. 参见代码:反复从q中除去b和q的公因子部分,并 ...

  5. bzoj 3209 数位DP+欧拉定理

    枚举1的个数,统计有那么多1的数的个数 /************************************************************** Problem: 3209 Us ...

  6. bzoj 3283 扩展BSGS + 快速阶乘

    T2  扩展BSGS T3 快速阶乘 给定整数n,质数p和正整数c,求整数s和b,满足n! / pb = s mod pc 考虑每次取出floor(n/p)个p因子,然后将问题转化为子问题. /*** ...

  7. 使用 Nokia Imaging SDK 开发有滤镜功能的 Windows Phone 8 应用

    说到滤镜应用,相信很多数开发者都对照片特效的经验都十分有限,通常都是去找一些三方的类库进行学习或移植,今天在这里给大家介绍下 Nokia 的 Imaging SDK, 相信大家对Nokia的自家图像软 ...

  8. BZOJ 2743: [HEOI2012]采花 离线树状数组

    2743: [HEOI2012]采花 题目连接: http://www.lydsy.com/JudgeOnline/problem.php?id=2743 Description 萧芸斓是Z国的公主, ...

  9. 理解 JavaScript 中的 Function.prototype.bind

    函数绑定(Function binding)很有可能是你在开始使用JavaScript时最少关注的一点,但是当你意识到你需要一个解决方案来解决如何在另一个函数中保持this上下文的时候,你真正需要的其 ...

  10. Linux命令service - 系统服务管理(转)

    用途说明 service命令用于对系统服务进行管理,比如启动(start).停止(stop).重启(restart).查看状态(status)等.相关的命令还包括chkconfig.ntsysv等,c ...