Leopard Lion Mavericks Monterey Snow Leopard Software

Wiping-out Safari completely and spoofing browser id and MAC address.

Post Reply
macosx / lion     Views: 3696Prev .. Next
Wiping-out Safari completely and spoofing browser id and MAC address.Posted: Saturday, November 14, 2015 [22:59:05] - 1
rootPosted by:rootMember Since:
June 16 2010
Posts: 356
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:
View Code#!/usr/bin/perl
## 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`;chomp $cuser; ## Get current user
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`;chop $localtime;$localtime =~ tr/ //s;($wd,$mo,$da,$ti,$sh,$ye) = split(/\s/,$localtime);$ti=~ s/\:/\-/g;
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='';$fd1=$fd;$fd1 =~ s/\//\-/g;$fd1 =~ s/(^\W+)|(\W+$)//;
$action = $files{$fd};$fd =~ s/ /\\ /g;
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;print "\t$fd not found\n";}
} ## 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 );$nbrows=shift(@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:
View Codetell application "Safari" to activate
delay 2
tell application "System Events"
tell process "Safari"
set frontmost to true
tell menu bar 1 to tell menu bar item "Safari" to tell menu 1 to tell menu item "Reset Safariā€¦" to click
delay 1
tell window "Reset Safari" to tell button "Reset" to click
end tell
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)
View Codeopenssl rand -hex 6 | sed 's/\(..\)/\1:/g; s/.$//' | xargs sudo ifconfig en0 ether

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:
View Codeifconfig

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.There's no place like ~
macosx / lionPrev .. Next
 
Post Reply
Home - Macosx: Leopard Lion Mavericks Monterey Snow Leopard Software
Our Telegram Group