diff options
Diffstat (limited to 'src/analysis/scan/patterns')
-rw-r--r-- | src/analysis/scan/patterns/tokens/atom.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/src/analysis/scan/patterns/tokens/atom.c b/src/analysis/scan/patterns/tokens/atom.c index f59c81c..4f2ad67 100644 --- a/src/analysis/scan/patterns/tokens/atom.c +++ b/src/analysis/scan/patterns/tokens/atom.c @@ -211,11 +211,12 @@ void find_best_atom(const sized_binary_t *raw, size_t maxsize, tracked_scan_atom bin_t ch; /* Octets à étudier */ size_t best_letters; /* Mémorisation de décompte */ size_t *ptr_letters; /* Pointeur vers le décompte */ - int best_rating; /* Meilleur notation obtenue */ + int raw_rating; /* Notation brute de séquence */ uint8_t seen[256]; /* Mémorisation des passages */ size_t uniq; /* Nombre d'octets originaux */ - size_t max_loop; /* Limitation des itérations */ const bin_t *last; /* Dernier caractère étudié */ + int best_rating; /* Meilleur notation obtenue */ + size_t max_loop; /* Limitation des itérations */ size_t k; /* Boucle de parcours #2 */ size_t local_letters; /* Décompte courant des lettres*/ int local_rating; /* Notation courante */ @@ -258,7 +259,7 @@ void find_best_atom(const sized_binary_t *raw, size_t maxsize, tracked_scan_atom ptr_letters = (letters != NULL ? &best_letters : NULL); best_letters = 0; - best_rating = 0; + raw_rating = 0; memset(seen, 0, sizeof(seen)); uniq = 0; @@ -266,9 +267,9 @@ void find_best_atom(const sized_binary_t *raw, size_t maxsize, tracked_scan_atom last = raw->static_bin_data; for (k = 0; k < maxsize; k++) - best_rating += rate_byte_quality(*last++, seen, &uniq, ptr_letters); + raw_rating += rate_byte_quality(*last++, seen, &uniq, ptr_letters); - best_rating = finish_quality_rating(best_rating, uniq, maxsize); + best_rating = finish_quality_rating(raw_rating, uniq, maxsize); /* Parcours du reste du contenu */ @@ -283,14 +284,14 @@ void find_best_atom(const sized_binary_t *raw, size_t maxsize, tracked_scan_atom for (i = 0; i < max_loop; i++) { - local_rating += rate_byte_quality(*last++, seen, &uniq, ptr_letters); - local_rating -= rate_byte_quality(*first++, seen, &uniq, ptr_letters); + raw_rating += rate_byte_quality(*last++, seen, &uniq, ptr_letters); + raw_rating -= unrate_byte_quality(*first++, seen, &uniq, ptr_letters); - local_rating = finish_quality_rating(local_rating, uniq, maxsize); + local_rating = finish_quality_rating(raw_rating , uniq, maxsize); if (local_rating > best_rating) { - atom->pos = maxsize + i; + atom->pos = i + 1; best_letters = local_letters; best_rating = local_rating; |