<?php
/**
* Experimental HTML5-based parser using Jeroen van der Meer's PH5P library.
* Occupies space in the HTML5 pseudo-namespace, which may cause conflicts.
*
* @note
* Recent changes to PHP's DOM extension have resulted in some fatal
* error conditions with the original version of PH5P. Pending changes,
* this lexer will punt to DirectLex if DOM throughs an exception.
*/
class HTMLPurifier_Lexer_PH5P extends HTMLPurifier_Lexer_DOMLex {
public function tokenizeHTML($html, $config, $context) {
$new_html = $this->normalize($html, $config, $context);
$new_html = $this->wrapHTML($new_html, $config, $context);
try {
$parser = new HTML5($new_html);
$doc = $parser->save();
} catch (DOMException $e) {
// Uh oh, it failed. Punt to DirectLex.
$lexer = new HTMLPurifier_Lexer_DirectLex();
$context->register('PH5PError', $e); // save the error, so we can detect it
return $lexer->tokenizeHTML($html, $config, $context); // use original HTML
}
$tokens = array();
$this->tokenizeDOM(
$doc->getElementsByTagName('html')->item(0)-> // <html>
getElementsByTagName('body')->item(0)-> // <body>
getElementsByTagName('div')->item(0) // <div>
, $tokens);
return $tokens;
}
}
/*
Copyright 2007 Jeroen van der Meer <http://jero.net/>
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
class HTML5 {
private $data;
private $char;
private $EOF;
private $state;
private $tree;
private $token;
private $content_model;
private $escape = false;
private $entities = array('AElig;','AElig','AMP;','AMP','Aacute;','Aacute',
'Acirc;','Acirc','Agrave;','Agrave','Alpha;','Aring;','Aring','Atilde;',
'Atilde','Auml;','Auml','Beta;','COPY;','COPY','Ccedil;','Ccedil','Chi;',
'Dagger;','Delta;','ETH;','ETH','Eacute;','Eacute','Ecirc;','Ecirc','Egrave;',
'Egrave','Epsilon;','Eta;','Euml;','Euml','GT;','GT','Gamma;','Iacute;',
'Iacute','Icirc;','Icirc','Igrave;','Igrave','Iota;','Iuml;','Iuml','Kappa;',
'LT;','LT','Lambda;','Mu;','Ntilde;','Ntilde','Nu;','OElig;','Oacute;',
'Oacute','Ocirc;','Ocirc','Ograve;','Ograve','Omega;','Omicron;','Oslash;',
'Oslash','Otilde;','Otilde','Ouml;','Ouml','Phi;','Pi;','Prime;','Psi;',
'QUOT;','QUOT','REG;','REG','Rho;','Scaron;','Sigma;','THORN;','THORN',
'TRADE;','Tau;','Theta;','Uacute;','Uacute','Ucirc;','Ucirc','Ugrave;',
'Ugrave','Upsilon;','Uuml;','Uuml','Xi;','Yacute;','Yacute','Yuml;','Zeta;',
'aacute;','aacute','acirc;','acirc','acute;','acute','aelig;','aelig',
'agrave;','agrave','alefsym;','alpha;','amp;','amp','and;','ang;','apos;',
'aring;','aring','asymp;','atilde;','atilde','auml;','auml','bdquo;','beta;',
'brvbar;','brvbar','bull;','cap;','ccedil;','ccedil','cedil;','cedil',
'cent;','cent','chi;','circ;','clubs;','cong;','copy;','copy','crarr;',
'cup;','curren;','curren','dArr;','dagger;','darr;','deg;','deg','delta;',
'diams;','divide;','divide','eacute;','eacute','ecirc;','ecirc','egrave;',
'egrave','empty;','emsp;','ensp;','epsilon;','equiv;','eta;','eth;','eth',
'euml;','euml','euro;','exist;','fnof;','forall;','frac12;','frac12',
'frac14;','frac14','frac34;','frac34','frasl;','gamma;','ge;','gt;','gt',
'hArr;','harr;','hearts;','hellip;','iacute;','iacute','icirc;','icirc',
'iexcl;','iexcl','igrave;','igrave','image;','infin;','int;','iota;',
'iquest;','iquest','isin;','iuml;','iuml','kappa;','lArr;','lambda;','lang;',
'laquo;','laquo','larr;','lceil;','ldquo;','le;','lfloor;','lowast;','loz;',
'lrm;','lsaquo;','lsquo;','lt;','lt','macr;','macr','mdash;','micro;','micro',
'middot;','middot','minus;','mu;','nabla;','nbsp;','nbsp','ndash;','ne;',
'ni;','not;','not','notin;','nsub;','ntilde;','ntilde','nu;','oacute;',
'oacute','ocirc;','ocirc','oelig;','ograve;','ograve','oline;','omega;',
'omicron;','oplus;','or;','ordf;','ordf','ordm;','ordm','oslash;','oslash',
'otilde;','otilde','otimes;','ouml;','ouml','para;','para','part;','permil;',
'perp;','phi;','pi;','piv;','plusmn;','plusmn','pound;','pound','prime;',
'prod;','prop;','psi;','quot;','quot','rArr;','radic;','rang;','raquo;',
'raquo','rarr;','rceil;','rdquo;','real;','reg;','reg','rfloor;','rho;',
'rlm;','rsaquo;','rsquo;','sbquo;','scaron;','sdot;','sect;','sect','shy;',
'shy','sigma;','sigmaf;','sim;','spades;','sub;','sube;','sum;','sup1;',
'sup1','sup2;','sup2','sup3;','sup3','sup;','supe;','szlig;','szlig','tau;',
'there4;','theta;','thetasym;','thinsp;','thorn;','thorn','tilde;','times;',
'times','trade;','uArr;','uacute;','uacute','uarr;','ucirc;','ucirc',
'ugrave;','ugrave','uml;','uml','upsih;','upsilon;','uuml;','uuml','weierp;',
'xi;','yacute;','yacute','yen;','yen','yuml;','yuml','zeta;','zwj;','zwnj;');
const PCDATA = 0;
const RCDATA = 1;
const CDATA = 2;
const PLAINTEXT = 3;
const DOCTYPE = 0;
const STARTTAG = 1;
const ENDTAG = 2;
const COMMENT = 3;
const CHARACTR = 4;
const EOF = 5;
public function __construct($data) {
$data = str_replace("\r\n", "\n", $data);
$data = str_replace("\r", null, $data);
$this->data = $data;
$this->char = -1;
$this->EOF = strlen($data);
$this->tree = new HTML5TreeConstructer;
$this->content_model = self::PCDATA;
$this->state = 'data';
while($this->state !== null) {
$this->{$this->state.'State'}();
}
}
public function save() {
return $this->tree->save();
}
private function char() {
return ($this->char < $this->EOF)
? $this->data[$this->char]
: false;
}
private function character($s, $l = 0) {
if($s + $l < $this->EOF) {
if($l === 0) {
return $this->data[$s];
} else {
return substr($this->data, $s, $l);
}
}
}
private function characters($char_class, $start) {
return preg_replace('#^(['.$char_class.']+).*#s', '\\1', substr($this->data, $start));
}
private function dataState() {
// Consume the next input character
$this->char++;
$char = $this->char();
if($char === '&' && ($this->content_model === self::PCDATA || $this->content_model === self::RCDATA)) {
/* U+0026 AMPERSAND (&)
When the content model flag is set to one of the PCDATA or RCDATA
states: switch to the entity data state. Otherwise: treat it as per
the "anything else" entry below. */
$this->state = 'entityData';
} elseif($char === '-') {
/* If the content model flag is set to either the RCDATA state or
the CDATA state, a
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
(网络安全大百科配套靶场)开源网络安全靶场(经典型),主要包括各类常见漏洞,如sql注入、xss、命令执行、文件上传等。靶场发布时使用虚机进行发布,基础操作系统采用windows server 2008r2。 为什么用windows,因为linux有人不用会啊,视窗操作系统还是能够更好的让新手进行学习。使用php作为基础语言,java作为辅助语言。 对于绝大多数漏洞,使用php足以进行描述,同时可以借鉴各个地方的靶场源代码,做一个代码的搬运工。 在一些漏洞,如反序列化等需要使用java作为开发语言的,利用sprintboot技术进行微服务快速开发。数据库使用mysql,简单易用,同时可使用多个经典bug。
资源推荐
资源详情
资源评论
收起资源包目录
(网络安全大百科配套靶场)开源网络安全靶场(经典型),主要包括各类常见漏洞,如sql注入、xss、命令执行、文件上传等 (702个子文件)
layui.css 59KB
layer.css 14KB
github-markdown.css 14KB
xadmin.css 11KB
layui.mobile.css 10KB
mardown-css-jwsky.css 8KB
style.css 7KB
laydate.css 7KB
container.css 7KB
stylesheet.css 5KB
purebasic.css 2KB
grayscale.css 2KB
vs2015.css 1KB
gruvbox-light.css 1KB
gruvbox-dark.css 1KB
font.css 1KB
hybrid.css 1KB
atelier-estuary-light.css 1KB
atelier-savanna-light.css 1KB
atelier-plateau-light.css 1KB
atelier-estuary-dark.css 1KB
atelier-savanna-dark.css 1KB
atelier-plateau-dark.css 1KB
atelier-cave-light.css 1KB
agate.css 1KB
atelier-cave-dark.css 1KB
atom-one-light.css 1KB
atom-one-dark.css 1KB
railscasts.css 1KB
routeros.css 1KB
sunburst.css 1KB
idea.css 1KB
github.css 1KB
docco.css 1KB
default.css 1KB
tomorrow-night-blue.css 1KB
tomorrow-night.css 1KB
atelier-sulphurpool-light.css 1KB
atelier-sulphurpool-dark.css 1KB
solarized-dark.css 1KB
solarized-light.css 1KB
pojoaque.css 1KB
atelier-lakeside-light.css 1KB
atelier-lakeside-dark.css 1KB
atelier-seaside-light.css 1KB
atelier-seaside-dark.css 1KB
atelier-forest-light.css 1KB
atelier-forest-dark.css 1KB
foundation.css 1KB
atelier-heath-light.css 1KB
atelier-heath-dark.css 1KB
atelier-dune-light.css 1KB
atelier-dune-dark.css 1KB
tomorrow-night-eighties.css 1KB
xcode.css 1KB
obsidian.css 1KB
tomorrow-night-bright.css 1KB
kimbie.light.css 1KB
xt256.css 1KB
kimbie.dark.css 1KB
arduino-light.css 1KB
googlecode.css 1KB
hopscotch.css 1KB
code.css 1KB
monokai-sublime.css 1KB
paraiso-light.css 1KB
paraiso-dark.css 1KB
dracula.css 1KB
school-book.css 1KB
ocean.css 1KB
rainbow.css 1017B
tomorrow.css 1006B
qtcreator_light.css 1005B
qtcreator_dark.css 1004B
zenburn.css 980B
monokai.css 964B
github-gist.css 953B
darcula.css 939B
magula.css 917B
color-brewer.css 906B
ir-black.css 904B
arta.css 880B
far.css 873B
brown-paper.css 867B
vs.css 864B
codepen-embed.css 864B
dark.css 814B
androidstudio.css 804B
mono-blue.css 769B
ascetic.css 609B
banner.css 393B
ConfigForm.css 275B
darkula.css 153B
courier_bolditalic-webfont.eot 51KB
iconfont.eot 48KB
amarillousaf-webfont.eot 43KB
iconfont.eot 40KB
59.gif 10KB
22.gif 10KB
24.gif 8KB
共 702 条
- 1
- 2
- 3
- 4
- 5
- 6
- 8
资源评论
Java程序员-张凯
- 粉丝: 1w+
- 资源: 7361
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功