CSS的加密不是绝对的加密 教你超级混淆大法

首先我来解释一下CSS是什么?

CSS层叠样式表是用来设计网页的样式,它不仅可以静态修改网页,还可以使用各种脚本语言动态格式化网页的元素。

它可以有效地实现对页面布局,字体,颜色,背景和其他效果的更精确控制。

为什么说CSS的加密不是绝对的加密呢?

CSS是无法加密的,CSS本来就没有安全的文本文件,最后要被浏览器解析,怎么都是可以看到的,但有时候你不想把你的网页样式被别人抄袭盗用,为了保护样式表你只能通过混淆的方法扰乱盗窃者。一般加密javascript文件,用代码混淆、加密的方式再压缩,这样别人很难读懂你的代码。

被浏览器忽略的“\0”代码?

网上很多 \0 \00 \000的混淆方法,但不建议使用,为什么呢?因为它不被火狐浏览器(Firefox浏览器)忽略,而其他浏览器都忽略了。

\0代码混淆方法也就是其他浏览器都对“\0”进行了忽略,以下是例子

@charset "utf-8";
/*
Theme Name: linstyle
Version: 1.0
Author: perfume
*/
/*\0le\0u\0r\0y\0le@\0s\0.c\0s\0ss\0s\0s@@\0t u\0)r\0y\0le\0s u\0r\0y\0le\0s\0.c\0s\@0sy\0le\ u\0r\0y\0le\0s\0.c\0s\0s0s\0.c u\ u\0@r\0y\0l@e\0s\0.@c\0s\0s0r\0y\0le\0s\0.c\0s\0 t u\0r\0y@\0le\0u\0r\0y\0le@\0s\0.c\0s\0ss\0s\0s@@\0t u\0r\0y\0le\0s u\0r\0y\0le\0s\0.c\0s\@0sy\0le\ u\0r\0y\0le\0s\0.c\0s\0s0s\0.c u\ u\0*/@\00\0i\0\00m\0000\0p\0\0\0o\0r\0000t \000u\00r\0l\000("\0i\000ma\0\0\0\00ge\0\0s\0\0\0\0/\0\0l\0i\0\0\0\0\0\0n\0s\0\0t\0\0y\0\0le\0\0\0.c\0\0s\0s\0\0\0\0");\0\0m\0p\0o\0r\0t u\0r\0y\0le\0s\0.c\ u\0r\@0y\0le\0s\0.c(\0s\0s) u@\0r\0y\0le\0s\0.c\0s\0s u\0r(\0y\0le\0s\0.c\0@s\0s u\0r\0 u\0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s\@0sy\0le\ u\0r\0y\0\0\0\0le\0s\0.c\0s\0s0s\0.c u\ u\0@r\0y\0l@e\0s\0.@c\0s\0s\0\0\00r\0y\0le\0s\0.c\0s\0 t u\0r\0y@\0le\0u\0r\0y\0le@\0s\0.c\0s\0ss\0s\0s@@\0t u\0r\0y\0le\0s u\0r\0y\0le\0s\0.c\0s\@0sy\0le\ u\0r\0y\0le\0s\0.c\0s\0\0\0\0s0s\0.c u\ u\0@r\0y\0l@e\0s\0.@c\0s\0s0r\0y\0le\0s\0.c\0s\0 t u\0r\0y@\0le\0u\0\0\0r\0y\0l\0\0\0e@\0s\0.c\0s\0ss\0s\0s@@\0t u\0r\0y\0le\0s u\0r\0y\0le\0s\0.c\0s\@0sy\0le\ u\0r\0y\0le\0s\0.c\0s\0s0s\0.c u\ u\0@r\0y\\0\0\00l@e\0s\0.@c\0s\0s0r\0y\0le\0s\0.c\0s\0 t u\0r\0y@\0le\0u\0r\0y\0le@\0s\0.c\0s\0ss\0s\0s@
<style type="text/css">
<!--
html, body {scrollbar-face-color: #656cac;scrollbar-highlight-color: #a0a6d1;scrollbar-3dlight-color: #7b82c3;scrollbar-darkshadow-color: #3b4295;scrollbar-shadow-color: #7b82c3;scrollbar-arrow-color: #e8eaf9;scrollbar-track-color: #c2c5e6;}
-->
</style>

这个所谓的加密很简单,在CSS里“\0”、“\00”、“\000”是会被浏览器忽略的.

再举个短的例子:

\0s\0t\0y\0l\0e\0.\0c\0s\0s

去掉\0,\00什么的之后就是:“style.css”

Javascript加密输出CSS样式

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <title>阻止查看CSS文件</title> <script language="javascript" type="text/javascript"> document.write(unescape("%3Cstyle%20type%3D%22text/css%22%3E")); document.write(unescape("%3C%21--.tablecls%20%7B%20border%3A1px%20solid%20%23a2a2a2%3B%20background-color%3A%23f2f2f2%3B%20width%3A200px%3B%20height%3A300px%3B%20text-align%3Acenter%3B%20padding%3A2px%3B%20font-size%3A14px%3B%20line-height%3A23px%3B%7D--%3E")); document.write(unescape("%3C/style%3E")); </script> </head> <body> <table width="100%" border="0" cellspacing="0" cellpadding="0" class="tablecls"> <tr> <td>虽然不能100%防下载或查看,但是对于菜鸟估计费一番周折了</td> </tr> </table> </body> </html>

这种方式的加密,其实在浏览器也已经被解析出来了,根本就不再需要访问真实的CSS地址,难道用对象存储+CDN防盗链加密不香吗?

© 版权声明
THE END
喜欢就支持以下吧
点赞9
分享
评论 共4条

请登录后发表评论

    • iq4w
    • 小鹿0

      支持大佬

      2020-09-07 18:30
    • iq4w
    • jjda0

      支持大佬

      2020-09-08 12:36