IWBH_01

Find All Network-Hot JavaScript Objects

Apr 29th, 2021 (edited)
797
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //Find All Network-Hot JavaScript Objects
  2.  
  3.  
  4. var getOAPN=function getAllPropertyNames(obj){
  5.  var la=0, lim=700, cu=obj, ALL=[];
  6.  while(lim--&&cu&&(la!=cu)){ try{ ALL=ALL.concat(Object.getOwnPropertyNames(cu)); la=cu; if(typeof cu=='function') cu=cu.prototype; else cu=Object.getPrototypeOf(cu).prototype; }catch(e){ console.log("property name error, lim= "+lim,e); } }
  7.  return ALL;
  8. };
  9.  
  10.  
  11. var ALL_defo=getOAPN(self);
  12.  
  13.  
  14. var NET_HOT=[], ee=[],
  15. //using the uri keyword causes problems
  16. net_hot_keywords=[/*"uri",*/"location","domain","origin","href","url","src"],
  17. net_ht_kwL=net_hot_keywords.length,
  18. str, nj=0, //set net j to 0
  19. ki, aw, c0, cn, //cn means current name
  20. ni=ALL_defo.length; //the net that says ni (ALL_defo index)
  21.  
  22. while(ni){
  23.  if(!nj){ ni--;  nj=net_ht_kwL;
  24.   try{ str="\n"+(getOAPN(c0=self[cn=ALL_defo[ni]]).join("\n").toLowerCase()); }catch(e){ ee.push(e); }
  25.   /*try{ if(typeof c0=="function") str+="\n"+(getOAPN(c0.prototype).join("\n").toLowerCase()); }catch(e){ console.log(cn,e); } */
  26.  }
  27.  nj--;
  28.  try{
  29.  if( (ki=str.indexOf(net_hot_keywords[nj]))+1){
  30.   aw=str.substring(str.lastIndexOf("\n",ki)+1,str.indexOf("\n",ki+1));
  31.   if((!(net_hot_keywords[nj]=="src"||net_hot_keywords[nj]=="origin"))||net_hot_keywords[nj]==aw){
  32.    NET_HOT.push({"name":cn, "keyword":net_hot_keywords[nj], "actual_word":aw });
  33.    nj=0;
  34.   }
  35.  }
  36.  }catch(e){ ee.push(e); }
  37. }
  38.  
  39.  
  40. //optional sort
  41. //NET_HOT.sort(function(a,b){ return a.name>b.name; });
  42.  
  43.  
  44. //note, still picking up some non-network-related objects, like navigator.geolocation
  45.  
  46.  
Add Comment
Please, Sign In to add comment