From 04f595e692969aeb71472bcacbfb728e521a474e Mon Sep 17 00:00:00 2001 From: david Date: Tue, 14 Feb 2012 02:59:28 +0000 Subject: [PATCH] Use stable_sort when sorting OS fingerprints for comparison. Often an OS will respond differently to the second transmission of a probe than to the first. For example, sometimes after it sends a SYN/ACK it loses patience and sends a RST. The different second probe often has different flags and options. In OS integration, I normally want to compare with the first set of responses whenever they differ, so keep them in the first position when sorting. --- osscan.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osscan.cc b/osscan.cc index 6d44986da..611e8f919 100644 --- a/osscan.cc +++ b/osscan.cc @@ -213,8 +213,8 @@ void FingerPrint::sort() { unsigned int i; for (i = 0; i < tests.size(); i++) - std::sort(tests[i].results.begin(), tests[i].results.end()); - std::sort(tests.begin(), tests.end()); + std::stable_sort(tests[i].results.begin(), tests[i].results.end()); + std::stable_sort(tests.begin(), tests.end()); } /* Compare an observed value (e.g. "45") against an OS DB expression (e.g.