欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  后端开发

php 恶意代码过滤函数_PHP教程

程序员文章站 2022-04-30 13:43:05
...

php 恶意代码过滤函数

Public Function DecodeFilter(html, filter)
html=LCase(html)
filter=split(filter,",")
For Each i In filter
Select Case i
Case "SCRIPT" ' 去除所有客户端脚本javascipt,vbscript,jscript,js,vbs,event,...
html = exeRE("(javascript|jscript|vbscript|vbs):", "#", html)
html = exeRE("?script[^>]*>", "", html)
html = exeRE("on(mouse|exit|error|click|key)", "", html)
Case "TABLE": ' 去除表格

'html = Replace(html," DecodeFilter = html
End Function

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/629754.htmlTechArticlephp 恶意代码过滤函数 Public Function DecodeFilter(html, filter) html=LCase(html) filter=split(filter,,) For Each i In filter Select Case i Case SCRIPT ' 去除所有客户端...
php 恶意代码过滤函数_PHP教程

声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn核实处理。

相关文章

相关视频


网友评论

文明上网理性发言,请遵守 新闻评论服务协议

我要评论
  • php 恶意代码过滤函数_PHP教程
  • 专题推荐

    作者信息
    php 恶意代码过滤函数_PHP教程

    认证0级讲师

    推荐视频教程
  • php 恶意代码过滤函数_PHP教程javascript初级视频教程
  • php 恶意代码过滤函数_PHP教程jquery 基础视频教程
  • 视频教程分类

    html = exeRE("?table[^>]*>", "", html)
    html = exeRE("?tr[^>]*>", "", html)
    html = exeRE("?th[^>]*>", "", html)
    html = exeRE("?td[^>]*>", "", html)
    html = exeRE("?tbody[^>]*>", "", html)
    Case "CLASS" ' 去除样式类class=""
    html = exeRE("(]+) class=[^ |^>]*([^>]*>)", "$1 $2", html)
    Case "STYLE" ' 去除样式style=""
    html = exeRE("(]+) style=""[^""]*""([^>]*>)", "$1 $2", html)
    html = exeRE("(]+) style='[^']*'([^>]*>)", "$1 $2", html)
    Case "IMG" ' 去除样式style=""
    html = exeRE("?img[^>]*>", "", html)
    Case "XML" ' 去除XML
    html = exeRE("]*>", "", html)
    Case "NAMESPACE" ' 去除命名空间>php 恶意代码过滤函数_PHP教程>
    html = exeRE("]*>", "", html)
    Case "FONT" ' 去除字体
    html = exeRE("?font[^>]*>", "", html)
    html = exeRE("?a[^>]*>", "", html)
    html = exeRE("?span[^>]*>", "", html)
    html = exeRE("?br[^>]*>", "", html)
    Case "MARQUEE" ' 去除字幕
    html = exeRE("?marquee[^>]*>", "", html)
    Case "OBJECT" ' 去除对象
    html = exeRE("?object[^>]*>", "", html)
    html = exeRE("?param[^>]*>", "", html)
    'html = exeRE("?embed[^>]*>", "", html)
    Case "EMBED"
    html = exeRE("?embed[^>]*>", "", html)
    Case "DIV" ' 去除对象
    html = exeRE("?div([^>])*>", "$1", html)
    html = exeRE("?p([^>])*>", "$1", html)
    Case "ONLOAD" ' 去除样式style=""
    html = exeRE("(]+) onload=""[^""]*""([^>]*>)", "$1 $2", html)
    html = exeRE("(]+) onload='[^']*'([^>]*>)", "$1 $2", html)
    Case "ONCLICK" ' 去除样式style=""
    html = exeRE("(]+) onclick=""[^""]*""([^>]*>)", "$1 $2", html)
    html = exeRE("(]+) onclick='[^']*'([^>]*>)", "$1 $2", html)
    Case "ONDBCLICK" ' 去除样式style=""
    html = exeRE("(]+) ondbclick=""[^""]*""([^>]*>)", "$1 $2", html)
    html = exeRE("(]+) ondbclick='[^']*'([^>]*>)", "$1 $2", html)

    End Select
    Next
    'html = Replace(html,"
    'html = Replace(html,"