Browser detection
Results 1 to 10 of 10

Thread: Browser detection

  1. #1
    Junior Member
    Join Date
    Dec 2003
    Posts
    7

    Browser detection

    Can someone tell me how some websites can detect the browsers and os that we use.Also how do browsers like opera disguise themselves as other browsers?

  2. #2
    Senior Member
    Join Date
    Sep 2003
    Posts
    179
    First question of dectection. Usually done with javascript. Go to a site such as http://www.webmonkey.com and search for 'browser detection' and you should get some good tutorials on how to play around with browser detection. I'm not exactly sure ware the variables are created but somewhere in the http headers are variables about browser and OS plus more. Browsers like Opera just change this variable. Get a packet sniffer, knoppix-std (security tools distro) has a bunch of good ones. With a packet sniffer you can read all the info in the ip and udp packets that are floating around your network which will give some good practice and help you answer your questions.

    DeafLamb

  3. #3
    Senior Member
    Join Date
    Nov 2001
    Posts
    4,786
    the browser info is passed with the initial request header (HTTP_USER_AGENT). it is usually hard coded into the browser but can be a var if the manufacturer designed it that way
    Bukhari:V3B48N826 “The Prophet said, ‘Isn’t the witness of a woman equal to half of that of a man?’ The women said, ‘Yes.’ He said, ‘This is because of the deficiency of a woman’s mind.’”

  4. #4
    AO Curmudgeon rcgreen's Avatar
    Join Date
    Nov 2001
    Posts
    2,716
    Code:
    GET / HTTP/1.1
    Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/msword, application/x-comet, application/x-shockwave-flash, */*
    Accept-Language: en-us
    Accept-Encoding: gzip, deflate
    User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows 98; 31173 h4ck3r 3d1710n)
    Host: 192.168.0.3
    Connection: Keep-Alive
    http://www.winguides.com/registry/display.php/799/
    I came in to the world with nothing. I still have most of it.

  5. #5
    Senior Member
    Join Date
    Oct 2003
    Posts
    707
    But changing those values would it not affect the way you view some websites? As some websites tend to say : Best viewed with this browser. So in a way it would make it hard for the script to detect what browser your using and thous displaying the webpage incorrectly. Correct me if I am wrong.
    Operation Cyberslam
    \"I\'ve noticed that everybody that is for abortion has already been born.\" Author Unknown
    Microsoft Shared Computer Toolkit
    Proyecto Ututo EarthCam

  6. #6
    Elite Hacker
    Join Date
    Mar 2003
    Posts
    1,407
    I have been playing around with php lately. I have a logging script that puts all this info on another file for
    me to view. What is cool is that if I go to the pages that log through telnet ex. telnet 192.168.0.255 80
    then I can manipulate what is logged for the user agent. for example, once I have connected using the
    telnet command above I would do this:

    GET / HTTP/1.0
    user agent:<h1>I 0wn j00</h1>

    Then I would go to the page my logging script spits the info to, and sure enough that info was there for the
    user agent. To do this with php all you have to do is use the $_SERVER[] variable like this:
    $agent = $_SERVER['HTTP_USER_AGENT'];
    then the user agent is stored in the variable $agent. But what i just showed you is not smart if you are
    outputting the result to a webpage, what you want to do is this instead:
    $agent = strip_tags($_SERVER['HTTP_USER_AGENT']);
    and that will take out all the html tags I believe. It is very interesting to fool around with. I have just started
    using php, and I really enjoy it, and if you can find a webserver with it installed, I highly recommend you fool
    around with it too. Have fun.

  7. #7
    Member
    Join Date
    Nov 2003
    Posts
    33
    You can always use javasscript to detect such things. The following s a small script for OS detection by Bret Bailey. I got this from www.javascriptkit.com.

    Insert this in the header section:


    <SCRIPT LANGUAGE="JavaScript">

    <!--
    function checkOS() {
    if(navigator.userAgent.indexOf('IRIX') != -1)
    { var OpSys = "Irix"; }
    else if((navigator.userAgent.indexOf('Win') != -1) &&
    (navigator.userAgent.indexOf('95') != -1))
    { var OpSys = "Windows95"; }
    else if(navigator.userAgent.indexOf('Win') != -1)
    { var OpSys = "Windows3.1 or NT"; }
    else if(navigator.userAgent.indexOf('Mac') != -1)
    { var OpSys = "Macintosh"; }
    else { var OpSys = "other"; }
    return OpSys;
    }
    // -->

    </SCRIPT>


    Insert this in the body section (Please dont remove the credits)


    <script>
    <!--
    var OpSys = checkOS();
    document.write(OpSys);
    //-->
    </script>

    <p align="center"><font face="arial" size="-2">This free script provided by</font><br>
    <font face="arial, helvetica" size="-2"><a href="http://javascriptkit.com">JavaScript
    Kit</a></font></p>
    There are 10 kinds people on Earth.
    Those who know Binary and those who dont.

    [flip]4675636B207468652064616D6E20626C6F6F6479206861636B65642D757020776F726C6400[/flip]

  8. #8
    Senior Member
    Join Date
    Oct 2003
    Posts
    707
    While reading the article I noticed this:
    Note: This tweak may affect some online services that read this information to detect the operating system such as Microsoft Windows Update.
    It seems like it's not a really good idea. But I guess that you can browse over to the Microsoft update page and do it that way. But I was also thinking if you do change the values of the OS in the registry would that not also affect the update page from detecting the proper patches ?

    Just wondering ....
    Operation Cyberslam
    \"I\'ve noticed that everybody that is for abortion has already been born.\" Author Unknown
    Microsoft Shared Computer Toolkit
    Proyecto Ututo EarthCam

  9. #9
    Member
    Join Date
    May 2002
    Posts
    68
    But I was also thinking if you do change the values of the OS in the registry would that not also affect the update page from detecting the proper patches ?
    Yes if you modify some of those reg values, the wupdate site will error out.

  10. #10
    AO Curmudgeon rcgreen's Avatar
    Join Date
    Nov 2001
    Posts
    2,716
    I came in to the world with nothing. I still have most of it.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •