| | |
| | | return tmp.toString(); |
| | | } |
| | | |
| | | public static void main(String[] args) |
| | | { |
| | | String html = "<script>alert(1);</script>"; |
| | | String escape = EscapeUtil.escape(html); |
| | | // String html = "<scr<script>ipt>alert(\"XSS\")</scr<script>ipt>"; |
| | | // String html = "<123"; |
| | | // String html = "123>"; |
| | | System.out.println("clean: " + EscapeUtil.clean(html)); |
| | | System.out.println("escape: " + escape); |
| | | System.out.println("unescape: " + EscapeUtil.unescape(escape)); |
| | | } |
| | | // public static void main(String[] args) |
| | | // { |
| | | // String html = "<script>alert(1);</script>"; |
| | | // String escape = EscapeUtil.escape(html); |
| | | // // String html = "<scr<script>ipt>alert(\"XSS\")</scr<script>ipt>"; |
| | | // // String html = "<123"; |
| | | // // String html = "123>"; |
| | | // System.out.println("clean: " + EscapeUtil.clean(html)); |
| | | // System.out.println("escape: " + escape); |
| | | // System.out.println("unescape: " + EscapeUtil.unescape(escape)); |
| | | // } |
| | | } |