ADD: Some instructions for configure CoverityScan using alternative compiler like the ARM-NONE-EABI-GCC

FIX: stupid clock() == -1 on systems who doesn't have it..
This commit is contained in:
iceman1001 2016-01-19 21:48:29 +01:00
commit b112787d4f
4 changed files with 85 additions and 53 deletions

View file

@ -17,6 +17,24 @@ NEWS:
[![Coverity Scan Build Status](https://scan.coverity.com/projects/5117/badge.svg)](https://scan.coverity.com/projects/proxmark3-iceman-fork) [![Coverity Scan Build Status](https://scan.coverity.com/projects/5117/badge.svg)](https://scan.coverity.com/projects/proxmark3-iceman-fork)
## Coverity Scan Config && Run
Download the Coverity Scan Self-buld and install it.
You will need to configure ARM-NON-EABI- Compiler for it to use:
:: Configure
cov-configure --comptype gcc --compiler /opt/devkitpro/devkitARM/bin/arm-none-eabi-gcc
::run it (I'm running on Ubuntu)
cov-build --dir cov-int make all UBUNTU_1404_QT4=1
:: make a tarball
tar czvf proxmark3.tgz cov-int
:: upload it to coverity.com
## Whats changed?
Whats in this fork? I have scraped the web for different enhancements to the PM3 source code and not all of them ever found their way to the master branch. Whats in this fork? I have scraped the web for different enhancements to the PM3 source code and not all of them ever found their way to the master branch.
Among the stuff is Among the stuff is
@ -39,6 +57,8 @@ Among the stuff is
* A Bruteforce for T55XX passwords against tag. * A Bruteforce for T55XX passwords against tag.
* A Bruteforce for AWID 26, starting w a facilitycode then trying all 0xFFFF cardnumbers via simulation. To be used against a AWID Reader. * A Bruteforce for AWID 26, starting w a facilitycode then trying all 0xFFFF cardnumbers via simulation. To be used against a AWID Reader.
* Blaposts Crapto1 v3.3
Give me a hint, and I'll see if I can't merge in the stuff you have. Give me a hint, and I'll see if I can't merge in the stuff you have.

View file

@ -30,7 +30,7 @@ int CmdHF14AMifare(const char *Cmd)
printf("Press button on the proxmark3 device to abort both proxmark3 and client.\n"); printf("Press button on the proxmark3 device to abort both proxmark3 and client.\n");
printf("-------------------------------------------------------------------------\n"); printf("-------------------------------------------------------------------------\n");
clock_t t = clock(); clock_t t1 = clock();
start: start:
clearCommandBuffer(); clearCommandBuffer();
@ -91,9 +91,10 @@ start:
printf("------------------------------------------------------------------\n"); printf("------------------------------------------------------------------\n");
PrintAndLog("Found valid key: %012"llx" \n", r_key); PrintAndLog("Found valid key: %012"llx" \n", r_key);
} }
t = clock() - t; t1 = clock() - t1;
//printf("Time in darkside: %d ticks - %1.2f seconds\n", t, ((float)t)/CLOCKS_PER_SEC); if ( t1 > 0 ){
printf("Time in darkside: %Lf ticks - %1.2Lf seconds\n", (long double)t, ((long double)t)/CLOCKS_PER_SEC); PrintAndLog("Time in darkside: %f ticks - %1.2f sec\n", (float)t1, ((float)t1)/CLOCKS_PER_SEC);
}
return 0; return 0;
} }
@ -675,7 +676,7 @@ int CmdHF14AMfNested(const char *Cmd)
} }
} }
else { // ------------------------------------ multiple sectors working else { // ------------------------------------ multiple sectors working
clock_t time1 = clock(); clock_t t1 = clock();
e_sector = calloc(SectorsCnt, sizeof(sector)); e_sector = calloc(SectorsCnt, sizeof(sector));
if (e_sector == NULL) return 1; if (e_sector == NULL) return 1;
@ -776,7 +777,10 @@ int CmdHF14AMfNested(const char *Cmd)
} }
} }
PrintAndLog("Time in nested: %1.2f (%1.2f sec per key)\n\n", ((float)clock() - time1)/CLOCKS_PER_SEC, ((float)clock() - time1)/iterations/CLOCKS_PER_SEC); t1 = clock() - t1;
if ( t1 > 0 ) {
PrintAndLog("Time in nested: %f ticks %1.2f sec (%1.2f sec per key)\n\n", (float)t1, ((float)t1)/CLOCKS_PER_SEC, ((float)t1)/iterations/CLOCKS_PER_SEC);
}
PrintAndLog("-----------------------------------------------\nIterations count: %d\n\n", iterations); PrintAndLog("-----------------------------------------------\nIterations count: %d\n\n", iterations);
//print them //print them
@ -1131,7 +1135,7 @@ int CmdHF14AMfChk(const char *Cmd)
} }
} }
// time // time
clock_t time1 = clock(); clock_t t1 = clock();
for ( int t = !keyType; t < 2; keyType==2?(t++):(t=2) ) { for ( int t = !keyType; t < 2; keyType==2?(t++):(t=2) ) {
int b=blockNo; int b=blockNo;
@ -1154,8 +1158,10 @@ int CmdHF14AMfChk(const char *Cmd)
b<127?(b+=4):(b+=16); b<127?(b+=4):(b+=16);
} }
} }
printf("Time in checkkeys: %1.3f (%1.3f sec per key)\n\n", ((float)clock() - time1)/CLOCKS_PER_SEC, ((float)clock() - time1)/keycnt/CLOCKS_PER_SEC); t1 = clock() - t1;
if ( t1 > 0 ){
printf("Time in checkkeys: %f ticks %1.2f sec (%1.2f sec per key)\n\n", (float)t1, ((float)t1)/CLOCKS_PER_SEC, ((float)t1)/keycnt/CLOCKS_PER_SEC);
}
if (transferToEml) { if (transferToEml) {
uint8_t block[16]; uint8_t block[16];

View file

@ -750,11 +750,13 @@ static void simulate_acquire_nonces()
} while (num_good_first_bytes < GOOD_BYTES_REQUIRED); } while (num_good_first_bytes < GOOD_BYTES_REQUIRED);
time1 = clock() - time1;
if ( time1 > 0 ) {
PrintAndLog("Acquired a total of %d nonces in %1.1f seconds (%0.0f nonces/minute)", PrintAndLog("Acquired a total of %d nonces in %1.1f seconds (%0.0f nonces/minute)",
total_num_nonces, total_num_nonces,
((float)clock()-time1)/CLOCKS_PER_SEC, ((float)time1)/CLOCKS_PER_SEC,
total_num_nonces*60.0*CLOCKS_PER_SEC/((float)clock()-time1)); total_num_nonces * 60.0 * CLOCKS_PER_SEC/(float)time1);
}
fprintf(fstats, "%d;%d;%d;%1.2f;", total_num_nonces, total_added_nonces, num_good_first_bytes, CONFIDENCE_THRESHOLD); fprintf(fstats, "%d;%d;%d;%1.2f;", total_num_nonces, total_added_nonces, num_good_first_bytes, CONFIDENCE_THRESHOLD);
} }
@ -876,11 +878,14 @@ static int acquire_nonces(uint8_t blockNo, uint8_t keyType, uint8_t *key, uint8_
fclose(fnonces); fclose(fnonces);
} }
time1 = clock() - time1;
if ( time1 > 0 ) {
PrintAndLog("Acquired a total of %d nonces in %1.1f seconds (%0.0f nonces/minute)", PrintAndLog("Acquired a total of %d nonces in %1.1f seconds (%0.0f nonces/minute)",
total_num_nonces, total_num_nonces,
((float)clock()-time1)/CLOCKS_PER_SEC, ((float)time1)/CLOCKS_PER_SEC,
total_num_nonces*60.0*CLOCKS_PER_SEC/((float)clock()-time1)); total_num_nonces * 60.0 * CLOCKS_PER_SEC/(float)time1
);
}
return 0; return 0;
} }
@ -1434,47 +1439,48 @@ int mfnestedhard(uint8_t blockNo, uint8_t keyType, uint8_t *key, uint8_t trgBloc
fclose(fstats); fclose(fstats);
} else { } else {
init_nonce_memory(); init_nonce_memory();
if (nonce_file_read) { // use pre-acquired data from file nonces.bin if (nonce_file_read) { // use pre-acquired data from file nonces.bin
if (read_nonce_file() != 0) { if (read_nonce_file() != 0) {
return 3; return 3;
} }
Check_for_FilterFlipProperties(); Check_for_FilterFlipProperties();
num_good_first_bytes = MIN(estimate_second_byte_sum(), GOOD_BYTES_REQUIRED); num_good_first_bytes = MIN(estimate_second_byte_sum(), GOOD_BYTES_REQUIRED);
} else { // acquire nonces. } else { // acquire nonces.
uint16_t is_OK = acquire_nonces(blockNo, keyType, key, trgBlockNo, trgKeyType, nonce_file_write, slow); uint16_t is_OK = acquire_nonces(blockNo, keyType, key, trgBlockNo, trgKeyType, nonce_file_write, slow);
if (is_OK != 0) { if (is_OK != 0) {
return is_OK; return is_OK;
}
} }
Tests();
PrintAndLog("");
PrintAndLog("Sum(a0) = %d", first_byte_Sum);
// PrintAndLog("Best 10 first bytes: %02x, %02x, %02x, %02x, %02x, %02x, %02x, %02x, %02x, %02x",
// best_first_bytes[0],
// best_first_bytes[1],
// best_first_bytes[2],
// best_first_bytes[3],
// best_first_bytes[4],
// best_first_bytes[5],
// best_first_bytes[6],
// best_first_bytes[7],
// best_first_bytes[8],
// best_first_bytes[9] );
PrintAndLog("Number of first bytes with confidence > %2.1f%%: %d", CONFIDENCE_THRESHOLD*100.0, num_good_first_bytes);
clock_t time1 = clock();
generate_candidates(first_byte_Sum, nonces[best_first_bytes[0]].Sum8_guess);
time1 = clock() - time1;
if ( time1 > 0 )
PrintAndLog("Time for generating key candidates list: %1.0f seconds", ((float)time1)/CLOCKS_PER_SEC);
brute_force();
free_nonces_memory();
free_statelist_cache();
free_candidates_memory(candidates);
candidates = NULL;
} }
Tests();
PrintAndLog("");
PrintAndLog("Sum(a0) = %d", first_byte_Sum);
// PrintAndLog("Best 10 first bytes: %02x, %02x, %02x, %02x, %02x, %02x, %02x, %02x, %02x, %02x",
// best_first_bytes[0],
// best_first_bytes[1],
// best_first_bytes[2],
// best_first_bytes[3],
// best_first_bytes[4],
// best_first_bytes[5],
// best_first_bytes[6],
// best_first_bytes[7],
// best_first_bytes[8],
// best_first_bytes[9] );
PrintAndLog("Number of first bytes with confidence > %2.1f%%: %d", CONFIDENCE_THRESHOLD*100.0, num_good_first_bytes);
clock_t start_time = clock();
generate_candidates(first_byte_Sum, nonces[best_first_bytes[0]].Sum8_guess);
PrintAndLog("Time for generating key candidates list: %1.0f seconds", (float)(clock() - start_time)/CLOCKS_PER_SEC);
brute_force();
free_nonces_memory();
free_statelist_cache();
free_candidates_memory(candidates);
candidates = NULL;
}
return 0; return 0;
} }

View file

@ -522,8 +522,8 @@ int bruteforceDump(uint8_t dump[], size_t dumpsize, uint16_t keytable[])
errors += bruteforceItem(*attack, keytable); errors += bruteforceItem(*attack, keytable);
} }
free(attack); free(attack);
clock_t t2 = clock(); t1 = clock() - t1;
float diff = (((float)t2 - (float)t1) / CLOCKS_PER_SEC ); float diff = ((float)t1 / CLOCKS_PER_SEC );
prnlog("\nPerformed full crack in %f seconds",diff); prnlog("\nPerformed full crack in %f seconds",diff);
// Pick out the first 16 bytes of the keytable. // Pick out the first 16 bytes of the keytable.