Esempio n. 1
0
var_dump($_POST);
echo "</pre>";
require_once '../includes/bootstrap.php';
chdir('..');
if ($_FILES['eeprom']['tmp_name'] == '') {
    jsCallback('Es wurde kein EEPROM Dump hochgeladen!', true);
    die;
}
$requestId = md5(serialize($_POST) . serialize($_FILES) . microtime());
$eeprom = _EEPROMUPLOAD . 'tmp' . $requestId . '.bin';
if (!move_uploaded_file($_FILES['eeprom']['tmp_name'], $eeprom)) {
    jsCallback('Dateiuploads konnten nicht verarbeitet werden!', true);
    die;
}
if (filesize($eeprom) != _EEPROM_SIZE) {
    jsCallback('Unerwartete Dateigröße des hochgeladenen EEPROM Dumps!');
    die;
}
$fileName = $_FILES['eeprom']['name'];
$output = "<h3>EEPROM Analyzer Ausgabe für Datei: {$fileName}</h3><br /><dl>";
// DO ANALYITCAL STUFF
$byteDefinitions = array("model" => array("35", "37"), "type" => array("38", "3A"), "side" => array("3B", "3B"), "FIN" => array("32", "42"), "idcode" => array("0A", "19"), "fahrzaehler" => array('6C', '6D'), "writes" => array("F2", "F2"), "scn" => array("05", "06"), "features" => array('07', '07'), "schluesselcode" => array('A4', 'A5'), "wegfahrsperre" => array('52', '52'), "wegfahrsperre1" => array('B4', 'B5'), "wegfahrsperre2" => array('B6', 'B7'), "key" => array('56', '56'), "keycode" => array('5C', '5D'), "adaption" => array('E3', 'E6'), "kupplungsc1" => array('9A', '9B'), "kupplungsc2" => array('9C', '9D'), "kupplungsc3" => array('9E', '9F'), "kupplungsc3zeit" => array('A2', 'A3'), "fehlercode" => array('B6', 'B6'), "zaehler" => array('A0', 'A1'), "killbytes" => array('96', '97'));
$valueList = array("model" => array("452" => "Smart Roadster", "450" => "Smart ForTwo"), "type" => array("332" => " Coupé, 45kW", "334" => " Coupé, 60kW", "337" => " Coupé, 74kW (Brabus)", "434" => "60kW", "432" => "45kW", "437" => "74kW (Brabus)"), "side" => array("1" => "Linkslenker", "2" => "Rechtslenker"), "features" => array("Smart", "Schaltwippen", "Servolenkung", "Tempomat", "Softtip", "unbekannt (Bit6)", "ohne Klimaanlage", "unbekannt (Bit8)"), "scn0" => array("", "SCN5: ??? (Bit 2)", "", "", "", "SCN5: ohne Klima (Bit 6)", "SCN5: SB2 (Bit 7)", "SCN5: Roadster (Bit 8)"), "scn1" => array("", "", "", "SCN6: 45kW (Bit 4)", "SCN6: 60kW (Bit 5)", "", "SCN6: 74kW (Bit 7)", ""));
$sEeprom = fopen($eeprom, 'r');
$model = '';
foreach ($byteDefinitions as $name => $pos) {
    $start = hexdec($pos[0]);
    $end = hexdec($pos[1]);
    $length = $end - $start + 1;
    fseek($sEeprom, $start);
    $value = fread($sEeprom, $length);
Esempio n. 2
0
$maps = PatchLocator::getMaps('R60_2005');
$patcher = new Patcher();
foreach ($_POST['setting'] as $mapName => $settingVal) {
    if ($settingVal == $mapName . '0' && !array_key_exists('overwriteOriginal', $_POST)) {
        continue;
    }
    $mod = new Modification($maps[$mapName], $maps[$mapName]->getSetting($settingVal));
    $patcher->addModification($mod);
}
$presetString = '';
$presetMap = _PRESET_MAPPING();
foreach ($presetMap as $preset) {
    if (!array_key_exists($preset, $_POST['setting'])) {
        $presetString = '';
        break;
    }
    $presetString .= str_replace($preset, '', $_POST['setting'][$preset]);
}
if ($patcher->getNumberOfModifications() == 0) {
    jsCallback('Keine Änderungen vorgenommen!');
    die;
}
$staticMaps = PatchLocator::getStaticMaps('R60_2005');
foreach ($staticMaps as $mapName => $map) {
    $mod = new Modification($map, $map->getSetting($mapName . '0'));
    $patcher->addModification($mod);
}
$filename = $patcher->createTunedFile($sourceFile, $originalFile);
$newFilename = str_replace(basename($filename), '', $filename) . 'R60_2005-' . $presetString . '-' . $requestId . '.Bad Checksums!!';
rename($filename, $newFilename);
downloadFile($newFilename, basename($newFilename), md5_file($newFilename));