diff options
| -rw-r--r-- | src/extractblocks_new.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/extractblocks_new.c b/src/extractblocks_new.c index c3fb899..580d3ad 100644 --- a/src/extractblocks_new.c +++ b/src/extractblocks_new.c | |||
| @@ -24,7 +24,7 @@ | |||
| 24 | 24 | ||
| 25 | */ | 25 | */ |
| 26 | 26 | ||
| 27 | static uint8_t mantra_in[] = { 0x68, 0x00, 0x2d, 0x6c }; | 27 | static uint8_t mantra_in[] = { 0x68, 0x35, 0x2d, 0x6c }; |
| 28 | 28 | ||
| 29 | int main( int args, char **argv ) | 29 | int main( int args, char **argv ) |
| 30 | { | 30 | { |
| @@ -54,7 +54,7 @@ int main( int args, char **argv ) | |||
| 54 | mappedfile = map->addr; | 54 | mappedfile = map->addr; |
| 55 | 55 | ||
| 56 | mantra[0] = mantra_in[0] ^ mappedfile[4]; | 56 | mantra[0] = mantra_in[0] ^ mappedfile[4]; |
| 57 | mantra[1] = mantra_in[1] ^ mappedfile[9]; | 57 | mantra[1] = mantra_in[1] ^ mappedfile[5]; |
| 58 | mantra[2] = mantra_in[2] ^ mappedfile[2]; | 58 | mantra[2] = mantra_in[2] ^ mappedfile[2]; |
| 59 | mantra[3] = mantra_in[3] ^ mappedfile[3]; | 59 | mantra[3] = mantra_in[3] ^ mappedfile[3]; |
| 60 | 60 | ||
| @@ -106,8 +106,13 @@ int main( int args, char **argv ) | |||
| 106 | 106 | ||
| 107 | /* Open file and dump our de-"crypted" header and then rest of file */ | 107 | /* Open file and dump our de-"crypted" header and then rest of file */ |
| 108 | i = open( filename, O_CREAT | O_TRUNC | O_WRONLY, 0644 ); | 108 | i = open( filename, O_CREAT | O_TRUNC | O_WRONLY, 0644 ); |
| 109 | write( i, df, header_len ); | 109 | if( enc_len > header_len ) { |
| 110 | write( i, mf + header_len, offset - oldoffset - header_len ); | 110 | write( i, df, enc_len ); |
| 111 | write( i, mf + enc_len, offset - oldoffset - enc_len ); | ||
| 112 | } else { | ||
| 113 | write( i, df, header_len ); | ||
| 114 | write( i, mf + header_len, offset - oldoffset - header_len ); | ||
| 115 | } | ||
| 111 | close( i ); | 116 | close( i ); |
| 112 | } | 117 | } |
| 113 | oldoffset = offset; | 118 | oldoffset = offset; |
