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. [leetcode sort]148. Sort List

    Sort a linked list in O(n log n) time using constant space complexity. 以时间复杂度O(n log n)排序一个链表. 归并排序, ...

  2. HTML基础-DAY1

    HTML基础 Web的本质就是利用浏览器访问socket服务端,socket服务端收到请求回复数据提供给浏览器进行渲染显示. import socket def main(): sock = sock ...

  3. python 自带的range是不能实现对小数的操作的,如果要对小数操作可以使用numpy

    import numpy as np s = np.arange(0, 1, 0.1) print s [0. 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9]

  4. type与instance区别

    class Foo(object): pass class Bar(Foo): pass obj = Bar() # isinstance用于判断,对象是否是指定类或其派生类的实例 print(isi ...

  5. android viewHolder static 静态

    韩梦飞沙  韩亚飞  313134555@qq.com  yue31313  han_meng_fei_sha 不是静态内部类 会 持有 外部类的 引用.  就像经常自定义的 适配器 类 作为内部类 ...

  6. SPOJ 10232. Distinct Primes

    Arithmancy is Draco Malfoy's favorite subject, but what spoils it for him is that Hermione Granger i ...

  7. ZOJ 2969 Easy Task

    E - Easy Task Description Calculating the derivation of a polynomial is an easy task. Given a functi ...

  8. nginx 注册为linux系统服务

    #! /bin/sh # chkconfig: - 85 15 # description: nginx is a World Wide Web server. It is used to serve ...

  9. 成为一名JAVA高级工程师你需要学什么【转】

    宏观上: 1.技术广度方面至少要精通多门开源技术吧,研究过struts\spring等的源码. 2.项目经验方面从头到尾跟过几个大项目,头是指需求阶段,包括需求调研.尾是指上线交付之后,包括维护阶段. ...

  10. Shell脚本里的双冒号是什么意思

    这个是代码开发风格,其实也就是一个函数名,相当于下划线分割,但改读成包名之后就意义不一样.这个是根据Google的Shell开发规范进行定义的. 参考: https://google.github.i ...