projects
/
proxmark3-svn
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
ADD: Visa2000 demod
[proxmark3-svn]
/
client
/
loclass
/
elite_crack.c
diff --git
a/client/loclass/elite_crack.c
b/client/loclass/elite_crack.c
index c824eaa188ed45c56fce156718c4dfeda90f5b19..29b7f04d4f3dec2ec1dc1316ae28a185dad0775d 100644
(file)
--- a/
client/loclass/elite_crack.c
+++ b/
client/loclass/elite_crack.c
@@
-71,7
+71,6
@@
*/
void permutekey(uint8_t key[8], uint8_t dest[8])
{
*/
void permutekey(uint8_t key[8], uint8_t dest[8])
{
-
int i;
for(i = 0 ; i < 8 ; i++)
{
int i;
for(i = 0 ; i < 8 ; i++)
{
@@
-84,7
+83,6
@@
void permutekey(uint8_t key[8], uint8_t dest[8])
(((key[1] & (0x80 >> i)) >> (7-i)) << 1) |
(((key[0] & (0x80 >> i)) >> (7-i)) << 0);
}
(((key[1] & (0x80 >> i)) >> (7-i)) << 1) |
(((key[0] & (0x80 >> i)) >> (7-i)) << 0);
}
-
return;
}
/**
return;
}
/**
@@
-522,8
+520,8
@@
int bruteforceDump(uint8_t dump[], size_t dumpsize, uint16_t keytable[])
errors += bruteforceItem(*attack, keytable);
}
free(attack);
errors += bruteforceItem(*attack, keytable);
}
free(attack);
-
clock_t t2 = clock()
;
- float diff = ((
(float)t2 - (float)t1)
/ CLOCKS_PER_SEC );
+
t1 = clock() - t1
;
+ float diff = ((
float)t1
/ CLOCKS_PER_SEC );
prnlog("\nPerformed full crack in %f seconds",diff);
// Pick out the first 16 bytes of the keytable.
prnlog("\nPerformed full crack in %f seconds",diff);
// Pick out the first 16 bytes of the keytable.
@@
-552,7
+550,6
@@
int bruteforceDump(uint8_t dump[], size_t dumpsize, uint16_t keytable[])
*/
int bruteforceFile(const char *filename, uint16_t keytable[])
{
*/
int bruteforceFile(const char *filename, uint16_t keytable[])
{
-
FILE *f = fopen(filename, "rb");
if(!f) {
prnlog("Failed to read from file '%s'", filename);
FILE *f = fopen(filename, "rb");
if(!f) {
prnlog("Failed to read from file '%s'", filename);
@@
-563,15
+560,28
@@
int bruteforceFile(const char *filename, uint16_t keytable[])
long fsize = ftell(f);
fseek(f, 0, SEEK_SET);
long fsize = ftell(f);
fseek(f, 0, SEEK_SET);
+ if (fsize < 0) {
+ prnlog("Error, when getting filesize");
+ if (f) {
+ fclose(f);
+ f = NULL;
+ }
+ return 1;
+ }
+
uint8_t *dump = malloc(fsize);
size_t bytes_read = fread(dump, 1, fsize, f);
uint8_t *dump = malloc(fsize);
size_t bytes_read = fread(dump, 1, fsize, f);
- fclose(f);
- if (bytes_read < fsize)
- {
+ if (f) {
+ fclose(f);
+ f = NULL;
+ }
+ if (bytes_read < fsize) {
prnlog("Error, could only read %d bytes (should be %d)",bytes_read, fsize );
}
prnlog("Error, could only read %d bytes (should be %d)",bytes_read, fsize );
}
- return bruteforceDump(dump,fsize,keytable);
+ uint8_t res = bruteforceDump(dump,fsize,keytable);
+ free(dump);
+ return res;
}
/**
*
}
/**
*
Impressum
,
Datenschutz