Eridtamper

Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 2

// ==UserScript==

// @name ERID (Expose Rockstar ID)


// @namespace http://tampermonkey.net/
// @version 0.2
// @description Autograb Social Club User Information
// @author Segfault
// @match https://socialclub.rockstargames.com/*

// ==/UserScript==
var script = document.createElement("script");
script.innerHTML += "(" + function() {
var lastName = null;
var erid = function() {};
erid.request = function(name, auto) {
if (!name || name == null) {
var p = document.location.pathname.slice(1).split("/");
if (p.length > 1 && p[0] == "member") {
name = p[1];
} else {
if (!auto) {
console.log("Could not expose rid");
}
return;
}
}
if (lastName == name) {
return;
}
lastName = name;
function getCookie(e) {
for (var t = e + "=", r = decodeURIComponent(document.cookie).split(";"), o =
0; o < r.length; o++) {
for (var n = r[o]; " " == n.charAt(0);) {
n = n.substring(1);
}
if (0 == n.indexOf(t)) {
return n.substring(t.length, n.length);
}
}
return "";
}
var _token = getCookie("BearerToken");
var request = new XMLHttpRequest;
request.onload = function() {
if (request.status == 200) {
var data = null;
try {
data = JSON.parse(request.response);
} catch (e) {
}
if (data != null) {
console.log(data.accounts[0].rockstarAccount.name + ": " +
data.accounts[0].rockstarAccount.rockstarId);
console.groupCollapsed(data.accounts[0].rockstarAccount.name + " account
information");
console.log(data.accounts[0]);
console.groupEnd();
if (auto) {
setTimeout(function() {
var s = document.querySelector("#app-
page").children[0].children[0].children[1].children[0];
if (s != null) {
s.innerHTML += '<br/><span style="font-size:15px;font-
weight:normal;top:-10px;position:relative;">(<samp style="color:black;">' +
data.accounts[0].rockstarAccount.rockstarId + "</samp>)</span>";
}
}, 1500);
}
}
} else {
console.log("Error getting data, try refreshing");
return;
}
};
request.open("GET", "https://scapi.rockstargames.com/profile/getprofile?
nickname=" + name);
request.setRequestHeader("Authorization", "Bearer " + _token);
request.setRequestHeader("Content-Type", "application/json");
request.setRequestHeader("X-Cache-Ver", 1);
request.setRequestHeader("X-Lang", "en-US");
request.setRequestHeader("X-Requested-With", "XMLHttpRequest");
request.send();
};
window.erid = erid.request;
window.onload = function() {
return erid.request(null, true);
};
var pushState = history.pushState;
history.pushState = function() {
pushState.apply(history, arguments);
erid.request(null, true);
};
}.toString() + ")()";
document.body.appendChild(script);

You might also like