[nSLUG] User agent spoofing

Ben Armstrong synrg at sanctuary.nslug.ns.ca
Tue Jan 23 10:18:03 AST 2007


On Tue, 23 Jan 2007 07:27:15 -0400
Gerard MacNeil <aa030 at chebucto.ns.ca> wrote:
> TSN.ca's video feeds have been a pain. The UAS was sufficient to get
> past the "Sorry, your OS is not supported!"  message. Switching to
> "Internet Explorer 6 (Windows XP)" I get a message screen with "You need
> to upgrade your Flash Player to version 8 or later." I have Debian
> non-free, version 9,0,31 installed.
> 
> Suggestions? 

Same problem.  Same site.  Same result.  So I went looking for Javascript
flash plugin detectors to try to understand what they do.  I found this:

http://jsbrwsniff.sourceforge.net/

Here's an excerpt.  Apparently the method for detection of the flash plugin differs between browsers, so if you use Firefox spoof IE, such code is bound to fail.

If you figure out the appropriate settings to use with the Firefox User Agent Switcher, please share.

Ben

// Is Flash plug-in installed?
function hasFlashPlugin(obj) {

    (isEmpty(obj) ? brs=navigator.userAgent.toLowerCase() : brs=obj);

    var f=new Array("0", "0");
    var brwEng=getBrowser(obj)[2];
    var opSys=getOS(obj)[0];

    //if (getBrowser(obj)[2]!="msie") {
    if ( (brwEng=="gecko") || (brwEng=="opera") || (brwEng=="khtml") || (brwEng=="mozold") || (opSys=="macosx") || (opSys=="macclassic") ) {
        // Non-IE Flash plug-in detection

        if (navigator.plugins && navigator.plugins.length) {
            x = navigator.plugins["Shockwave Flash"];
            if (x) {
                f[0] = 2;
                if (x.description) {
                    y = x.description;
                    f[1] = y.charAt(y.indexOf('.')-1);
                }
            } else {
                f[0] = 1;
            }
            if (navigator.plugins["Shockwave Flash 2.0"]) {
                f[0] = 2;
                f[0] = 2;
            }
        } else if (navigator.mimeTypes && navigator.mimeTypes.length) {
            x = navigator.mimeTypes['application/x-shockwave-flash'];
            if (x && x.enabledPlugin) {
                f[0] = 2;
            } else {
                f[0] = 1;
            }
        }

   return f;

  } else if (brwEng=="msie") {
      // IE flash detection.
       for(var i=15; i>0; i--) {
           try {
               var flash = new ActiveXObject("ShockwaveFlash.ShockwaveFlash." + i);
               f[1] = i;
               break;
               //return;
           } catch(e) { }
       }

       if (f[1]>0) {
           f[0]=2
       } else {
           f[0]=1
       }
   return f;
   } else {
       f[0]=0;
       f[1]=0;
       return f;
   }
}


--
 ,-.  nSLUG    http://www.nslug.ns.ca   synrg at sanctuary.nslug.ns.ca
 \`'  Debian   http://www.debian.org    synrg at debian.org
  `          [ gpg 395C F3A4 35D3 D247 1387 2D9E 5A94 F3CA 0B27 13C8 ]
             [ pgp 7F DA 09 4B BA 2C 0D E0 1B B1 31 ED C6 A9 39 4F ]

!DSPAM:45b61934160642133027638!




More information about the nSLUG mailing list