首页| 论坛| 搜索| 消息
主题:重做论坛的Synaptics病毒修复工具
z3960发表于 2025-06-25 09:51
odule); if (File.Exists(copyFile)) { File.Delete(copyFile);//如果存在复制的临时文件,就删除 Console.WriteLine("文件已被删除: " + copyFile); } return rltByte.ToArray();}return new byte[] { }; }3.修改 检测文件及文件夹遍历递归方式,将try放在for/foreach 内部
纯文本查看 复制代码
?001002003004005006007008009010011012013014015016017018019020021022023024025026027028029030031032033034035036037038039040041042043044045046047048049050051052053054055056057058059060061062063064065066067068069070071072073074075076077078079080081082083084085086087088089090091092093094095096097098099100101102103104105106107108109110111112113114115116117118private void ScanDirectoryRecursively(string directory, boolisTest, object sender, ref int scanCount, ref int virsCount){if(reqStop){ //(sender as BackgroundWorker).ReportProgress(3);//退出 Console.WriteLine("ScanDirectoryRecursively--return"); return;} foreach(string file in Directory.GetFiles(directory,"*.exe"))//后续要添加xlsm,不要添加SearchOption.AllDirectories 参数{ try { scanCount++; (sender as BackgroundWorker).ReportProgress(1,file + '|' + scanCount); if (!file.ToLower().EndsWith(".exe")) continue;//过滤以 ".exe_bak" 结尾的文件 if (skipCache &&file.Contains("\._cache_")) continue;//过滤含"\._cache_" 的文件 //判断文件大小是不是< 740K long.TryParse(GetFileSize(file, false),out longfileSizeB); if (fileSizeB < VIR_FILE_MIN_SIZE) continue;//过滤小于740K 的文件 if (isPause) {//暂停 if(PauseWork(sender)) return; } Console.WriteLine(file); bool isVirus = false; //是否感染 if (scanMode == 0) { //快速匹配 if(ReadFileBinMark(file).SequenceEqual(virDESCRIPTION)) { isVirus = true; } } else if (ResGetRCDATA(file,resDesLabel).SequenceEqual(virDESCRIPTION)) { //精确匹配 isVirus = true; } if (isVirus) { virsCount++; (sender as BackgroundWorker).ReportProgress(2,file + '|' + virsCount); //int tableIndex =0; //用添加的方式时,新项依次追加在后面,要scollView查看最后项,用insert直接插入时,最新的项在最前面 // 将病毒信息添加到DataGridView中// 使用Invoke来在UI线程上执行添加行的操作 dataGridView1.Invoke(new Action(()=> {//tableIndex=dataGridView1.Rows.Add((dataGridView1.Rows.Count).ToString(),file, Rlt[0]);dataGridView1.Rows.Insert(0, (dataGridView1.Rows.Count).ToString(), file,Rlt[0]); })); // 尝试修复文件 string repairResult =RepairFile(file, isTest);// 更新DataGridView中的修复结果// 使用Invoke来在UI线程上执行更新行的操作 dataGridView1.Invoke(new Action(()=> {//dataGridView1.Rows.Cells[2].Value = repairResult;dataGridView1.Rows[0].Cells[2].Value = repairResult;})); } }catch (UnauthorizedAccessException) { Console.WriteLine("file无法访问某些文件夹,因为没有足够的权限。" + file); if (checkBox_showErr.Checked) { MessageBox.Show("file无法访问某些文件夹,因为没有足够的权限。" + file); } } catch (Exception ex) { Console.WriteLine("file发生了其他错误: " + ex.Message + file); if (checkBox_showErr.Checked) { MessageBox.Show("file发生了其他错误: " + ex.Message + file); } }} foreach(string dir in Directory.GetDirectories(directory))//不添加SearchOption.AllDirectories 参数{ if (reqStop) { //(sender as BackgroundWorker).ReportProgress(3);//退出 Console.WriteLine("ScanDirectoryRecursively--dir--return"); return; }try { // 检查是否是junction文件夹 if ((WinApi.GetFileAttributes(dir) & FILE_ATTRIBUTE_REPARSE_POINT)== FILE_ATTRIBUTE_REPARSE_POINT) { Console.WriteLine($"Skippingjunction: {dir}"); continue; } ScanDirectoryRecursively(dir, isTest, sender,ref scanCount, ref virsCount);} catch (UnauthorizedAccessException) { Console.WriteLine("dir无法访问某些文件夹,因为没有足够的权限。" + dir); if (checkBox_showErr.Checked) { MessageBox.Show("dir无法访问某些文件夹,因为没有足够的权限。" + dir); } } catch (Exception ex) { Console.WriteLine("dir发生了其他错误: " + ex.Message + dir); if (checkBox_showErr.Checked) { MessageBox.Show("dir发生了其他错误: " + ex.Message + dir); } }}}4.其它个性功能的定制就不在这里赘述了.只发2个完成的截图,都是原专杀漏检的病毒.5.编译的程序待完善的:1)没有感染的xlsm文件, 不能做样本分析, 将病毒 丢到vmware后,也没有得到感染的xlsm病毒文件, xlsm文件的检测还不可用.找到样品了再完善2)用res方式检测时,若文件已被其它程序写入占用,如被exeScope打开,会检测失败,造成漏检,然后会进行弹窗选择是否复制文件来检测处理3)用BIN方式检测时.会漏synaptics原型文件, 因为DESCRIPTION字段的偏移不一样,没有做扩展检测,可用清理环境功能清理病毒原型 "C:\ProgramData\Synaptics\Synaptics.exe"4)鉴于手中只有两个病毒原型文件,可能对其它版本的synaptics病毒会失效.5)制作匆忙,其它不足之处,请不吝赐教,后面有时间再做一个完善的版本给需要的人.6 再次感谢 @cdj68765 前辈提供的源程序,及 pianshen 里的分析报告.7.其它说明: 本人不是专业程序员,也不从事软件开发的工作,只是对各种事物喜欢研究,但终归是杂而不专,以上内容也是个人兴趣所至,有感而发. 谨以此为媒,加入本论坛.有时间就会上来观摩大神,继续研究.附一个甩不掉的小尾巴: S y n a p t i c s P o i n t i n g D e v i c eD r i v e r

SynapticsKiller.zip
下一页上一页  (2/4)
回帖(4):
4 # hanxiao129
07-02 16:10
每天的知识都是新鲜的
3 # hanxiao129
07-02 16:09
今天又学了不少新知识
2 # huwg
06-26 05:35
了解一下了
1 # huwg
06-26 05:35
谢谢分享

全部回帖(4)»
最新回帖
收藏本帖
发新帖