title: Python nmap module error (decreasing to 2.0\nRTTVAR has grown to over 2.3 seconds)
body: <p>Well, this is just all kinds of weird to me. I've been working on this script to automate some nmap scans, and dump them into a database to hopefully do comparisons and find out which ports are open that might not have been open during the last scan. The script is below, and it worked great for the first test run, but when I changed the hostlist variable to scan a different subnet, it quit working. The scan took WAAAY longer than normal, and when it finally errored out it just printed two or three screens worth of </p>
  
  <pre><code>"(decreasing to 2.0\nRTTVAR has grown to over 2.3 seconds)"
  </code></pre>
  
  <p>It would alternate between 2.0 and 2.3 seconds, but that's pretty much the spam I got dumped to stdout. The first time I ran the script and it worked I didn't have the day checker in there, but when I commented those out and tried to run it again the way it was the first time it worked, with the new subnet as the only difference, it was still borked. Any thoughts on what's going on? Script is below. Don't mind that I don't actually use the results variable, it's a young script and I'm still learning the nmap module ;)</p>
  
  <pre><code>#!/usr/bin/python
  
  # automated nmap scanning script
  
  import nmap
  import MySQLdb
  #import datetime
  
  # initialize port scanner and hosts to be scanned
  
  nm = nmap.PortScanner()
  
  #if datetime.datetime.today().weekday() == 2:
  hostlist = 'XXX.XXX.XXX.0/24'
  
  # open database connection and prepare a cursor
  
  db = MySQLdb.connect("XXXX","XXXX","XXXX","XXXX")
  
  cursor = db.cursor()
  
  # scan
  
  results = nm.scan(hosts=hostlist, arguments='-PN')
  
  for item in nm.all_hosts():
  #       print('Host: %s (%s)') % (item, nm[item]['hostname'])
          if 'tcp' in nm[item]:
                  for port in nm[item]['tcp'].keys():
  #                       print("\t %s") % (port)
                          sql = "INSERT INTO scanresults (ipaddress, port) VALUES ('%s', '%s')" % (item, port)
                          try:
                                  cursor.execute(sql)
                                  db.commit()
                          except:
                                  print "There was an error!"
                                  db.rollback()
  
  db.close()
  </code></pre>