评价我的脚本:查找 Office 文件中嵌入的 Flash 文件

发布于 2024-09-05 16:57:51 字数 1689 浏览 4 评论 0原文

有人可以对此进行改进吗?需要 Sysinternals 字符串

date /T >N:\output.txt
net use z: /delete
net use z: \\svr-002\rmstudentwork
@cd /d "z:\"
"N:\Scripts and Reg Frags\FindEmbededFlashFiles\strings.exe" -s *.xls | findstr \.swf >> "N:\output.txt"
"N:\Scripts and Reg Frags\FindEmbededFlashFiles\strings.exe" -s *.ppt | findstr \.swf >> "N:\output.txt"
"N:\Scripts and Reg Frags\FindEmbededFlashFiles\strings.exe" -s *.doc | findstr \.swf >> "N:\output.txt"
"N:\Scripts and Reg Frags\FindEmbededFlashFiles\strings.exe" -s *.xlsx | findstr \.swf >> "N:\output.txt"
"N:\Scripts and Reg Frags\FindEmbededFlashFiles\strings.exe" -s *.pptx | findstr \.swf >> "N:\output.txt"
"N:\Scripts and Reg Frags\FindEmbededFlashFiles\strings.exe" -s *.docx | findstr \.swf >> "N:\output.txt"

date /T >>N:\output.txt
net use z: /delete /yes >>N:\output.txt
net use z: \\svr-003\rmstudentwork
"N:\Scripts and Reg Frags\FindEmbededFlashFiles\strings.exe" -s *.xls | findstr \.swf >> "N:\output.txt"
"N:\Scripts and Reg Frags\FindEmbededFlashFiles\strings.exe" -s *.ppt | findstr \.swf >> "N:\output.txt"
"N:\Scripts and Reg Frags\FindEmbededFlashFiles\strings.exe" -s *.doc | findstr \.swf >> "N:\output.txt"
"N:\Scripts and Reg Frags\FindEmbededFlashFiles\strings.exe" -s *.xlsx | findstr \.swf >> "N:\output.txt"
"N:\Scripts and Reg Frags\FindEmbededFlashFiles\strings.exe" -s *.pptx | findstr \.swf >> "N:\output.txt"
"N:\Scripts and Reg Frags\FindEmbededFlashFiles\strings.exe" -s *.docx | findstr \.swf >> "N:\output.txt"
net use z: /delete /yes

基本上,它会将共享安装为网络驱动器,然后在共享中运行以查找 Office 文档中的 swf 文件。

Can anyone improve on this? Requires Sysinternals Strings

date /T >N:\output.txt
net use z: /delete
net use z: \\svr-002\rmstudentwork
@cd /d "z:\"
"N:\Scripts and Reg Frags\FindEmbededFlashFiles\strings.exe" -s *.xls | findstr \.swf >> "N:\output.txt"
"N:\Scripts and Reg Frags\FindEmbededFlashFiles\strings.exe" -s *.ppt | findstr \.swf >> "N:\output.txt"
"N:\Scripts and Reg Frags\FindEmbededFlashFiles\strings.exe" -s *.doc | findstr \.swf >> "N:\output.txt"
"N:\Scripts and Reg Frags\FindEmbededFlashFiles\strings.exe" -s *.xlsx | findstr \.swf >> "N:\output.txt"
"N:\Scripts and Reg Frags\FindEmbededFlashFiles\strings.exe" -s *.pptx | findstr \.swf >> "N:\output.txt"
"N:\Scripts and Reg Frags\FindEmbededFlashFiles\strings.exe" -s *.docx | findstr \.swf >> "N:\output.txt"

date /T >>N:\output.txt
net use z: /delete /yes >>N:\output.txt
net use z: \\svr-003\rmstudentwork
"N:\Scripts and Reg Frags\FindEmbededFlashFiles\strings.exe" -s *.xls | findstr \.swf >> "N:\output.txt"
"N:\Scripts and Reg Frags\FindEmbededFlashFiles\strings.exe" -s *.ppt | findstr \.swf >> "N:\output.txt"
"N:\Scripts and Reg Frags\FindEmbededFlashFiles\strings.exe" -s *.doc | findstr \.swf >> "N:\output.txt"
"N:\Scripts and Reg Frags\FindEmbededFlashFiles\strings.exe" -s *.xlsx | findstr \.swf >> "N:\output.txt"
"N:\Scripts and Reg Frags\FindEmbededFlashFiles\strings.exe" -s *.pptx | findstr \.swf >> "N:\output.txt"
"N:\Scripts and Reg Frags\FindEmbededFlashFiles\strings.exe" -s *.docx | findstr \.swf >> "N:\output.txt"
net use z: /delete /yes

Basically it mounts a share as a network drive then runs through the share looking for swf files inside office documents.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

满地尘埃落定 2024-09-12 16:57:51

我不是批处理文件专家,但我认为您可以:

免责声明:我'我是凭空写下这个的,所以建议的代码可能不起作用或者可能需要额外的微调。不管怎样,我希望这能给你带来启发。

I'm not a batch file expert, but I think you could:

  • Store repeated paths in variables:

    set STRINGS="N:\Scripts and Reg Frags\FindEmbededFlashFiles\strings.exe"
    set OUTFILE=N:\output.txt
    
  • Replace repeated commands with a FOR loop, e.g.:

    for /r z:\ %%f in (*.xls *.ppt *.doc *.xlsx *.pptx *.docx) do (
      %STRINGS% -q "%%f" | findstr \.swf >> %OUTFILE%
    )
    

    (Note that this loop also replaces @cd /d "z:\" and the -s parameter of strings.exe.)

Disclaimer: I'm writing this off the top of my head, so the suggested code may not work or may need additional fine-tuning. Anyway, I hope this will give you the idea.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文