Example #1
0
 //判别异常 进行检测
 private void ExceptionThenMonitor(string pName, IntPtr hWnd)
 {
     if (ExceptionCatch.IsSuspicious(pName, hWnd))
     {
         new VerifySensitiveProcess(pName);
     }
 }
        //获取进程行为数据
        private void GetProcessInfo()
        {
            Process[] processes = Process.GetProcessesByName(_monitoredName);
            //同名进程数
            int processNum = processes.Count();

            //此进程在判别时关闭了  则释放资源,判别无效
            if (processNum == 0) //无此进程 值为0
            {
                SetProcessState("");
                Dispose();
                return;
            }
            else
            {
                //判别是否有网络行为
                if (_isOnline == false)
                {
                    if (ExceptionCatch.JudgeNetBehavior(_monitoredName))
                    {
                        _isOnline = true;
                    }
                }
                //cpu值记录一次
                AddCpuValue();
                //内存值记录
                AddMemoryValue(processes);
            }
        }