惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

S
Secure Thoughts
Security Latest
Security Latest
Simon Willison's Weblog
Simon Willison's Weblog
O
OpenAI News
GbyAI
GbyAI
L
LINUX DO - 最新话题
A
Arctic Wolf
T
Tor Project blog
G
GRAHAM CLULEY
I
InfoQ
博客园_首页
IT之家
IT之家
The Register - Security
The Register - Security
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
P
Proofpoint News Feed
The GitHub Blog
The GitHub Blog
Blog — PlanetScale
Blog — PlanetScale
N
Netflix TechBlog - Medium
K
Kaspersky official blog
博客园 - 三生石上(FineUI控件)
S
SegmentFault 最新的问题
U
Unit 42
PCI Perspectives
PCI Perspectives
量子位
P
Palo Alto Networks Blog
S
Securelist
T
Troy Hunt's Blog
博客园 - 【当耐特】
Recorded Future
Recorded Future
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
S
Security Affairs
Engineering at Meta
Engineering at Meta
T
The Blog of Author Tim Ferriss
博客园 - 聂微东
罗磊的独立博客
N
News and Events Feed by Topic
人人都是产品经理
人人都是产品经理
B
Blog RSS Feed
NISL@THU
NISL@THU
C
Cisco Blogs
T
Threatpost
有赞技术团队
有赞技术团队
Forbes - Security
Forbes - Security
Hugging Face - Blog
Hugging Face - Blog
Last Week in AI
Last Week in AI
T
The Exploit Database - CXSecurity.com
Cloudbric
Cloudbric
Cyberwarzone
Cyberwarzone
Google DeepMind News
Google DeepMind News
C
Cyber Attacks, Cyber Crime and Cyber Security

博客园 - ji yang

页面点击分析工具设计与实现 使用FreeMind代替PowerPoint做演示 Velocity 2011大会归来 通过扩展属性为SqlServer的索引添加注释信息 memcached对中文key的支持 网站活跃用户统计的思路与设计 以服务的方式提供站点基础功能支持 safari的url地址转义问题 fastdfs dotnet 客户端发布 go lang web项目的部署与发布 从设计图到HTML页面时的注意点 关于加班 关于Google App Engine 一个简单的Spring.net绑定例子 SOA中国路线图活动感受 文章被转载了 Asp.net中基类页的设计和使用 产品营销上的求同策略
更安全的服务器:Windows账号权限修改监控
ji yang · 2011-06-01 · via 博客园 - ji yang

系统入侵首先从账号权限修改开始,常见的操作有,给自己开新账号,修改已有账号权限,如:提升guest账号为管理员等,如果手工去检查账号的变化,不仅繁琐,而且会遗漏,因为有经验的黑客操作后,会清除事件日志。

理想的方式是,只要服务器账号权限发生改变,就即时通知相关人员。

在.net中,提供了EventLog对象,我们可以利用EventLog的EntryWrittenEvent事件来监控账号相关的操作。

static AutoResetEvent signal;void Listen() {
    EventLog log 
= new EventLog();
    
    
// 和安全相关的系统事件
    log.Log = "Security";// 监听EventLog写入事件
    log.EntryWritten += new EntryWrittenEventHandler(OnEntryWritten);
    log.EnableRaisingEvents 
= true;// 等待
    signal = new AutoResetEvent(false);
    signal.WaitOne();
}
public void OnEntryWritten(object source, EntryWrittenEventArgs e) {
   
// 监听所有系统管理事件
    if (e.Entry.CategoryNumber == 7) {
        EventLogEntry entry 
= e.Entry;
       
string userName = entry.UserName;
        
long eventID = entry.InstanceId;
        DateTime dateAdded 
= entry.TimeGenerated;
        
string message = entry.Message;// 测试:写入到文本文件,实际使用时可以发邮件,或记到数据库
        
// File.AppendAllText("c:\\event.txt", string.Format("\r\nEventID:{0}\r\nTime:{1}\r\n{2}\r\n\r\n", eventID, dateAdded.ToString(), message));
    }
}

为了让这儿的监控程序在后台执行,还可以包装成服务,包装成服务的例子程序,从这儿下载: