Nmap Development mailing list archives

[PATCH] --comment option


From: Kris Katterjohn <katterjohn () gmail com>
Date: Sat, 15 Sep 2007 11:00:00 -0500

Hey everyone!

I know Nmap is in a feature freeze, so I'm sending this patch so it's archived on seclists if/when it can be applied. It's so small it shouldn't unstabilize Nmap, but when it's a feature freeze it's a feature freeze :)

This patch adds a --comment option, which allows you to send a comment (some text) along with the packets. It's basically just like --data-length (the way I implemented it) but you choose what goes with the packets rather than just random data.

I saw this on the Nmap TODO, and thought it was an interesting idea. Here's a little example from the TODO:

--comment "Scan conducted by Marc Reis from SecOps, extension 2147"

Please let me know what you think!

Thanks,
Kris Katterjohn
Index: nmap.cc
===================================================================
--- nmap.cc     (revision 5839)
+++ nmap.cc     (working copy)
@@ -581,6 +581,7 @@
       {"version-trace", no_argument, 0, 0}, /* Display -sV related activity */
       {"data_length", required_argument, 0, 0},
       {"data-length", required_argument, 0, 0},
+      {"comment", required_argument, 0, 0},
       {"send_eth", no_argument, 0, 0},
       {"send-eth", no_argument, 0, 0},
       {"send_ip", no_argument, 0, 0},
@@ -794,6 +795,8 @@
        o.setVersionTrace(true);
        o.debugging++;
       } else if (optcmp(long_options[option_index].name, "data-length") == 0) {
+       if (o.extra_payload_length)
+         fatal("Can't use --data-length and --comment together, or multiple times");
        o.extra_payload_length = atoi(optarg);
        if (o.extra_payload_length < 0) {
          fatal("data-length must be greater than 0");
@@ -801,6 +804,11 @@
          o.extra_payload = (char *) safe_malloc(o.extra_payload_length);
          get_random_bytes(o.extra_payload, o.extra_payload_length);
        }
+      } else if (optcmp(long_options[option_index].name, "comment") == 0) {
+       if (o.extra_payload_length)
+         fatal("Can't use --data-length and --comment together, or multiple times");
+       o.extra_payload = strdup(optarg);
+       o.extra_payload_length = strlen(o.extra_payload);
       } else if (optcmp(long_options[option_index].name, "send-eth") == 0) {
        o.sendpref = PACKET_SEND_ETH_STRONG;
       } else if (optcmp(long_options[option_index].name, "send-ip") == 0) {

_______________________________________________
Sent through the nmap-dev mailing list
http://cgi.insecure.org/mailman/listinfo/nmap-dev
Archived at http://SecLists.Org

Current thread: