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 ... 
随机推荐
- Android Actionbar Tab 导航模式
			Android Actionbar Tab 下图中,红色矩形圈起来的就是我们 ActionBar Tab,下面我们将一步一步的实现下图中的效果. 初次尝试 package com.example.it ... 
- 关于Python Profilers性能分析器
			1. 介绍性能分析器 作者:btchenguang profiler是一个程序,用来描述运行时的程序性能,并且从不同方面提供统计数据加以表述.Python中含有3个模块提供这样的功能,分别是cProf ... 
- Linux命令学习<不断更新>
			没有系统的学习过Linux命令,遇到了就学习一下,慢慢积累. 1.echo 命令,学习网站『https://linux.cn/article-3948-1.html』. echo单词有回声.共鸣的意思 ... 
- NOI.AC WC模拟赛
			4C(容斥) http://noi.ac/contest/56/problem/25 同时交换一行或一列对答案显然没有影响,于是将行列均从大到小排序,每次处理限制相同的一段行列(呈一个L形). 问题变 ... 
- bzoj 3837 (随机过题法了解一下)
			3837: [Pa2013]Filary Time Limit: 60 Sec Memory Limit: 256 MBSubmit: 395 Solved: 74[Submit][Status] ... 
- [CodeVS1243]网络提速
			题目大意: 有n个点的连通图,有m次可以将某一条边权值减半的机会. 不同的机会可以叠加作用于同一条边. 求1~n的最短路. 思路: 拆点,记录1到每个点在使用不同次数的机会后的最短路,然后直接跑Dij ... 
- 鸟哥的私房菜:Bash shell(三)-命令别名与历史指令
			一 命令别名设定: alias, unalias 命令别名是一个很有趣的东西,特别是你的惯用指令特别长的时候!还有, 增设预设的属性在一些惯用的指令上面,可以预防一些不小心误杀档案的情况发生的时候! ... 
- java中的hashmap与hashtable的区别
			HashMap和Hashtable的区别 HashMap和Hashtable都实现了Map接口,但决定用哪一个之前先要弄清楚它们之间的分别.主要的区别有:线程安全性,同步(synchronizatio ... 
- Spring Boot 运作原理
			Spring Boot 运作原理 1.Spring Boot 简介 SpringBoot是由Pivotal团队提供的全新框架,其设计目的是用来简化新Spring应用的初始搭建以及开发过程.该框架使用了 ... 
- 【BZOJ-3527】力     FFT
			3527: [Zjoi2014]力 Time Limit: 30 Sec Memory Limit: 256 MBSec Special JudgeSubmit: 1544 Solved: 89 ... 
