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. Redis和MySQL数据一致中出现的几种情况

    1. MySQL持久化数据,Redis只读数据 redis在启动之后,从数据库加载数据. 读请求: 不要求强一致性的读请求,走redis,要求强一致性的直接从mysql读取 写请求: 数据首先都写到数 ...

  2. 常用SQL脚本记录一

    20.SUM()和 列+ 统计结果时:如果列里有一行为null,SUM函数会忽略它:如果+,则结果集也为NULL了 19 SUBSTRING (expression,startIndex, endIn ...

  3. BZOJ3611 HEOI2014大工程

    先建虚树,然后统计答案. 对于这个两点间最大值和最小值的操作我参考了hzwer的代码. 建虚树时注意判自环 By:大奕哥 #include<bits/stdc++.h> using nam ...

  4. 【洛谷】2474:[SCOI2008]天平【差分约束系统】

    P2474 [SCOI2008]天平 题目背景 2008四川NOI省选 题目描述 你有n个砝码,均为1克,2克或者3克.你并不清楚每个砝码的重量,但你知道其中一些砝码重量的大小关系.你把其中两个砝码A ...

  5. java知识回顾

    一.构造方法能不能被继承 当然不能,1.构造方法是类的唯一入口 2.构造方法与类名相同 3.子类构造方法中隐式的调用了父类的构造方法 二.值传递和引用传递.不变类和可变类.直接赋值和浅拷贝和深拷贝   ...

  6. GIT(5)----常用命令:新分支,切换,删除,远程推送,标签,日志

    常用命令 1.新分支 创建新分支:git branch <branch_name> 创建分支并切换到新的分支上:git checkout -b <branch_name> 2. ...

  7. oracle监听理解 命名理解

    一.监听器是oracle基于服务器端的一种网络服务,主要作用是监听客户端的连接请求,并将请求转发给服务器. 监听器基于端口的,每个监听器会占用一个端口.默认监听端口1521. oracle家目录下的n ...

  8. xcode .h文件编译时 版本不正确

    在终端里面   执行下面的命令 rm -rf ~/Library/Developer/Xcode/DerivedData/ModuleCache/*

  9. 计算机音频基础-PCM简介

    我们在音频处理的时候经常会接触到PCM数据:它是模拟音频信号经模数转换(A/D变换)直接形成的二进制序列,该文件没有附加的文件头和文件结束标志. 声音本身是模拟信号,而计算机只能识别数字信号,要在计算 ...

  10. FolderSync Instant sync 即时同步

    Folderpairs - Edit folderpair - Sync options - Instant sync  Select this for instant sync on change. ...