Nmap Development mailing list archives

Re: payload file prototype


From: Jay Fink <jay.fink () gmail com>
Date: Fri, 12 Feb 2010 19:53:18 -0500

On Fri, Feb 12, 2010 at 7:05 PM, David Fifield <david () bamsoftware com> wrote:
struct proto_port {
       u8 proto;
       u16 port;
};


When looking it up. That's the key and the payload struct is the value.

Cool.

I don't think you need to store the proto and dport for each payload;
the caller already has that information. You could do that if you needed
it for your data structure, but with a std::map you don't need that.

If you have a good idea for a data structure to use other than std::map,
that's cool. I just suggested it because this is exactly what it's
designed for, and it won't take a lot of extra work. You also wouldn't
need a special AllPayloads struct.

Okay, I need to read up on what std::map actually does :D

The worst part is just dealing with the C++ ugliness.

heh

Think of it in
pseudocode first. The algorithm will be something like this:

       loop:
               proto, ports, payload = parse_payload()
               for port in ports:
                       all_payloads[proto, port] = payload

Then lookup is just

       lookup(proto, port):
               return all_payloads[proto, port]

Okay - will do more reading up.

thanks!
 j
_______________________________________________
Sent through the nmap-dev mailing list
http://cgi.insecure.org/mailman/listinfo/nmap-dev
Archived at http://seclists.org/nmap-dev/


Current thread: