Coder Social home page Coder Social logo

b-xiang / imonitorsdk Goto Github PK

View Code? Open in Web Editor NEW

This project forked from wecooperate/imonitorsdk

1.0 0.0 1.0 12.78 MB

系统监控开发套件(sysmon、promon、edr、终端安全、主机安全、零信任、上网行为管理)

Home Page: https://imonitorsdk.com/

Batchfile 1.16% C++ 93.29% C 5.55%

imonitorsdk's Introduction

English

简介

iMonitorSDK是一款为终端、云端提供系统行为监控的开发套件。

旨在帮助安全、管理、审计等行业应用可以快速实现必要功能,而不用关心底层驱动的开发、维护和兼容性问题,让其可以专注于业务开发。

iMonitorSDK使用基于消息协议的通信框架,让驱动开发更加稳定、快速。内核监控使用了稳定、标准的方式实现,同时支持Windows(XP-Win11)、Linux、MacOS。

利用iMonitorSDK可以极低成本地实现自保护、进程拦截、勒索病毒防御、主动防御、上网行为管理等等终端安全常见的功能。

接入文档

✨ 具备如下核心功能

  • 进程、文件、注册表、网络各种事件监听,支持拦截禁止
  • 进程、文件、注册表保护
  • 进程启动、模块加载拦截,模块注入
  • 文件拦截、重定向
  • 网络防火墙、流量代理、协议分析
  • 规则引擎、动态脚本

📦 适用于如下的产品

  • 主动防御

  • 终端管控

  • 入侵检测

  • 主机安全

  • 零信任

  • 上网行为管理

🔨 快速入门

示例一:进程启动拦截

class MonitorCallback : public IMonitorCallback
{
public:
	void OnCallback(IMonitorMessage* Message) override
	{
		if (Message->GetType() != emMSGProcessCreate)
			return;

		cxMSGProcessCreate* msg = (cxMSGProcessCreate*)Message;

		//
		// 禁止进程名 cmd.exe 的进程启动
		//

		if (msg->IsMatchPath(L"*\\cmd.exe"))
			msg->SetBlock();
	}
};

int main()
{
	MonitorManager manager;
	MonitorCallback callback;

	HRESULT hr = manager.Start(&callback);

	if (hr != S_OK) {
		printf("start failed = %08X\n", hr);
		return 0;
	}

	cxMSGUserSetMSGConfig config;
	config.Config[emMSGProcessCreate] = emMSGConfigSend;
	manager.InControl(config);

	WaitForExit("禁止进程名 cmd.exe 的进程启动");

	return 0;
}

示例二:自保护规则设置

class MonitorCallback : public IMonitorCallback
{
public:
	void OnCallback(IMonitorMessage* Message) override
	{}
};

int main()
{
	MonitorManager manager;
	MonitorCallback callback;

	HRESULT hr = manager.Start(&callback);

	if (hr != S_OK) {
		printf("start failed = %08X\n", hr);
		return 0;
	}

	manager.InControl(cxMSGUserEnableProtect());

	//
	// Path路径支持通配符
	//	* 表示任意n个字符
	//	? 表示任意一个字符
	//	> 用于字符串结尾,表示字符串结束或者是\\结尾,用于目录判断(比如protect> 匹配 protect 和 protect\\*)
	//
	{
		//
		// 添加进程、文件保护: 保护进程名是notepad.exe的进程不被结束、文件不被修改、删除
		//
		cxMSGUserAddProtectRule rule;
		rule.ProtectType = emProtectTypeProcessPath | emProtectTypeFilePath;
		wcsncpy(rule.Path, L"*\\notepad.exe", MONITOR_MAX_BUFFER);
		manager.InControl(rule);
	}

	{
		//
		// 添加文件夹保护: 保护protect目录下面的文件不被外部修改、目录不被重命名、删除
		//
		cxMSGUserAddProtectRule rule;
		rule.ProtectType = emProtectTypeFilePath;
		wcsncpy(rule.Path, L"*\\protect>", MONITOR_MAX_BUFFER);
		manager.InControl(rule);
	}

	{
		//
		// 添加注册表保护: 保护iMonitor键不被删除、修改,包括键值
		//
		cxMSGUserAddProtectRule rule;
		rule.ProtectType = emProtectTypeRegPath;
		wcsncpy(rule.Path, L"*\\iMonitor>", MONITOR_MAX_BUFFER);
		manager.InControl(rule);
	}

	{
		//
		// 添加信任进程:可以操作被保护的进程、文件、注册表,但是进程本身不受保护
		//
		cxMSGUserAddProtectRule rule;
		rule.ProtectType = emProtectTypeTrustProcess;
		wcsncpy(rule.Path, L"*taskkill*", MONITOR_MAX_BUFFER);
		manager.InControl(rule);
	}

	WaitForExit("自保护开启中");

	manager.InControl(cxMSGUserRemoveAllProtectRule());
	manager.InControl(cxMSGUserDisableProtect());

	return 0;
}

示例三:sysmon

class MonitorCallback : public IMonitorCallback
{
public:
	void OnCallback(IMonitorMessage* msg) override
	{
		printf("%S ==> %S\n", msg->GetTypeName(), msg->GetFormatedString(emMSGFieldCurrentProcessPath));

		for (ULONG i = emMSGFieldCurrentProcessCommandline; i < msg->GetFieldCount(); i++) {
			printf("\t%30S : %-30S\n", msg->GetFieldName(i), msg->GetFormatedString(i));
		}
	}
};

int main()
{
	MonitorManager manager;
	MonitorCallback callback;

	HRESULT hr = manager.Start(&callback);

	if (hr != S_OK) {
		printf("start failed = %08X\n", hr);
		return 0;
	}

	cxMSGUserSetMSGConfig config;
	for (int i = 0; i < emMSGMax; i++) {
		config.Config[i] = emMSGConfigPost;
	}
	manager.InControl(config);

	WaitForExit("");

	return 0;
}

示例四:上网行为管理(基于网络重定向的方式实现,支持https,详细参考http_access_control例子)

示例五:任意时刻对进程注入动态库

class MonitorCallback : public IMonitorCallback
{
public:
	void OnCallback(IMonitorMessage* Message) override
	{
		if (Message->GetType() != emMSGImageLoad)
			return;

		cxMSGImageLoad* msg = (cxMSGImageLoad*)Message;

		if (!msg->IsMatchCurrentProcessName(L"notepad.exe"))
			return;

		if (msg->IsMatchPath(L"*\\kernel32.dll")) {
			msg->SetInjectDll(L"D:\\test.dll");
		}
	}
};

int main()
{
	MonitorManager manager;
	MonitorCallback callback;

	HRESULT hr = manager.Start(&callback);

	CheckSignError(hr);

	if (hr != S_OK) {
		printf("start failed = %08X\n", hr);
		return 1;
	}

	manager.InControl(cxMSGUserSetGlobalConfig());

	cxMSGUserSetMSGConfig config;
	config.Config[emMSGImageLoad] = emMSGConfigSend;
	manager.InControl(config);

	WaitForExit("模块注入:在notepad.exe启动加载kernel32.dll过程中,让其强制加载D:\\test.dll");

	return 0;
}

更多的示例可以参考sample目录。

使用授权

免责说明:

iMonitorSDK(以下称本SDK)只授权给为正规的企业厂商使用。禁止用于危害企业、个人安全等任何非法的场景。

本SDK带有内核驱动程序,在使用本SDK前,请先在业务对应的环境系统中充分测试后再实际接入使用。

非法授权、非法使用而造成的经济损失、法律问题都于本SDK提供团队无关。

在您使用本SDK前,视为您已经知悉并且遵守此免责说明。

不同授权的功能差异:

功能说明 免费授权 企业授权 企业定制授权
进程监控
文件监控
注册表监控
网络监控
自保护
网络协议代理
内核对象定制
配置签发
规则引擎
Javascript脚本支持
Linux支持
MacOS支持
源码
服务支持 邮件、GitHub 邮件、GitHub、微信、远程桌面

授权请通过邮箱([email protected])联系。

使用本SDK的产品

关于我们

优秀的人,做专业的事。

创信长荣科技的团队来自国内头部互联网公司,具备十多年安全底层开发经验、架构设计能力,对企业安全业务有着深刻的理解。 是一家致力于为企业管理提供基础服务、一体化管理平台,力争成为企业管理入口,促进企业管理标准化、数字化的企业。

有任何商业合作、功能定制请 联系我们

imonitorsdk's People

Contributors

wecooperate avatar

Stargazers

 avatar

Forkers

zhaoyaogit

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.