Saturday, December 12, 2009

How to remove ads from SBSettings

You have to install PHP and run this script
removeaps.php Select all

#!/usr/bin/php
<?
$filename = trim(shell_exec("find /Applications.* -type f -name SBSettings"));
$backup_filename = $filename.".bak";
$tmp_filename = $filename.".tmp";

while (file_exists($backup_filename)) {
$backup_filename .= ".bak";
}

if (!file_exists($filename)) {
die("Can't open: $filename\n");
}

copy($filename, $backup_filename);

echo "Patching file: $filename\n";
echo "Backup saved at: $backup_filename\n";

$fp = fopen($filename,"r");
$data = fread($fp, filesize($filename));
fclose($fp);

$data = str_replace('extra.thebigboss.org','extra.th4bigbo ss.org',$data);
$data = str_replace('mm.admob.com','mm.a4mob.com',$data);
$data = str_replace('r.admob.com','r.a4mob.com',$data);
$data = str_replace('ads.mobclix.com','ads.m4b4lix.com',$d ata);
$data = str_replace('a.qwapi.com','a.q4api.com',$data);
$data = str_replace('mydas.mobi','my4as.mobi',$data);

$fp = fopen($tmp_filename,"w");
fwrite($fp,$data);
fclose($fp);

shell_exec("ldid -s \"$tmp_filename\"");
shell_exec("mv \"$tmp_filename\" \"$filename\"");
shell_exec("chmod 4755 \"$filename\"");
echo "\nDone! :)\n";

?>


And you have to ldid -s /Applications/SBSettings.app/SBSettings

2 comments:

Anonymous said...

I've installed PHP from saurik's source. But, how to run that (via WinSCP or Mobileterminal?) and Mobileterminal says "-sh: ldid: command not found"

Anonymous said...

Very clever...

It appears that this php script modifies the binary/executable itself (private/var/stash/Aplications.XxXxXx/SBSettings.app/SBSettings)

If you don't want to do it via php than just navigate to the binary and edit it in your favorite hex editor. (example: replace mm.admob.com with an arbitrary non existent site, but keep the same length "perhaps due to check-sums/stability issue?")

Than again im not familiar with php on iphone...