I'm building a chrome extension that reads the console log and find where an ip appears, after the string "Connecting to", 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 have tried this code with Tampermonkey and works ok, but as chrome extension it doesn't work.The override for the console.log function works right so it might be something about permissions with the chrome extension. Is my first so I don't know much about. I get Uncaught TypeError: Cannot read property '0' of undefined If you need anything else just tell me
The reason is because Tampermonkey injects code into a site's document, whereas in Chrome Extension no, if you do this, you edit Chrome extension's console. To do this, you should use a method to inject the script, you can see here
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With