[tor-commits] [ooni-probe/master] Update user agent strings for user agent randomization

art at torproject.org art at torproject.org
Tue Feb 26 15:52:41 UTC 2013


commit 66cbb71acfaf158fa8380a44395f83c95e6e7548
Author: Arturo Filastò <art at fuffa.org>
Date:   Fri Feb 8 22:44:48 2013 +0100

    Update user agent strings for user agent randomization
    
    They are now taken from the PETS2010 paper "How unique is your browser" as the
    user agents with the largest anonymity set.
    Note: this is probably no longer true as of today, but I could not find a
    better source for mostly used user agent strings and it's for sure better than
    what we had before (We were considering highly used Opera 8.1).
---
 .../manipulation/http_header_field_manipulation.py |    2 +-
 ooni/utils/net.py                                  |   27 ++++++++++---------
 2 files changed, 15 insertions(+), 14 deletions(-)

diff --git a/nettests/manipulation/http_header_field_manipulation.py b/nettests/manipulation/http_header_field_manipulation.py
index e6e3fde..c831814 100644
--- a/nettests/manipulation/http_header_field_manipulation.py
+++ b/nettests/manipulation/http_header_field_manipulation.py
@@ -64,7 +64,7 @@ class HTTPHeaderFieldManipulation(httpt.HTTPTest):
         else:
             # XXX generate these from a random choice taken from whatheaders.com
             # http://s3.amazonaws.com/data.whatheaders.com/whatheaders-latest.xml.zip
-            headers = {"User-Agent": [random.choice(net.userAgents)[0]],
+            headers = {"User-Agent": [random.choice(net.userAgents)],
                 "Accept": ["text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"],
                 "Accept-Encoding": ["gzip,deflate,sdch"],
                 "Accept-Language": ["en-US,en;q=0.8"],
diff --git a/ooni/utils/net.py b/ooni/utils/net.py
index 865977c..49f9998 100644
--- a/ooni/utils/net.py
+++ b/ooni/utils/net.py
@@ -12,19 +12,20 @@ from ooni.utils import log, txscapy
 #if sys.platform.system() == 'Windows':
 #    import _winreg as winreg
 
-userAgents = [
-    ("Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6", "Firefox 2.0, Windows XP"),
-    ("Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)", "Internet Explorer 7, Windows Vista"),
-    ("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)", "Internet Explorer 7, Windows XP"),
-    ("Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.1.4322)", "Internet Explorer 6, Windows XP"),
-    ("Mozilla/4.0 (compatible; MSIE 5.0; Windows NT 5.1; .NET CLR 1.1.4322)", "Internet Explorer 5, Windows XP"),
-    ("Opera/9.20 (Windows NT 6.0; U; en)", "Opera 9.2, Windows Vista"),
-    ("Opera/9.00 (Windows NT 5.1; U; en)", "Opera 9.0, Windows XP"),
-    ("Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; en) Opera 8.50", "Opera 8.5, Windows XP"),
-    ("Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; en) Opera 8.0", "Opera 8.0, Windows XP"),
-    ("Mozilla/4.0 (compatible; MSIE 6.0; MSIE 5.5; Windows NT 5.1) Opera 7.02 [en]", "Opera 7.02, Windows XP"),
-    ("Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.5) Gecko/20060127 Netscape/8.1", "Netscape 8.1, Windows XP")
-    ]
+# These user agents are taken from the "How Unique Is Your Web Browser?"
+# (https://panopticlick.eff.org/browser-uniqueness.pdf) paper as the browser user
+# agents with largest anonymity set.
+
+userAgents = ("Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.7) Gecko/20091221 Firefox/3.5.7",
+    "Mozilla/5.0 (iPhone; U; CPU iPhone OS 3 1 2 like Mac OS X; en-us) AppleWebKit/528.18 (KHTML, like Gecko) Mobile/7D11",
+    "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2) Gecko/20100115 Firefox/3.6",
+    "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2) Gecko/20100115 Firefox/3.6",
+    "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2) Gecko/20100115 Firefox/3.6",
+    "Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.9.2) Gecko/20100115 Firefox/3.6",
+    "Mozilla/5.0 (Windows; U; Windows NT 6.1; de; rv:1.9.2) Gecko/20100115 Firefox/3.6",
+    "Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.9.2) Gecko/20100115 Firefox/3.6",
+    "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.7) Gecko/20091221 Firefox/3.5.7",
+    "Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.9.1.7) Gecko/20091221 Firefox/3.5.7 (.NET CLR 3.5.30729)")
 
 class UnsupportedPlatform(Exception):
     """Support for this platform is not currently available."""





More information about the tor-commits mailing list