Author Topic: Web bug detecting script for Firefox  (Read 2832 times)

H_TeXMeX_H

  • Member
  • **
  • Posts: 1,988
  • Kudos: 494
    • http://draconishinobi.50webs.com/
Web bug detecting script for Firefox
« on: 20 November 2005, 01:40 »
If you use Firefox you can actually detect and block web bugs:

  1) Install greasemonkey and restart browser
  2) Goto tools -> new user script

then paste this in there (right after // ==/UserScript==), save it (might wanna retitle the line @name bug detector), then open it with firefox and goto Tools -> install this user script

 
Code: [Select]
(function()
{
  window.addEventListener("load", function(e)
 {
    var imgList = document.getElementsByTagName("img");
    for (i=0; i < imgList.length; i++)
  {
      if (imgList[i].width == 1 && imgList[i].height == 1 && imgList[i].src != "")
   {
        imgList[i].width = "101";
        imgList[i].height = "101";
        imgList[i].alt = "WeB BuG";
        imgList[i].border = "7";
        imgList[i].style.borderColor = '#ff0000';
        imgList[i].style.backgroundColor = '#00ff00';
   }
  }
    return;
 }, false);
})();


I wrote this myself, with a little help from a few other sites :thumbup: (Upon loading a site it gathers a list of all objects tagged "img" that are 1 x 1 pixels in size and that have a url associated with them, then it makes them a lot more visible ;) based on this , except my version is better cuz it allows you to use Adblock

This produces a green box 101 x 101 pixels with a 7 pixel RED border that marks the bug ... when you right-click -> Propeties it should say "Alternate text:  WeB BuG"

  3)Use the Adblock extension to block the image, right-click the green square and Adblock image ... some of the 1x1 images are spacers for formatting purposes ... you should check the page source to make sure, but blocking the image does not affect site layout (usually), so it is safer just to block them

  4)Try it out here (refresh browser if they are not visible) and at http://www.nytimes.com/  a.k.a web bug central
or http://www.cnn.com/

187nimd4

  • Newbie
  • *
  • Posts: 12
  • Kudos: 10
Re: Web bug detecting script for Firefox
« Reply #1 on: 21 November 2005, 19:49 »
whoa! awesome :D all good until they make them 1x2 px ;P tnx 4 this script nigga :)

H_TeXMeX_H

  • Member
  • **
  • Posts: 1,988
  • Kudos: 494
    • http://draconishinobi.50webs.com/
Re: Web bug detecting script for Firefox
« Reply #2 on: 21 November 2005, 21:32 »
Quote from: 187nimd4
whoa! awesome :D all good until they make them 1x2 px ;P tnx 4 this script nigga :)

No problem :thumbup:

... if they do ... then change this line: (any image less than 3 x 3 ... i.e 2 x 2 or less)

 
Code: [Select]
if (imgList[i].width < 3 && imgList[i].height < 3 && imgList[i].src != "")  
... just change the numbers corresponding to width and height above to match whatever they choose to change it to. Who knows, they might just do it, especially if more people know about 1x1 bugs.

You might wanna note:

Are Web Bugs always invisible on a page?    Not necessarily.  Any graphics on a Web page that is used for monitoring purposes can be considered a Web Bug.


... this often includes ads ... so block the ads too.

Here is Wiki, another test (refresh browser if they are not visible), and a recent article on web bugs

187nimd4

  • Newbie
  • *
  • Posts: 12
  • Kudos: 10
Re: Web bug detecting script for Firefox
« Reply #3 on: 22 November 2005, 10:50 »
You're the Don :D Tnx.

worker201

  • Global Moderator
  • Member
  • ***
  • Posts: 2,810
  • Kudos: 703
    • http://www.triple-bypass.net
Re: Web bug detecting script for Firefox
« Reply #4 on: 22 November 2005, 22:35 »
Uhm, except for the fact that many websites still use 1x1 images for preloading purposes.  Loading a 45k image at 1x1 pixel places it into cache, so it can be loaded quickly when needed, at which time it can be displayed at its proper size.  With the increase of broadband, this isn't so much of a problem anymore.  But you still might be interfering with site loading.

H_TeXMeX_H

  • Member
  • **
  • Posts: 1,988
  • Kudos: 494
    • http://draconishinobi.50webs.com/
Re: Web bug detecting script for Firefox
« Reply #5 on: 22 November 2005, 22:48 »
Quote from: worker201
Uhm, except for the fact that many websites still use 1x1 images for preloading purposes. Loading a 45k image at 1x1 pixel places it into cache, so it can be loaded quickly when needed, at which time it can be displayed at its proper size. With the increase of broadband, this isn't so much of a problem anymore. But you still might be interfering with site loading.

hmmm ... so is there anything that differentiates web bugs from these pre-loading ones ? Is it a size difference byte wise (not width or length obviously) ? There might be a way to exclude them ?

worker201

  • Global Moderator
  • Member
  • ***
  • Posts: 2,810
  • Kudos: 703
    • http://www.triple-bypass.net
Re: Web bug detecting script for Firefox
« Reply #6 on: 22 November 2005, 23:20 »
I guess if you were to determine how big a 1x1 pixel image is, and then set some kind of threshold, like 2k or something.  Nobody would bother to preload a really small image, and even if they did, it would probably take just as long to pull it from cache as it would to download it.

H_TeXMeX_H

  • Member
  • **
  • Posts: 1,988
  • Kudos: 494
    • http://draconishinobi.50webs.com/
Re: Web bug detecting script for Firefox
« Reply #7 on: 23 November 2005, 04:30 »
Ok, here is the new and improved code that looks at the normal height and width of an image before any type of modification, which allows for pre-loaded images (no, unfortunately there is no img.fileSize function (like with IE or Opera) for Mozilla, but they have naturalHeight and naturalWidth that makes up for it)

And, I changed the border to 11 pixels because of this site ... there is a barely noticible bug in the upper left-hand corner that is much more visible with 11 pixel border

Thanks for pointing that out ... it was a rather simple fix too :thumbup:

 
Code: [Select]
( function()
{
 window.addEventListener("load", function(e)
 {
  var imgList = document.getElementsByTagName("img");
  for (i=0; i < imgList.length; i++)
  {
if (imgList[i].src != "" && imgList[i].naturalWidth == 1 && imgList[i].naturalHeight == 1)
   {
   imgList[i].width = "101";
   imgList[i].height = "101";
   imgList[i].alt = "WeB BuG";
   imgList[i].border = "11";
   imgList[i].style.borderColor = '#ff0000';
   imgList[i].style.backgroundColor = '#00ff00';
   }
  }
  return;
 }, false);
})();

H_TeXMeX_H

  • Member
  • **
  • Posts: 1,988
  • Kudos: 494
    • http://draconishinobi.50webs.com/
Re: Web bug detecting script for Firefox
« Reply #8 on: 10 December 2005, 02:28 »
Here is an alternative ... a script that stops bugs from loading ... you'll just have to trust me that it does work :D

Code: [Select]

( function()
{
 window.addEventListener("load", function(e)
 {
  var imgList = document.getElementsByTagName("img");
  for (i=0; i < imgList.length; i++)
  {
  if (imgList[i].naturalWidth == 1 && imgList[i].naturalHeight == 1)
   {
   imgList[i].style.display = "none";
   }
  }
  return;
 }, false);
})();