COM/DirectShow Audio device

一些病毒通过COM组件来检测沙箱环境

#include "stdafx.h"
#include <windows.h>
#include <dshow.h>
#include <Strmif.h>
#pragma comment(lib,"Strmiids.lib")

int _tmain(int argc, _TCHAR* argv[])
{
	CoInitialize(0);
	wchar_t * filterName= L"random_name";
	IGraphBuilder * pGraph;
	CoCreateInstance(CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER, IID_IGraphBuilder, (void**)&pGraph);
	if (E_POINTER != pGraph->AddFilter(NULL, filterName))
	{
		MessageBoxA(0, "检测到沙箱L !\n", 0, 0);
	}

	IBaseFilter* pBaseFilter = NULL;
	CoCreateInstance(CLSID_AudioRender, NULL, CLSCTX_INPROC_SERVER, IID_IBaseFilter, (void**)&pBaseFilter);

	pGraph->AddFilter(pBaseFilter, filterName);

	IBaseFilter* pBaseFilter2 = NULL;
	pGraph->FindFilterByName(filterName, &pBaseFilter2);
	if (NULL == pBaseFilter2)
	{
		MessageBoxA(0, "检测到沙箱2L !\n", 0, 0);
	}

	FILTER_INFO info = { 0 };
	pBaseFilter2->QueryFilterInfo(&info);
	if (0 != wcscmp(info.achName, filterName))
	{
		return 0;
	}

	IReferenceClock * pClock;
	if (0 != pBaseFilter2->GetSyncSource((&pClock)))
	{
		return 0;
	}

	if (0 != pClock)
	{
		return 0;
	}
	
	CLSID clsID;
	pBaseFilter2->GetClassID(&clsID);
	if (clsID.Data1 == 0)
	{
		exit(1);
	}

	if (NULL == pBaseFilter2)
	{
		exit(-1);
	}

	IEnumPins* pEnum = NULL;
	if (0 != pBaseFilter2->EnumPins(&pEnum))
	{
		exit(-1);
	}

	if (0 == pBaseFilter2->AddRef())
	{
		exit(-1);
	}


	MessageBoxA(0,"没有检测到沙箱,执行病毒代码!\n",0,0);
	system("pause");

	return 0;
}


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值