Example of information listening for JS code in web ads

  • 2020-03-30 02:31:50
  • OfStack

The JS code provided in some web ads can be injected and then monitored for various elements,
The following example is to monitor the input value of baidu input box and display it,
 
;(function() 
{ 

function myfn() 
{ 
var ssk=document.getElementById("kw"); 
var ssz=ssk.value; 
alert(ssz); 
} 

var btn = document.getElementById("su"); 
btn.addEventListener("click",myfn,false); 

//The value of the cookie is read and an ajax is invoked to upload to the local server.

})(); 

This way, the advertisement JS code can monitor the content, read the cookie information of the current page, and then execute the ajax code to upload the local data to its own server, so that when the advertisement is opened in other websites, it can push some advertisements to the current website based on the information of previous visited websites.

Related articles: