OK I'm all finished anyway
Right then, basically all you need is the backup.arc file from the \backup folder on your memory card, this stores everything that has been backed up from your phone.
The first script just extracts things like pics, vids and tunes etc.
PHP Code:
<?php
//header("Content-Type: "."text/plain");
$index = 0;
$backupfilename = "backup.arc";
$fr = fopen($backupfilename,'rb');
$compressed = fread($fr, filesize($backupfilename));
echo strlen($compressed);
echo "Finding headers..\n";
//while(!(FALSE === ($iParse = strpos ($compressed, chr(0x78).chr(0xda)))) )
while(!(FALSE === ($iParse = strpos ($compressed, chr(0x78).chr(0x9c)))) )
{
$iSkip = 1;
echo "iParse: ".$iParse." DataLeft: ".strlen($compressed)."\n";
$compressed = substr($compressed, $iParse);
if(FALSE != ($uncompressed = gzuncompress($compressed)) )
{
//$iSkip = strlen(gzcompress($uncompressed, 6));
// file_put_contents("bck_".$index, $uncompressed);
$filename = "bck_".$index;
if (!$handle = fopen($filename, 'a')) {
echo "Cannot open file ($filename)";
continue;
}
if (fwrite($handle, $uncompressed) === FALSE) {
echo "Cannot write to file ($filename)";
}
fclose($handle);
$index++;
}
echo "Skipping ".$iSkip."\n";
//remove "x"
$compressed = substr($compressed, $iSkip);
}
?>
The second script extracts things like contact data, messages and calendar data:
PHP Code:
<?php
//header("Content-Type: "."text/plain");
$index = 0;
$backupfilename = "backup.arc";
$fr = fopen($backupfilename,'rb');
$compressed = fread($fr, filesize($backupfilename));
echo strlen($compressed);
echo "Finding headers..\n";
while(!(FALSE === ($iParse = strpos ($compressed, chr(0x78).chr(0xda)))) )
//while(!(FALSE === ($iParse = strpos ($compressed, chr(0x78).chr(0x9c)))) )
{
$iSkip = 1;
echo "iParse: ".$iParse." DataLeft: ".strlen($compressed)."\n";
$compressed = substr($compressed, $iParse);
if(FALSE != ($uncompressed = gzuncompress($compressed)) )
{
//$iSkip = strlen(gzcompress($uncompressed, 6));
// file_put_contents("bck_".$index, $uncompressed);
$filename = "bck_".$index;
if (!$handle = fopen($filename, 'a')) {
echo "Cannot open file ($filename)";
continue;
}
if (fwrite($handle, $uncompressed) === FALSE) {
echo "Cannot write to file ($filename)";
}
fclose($handle);
$index++;
}
echo "Skipping ".$iSkip."\n";
//remove "x"
$compressed = substr($compressed, $iSkip);
}
?>
Both scripts output the data found to files named BCK_xxx - the xxx is a numeric value that increments for each new file.
Unfortunately you can't tell which files are of which type but you can kind of guess by the size, or just do a search for JFIF or Exif which gives you all the JPGs etc.
Just save them into a file named whatever.php and then run at the command line via
php whatever.php
They'll run through and when the script encounters any GZip'd data it will extract it to disk!
Works ok and I've just recovered all the data from my N73 now
Social Networking Bookmarks