////// 检测文件是否存在木马字眼 /// /// 文件字符串路径 ///true:安全、false:危险 private bool CheckFileSafe(string path) { var file=new FileInfo(path); var sr = file.OpenText(); var text = sr.ReadToEnd(); var DangerString = ".getfolder|.createfolder|.deletefolder|.createdirectory|.deletedirectory|.saveas|wscript.shell|script.encode|server.|.createobject|execute|activexobject|language=|include|filesystemobject|shell.application"; Array arrDangerArray = DangerString.Split('|').ToArray(); //var isSafe = true; if (arrDangerArray.Cast().Any(item => text.IndexOf(item) >= 0)) { sr.Close(); sr.Dispose(); return false; } sr.Close(); sr.Dispose(); return true; }