Recover XFI Electronic Fuel Injection Systems .xfi, .gct and .ttd
This commit is contained in:
parent
1115ff8b64
commit
f9ac32559d
5 changed files with 164 additions and 0 deletions
|
@ -112,6 +112,7 @@ file_C = filegen.c \
|
|||
file_freeway.c \
|
||||
file_frm.c \
|
||||
file_fs.c \
|
||||
file_gct.c \
|
||||
file_gho.c \
|
||||
file_gif.c \
|
||||
file_gm6.c \
|
||||
|
@ -241,6 +242,7 @@ file_C = filegen.c \
|
|||
file_wv.c \
|
||||
file_x3f.c \
|
||||
file_xcf.c \
|
||||
file_xfi.c \
|
||||
file_xm.c \
|
||||
file_xsv.c \
|
||||
file_xpt.c \
|
||||
|
|
67
src/file_gct.c
Normal file
67
src/file_gct.c
Normal file
|
@ -0,0 +1,67 @@
|
|||
/*
|
||||
|
||||
File: file_gct.c
|
||||
|
||||
Copyright (C) 2011 Christophe GRENIER <grenier@cgsecurity.org>
|
||||
|
||||
This software is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write the Free Software Foundation, Inc., 51
|
||||
Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
#ifdef HAVE_STRING_H
|
||||
#include <string.h>
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
#include "types.h"
|
||||
#include "filegen.h"
|
||||
|
||||
static void register_header_check_gct(file_stat_t *file_stat);
|
||||
|
||||
const file_hint_t file_hint_gct= {
|
||||
.extension="gct",
|
||||
.description="XFI Electronic Fuel Injection Systems",
|
||||
.min_header_distance=0,
|
||||
.max_filesize=PHOTOREC_MAX_FILE_SIZE,
|
||||
.recover=1,
|
||||
.enable_by_default=1,
|
||||
.register_header_check=®ister_header_check_gct
|
||||
};
|
||||
|
||||
static const unsigned char gct_header[9]= {
|
||||
'J' , 'L' , 'G' , 'E' , 'N' , '2' , 'X' , 'F' ,
|
||||
'I'
|
||||
};
|
||||
|
||||
static int header_check_gct(const unsigned char *buffer, const unsigned int buffer_size, const unsigned int safe_header_only, const file_recovery_t *file_recovery, file_recovery_t *file_recovery_new)
|
||||
{
|
||||
if(memcmp(&buffer[0], gct_header, sizeof(gct_header))==0)
|
||||
{
|
||||
reset_file_recovery(file_recovery_new);
|
||||
file_recovery_new->extension=file_hint_gct.extension;
|
||||
file_recovery_new->calculated_file_size=2416;
|
||||
file_recovery_new->data_check=&data_check_size;
|
||||
file_recovery_new->file_check=&file_check_size;
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void register_header_check_gct(file_stat_t *file_stat)
|
||||
{
|
||||
register_header_check(0, gct_header, sizeof(gct_header), &header_check_gct, file_stat);
|
||||
}
|
|
@ -115,6 +115,7 @@ extern const file_hint_t file_hint_fp7;
|
|||
extern const file_hint_t file_hint_freeway;
|
||||
extern const file_hint_t file_hint_frm;
|
||||
extern const file_hint_t file_hint_fs;
|
||||
extern const file_hint_t file_hint_gct;
|
||||
extern const file_hint_t file_hint_gho;
|
||||
extern const file_hint_t file_hint_gif;
|
||||
extern const file_hint_t file_hint_gm6;
|
||||
|
@ -244,6 +245,7 @@ extern const file_hint_t file_hint_wtv;
|
|||
extern const file_hint_t file_hint_wv;
|
||||
extern const file_hint_t file_hint_x3f;
|
||||
extern const file_hint_t file_hint_xcf;
|
||||
extern const file_hint_t file_hint_xfi;
|
||||
extern const file_hint_t file_hint_xm;
|
||||
extern const file_hint_t file_hint_xsv;
|
||||
extern const file_hint_t file_hint_xpt;
|
||||
|
@ -340,6 +342,7 @@ file_enable_t list_file_enable[]=
|
|||
{ .enable=0, .file_hint=&file_hint_freeway },
|
||||
{ .enable=0, .file_hint=&file_hint_frm },
|
||||
{ .enable=0, .file_hint=&file_hint_fs },
|
||||
{ .enable=0, .file_hint=&file_hint_gct },
|
||||
{ .enable=0, .file_hint=&file_hint_gho },
|
||||
{ .enable=0, .file_hint=&file_hint_gif },
|
||||
{ .enable=0, .file_hint=&file_hint_gm6 },
|
||||
|
@ -469,6 +472,7 @@ file_enable_t list_file_enable[]=
|
|||
{ .enable=0, .file_hint=&file_hint_wv },
|
||||
{ .enable=0, .file_hint=&file_hint_x3f },
|
||||
{ .enable=0, .file_hint=&file_hint_xcf },
|
||||
{ .enable=0, .file_hint=&file_hint_xfi },
|
||||
{ .enable=0, .file_hint=&file_hint_xm },
|
||||
{ .enable=0, .file_hint=&file_hint_xsv },
|
||||
{ .enable=0, .file_hint=&file_hint_xpt },
|
||||
|
|
|
@ -150,6 +150,7 @@ static const unsigned char header_slk[10] = "ID;PSCALC3";
|
|||
static const unsigned char header_smil[6] = "<smil>";
|
||||
static const unsigned char header_stl[6] = "solid ";
|
||||
static const unsigned char header_stp[13] = "ISO-10303-21;";
|
||||
static const unsigned char header_ttd[55] = "FF 09 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FFFF 00";
|
||||
static const unsigned char header_url[18] = {
|
||||
'[', 'I', 'n', 't', 'e', 'r', 'n', 'e',
|
||||
't', 'S', 'h', 'o', 'r', 't', 'c', 'u',
|
||||
|
@ -227,6 +228,7 @@ static void register_header_check_fasttxt(file_stat_t *file_stat)
|
|||
register_header_check(0, header_smil,sizeof(header_smil), &header_check_fasttxt, file_stat);
|
||||
register_header_check(0, header_stl,sizeof(header_stl), &header_check_fasttxt, file_stat);
|
||||
register_header_check(0, header_stp,sizeof(header_stp), &header_check_fasttxt, file_stat);
|
||||
register_header_check(0, header_ttd, sizeof(header_ttd), &header_check_fasttxt, file_stat);
|
||||
register_header_check(0, header_url,sizeof(header_url), &header_check_fasttxt, file_stat);
|
||||
register_header_check(0, header_wpl,sizeof(header_wpl), &header_check_fasttxt, file_stat);
|
||||
register_header_check(0, header_xml,sizeof(header_xml), &header_check_fasttxt, file_stat);
|
||||
|
@ -424,6 +426,21 @@ int UTF2Lat(unsigned char *buffer_lower, const unsigned char *buffer, const int
|
|||
return(p-buffer);
|
||||
}
|
||||
|
||||
static int data_check_ttd(const unsigned char *buffer, const unsigned int buffer_size, file_recovery_t *file_recovery)
|
||||
{
|
||||
unsigned int i;
|
||||
for(i=buffer_size/2; i<buffer_size; i++)
|
||||
{
|
||||
const unsigned char car=buffer[i];
|
||||
if((car>='A' && car<='F') || (car >='0' && car <='9') || car==' ' || car=='\n')
|
||||
continue;
|
||||
file_recovery->calculated_file_size=file_recovery->file_size + i - buffer_size/2;
|
||||
return 2;
|
||||
}
|
||||
file_recovery->calculated_file_size=file_recovery->file_size+(buffer_size/2);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int header_check_fasttxt(const unsigned char *buffer, const unsigned int buffer_size, const unsigned int safe_header_only, const file_recovery_t *file_recovery, file_recovery_t *file_recovery_new)
|
||||
{
|
||||
static const unsigned char spaces[16]={
|
||||
|
@ -639,6 +656,14 @@ static int header_check_fasttxt(const unsigned char *buffer, const unsigned int
|
|||
file_recovery_new->extension="stp";
|
||||
return 1;
|
||||
}
|
||||
if(memcmp(buffer, header_ttd, sizeof(header_ttd))==0)
|
||||
{
|
||||
reset_file_recovery(file_recovery_new);
|
||||
file_recovery_new->data_check=&data_check_ttd;
|
||||
file_recovery_new->file_check=&file_check_size;
|
||||
file_recovery_new->extension="ttd";
|
||||
return 1;
|
||||
}
|
||||
if(memcmp(buffer, header_url, sizeof(header_url))==0)
|
||||
{
|
||||
/* URL / Internet Shortcut */
|
||||
|
|
66
src/file_xfi.c
Normal file
66
src/file_xfi.c
Normal file
|
@ -0,0 +1,66 @@
|
|||
/*
|
||||
|
||||
File: file_xfi.c
|
||||
|
||||
Copyright (C) 2011 Christophe GRENIER <grenier@cgsecurity.org>
|
||||
|
||||
This software is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write the Free Software Foundation, Inc., 51
|
||||
Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
#ifdef HAVE_STRING_H
|
||||
#include <string.h>
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
#include "types.h"
|
||||
#include "filegen.h"
|
||||
|
||||
static void register_header_check_xfi(file_stat_t *file_stat);
|
||||
|
||||
const file_hint_t file_hint_xfi= {
|
||||
.extension="xfi",
|
||||
.description="XFI Electronic Fuel Injection Systems",
|
||||
.min_header_distance=0,
|
||||
.max_filesize=PHOTOREC_MAX_FILE_SIZE,
|
||||
.recover=1,
|
||||
.enable_by_default=1,
|
||||
.register_header_check=®ister_header_check_xfi
|
||||
};
|
||||
|
||||
static const unsigned char xfi_header[0x20]= {
|
||||
0x2c, ' ' , 'F' , 'u' , 'e' , 'l' , ' ' , 'A' ,
|
||||
'i' , 'r' , ' ' , 'S' , 'p' , 'a' , 'r' , 'k' ,
|
||||
' ' , 'T' , 'e' , 'c' , 'h' , 'n' , 'o' , 'l' ,
|
||||
'o' , 'g' , 'i' , 'e' , 's' , ' ' , ' ' , ' ' ,
|
||||
};
|
||||
|
||||
static int header_check_xfi(const unsigned char *buffer, const unsigned int buffer_size, const unsigned int safe_header_only, const file_recovery_t *file_recovery, file_recovery_t *file_recovery_new)
|
||||
{
|
||||
if(memcmp(&buffer[0x10], xfi_header, sizeof(xfi_header))==0)
|
||||
{
|
||||
reset_file_recovery(file_recovery_new);
|
||||
file_recovery_new->extension=file_hint_xfi.extension;
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void register_header_check_xfi(file_stat_t *file_stat)
|
||||
{
|
||||
register_header_check(0x10, xfi_header, sizeof(xfi_header), &header_check_xfi, file_stat);
|
||||
}
|
Loading…
Reference in a new issue