From aee73b577be556d1aeacd97aaadf0bdb6dda86fe Mon Sep 17 00:00:00 2001 From: fyodor Date: Mon, 25 Sep 2006 09:08:27 +0000 Subject: [PATCH] Update scripts to support new test point system --- scripts/fingerdiff.cc | 9 ++++++++- scripts/fingermatch.cc | 4 ++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/scripts/fingerdiff.cc b/scripts/fingerdiff.cc index 008755ea7..09a7d7cda 100644 --- a/scripts/fingerdiff.cc +++ b/scripts/fingerdiff.cc @@ -128,6 +128,7 @@ int main(int argc, char *argv[]) { double accuracy; char sourcefile[MAXPATHLEN]; int sourceline=-1; + FingerPrintDB *DB = NULL; char referenceFPString[8192]; char observedFPString[8192]; char line[512]; @@ -135,6 +136,7 @@ int main(int argc, char *argv[]) { int i, rc; int done=0; FILE *fp; + FingerPrint *MatchPoints = NULL; if (argc < 1 || argc > 2) usage(NULL); @@ -162,6 +164,11 @@ int main(int argc, char *argv[]) { if (readFP(fp, referenceFPString, sizeof(referenceFPString)) == -1) usage("Failed to read in supposed fingerprint in %s line %d\n", sourcefile, sourceline); fclose(fp); + + /* Try to parse the file as an nmap-DB to get the matchpoints */ + DB = parse_fingerprint_file(sourcefile); + if (DB) MatchPoints = DB->MatchPoints; + printf("STEP ONE: Reading REFERENCE FINGERPRINT from %s line %d:\n%s\n" ,sourcefile, sourceline, referenceFPString); } else { @@ -191,7 +198,7 @@ int main(int argc, char *argv[]) { } /* OK, now I've got the fingerprints -- I just need to compare them ... */ - accuracy = compare_fingerprints(referenceFP, observedFP, 1); + accuracy = compare_fingerprints(referenceFP, observedFP, MatchPoints, 1); if (accuracy == 1) printf("PERFECT MATCH!\n"); else printf("Accuracy of the two prints is %d%% -- see differences above.\n", diff --git a/scripts/fingermatch.cc b/scripts/fingermatch.cc index c12b22730..373253af2 100644 --- a/scripts/fingermatch.cc +++ b/scripts/fingermatch.cc @@ -107,7 +107,7 @@ #include "osscan.h" #include "fingerlib.h" -#define FINGERMATCH_GUESS_THRESHOLD 0.75 /* How low we will still show guesses for */ +#define FINGERMATCH_GUESS_THRESHOLD 0.80 /* How low we will still show guesses for */ void usage() { printf("Usage: fingermatch \n" @@ -118,7 +118,7 @@ void usage() { int main(int argc, char *argv[]) { char *fingerfile = NULL; - FingerPrint **reference_FPs = NULL; + FingerPrintDB *reference_FPs = NULL; FingerPrint *testFP; struct FingerPrintResults FPR; char fprint[8192];