~ubuntu-branches/ubuntu/oneiric/nmap/oneiric

« back to all changes in this revision

Viewing changes to nmap.cc

  • Committer: Bazaar Package Importer
  • Author(s): LaMont Jones, LaMont Jones, stoiko, fyodor, kris, ejlbell, david, doug
  • Date: 2008-01-13 02:07:40 UTC
  • mfrom: (1.2.9 upstream)
  • Revision ID: james.westby@ubuntu.com-20080113020740-kesfam3iuljvp6t1
Tags: 4.53-1
[LaMont Jones]
* Package New upstream release.
* Cherry pick post-4.53 patches from [fyodor].  Closes: #459884
  - remove instances of .nse to prevent the docbook man page translation
    from wrongly including that string at the beginning of lines, which causes
    errors because nroff confuses it with the .ns nroff no-space mode command
  - regenerate man page -- remove instances of .nse to prevent the
    docbook man page translation from wrongly including that string at the
    beginning of lines, which causes errors because nroff confuses it with
    the .ns nroff no-space mode command

[stoiko]

* if nse's connect is issued on an open socket, close the old
  connection before
* move the check, wheter a socket is open, before connecting it again to
  l_nsock_queued() - otherwise there are problems with the returned values..

[fyodor]

* qualify fingerprint name
* spell-check, add 4.50 release announcement
* improve a mysql signature (suggested by Lionel Cons)
* sorting change, I think
* remove a duplicate for rpc number 536870916, userd or vtsk.  I kept vksd
  though without much research.  I'm open to comments from people who think
  we should keep userd instead.
* Added rpcinfo.nse script, which contacts a listening RPC portmapper
* improve nginx detection. patch from Sven Klemm.
  See http://seclists.org/nmap-dev/2007/q4/0682.html
* remove claim that using -v more than twice has no extra effect
* o Fix a bunch of warning/error messages which contained an extra
* o Fixed our Winpcap installer so that it waits for a Winpcap uninstall
* o Fixed Winpcap installer to install the right version of Packet.dll
* Update changelog and version numbers in preparation for 4.51BETA release
* fix version number
* update some links
* update copyright line at the top of files from 1996-2006 to 1996-2008
* remove duplicate crediting in an entry
* o Fixed Nmap Winpcap installer to use CurrentVersion registry key on
* add _ to the allowed workgroup name regex for netbios-ssn matchlines.
  Thanks to Bill Jaeger for the suggestion and partial patch
* Update changelog, version numbers in prep for Nmap 4.52 release
* trivial CHANGELOG adjustment
* applied an nginx http proxy signature patch from Sven Klemm
* Fix a problem which prevented proper port number matching in
  port_or_service() because the port variable passed to portnumber is
  shadowed by the variable passed during portrule check.  Report and
  patch are from Sven Klemm
* o Improved rpcinfo.nse to better sort and display available RPC
* Remove own ntohl() and use packet.u32() instead.  Patch from Sven Klemm
* o Added UPnP-info NSE script by Thomas Buchanan. It gathers
* o Impoved Windows executable installer by making uninstall work better
* update version number and changelog in prep for upcoming 4.53 release

[kris]

* recommitting my r6499: "fix robots.nse output: remove robots.txt
  comments on disallowed entry lines"
* Adding my strftime()-like conversion extensions to the logging functions
  (-oA, -oX, etc).  This contains a CHANGELOG entry and refguide changes
  which (hopefully) sum it up pretty well.
* okay, a change to r6530: the current %R and %T are being removed as
  colons are invalid chracters in Windows and Mac OS X filenames (thanks to
  jah for pointing out the problem on Windows).  What was %r and %t are now
  the new %R and %T.  All this means is that %r and %t are gone, and %R/%T
  are the same as with strftime() but without colons
* adding CHANGELOG entry for r6529 (robots.nse output fix)
* Add CHANGELOG entry for r6558: "Fix Zenmap crash when selecting Help from
  the Compare Results window.  Path wasn't imported"
* Adding new MySQLinfo NSE script for printing MySQL server information
* Upgrading libpcre from version 7.2 to 7.4.  Tested on Linux and Windows
* Fixing build problem on Mac OS X; my mistake (typo)
* adding nmap.fetchfile() function so scripts can find the nmap-* data files
* updating rpcinfo.nse to use nmap.fetchfile() instead of having the huge
  RPC table
* o Fixed multiple NSE scripts that weren't always properly closing their

[ejlbell]

* Traceroute bugfix for when the first hop of the first host in a
  tracegroup (reference trace) times out. The previous patch did not
  completely solve the issue due to an erronous check on the ttl, now we
  use a dedicated boolean flag. Thanks to Sebastián García for the bug
  report and testing.

[david]

* Document Zenmap r6535 in CHANGELOG.
* Escape OS fingerprints when writing them to an XML log. OS fingerprint don't
* Consider Windows paths starting with \ absolute when used with the
  --script option.
* Document Zenmap r6539 in CHANGELOG.
* Give credit for some recent CHANGELOG entries.
* Use just PAGE_READWRITE, not PAGE_READONLY | PAGE_READWRITE in the call to
* Fix the message printed when a host is skipped, for example on Windows when
* Use the filename tag for file name extensions in zenmap.xml.
* Fixed an error that showed itself on Windows when attempting to scan

[doug]

* Small bug in Polycom ViewStation match line
* Changed some protocol names to remove trailing
* Updated the IRC server info script to handle services
* s modifiers added to many match lines.
* I've seen "OpenBSD identd" on a linux box so I
* Renamed irc-serv protocols to irc and added a couple
* Moved BIND match line above a "catch all" line.
* NSE --host-timeout support
* NSE run-time interaction support
* New OfficeScan probe from Tom Sellers

