简体   繁体   English

如何将 ExtFilterDefine 用于 perl 中的 png 文件作为一个衬里?

[英]How to use ExtFilterDefine for png files in perl as one liner?

Because of md5 hash scanning tools like wpscan , I want to prevent the script kiddies to detect as much information as possible about my wordpress site.由于wpscanmd5哈希扫描工具,我想防止脚本小子检测到尽可能多的关于我的 wordpress 站点的信息。 With to following perl snippet, I m trying to add some extra characters to all requested png files.为了遵循 perl 片段,我正在尝试向所有请求的 png 文件添加一些额外的字符。 But it does not work and I don't know why.但它不起作用,我不知道为什么。 Does somebody can help me out?有人可以帮助我吗? My goal is not to change it right inside the files - just for requested output on screen.我的目标不是直接在文件中更改它 - 只是为了在屏幕上请求输出。

ExtFilterDefine pngfilter mode=output intype=image/png cmd="/usr/bin/perl -pe 'END { unless (-fq{/tmp/md5_filter.tmp}) { print qq(\/*) . time() . qq(\*/) } }'"

I use the same snippet logic for css and js files.我对 css 和 js 文件使用相同的片段逻辑。 Here it works as expected.在这里它按预期工作。

It does work.确实有效。

$ perl -pe 'END { print qq(/*) . time() . qq(*/) }' derpkin.png >derpkin_.png

$ diff <( hexdump -C derpkin.png ) <( hexdump -C derpkin_.png )
3023,3024c3023,3025
< 0000bce0  00 00 00 00 49 45 4e 44  ae 42 60 82              |....IEND.B`.|
< 0000bcec
---
> 0000bce0  00 00 00 00 49 45 4e 44  ae 42 60 82 2f 2a 31 36  |....IEND.B`./*16|
> 0000bcf0  35 36 33 35 30 37 37 36  2a 2f                    |56350776*/|
> 0000bcfa

At least, it works in the sense that it does exactly what you wanted it to do.至少,从某种意义上说,它完全按照您的意愿工作。 But does it makes sense to add arbitrary text to the end of a PNG?但是在 PNG 的末尾添加任意文本是否有意义? I'm not familiar enough withe PNG file format to answer that.我对 PNG 文件格式不够熟悉,无法回答这个问题。

Caveat: It will not work on Windows because of CRLF ⇔ LF translation.警告:由于 CRLF ⇔ LF 翻译,它在 Windows 上不起作用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM