Nmap Development mailing list archives

Spurious port closed bug fix


From: sean rivera <sean.au.rivera () gmail com>
Date: Fri, 17 Aug 2012 21:21:40 -0600

Hey all,

I've written a very simple patch for the spurious port closed bug
(below). All it does is create a local version of the o.magic_port
variable and increments it by 256 every time we reach a new phase in
the scan.

I'm sorry for the delay in getting to you all, I've been fighting with
Comcast costumer service for the last week to get them to turn on my
internet.


Index: scan_engine.cc
===================================================================
--- scan_engine.cc      (revision 29629)
+++ scan_engine.cc      (working copy)
@@ -118,6 +118,9 @@
 extern NmapOps o;
 class UltraScanInfo;

+/*I chose to declare this here in the same place as o in order to
keep the code base as similar as possible*/
+static u16 magic_port = o.magic_port;
+
 /* A few extra performance tuning parameters specific to ultra_scan. */
 struct ultra_scan_performance_vars : public scan_performance_vars {
   /* When a successful ping response comes back, it counts as this many
@@ -2476,7 +2479,7 @@
               || seq32_decode(USI, ntohl(tcp->th_seq), &tryno, &pingseq);
   } else {
     /* Get the values from the destination port (our source port). */
-    sport_decode(USI, o.magic_port, ntohs(tcp->th_dport), &tryno, &pingseq);
+    sport_decode(USI, magic_port, ntohs(tcp->th_dport), &tryno, &pingseq);
     goodseq = true;
   }

@@ -3356,7 +3359,7 @@
   if (o.magic_port_set)
     sport = o.magic_port;
   else
-    sport = sport_encode(USI, o.magic_port, tryno, pingseq);
+    sport = sport_encode(USI, magic_port, tryno, pingseq);

   probe->tryno = tryno;
   probe->pingseq = pingseq;
@@ -5677,7 +5680,10 @@
   o.current_scantype = scantype;

   init_payloads(); /* Load up _all_ payloads into a mapped table */
-
+  if (magic_port > 65278) { //Catch overflow
+    magic_port=33000; //Because we start out at 33000 everytime;
+  }
+  magic_port+=256;
   if (Targets.size() == 0) {
     return;
   }




-- 

~Sean Rivera
_______________________________________________
Sent through the nmap-dev mailing list
http://cgi.insecure.org/mailman/listinfo/nmap-dev
Archived at http://seclists.org/nmap-dev/


Current thread: