Windows 2003下监控用户密码修改&服务启停

1. 概述

1.1 本文目的

  本文旨在描述如何在Windows 2003上监控用户密码修改和系统服务的启停

1.2 约定

  本文部分功能需要可能需要启用相应的组策略编辑

  本文所涉及用户或目录是假定的目录,比如本文约定工作目录 E:\sytem、监控命令执行的用户是systemMonitor

 

2. 创建事件触发监控

REM 监控任何用户密码重置时,使用systemMonitor用户执行E:\system\pwdChangeTask.bat
EVENTTRIGGERS /Create /RU systemMonitor /RP systemMonitor的密码 /TR password_Set /L security /EID 628 /TK E:\system\pwdChangeTask.bat

REM 监控任何用户密码修改时,使用systemMonitor用户执行E:\system\pwdChangeTask.bat
EVENTTRIGGERS /Create /RU systemMonitor /RP systemMonitor的密码 /TR password_Change /L security /EID 627 /TK E:\system\pwdChangeTask.bat

REM 监控服务启停时,使用systemMonitor用户执行E:\system\startStopService.bat
EVENTTRIGGERS /Create /RU systemMonitor /RP systemMonitor的密码 /TR service_Change /L system /EID 7035 /TK E:\system\startStopService.bat

 

 

 

3. E:\system\pwdChangeTask.bat

REM 输出日志文件路径
set SYS_MONI_LOGFILE=E:\system\logs\systemMonitor%DATE:~0,4%%DATE:~5,2%%DATE:~8,2%.log

REM 输出跳行标志,文件里面%SYS_MONI_LOGFILE%出现@@systemMonitor@@ SKIP LINES  解析时需要跳n行解析
echo @@systemMonitor@@ SKIP LINES  >> %SYS_MONI_LOGFILE%

REM 日志格式输出
CSCRIPT C:\Windows\system32\Eventquery.vbs /L Security /R 1 /FI "ID eq 627 OR ID eq 628" /V /FO CSV >> %SYS_MONI_LOGFILE%

 

 

4. E:\system\startStopService.bat

set SYS_MONI_LOGFILE=E:\system\logs\systemMonitor%DATE:~0,4%%DATE:~5,2%%DATE:~8,2%.log
echo @@systemMonitor@@ SKIP LINES >> %SYS_MONI_LOGFILE%
CSCRIPT C:\Windows\system32\Eventquery.vbs /L system /R 1 /FI "ID eq 7035" /V /FO CSV >> %SYS_MONI_LOGFILE%

 

5. 附java解析日志代码

  5.1 输出日志格式

@@systemMonitor@@ SKIP LINES  
Microsoft (R) Windows Script Host Version 5.6
版权所有(C) Microsoft Corporation 1996-2001。保留所有权利。

"类型","事件","时间日期","来源","计算机名","类别","用户","描述"
"审核成功","628","2010-5-6 14:22:41","Security","BBK","帐户管理","BBK\achievo","设置了用户帐户密码:  	目标帐户名:	Guest  	目标域:	BBK  	目标帐户 ID:	BBK\Guest  	调用方用户名:	achievo  	调用方域:	BBK  	调用方登录 ID:	(0x0,0xF9D361C)"

 

  5.2 java解析代码

package org.javaf.system.monitor;
import java.util.Calendar;

import org.javaf.common.utils.ReadTextFile;
import org.javaf.common.utils.WriteTextFile;
public class WindowsServerMonitor extends AbstractCommonMonitor {
	protected void getReport(ReadTextFile rt ,WriteTextFile wtm,WriteTextFile wtd) {
		String line;
		while((line = rt.readLine()) != null) {
			if(line.startsWith("@@systemMonitor@@ SKIP LINES")) {
				this.skipLine(rt, 4);
				continue;
			}
			if(line.indexOf(",") <=0 )
				continue;
			String contents[] = line.split(",");
			if(contents.length < 8)
				continue;
			Calendar c = Calendar.getInstance();
			c.set(Calendar.DAY_OF_YEAR,c.get(Calendar.DAY_OF_YEAR)-1);
			int day = c.get(Calendar.DATE);
			int month = c.get( Calendar.MONTH ) + 1;
			String outLine = "";
			if(day<10 && month < 10){
				outLine = getContent(contents,2).substring(0, 8) + "|" + ip;
			}else if(day > 10 && month > 10 ){
				outLine = getContent(contents,2).substring(0, 10) + "|" + ip;
			}else {
				outLine = getContent(contents,2).substring(0, 9) + "|" + ip;
			}
			long pid = getContentToLong(contents,1);
			if(pid == 627 || pid == 628) {
				String opUser = getContent(contents,7).split(":")[2].trim().split("\\s")[0].trim();
				outLine += "|" + ( pid == 628 ? "设置":"更改") + opUser + "密码";
				outLine += "|" + getContent(contents,6);
				outLine += "|1";
				wtm.println(outLine);
			}
			else if(pid == 7035) {
				String tmpStr = getContent(contents,7);
				tmpStr = tmpStr.substring(tmpStr.length()-6,tmpStr.length()-4) +"\"" +tmpStr.substring(0,tmpStr.indexOf("服务")).trim() + "\"服务";
				outLine += "|" + tmpStr + "|" + getContent(contents,6);
				outLine += "|1";
				if( outLine.indexOf( "WinHTTP Web Proxy Auto-Discovery Service" ) == -1 ){
					wtd.println(outLine);
					wtm.println(outLine);
				}
			}
		}
	}
	private String getContent(String []contents ,int i) {
		return contents[i].substring(1,contents[i].length() - 1);
	}
	private Long getContentToLong(String []contents ,int i) {
		return Long.parseLong(getContent(contents,i));
	}
}

 

 

Record监听程序获取Windows登陆密码 生活中我们处于安全考虑习惯给pc设置密码,如果这个电脑是私人财产那都不说什么了,可偏偏有些办公的公共资源被个别人设置了密码,其他人无法登陆使用,本人通过以下教程,监听其登录密码。 思路大纲:开机时候按F8,带命令提示符的安全模式进入后添加账户,但是本人测试了好几次都没有成功,原因是当用户设置了登陆密码后,进入带命令提示符的安全模式同样要密码。网上有个牛人通过替换放大镜程序,成功的添加用户并绕过了windows登陆密码,本教程还是沿用这种方法,但是重点是监听键盘,就是当系统启动至登陆界面的时候运行监听程序,当该机被登陆时其键盘按键信息会保存至指定文件夹下,这个过程涉及到以下问题,就是如何在电脑进入登陆画面前运行监听程序,如何保证我们操作的隐蔽性,第二句话的意思是当我们借用net命令添加账户以后,下次开机的时候会多出来了账户,这样别人就会发觉,比如我们用net命令新建了一个yutian账户,我们要做到对方下次登录时候还是只有一个administrators账户,有人说删除?在yutian账户下运行net user yutian /add删除账户,这样做当然办不到,因为yutian账户已经启用,cmd输入net命令是无法删除的。而正确的方法是,把这个删除命令写入批处理,用winrar做成exe格式替换放大镜程序。因此我们的大体思路就是,1新建账户yutian2向windows植入监听程序并使其开机启动3删除新建账户yutiian。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值