Chrome console extension.log
I am creating a chrome extension that reads the console log and finds where the ip appears after the "Connect to" line and gets the ip.
store = [];
var oldf = console.log;
console.log = function(){
store.push(arguments);
oldf.apply(console, arguments);
};
pos = 0
server = ""
setTimeout(function(){
for(i = 0; i < store.length; i++){
if(store[i][0].indexOf("Connecting to") != -1){
pos = i
}
}
var goal = store[pos][0].split(" ")[self.length-1];
server = goal
console.log(server);
}, 3000);
I tried this code with Tampermonkey and it works fine, but as a chrome extension it doesn't work. The override for the console.log function is working correctly, so it might be something about permissions with the chrome extension. I'm the first, so I don't know much. I am getting Uncaught TypeError: Can't read property '0' from undefined If you need something else just tell me
The reason is that it Tampermonkey
injects the code into the site document, whereas in Chrome Extension
not, if you do, you are editing the console of the Chrome extension. To do this, you must use a method to enter your script, you can see here