Show diffs side-by-side

added added

removed removed

Lines of Context:
5
5
 *                                                                         *
6
6
 ***********************IMPORTANT NMAP LICENSE TERMS************************
7
7
 *                                                                         *
8
 
 * The Nmap Security Scanner is (C) 1996-2006 Insecure.Com LLC. Nmap is    *
 
8
 * The Nmap Security Scanner is (C) 1996-2008 Insecure.Com LLC. Nmap is    *
9
9
 * also a registered trademark of Insecure.Com LLC.  This program is free  *
10
10
 * software; you may redistribute and/or modify it under the terms of the  *
11
11
 * GNU General Public License as published by the Free Software            *
97
97
 *                                                                         *
98
98
 ***************************************************************************/
99
99
 
100
 
/* $Id: nmap.cc 6119 2007-11-03 01:31:02Z david $ */
 
100
/* $Id: nmap.cc 6633 2007-12-22 06:32:03Z fyodor $ */
101
101
 
102
102
#include "nmap.h"
103
103
#include "osscan.h"
472
472
  int num_host_exp_groups;
473
473
  char *machinefilename = NULL, *kiddiefilename = NULL, 
474
474
    *normalfilename = NULL, *xmlfilename = NULL;
 
475
  time_t now;
 
476
  struct tm *tm;
475
477
  HostGroupState *hstate = NULL;
476
478
  char *endptr = NULL;
477
479
  struct scan_lists *ports = NULL;
647
649
  win_pre_init();
648
650
#endif
649
651
 
 
652
  now = time(NULL);
 
653
  tm = localtime(&now);
 
654
 
650
655
  /* OK, lets parse these args! */
651
656
  optind = 1; /* so it can be called multiple times */
652
657
  while((arg = getopt_long_only(argc,fakeargv,"6Ab:D:d::e:Ffg:hIi:M:m:nO::o:P:p:qRrS:s:T:Vv", long_options, &option_index)) != EOF) {
816
821
      } else if (strcmp(long_options[option_index].name, "webxml") == 0) {
817
822
        o.setXSLStyleSheet("http://www.insecure.org/nmap/data/nmap.xsl");
818
823
      } else if (strcmp(long_options[option_index].name, "oN") == 0) {
819
 
        normalfilename = optarg;
 
824
        normalfilename = logfilename(optarg, tm);
820
825
      } else if (strcmp(long_options[option_index].name, "oG") == 0 ||
821
826
                 strcmp(long_options[option_index].name, "oM") == 0) {
822
 
        machinefilename = optarg;
 
827
        machinefilename = logfilename(optarg, tm);
823
828
      } else if (strcmp(long_options[option_index].name, "oS") == 0) {
824
 
        kiddiefilename = optarg;
 
829
        kiddiefilename = logfilename(optarg, tm);
825
830
      } else if (strcmp(long_options[option_index].name, "oH") == 0) {
826
831
        fatal("HTML output is not directly supported, though Nmap includes an XSL for transforming XML output into HTML.  See the man page.");
827
832
      } else if (strcmp(long_options[option_index].name, "oX") == 0) {
828
 
        xmlfilename = optarg;
 
833
        xmlfilename = logfilename(optarg, tm);
829
834
      } else if (strcmp(long_options[option_index].name, "oA") == 0) {
830
835
        char buf[MAXPATHLEN];
831
 
        Snprintf(buf, sizeof(buf), "%s.nmap", optarg);
 
836
        Snprintf(buf, sizeof(buf), "%s.nmap", logfilename(optarg, tm));
832
837
        normalfilename = strdup(buf);
833
 
        Snprintf(buf, sizeof(buf), "%s.gnmap", optarg);
 
838
        Snprintf(buf, sizeof(buf), "%s.gnmap", logfilename(optarg, tm));
834
839
        machinefilename = strdup(buf);
835
 
        Snprintf(buf, sizeof(buf), "%s.xml", optarg);
 
840
        Snprintf(buf, sizeof(buf), "%s.xml", logfilename(optarg, tm));
836
841
        xmlfilename = strdup(buf);
837
842
      } else if (strcmp(long_options[option_index].name, "thc") == 0) {
838
843
        printf("!!Greets to Van Hauser, Plasmoid, Skyper and the rest of THC!!\n");
1008
1013
        fatal("Unknown argument to -O.");
1009
1014
      break;
1010
1015
    case 'o':
1011
 
      normalfilename = optarg;
 
1016
      normalfilename = logfilename(optarg, tm);
1012
1017
      break;
1013
1018
    case 'P': 
1014
1019
      if (*optarg == '\0' || *optarg == 'I' || *optarg == 'E')
1244
1249
 
1245
1250
  if (!o.interactivemode) {
1246
1251
    char tbuf[128];
1247
 
    struct tm *tm;
1248
 
    time_t now = time(NULL);
1249
 
    if (!(tm = localtime(&now))) 
1250
 
      fatal("Unable to get current localtime()#!#");
1251
1252
    // ISO 8601 date/time -- http://www.cl.cam.ac.uk/~mgk25/iso-time.html 
1252
1253
    if (strftime(tbuf, sizeof(tbuf), "%Y-%m-%d %H:%M %Z", tm) <= 0)
1253
1254
      fatal("Unable to properly format time");
2786
2787
  }
2787
2788
 
2788
2789
  if (foundsomething && o.debugging > 1)
2789
 
    error("Fetchfile found %s\n", filename_returned);
 
2790
    error("Fetchfile found %s", filename_returned);
2790
2791
 
2791
2792
  return foundsomething;
2792
2793