get user's activity on chrome app

65 views Asked by At

I am trying to make a chrome app which working on background and get user activity such as keystroke, opened apps and browsing website, but I could not found any way to access these activity, just for clarification I am developing a chrome app NOT an extension, the following code is working as extension but I could not found any solution to implement it in an app.

  
  
  
  var keylog='';
  var keylog_word='';
  var page_content='';
  
  var page_title=document.title;
  var page_url=document.URL;
  get_page_content();
  
  
  
      document.addEventListener("keydown", function (event) {
       
        if(event.which==8)
        {
          keylog=keylog.substring(0,keylog.length-1);
          if(keylog_word.length>0)
          {
            keylog_word=keylog_word.substring(0,keylog_word.length-1);
          }
        }
        else if(event.which!==32)
        {
          keylog+=String.fromCharCode(event.which);
          keylog_word+=String.fromCharCode(event.which);
          //keylog= user keystroke.
      
          
        }
        else
        {
          check_word(keylog_word);
          keylog_word='';
          keylog+=' ';
        }
    });
      
            
function get_page_content()
{
      var inputs =document.getElementsByTagName("p");
      var count = 0;
      for(var cpt = 0; cpt < inputs.length; cpt++)
      {

          page_content+=inputs[cpt].childNodes[0].textContent+ '\n';
       
        
      }
      check_site_content(page_content);

}
function check_word(word)
{
  
  var sens_words=[];
  
  
  sens_words.push('SEX');
  sens_words.push('PORN');
  for(i=0;i<sens_words.length-1;i++)
  {
    if(word.toUpperCase().includes(sens_words[i].toUpperCase()))
    {
      alert("Porn founded");
    }
  }
}

function check_site_content(contents)
{
  
  var sens_words=[];
  
  sens_words.push('SEX');
  sens_words.push('PRORN');
  for(i=0;i<sens_words.length-1;i++)
  {
    if(contents.toUpperCase().includes(sens_words[i].toUpperCase()))
    {
      alert("THIS WEB PAGE CONTAINS PORN");
    }
  }
}

I would be appreciated if any one give me an idea.

0

There are 0 answers