Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save usernam121/af2983132c827c43593f8e00a30caad3 to your computer and use it in GitHub Desktop.
Save usernam121/af2983132c827c43593f8e00a30caad3 to your computer and use it in GitHub Desktop.
import React, { useState } from "react";
import DOMPurify from 'dompurify';
function Xss(){
const [text, setText] = useState("");
const [script, setScript] =useState("");
const [imgg, setimgg] = useState("");
const [userInput, setInput] = useState("");
const [pure, setPure] = useState("");
return(
<div className="xss">
<h1 className="" dangerouslySetInnerHTML={{__html: text}}/>Type your Script <br></br>
<input value={text} onChange={e => setText(e.target.value.replace("", ""))} />
<h1 dangerouslySetInnerHTML={{__html: imgg}}/>Type your Script img has been blacklisted <br></br>
<input value={imgg} onChange={e => setimgg(e.target.value.replace("img", ""))} />
<h1 dangerouslySetInnerHTML={{__html: script}}/>Use a button to cauase XSS <br></br>
<input value={script} onChange={e => setScript(e.target.value.replace("script", ""))} />
<h1 dangerouslySetInnerHTML={{ __html: pure }} />Banned Charactors<br></br>
<input value={pure} onChange={e => setPure(e.target.value.replace(/[#_/]/g, ""))} />
<h1 dangerouslySetInnerHTML={{ __html: DOMPurify.sanitize(userInput) }} />Sanatized with DOMPurify default settings<br></br>
<input value={userInput} onChange={e => setInput(e.target.value.replace())} />
</div>
)}
export default Xss
@TofuWand
Copy link

TofuWand commented Jun 16, 2023

First πŸ₯‡πŸ† to comment. Hehe. Thank you so much, fellow hacker! ^_^ I saw your fresh YouTube video, and you mentioned this resource in the description. πŸ€“πŸ€πŸ€πŸ₯³πŸ”₯πŸ”₯πŸ˜ŒπŸ˜…πŸ˜»βœŠπŸ₯‡πŸ†πŸ‘ŒπŸ™ŠπŸ’―πŸ”₯πŸ‘»πŸ₯ΈπŸ₯°πŸ’ͺ🏻πŸ’ͺ🏻

I also wanted to say that there are at least three typos that you may made:

cause*

Use a button to cauase XSS

Characters*

Banned Charactors

Sanitized*

Sanatized with DOMPurify default settings

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment