Nmap Development mailing list archives

Re: payload file prototype


From: Jay Fink <jay.fink () gmail com>
Date: Sun, 14 Feb 2010 20:07:41 -0500

So back to the initializing part, now that I read up on what std::map
does it makes more sense. We have:

struct proto_port {
  u8 proto;
 u16 port;
};

is our key pair that will actually be a single key to map::std.
Following might be what the global map looks like:

typedef map<void, char *> allPayloads;
allPayloads Payload;

lets say we were ready to insert a payload into the map, lets say we
found the following (not a real example) in our initialization loop:

udp 2234 "\x00\x01"

our parsing loop passes it to:
tmp_payload = "\x00\x01";
tmp_proto_port.proto = 17;
tmp_proto_pport.port = 2234;
Payload.insert(pair<vopid, char*)(tmp_proto_port, tmp_payload));

I'm taking massive liberties with the types and passing. The only
difficulty I see is lookups, the documentation I read says that
looking for or comparing keys uses the bare value in the key pair,
which is fine, a simple loop could handle digging into the proto_port
struct and get a match like the psuedo code points out.

And yes that looks waaay simpler :D

Does that all make sense?
_______________________________________________
Sent through the nmap-dev mailing list
http://cgi.insecure.org/mailman/listinfo/nmap-dev
Archived at http://seclists.org/nmap-dev/


Current thread: