private void TakeAction(FileAnalysisStatus analysisStatus) { Logger.WriteToLog(String.Format("Taking corresponding action on file: '{0}' with status '{1}'.", _fileToBeAnalyzed, FileAnalysisStatusExtension.ToString(analysisStatus))); // -------- DEPRECATED ------ //string adminUserName = Environment.UserName; //FileSecurity fs = File.GetAccessControl(fileToBeAnalyzed); //FileSystemAccessRule fsa = new FileSystemAccessRule(adminUserName, FileSystemRights.FullControl, AccessControlType.Deny); //fs.RemoveAccessRule(fsa); //File.SetAccessControl(fileToBeAnalyzed, fs); if (analysisStatus == FileAnalysisStatus.Malicious) { Logger.WriteToLog(String.Format("File: '{0}' is malicious. Deleting it.", _fileToBeAnalyzed)); File.Delete(_fileToBeAnalyzed); } else { Logger.WriteToLog(String.Format("Unblocking file: '{0}'.", _fileToBeAnalyzed)); FileAttributes attr = File.GetAttributes(_fileToBeAnalyzed) & ~FileAttributes.Hidden; File.SetAttributes(_fileToBeAnalyzed, attr); } }
private void NotifyThreadProc(object state) { NotifyThreadStateInfo stateInfo = state as NotifyThreadStateInfo; if (stateInfo == null) { return; } try { Logger.WriteToLog(String.Format("[NotifyThreadPool] Notifying client with GUID: '{0}', Info: '{1}', Status: '{2}'", stateInfo.Client.Id, stateInfo.Args.FileName, FileAnalysisStatusExtension.ToString(stateInfo.Args.AnalysisStatus))); stateInfo.Client.Callback.OnSentNotification(stateInfo.Args); } catch (TimeoutException) { Logger.WriteToLog(String.Format("TimeoutException. Invalidating client with GUID: '{0}'.", stateInfo.Client.Id)); stateInfo.Client.Invalidate(); } }