For osCommerce you could test for the presences of the actual PHP files:
<?php
$files = array('account_history.php','account_history_info.php','account_newsletters.php','account_notifications.php','account_password.php','address_book.php','address_book_process.php','advanced_search.php','advanced_search_result.php','checkout_confirmation.php','checkout_payment.php','checkout_payment_address.php','checkout_process.php','checkout_shipping.php','checkout_shipping_address.php','checkout_success.php','conditions.php','contact_us.php','cookie_usage.php','create_account.php','create_account_success.php','download.php','index.php','info_shopping_cart.php','login.php','logoff.php','opensearch.php','password_forgotten.php','password_reset.php','popup_image.php','popup_search_help.php','privacy.php','product_info.php','product_reviews.php','product_reviews_info.php','product_reviews_write.php','products_new.php','redirect.php','reviews.php','shipping.php','shopping_cart.php','specials.php','ssl_check.php','stylesheet.css','tell_a_friend.php');
$nofound = 0;
foreach ($files as $file)
{
if (false == file_get_contents('http://www.example.com/' . $file)) {
//echo $file . "\n"
$notfound++;
}
}
if ($notfound > 3){
echo "Properly not osCommerce";
} else {
echo "Properly osCommerce";
}
?>
It might take some time to figure out the correct number of files that is allowed not to be present in the installation.
I guess you could come up with something similar for Magento?