-
Notifications
You must be signed in to change notification settings - Fork 8
/
webmail.js
158 lines (143 loc) · 3.1 KB
/
webmail.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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
var body = document.body;
var textContent = body.textContent;
var n = textContent.search("--\n");
var myString = textContent.substring(n+3, n+110);
var sad = myString.replace("\n"," ").replace("\r"," ").replace(","," ").replace(/(\r\n|\n|\r)/gm," ");
var splits = sad.replace(',',' ').split(' ', 100);
var temp = 0;
var size = splits.length;
for (var i = 0; i < size; i++)
{
if(temp==2 && (splits[i]=="" || splits[i]==" "))
{
splits = splits.slice(0,i-1);
size = i-1;
break;
}
if(splits[i]=="" || splits[i]==" ")
{
temp++;
continue;
}
else
temp=0;
}
document.getElementsByTagName("td")[6].className = "input";
String.prototype.replaceAt=function(index, char)
{
var a = this.split("");
a[index] = char;
return a.join("");
}
var nameValue = " ";
var num = 100;
var id=0;
var not = false;
var k=0;
var str = " ";
var re = /("."|-.-|:.:|'.'|\/.\/|_._)/;
var qu = /(.*\?)/;
var count = 0;
for (var i = 0; i < size; i++)
{
if(splits[i]=="not")
not = true;
else if(splits[i]=="chars" && splits[i+2]!="small")
{
num=parseInt(splits[i-1],10);
num = splits[i+2].charCodeAt()-num;
if(!not)
{
nameValue=nameValue.replaceAt(id,String.fromCharCode(num));
id++;
}
else
not = false;
i = i+2;
}
else if(splits[i]=="chars" && splits[i+2]=="small")
{
num=parseInt(splits[i-1],10);
num = splits[i+3].charCodeAt()-num;
if(!not)
{
nameValue=nameValue.replaceAt(id,String.fromCharCode(num));
id++;
}
else
not = false;
i = i+3;
}
else if(re.test(splits[i]) && splits[i+1].charAt(0)=='+')
{
num = parseInt(splits[i+1].slice(-1));
num = num + splits[i].charCodeAt(1);
if(!not)
{
nameValue=nameValue.replaceAt(id,String.fromCharCode(num));
id++;
}
else
not = false;
}
else if(re.test(splits[i]))
{
if(!not)
{
nameValue=nameValue.replaceAt(id,splits[i].charAt(1));
id++;
}
else
not = false;
}
else if(qu.test(splits[i]))
{
k=i;
}
else if(splits[i]=="=")
{
count = 0;
num = parseFloat(splits[i+1]);
while(i>k+1)
{
if(splits[i-2]=="-")
num = num + parseInt(splits[i-1]);
if(splits[i-2]=="/")
num = num * parseInt(splits[i-1]);
if(splits[i-2]=="*")
num = num / parseInt(splits[i-1]);
if(splits[i-2]=="+")
num = num - parseInt(splits[i-1]);
i=i-2;
count=count+2;
}
nameValue=nameValue.replaceAt(id,num.toString());
id++;
i = i + count;
}
}
var userid = "";
chrome.storage.sync.get('username',function (data) {
userid=data.username;
});
var pass = "";
chrome.storage.sync.get('password',function (data) {
pass=data.password;
});
var auto = false;
chrome.storage.sync.get('auto',function (data) {
auto=data.auto;
});
var delayMillis = 10;
var button = document.getElementById("rcmloginsubmit");
var m = textContent.search("Login failed");
setTimeout(function()
{
document.getElementsByName("_user")[0].value = userid;
document.getElementsByName("_pass")[0].value = pass;
document.getElementsByName("captcha_input")[0].value = nameValue;
if(auto & m==-1)
button.click();
if(m!=-1)
alert("Please check your username and password in the extension settings");
}, delayMillis);