Changeset 537

Show
Ignore:
Timestamp:
06/18/07 13:12:06 (1 year ago)
Author:
stephenson
Message:

More specific user agent strings, with more options.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • honeyclient/branches/exp/stephenson-browser_headers/lib/HoneyClient/Agent/Driver/Browser/FF.pm

    r534 r537  
    248248 
    249249sub getHeaders { 
    250     return HTTP::Headers->new( 
    251                 Accept => 'image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, application/xaml+xml, application/vnd.ms-xpsdocument, application/x-ms-xbap, application/x-ms-application, application/x-shockwave-flash, */*', 
    252                 Accept-Language => 'en-us', 
    253                 UA-CPU => 'x86', 
    254                 Accept-Encoding => 'gzip, deflate', 
    255                 User-Agent => 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30)', 
    256                 #Host: ldscatalog.com, 
    257                 Proxy-Connection => 'Keep-Alive', 
    258        ); 
     250 
     251    my $desired_agent = shift; 
     252    my $h = HTTP::Headers->new(); 
     253     
     254    if ($desired_agent) { 
     255        $h->header('User-Agent' => "Mozilla/5.0 (Windows; U; Windows NT 5.1; nl; rv:1.8) Gecko/20051107 $desired_agent"); 
     256    } 
     257    # Default case, no specific version specified 
     258    else { 
     259        $h->header('User-Agent' => "Mozilla/5.0 (Windows; U; Windows NT 5.1; nl; rv:1.8) Gecko/20051107 Firefox/2.0.0.1"); 
     260    } 
     261    return $h; 
    259262} 
    260263 
  • honeyclient/branches/exp/stephenson-browser_headers/lib/HoneyClient/Agent/Driver/Browser/IE.pm

    r534 r537  
    271271#} 
    272272 
     273 
    273274sub getHeaders { 
    274     return HTTP::Headers->new( 
    275                 Accept => 'image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, application/xaml+xml, application/vnd.ms-xpsdocument, application/x-ms-xbap, application/x-ms-application, application/x-shockwave-flash, */*', 
    276                 Accept-Language => 'en-us', 
    277                 UA-CPU => 'x86', 
    278                 Accept-Encoding => 'gzip, deflate', 
    279                 User-Agent => 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30)', 
    280                 #Host: ldscatalog.com, 
    281                 Proxy-Connection => 'Keep-Alive', 
    282        ); 
     275    my $desired_agent = shift; 
     276    my $h = HTTP::Headers->new(); 
     277 
     278    if ($desired_agent) { 
     279        User-Agent => 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30)', 
     280        $h->header('User-Agent' => "Mozilla/4.0 (compatible; $desired_agent; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30)"); 
     281    } 
     282    # Default case, no specific version specified 
     283    else { 
     284        $h->header('User-Agent' => "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30)"); 
     285    } 
     286    return $h; 
    283287} 
    284288