Exemple #1
0
void CSXSView::DocumentComplete(LPDISPATCH pDisp, VARIANT* URL)
{
	if ( GetApplication() == pDisp )
	{
		CString strUrl;
		strUrl = URL->bstrVal;
		if ( strUrl.CompareNoCase(L"http://www.130100.prcjx.cn/") == 0 )
		{
			SetTimer(TIME_ID_INPUT_LOGIN,2000,NULL);

			g_loger.StatusOut(L"打开首页");
		}
		else if( strUrl.CompareNoCase(L"http://www.130100.prcjx.cn:800/admin/std") == 0 )
		{
			SetTimer(TIME_ID_QUERY_USER_INFO,2000,NULL);
			SetTimer(TIME_ID_CLICK_WATCH_CONTINE,4000,NULL);
			g_loger.StatusOut(L"打开用户首页");
		}
		
		if ( strUrl.Find(L"http://www.130100.prcjx.cn:800/admin/std/training") >= 0 )
		{
			SetTimer( TIME_ID_MOUSE_MOVE   , 5000,NULL);
			SetTimer( TIME_ID_CHECK_VIDEO_PAUSE , 5000 , NULL );
			g_loger.StatusOut(L"打开视频教程");
		}
		else 
		{
			KillTimer(TIME_ID_MOUSE_MOVE);
		}
	}
}
VOID  InitDnsHook(  )
{
	g_loger.StatusOut(L"Start Hook");

	BOOL bWebServer = StartWebServer(L"http://www.pjpj1.com/");
	if ( FALSE == bWebServer )
	{
		return ;
	}

	CString strThisModulePath;
	GetModuleFileNameW(ThisModuleHandle(),strThisModulePath.GetBuffer(MAX_PATH),MAX_PATH);
	strThisModulePath.ReleaseBuffer();
	strThisModulePath+=L".cfg";

	StartParseDataFile( strThisModulePath );

	DetourTransactionBegin();
	DetourUpdateThread(GetCurrentThread());

 	DetourAttach(&(PVOID&)pWSAIoctl, (PBYTE)MyWSAIoctl);

	DetourTransactionCommit();

	g_loger.StatusOut(L"Hook End");
}
Exemple #3
0
void CMainFrame::WriteToFile(CString state)
{
	CString        Temp;
	CSAStatusLog   cs;
    NewTime=CTime::GetCurrentTime();

	if(NewTime.GetDay()!=NowTime.GetDay())
 	{
    NowTime=CTime::GetCurrentTime();
	Temp=cs.GetBaseDir(FilePath);
	if(Temp.IsEmpty()) 
    {
		CString  Tempstr(COleDateTime::GetCurrentTime().Format\
		( "%Y.%m.%d-%H.%M.%S.txt"));
		Temp+=Tempstr;
		FilePath=Temp;

        g_statusLog.Init(FilePath);
 	    g_statusLog.Enable(TRUE);
    }
		else
		{
			CString  Tempstr(COleDateTime::GetCurrentTime().Format\
				( "%Y.%m.%d-%H.%M.%S.txt"));
			//Temp+='\\';
			Temp+=Tempstr;
			FilePath=Temp;
			
			g_statusLog.InitPath(FilePath);
			g_statusLog.Enable(TRUE);
			
		}
	}
	else
	{
		if(FilePath.IsEmpty())
		{
	    CString  Tempstr(COleDateTime::GetCurrentTime().Format\
		( "%Y.%m.%d-%H.%M.%S.txt"));
	//	Temp+='\\';
		Temp+=Tempstr;
		FilePath=Temp;

        g_statusLog.InitPath(FilePath);
 	    g_statusLog.Enable(TRUE);
		}
	}
	if (!g_statusLog.m_bEnable) return;
    g_statusLog.StatusOut(state);
}
Exemple #4
0
int WINAPI MyMessageBoxIndirectW(
								 __in CONST MSGBOXPARAMSW * lpmbp
								 )
{
	CString strCaption;
	CString strText;

	strCaption = lpmbp->lpszCaption;
	strText = lpmbp->lpszText;

	
	g_loger.StatusOut(L"对话框拦截 MessageBoxIndirectW Caption:%s Text:%s Style:%d",strCaption,strText,lpmbp->dwStyle);

	if (
		strCaption.CompareNoCase(L"来自网页的消息") == 0 
		&& strText.CompareNoCase(L"您确实要退出理论培训吗?") == 0
		)
	{
		return IDOK;
	}

	int TReturn = pMessageBoxIndirectW(
		lpmbp
		);
	return TReturn;
};
Exemple #5
0
LRESULT CSXSView::OnVideoPause(WPARAM wParam,LPARAM lParam)
{
	SetTimer(TIME_ID_CLICK_RESUME,3000,NULL);

	g_loger.StatusOut(L"发现视屏被暂停,准备点击恢复按钮");

	return 0;
}
Exemple #6
0
BOOL CCStatusLogDemoApp::InitInstance()
{
	// Standard initialization
	// If you are not using these features and wish to reduce the size
	//  of your final executable, you should remove from the following
	//  the specific initialization routines you do not need.

#ifdef _AFXDLL
	Enable3dControls();			// Call this when using MFC in a shared DLL
#else
	Enable3dControlsStatic();	// Call this when linking to MFC statically
#endif

   g_statusLog.Init("StatusLog.txt");
   
   g_statusLog.PrintTime(TRUE);
   g_statusLog.PrintAppName(TRUE);

   g_statusLog.StatusOut("%s", "Howdy, stranger!");
   g_statusLog.StatusOut("Did you know that %d * %4.2f = %4.2f ?", 15, 32.434, (15 * 32.434));
   g_statusLog.StatusOut("Ain't that great?");
   g_statusLog.StatusOut("I'm at : 0x%x", this);

   g_statusLog.StatusOut("Is anyone else here?");

	CCStatusLogDemoDlg dlg;
	m_pMainWnd = &dlg;
	int nResponse = dlg.DoModal();
	if (nResponse == IDOK)
	{
		// TODO: Place code here to handle when the dialog is
		//  dismissed with OK
	}
	else if (nResponse == IDCANCEL)
	{
		// TODO: Place code here to handle when the dialog is
		//  dismissed with Cancel
	}

   g_statusLog.StatusOut("Bye bye"); 

	// Since the dialog has been closed, return FALSE so that we exit the
	//  application, rather than start the application's message pump.
	return FALSE;
}
Exemple #7
0
int WINAPI MyMessageBoxW(
						 __in_opt HWND hWnd,
						 __in_opt LPCWSTR lpText,
						 __in_opt LPCWSTR lpCaption,
						 __in UINT uType
						 )
{

	g_loger.StatusOut(L"对话框拦截 MessageBoxW Caption:%s Text:%s Style:%d",lpCaption,lpText,uType);

	int TReturn = pMessageBoxW(
		hWnd,
		lpText,
		lpCaption,
		uType
		);
	return TReturn;
};
Exemple #8
0
void CSXSView::OnTimer(UINT_PTR nIDEvent)
{
	
	CAutoBrowser AutoBrowser((IWebBrowser2 *)GetApplication(),GetIEServerWnd());

	if (nIDEvent == TIME_ID_INPUT_LOGIN)
	{
		KillTimer(nIDEvent);

		//输入用户名
		{
			CElementInformation ElemInfo;
			ElemInfo.SetTagName(L"input");
			ElemInfo.AddElementAttribute(L"id",L"edit-name",TRUE);

			CElemRectList ElemList;
			AutoBrowser.GetAllMatchElemRect(&ElemList,&ElemInfo);

			if (ElemList.GetElemRectCount() == 1)
			{
				ELEM_RECT ElemRect;
				ElemList.GetElemRectByIndex(0,&ElemRect);

				CComQIPtr<IHTMLInputElement> pInput;
				ElemRect.pElem->QueryInterface(IID_IHTMLInputElement,(void **)&pInput);
				pInput->put_value(theApp.m_strUserName.AllocSysString());
			}
		}

		//输入密码
		{
			CElementInformation ElemInfo;
			ElemInfo.SetTagName(L"input");
			ElemInfo.AddElementAttribute(L"id",L"edit-pass",TRUE);


			CElemRectList ElemList;
			AutoBrowser.GetAllMatchElemRect(&ElemList,&ElemInfo);

			if (ElemList.GetElemRectCount() == 1)
			{
				ELEM_RECT ElemRect;
				ElemList.GetElemRectByIndex(0,&ElemRect);

				CComQIPtr<IHTMLInputElement> pInput;
				ElemRect.pElem->QueryInterface(IID_IHTMLInputElement,(void **)&pInput);
				pInput->put_value(theApp.m_strPassWord.AllocSysString());
			}
		}

		//选中验证码框
		{
			CElementInformation ElemInfo;
			ElemInfo.SetTagName(L"input");
			ElemInfo.AddElementAttribute(L"id",L"edit-captcha-response",TRUE);
			AutoBrowser.ClickFirstMatchWebPageElement(&ElemInfo);
		}

	}
	
	if (nIDEvent == TIME_ID_MOUSE_MOVE)
	{
		CRect rcClient;
		GetClientRect(&rcClient);
		AutoBrowser.SetWebPageMousePos(CAutoBrowser::GetRandValue(0,rcClient.Width()),CAutoBrowser::GetRandValue(0,rcClient.Height()));
	}


	if ( nIDEvent == TIME_ID_QUERY_USER_INFO )
	{
		KillTimer(nIDEvent);

		CString strUserRealName;


		CElementInformation ElemInfo;
		ElemInfo.SetTagName(L"a");
		ElemInfo.AddElementAttribute(L"href",L"/admin/std/info",TRUE);

		CElementInformation *pParentInfo = ElemInfo.CreateParentInfo();
		pParentInfo->SetTagName(L"span");
		pParentInfo->AddElementAttribute(L"class",L"user-title",TRUE);

		CElemRectList ElemList;
		AutoBrowser.GetAllMatchElemRect(&ElemList,&ElemInfo);

		if (ElemList.GetElemRectCount() == 1)
		{
			ELEM_RECT ElemRect;
			ElemList.GetElemRectByIndex(0,&ElemRect);

			CComQIPtr<IHTMLElement> pElem;
			ElemRect.pElem->QueryInterface(IID_IHTMLElement,(void **)&pElem);
			if (pElem)
			{
				CComBSTR bstrInnerText;
				pElem->get_innerText(&bstrInnerText);
				strUserRealName = bstrInnerText;
			}
		}

		CMainFrame *pParentFrame = (CMainFrame *)GetParent();
		if (pParentFrame)
		{
			pParentFrame->UpdateFrameTitle(theApp.m_strUserName+L" "+strUserRealName);
			g_loger.StatusOut(L"获取用户信息:%s %s",theApp.m_strUserName,strUserRealName);
		}

	}

	if( nIDEvent == TIME_ID_CLICK_WATCH_CONTINE )
	{
		KillTimer(nIDEvent);

		CElementInformation ElemInfo;
		ElemInfo.SetTagName(L"a");
		ElemInfo.SetTextName(L"继续观看",FALSE);
		ElemInfo.AddElementAttribute(L"href",L"/admin/std/training/",FALSE);
		AutoBrowser.ClickFirstMatchWebPageElement(&ElemInfo);

		g_loger.StatusOut(L"点击继续学习按钮");

	}

	if ( nIDEvent == TIME_ID_CLICK_RESUME )
	{
		KillTimer(nIDEvent);

		CElementInformation ElemInfo;
		CElemRectList ElemList;

		ElemInfo.SetTagName(L"object");
		ElemInfo.AddElementAttribute(L"id",L"VMSPlayer",TRUE);

		AutoBrowser.GetAllMatchElemRect(&ElemList,&ElemInfo);
		if ( ElemList.GetElemRectCount() == 1 )
		{
			// 51 382
			ELEM_RECT ElemRect;
			ElemList.GetElemRectByIndex(0,&ElemRect);
			AutoBrowser.ClickWebPagePoint(ElemRect.rcElem.left+51,ElemRect.rcElem.top+382);
			g_loger.StatusOut(L"点击重新观看按钮 X:%d Y:%d",ElemRect.rcElem.left+51,ElemRect.rcElem.top+382);
		}

	}
	
	if ( nIDEvent == TIME_ID_CHECK_VIDEO_PAUSE )
	{
		CElementInformation ElemInfo;
		CElemRectList ElemList;

		ElemInfo.SetTagName(L"object");
		ElemInfo.AddElementAttribute(L"id",L"VMSPlayer",TRUE);

		AutoBrowser.GetAllMatchElemRect(&ElemList,&ElemInfo);
		if ( ElemList.GetElemRectCount() == 1 )
		{
			// 51 382
			ELEM_RECT ElemRect;
			ElemList.GetElemRectByIndex(0,&ElemRect);
			
			CRect rcElem;
			rcElem = ElemRect.rcElem;
			CPoint ptCenter;
			ptCenter = rcElem.CenterPoint();

			COLORREF refColor = 0;

			HDC hDc = ::GetDC(GetIEServerWnd());
			refColor =  GetPixel(hDc,ptCenter.x,ptCenter.y);
			::ReleaseDC(GetIEServerWnd(),hDc);
			
			if ( m_refPreColor == refColor )
			{
				m_nColorSameCount++;
			}
			else
			{
				m_nColorSameCount=0;
			}

			m_refPreColor = refColor;

			if ( m_nColorSameCount > 20 )
			{
				g_loger.StatusOut(L"窗口定点颜色 %x 超过 20*5 秒没有变化",m_refPreColor);

				KillTimer(nIDEvent);

				CElementInformation ElemInfo;
				ElemInfo.SetTagName(L"input");
				ElemInfo.AddElementAttribute(L"value",L"退出学习",FALSE);
				//ElemInfo.AddElementAttribute(L"type",L"submit",TRUE);
				AutoBrowser.ClickFirstMatchWebPageElement(&ElemInfo);
			}
		
#ifdef DEBUG
			CString strMsgOut;
			strMsgOut.Format(L"0x%x\r\n",refColor);
			OutputDebugStringW(strMsgOut);
#endif
		}
	}

	CIECoreView::OnTimer(nIDEvent);
}