merge soc07 r4947:4953 - os fingerprinting system improvements, trivial traceroute.cc grammar tweak

This commit is contained in:
fyodor 2007-08-11 04:29:03 +00:00
parent ea68216d71
commit 8a3b378695
4 changed files with 40 additions and 5 deletions

View file

@ -1573,15 +1573,31 @@ void HostOsScan::makeFP(HostOsScanStats *hss) {
/* Replace TTL with initial TTL. */
for(pAV = hss->FPtests[i]->results; pAV; pAV = pAV->next) {
if(pAV->attribute == "T") {
/* Found TTL item. The value for this attribute is the
received TTL encoded in decimal. We replace it with the
initial TTL encoded in hex. */
ttl = atoi(pAV->value);
/* found TTL item */
if(hss->distance_guess == -1)
hss->distance_guess = get_initial_ttl_guess(ttl) - ttl;
if(hss->distance != -1) {
/* We've gotten response for the UDP probe and thus have the "true" hop count. */
sprintf(pAV->value, "%hX", ttl + hss->distance);
/* We've gotten response for the UDP probe and thus have
the "true" hop count. Add the received TTL to the hop
count to get the initial TTL. */
ttl = ttl + hss->distance;
/* Keep track of the highest initial TTL we've seen. */
if (ttl > hss->target->FPR->max_init_ttl)
hss->target->FPR->max_init_ttl = ttl;
/* It's not possible for an initial TTL to be greater
than 255, but we might calculate it to be so if the
TTL was monkeyed with in transit. We cap the TTL at
255 to aid OS detection, while the too-high TTL is
stored in hss->target->FPR->max_init_ttl so we know
what happened. */
if (ttl > 0xFF)
ttl = 0xFF;
sprintf(pAV->value, "%hX", ttl);
} else {
/* Guess the initial TTL value */
pAV->attribute = "TG";