Wiping-out Safari completely and spoofing browser id and MAC address.
Post ReplyWiping-out Safari completely and spoofing browser id and MAC address.Posted: Saturday, November 14, 2015 [22:59:05] - 1
ALL INFORMATION BELOW FOR EDUCATION PURPOSE ONLY! NO WARRANTIES OF ANY KIND IMPLIED OR GIVEN! IN-SHORT: IF SOMETHING GETS BROKEN - DO NOT BLAME IT ON US! Sometimes we need to be as anonymous as possible for YouTube, Facebook, Twitter or any other online services. Besides denying access VIA /etc/hosts file additional Browser anonymity can help. Safari's "Private Browsing" leaks-out too much information and Tor is not an option. Instead of diving deep into the Mac OS X system files we can let Perl do it for you in one sweep. Here is a script I wrote based on 20 minutes research I did on Google: ## CLEARS ALL SAFARI DATA ## Works on: Mac OS X 10.8.5 Safari 6.2.8 ## Use at your own risk! No warranties of any kind implied. ## Posted for Educational purposes only. $cuser=`whoami`; print "User: $cuser\n"; %files=( ## Safari system files/folders to clear "/Users/$cuser/Library/Safari",'mv', "/Users/$cuser/Library/Caches/Metadata/Safari",'rm -rf', "/Users/$cuser/Library/Caches/com.apple.Safari",'rm -rf', "/Users/$cuser/Library/Caches/com.apple.WebKit.PluginProcess",'rm -rf', "/Users/$cuser/Library/Cookies/Cookies.binarycookies",'rm -rf', "/Users/$cuser/Library/Cookies/com.apple.Safari.SafeBrowsing.binarycookies",'rm -rf', "/Users/$cuser/Library/Preferences/Apple - Safari - Safari Extensions Gallery",'rm -rf', "/Users/$cuser/Library/Preferences/com.apple.Safari.LSSharedFileList.plist",'rm -rf', "/Users/$cuser/Library/Preferences/com.apple.Safari.RSS.plist",'rm -rf', "/Users/$cuser/Library/Preferences/com.apple.Safari.plist",'rm -rf', "/Users/$cuser/Library/Preferences/com.apple.WebFoundation.plist",'rm -rf', "/Users/$cuser/Library/Preferences/com.apple.WebKit.PluginHost.plist",'rm -rf', "/Users/$cuser/Library/Preferences/com.apple.WebKit.PluginProcess.plist",'rm -rf', "/Users/$cuser/Library/PubSub/Database",'rm -rf', "/Users/$cuser/Library/Saved Application State/com.apple.Safari.savedState",'rm -rf' ); $localtime = `date`; unless(-d "/Users/$cuser/Desktop/moved") {`mkdir /Users/$cuser/Desktop/moved`;} ## Adjust this folder according to your needs ## PROCESS, (REMOVE OR MOVE) FILES AND FOLDERS ### foreach $fd (sort keys(%files)) { if(-f $fd || -d $fd) {$next=''; $action = $files{$fd}; if($action eq 'mv') {$next = " /Users/$cuser/Desktop/moved/$fd1.$mo.$da.$ye.$ti";} `$action $fd$next`; print "$action $fd$next\n"; } ## END PRESENT else {$fd =~ s/ /\\ /g; } ## FOREACH FILE END ## RESET SAFARI ### - Applescript can be found below `osascript /Users/$cuser/Desktop/Mac/clear.safari.app`; ## SET RANDOM SAFARI BROWSER ID ## - add as many string as needed @idstrings = ( 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_3) AppleWebKit/537.75.14 (KHTML, like Gecko) Version/7.0.3 Safari/7046A194A', 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_3) AppleWebKit/600.5.17 (KHTML, like Gecko) Version/8.0.5 Safari/600.5.17', 'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/533.20.25 (KHTML, like Gecko) Version/5.0.4 Safari/533.20.27', 'Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US) AppleWebKit/533.20.25 (KHTML, like Gecko) Version/5.0.3 Safari/533.19.4', 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11) AppleWebKit/601.1.56 (KHTML, like Gecko) Version/9.0 Safari/601.1.56', 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_1) AppleWebKit/601.2.7 (KHTML, like Gecko) Version/9.0.1 Safari/601.2.7' ); randomarrs( \@idstrings ); print "New Browser:\n$nbrows\n"; ## Permanently write new Browser ID string, save your current string if you want to re-write it later-on `defaults write com.apple.Safari CustomUserAgent "\\"$nbrows\\""`; sub randomarrs { my $array = shift; my $i; for ($i = @$array; --$i; ) { my $j = int rand ($i+1); next if $i == $j; @$array[$i,$j] = @$array[$j,$i]; } } ## RANDOMIZE ARRAYS END AppleScript to Reset Safari: delay 2 tell application "System Events" end tell delay 2 tell application "Safari" to quit and now, if you need to spoof your MAC address, do NOT turn-off Wi-Fi just run this in your Terminal: (verify that your Wi-Fi is on en0, if not, change string below accordingly) then turn-off Wi-Fi and turn it back on. Verify new Mac address on your router and check your current MAC address in Terminal: System Preferences -> Network -> Advanced -> Hardware -> Mac Address may show original address while in fact it is spoofed on the actual network. Now your Mac has cleanly wiped Safari, new Safari ID and your MAC Address is different. Nobody can give you a 100% Guarantee your visit to the Website can not be tracked but, changing all of the above will sure make your visit trackable. Please keep in-mind, your MAC Address will revert to the original one after reboot and may revert after coming back from sleep. |