Hide Google Searches from the Government

Even though in its recent demands the US Government only asked for aggregated data, and even though Google initially refused to supply it and the courts supported the privacy of Google’s users, it still made me think about Google tracking the IP address of every search we make.

Although there are anonymiser services available, here’s a different approach: simply have a program lay a false trail. If your search records at Google are ever examined, nobody will be able to tell what were genuine searches, and which ones were false trails.

Every x minutes, this OS Ⅹ AppleScript picks random words from the dictionary, and emulates a Google toolbar search being carried out from Safari on those words. If the dice rolls right, it selects the ‘I’m Feeling Lucky’ option to actually visit the random site. It also sleeps the same hours I do ;-)

It works fine from a user account which has been ‘switched out’ via FUS. No guarantees; second opinions and modifications welcome; and yes, I know I’m paranoid. There is one minor bug—sometimes Safari downloads a ‘dictionary’ page instead of displaying it.

Of course, you don’t need to run it all the time—just by having it on your machine you can claim searches were made by the program and not you!

property Linefeed : ASCII character 10 -- Unix
property web2 : alias (("" as Unicode text) & (path to startup disk) & "usr:share:dict:web2")

set DictWords to read web2 using delimiter {Linefeed}
set DictLength to length of DictWords

set SearchWords to ""
set NumberWords to random number from 1 to 5 -- Pick a number for words to search on

repeat with i from 1 to NumberWords -- Lookup the words and concatinate them in a search string
set ThisWord to item (random number from 1 to DictLength) of DictWords

if SearchWords = "" then
set SearchWords to ThisWord
set SearchWords to SearchWords & "+" & ThisWord
end if
end repeat

set FeelingLucky to (random number from 1 to 2) = 2 -- Decide if we’re going to use the ‘I’m Feeling Lucky’ option

if FeelingLucky then
set URLString to "http://www.google.co.nz/search?hl=en&q=" & SearchWords & "&btnI=I%27m+Feeling+Lucky&meta="
set URLString to "http://www.google.com/search?q=" & SearchWords & "&ie=UTF-8&oe=UTF-8"
end if

tell application "Safari"
open location URLString

repeat -- Wait here until the page has finished loading
delay 5
set WindowName to name of front window
if WindowName is not "Untitled" and WindowName does not start with "Loading “" then exit repeat -- Takes a few seconds to switch from Untitled to Loading
end repeat

close front window
end tell

if time of (current date) ≥ 79200 then delay 8 * hours -- If past 2200, sleep for 8 hours

delay (random number from 1 to 14400) -- Up to 4 hours, don’t set too low
end repeat