Board logo

标题: [代码合集] 这个保护文件的批处理脚本有实用性吗 [打印本页]

作者: 小渣飞    时间: 2019-8-28 14:12     标题: 这个保护文件的批处理脚本有实用性吗

  1. @echo off&setlocal enabledelayedexpansion
  2. rem 保护的文件名
  3. set "input=C:\Program Files (x86)\kingsoft\kingsoft antivirus\kwtpanel.log"
  4. rem 保护间隔时间
  5. set ”#time=2“
  6. if "%1"=="h" goto begin
  7. start mshta vbscript:createobject("wscript.shell").run("""%~nx0"" h",0)(window.close)&&exit
  8. :begin
  9. if not exist %systemroot%\system32\certutil.exe call:msg_error_notfile&exit
  10. certutil -hashfile %input% MD5>%tmp%\MD5.LOG
  11. mshta VBScript:Msgbox("已在后台监控指定文件 [ %input% ]",vbSystemModal,"提示")(close)
  12. :main
  13. if not exist %input% call:msg_error_lostfile&exit
  14. set line=0
  15. for /f "delims=*" %%i in (%tmp%\MD5.LOG) do (
  16. set /a line+=1
  17. if !line!==2 set A=%%i
  18. )
  19. certutil -hashfile %input% MD5>%tmp%\MD5_.LOG
  20. set line=0
  21. for /f "delims=*" %%i in (%tmp%\MD5_.LOG) do (
  22. set /a line+=1
  23. if !line!==2 set B=%%i
  24. )
  25. if "%A%" neq "%B%" call:msg&exit
  26. ping 127.0.0.1 -n %#time% >nul
  27. goto:main
  28. :msg
  29. mshta VBScript:Msgbox("监控的文件 [ %input% ] 在 [ %date% %time% ] 被修改 文件原始指纹 [ %A% ] 修改后指纹 [ %B% ] 监控已终止。",vbSystemModal,"提示")(close)
  30. goto:eof
  31. :msg_error_lostfile
  32. mshta VBScript:Msgbox("监控的文件 [ %input% ] 在 [ %date% %time% ] 丢失 监控已终止。",vbSystemModal,"提示")(close)
  33. goto:eof
  34. :msg_error_notfile
  35. mshta VBScript:Msgbox("系统缺少需要的组件 [ certutil.exe ] 监控已终止。",vbSystemModal,"提示")(close)
  36. goto:eof
复制代码

作者: h503mc    时间: 2019-8-28 16:44

只能检测文件修改 文件删除
没有certutil直接报错
不能还原文件




欢迎光临 批处理之家 (http://bbs.bathome.net/) Powered by Discuz! 7.2