Nmap Development mailing list archives
Re: [NSE] generic file parsing for datafiles.lua
From: Kris Katterjohn <katterjohn () gmail com>
Date: Mon, 25 Aug 2008 18:49:23 -0500
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 jah wrote:
On 24/08/2008 20:43, Kris Katterjohn wrote:Anyway, I think this is a really cool idea. However, my one issue is whether or not this should be in datafiles or not. This is because your functions can parse much more than just Nmap's data files, which my original library was limited to. Maybe it should be a separate library ("parsefile" ?) and datafiles can use it for the parse*() functions. Or, as you suggested, maybe my parse*() functions can be removed leaving just your functions. But if these are removed, I especially think the library should be renamed for the reasons I mentioned above.I think the key thing about the parse_file() function is that not only can it deal with any (?) line-based data, but you can "have it your way" (mostly). So you could parse Nmap's data files, but have the data structured differently. I think it might be a bit confusing for script writers to have more than one method for parsing Nmap's data files and for that reason I'd advocate one-library-does-all. As for the name, parsefile is good, but I actually consider datafiles to be quite descriptive given that the kind of files that might be parsed are likely to be similar to Nmap's data files. I suppose wordlists might become common. These, of course, are just my opinions and I'm easily swayed.
Either way is OK with me, I just originally named the library "datafiles" because its existence was solely to handle Nmap's data files. Since you offer the simple parse_file(<data file>) functionality, it's still really easy to parse these files with or without my original functions. And since "datafiles" is already documented and whatnot, keeping the same name may be best.
Either way, I think these additions are neat and hopefully I'll get some time to test them out some more. For better or worse, the day the GSoC ended my school and personal life began again, but I've always tried to squeeze Nmap time into my schedule so we'll see :)Cripes! Has GSoC finished already? It's been raining a lot round these parts so it's quite hard to tell that the summer has ended.
Yes, unfortunately all good things come to an end. But I hate the heat so I'm hoping some cold weather comes soon :)
Thanks for the comments Kris, I've attached an updated lib which corrects my mistake and also adds the prevention of using a pattern based key with a table for a value - this would return an array of matches from each line, for each line, which would just be silly. Still to do is some method to prevent duplicate keys overwriting a value - perhaps appending the value. This would allow, for instance, indexing nmap services by service name. Obviously more testing is needed too.
Great, I'll try to test it all out soon and get back to you either way.
Regards, jah
Thanks, Kris Katterjohn -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iQIVAwUBSLNFAP9K37xXYl36AQJf2BAAuhEF/A0+uQohIa7QOPsFPSQehDkPnPk7 uYLJHcsnMJM9ufwLNVgWvvzGsMyTenZbtcsau+9OV/2wbueG9YuIzWHyJsPj6dS0 krc7rorYs+k+FqXlC/nQuKMyYGHSacjP/kV3W9FxFXeuFWv2cEChUt56sSbGcNX5 PeVm0Kj7INxPhW2HpWJGIE3kc3zPwD2LA6BmBnb73tutfsWf2Vx6IQoLeqlD2Oe5 5t7mRfxIOuAZMEAT+ly4Rms6Dab+bTru64lX5tFZVU4/hb9aTvieTzqiXELMpfHH qoDw28pN0QpXRdMXq9c8hkR75QTOxou9AN4FHygIfS8WWw5lL5DtdsRMGyTVUyQ4 VEXaa/6m9/XvwxqMBrhoD/pSF9m36R2n94FDsz0+Nkuwgc+CzW+G/wsQ/LPnfu2q DxoP4JGOD5Q66Es4DSBMeixK4w0HghU7wtqOLAu6eycETaC42LUTkuveZyWWuxWr 0iKHVON/Fb++eyERkp3RBC+lsE0RwPZJcsTr+3pffiOrYZu6g5UycyAPOH/CyRjH 8SDGGjFg6mlZSZvdtQrRYVtFkceTbniRvcnS0w2SiERKlbMxJNLaOfAihhJBRz5w +B9HqCy7K7x/vrv6CTlDK9/ETL45Y4ivj8loB7K5hGhBV82wZcNQOc+k2g8Npxra 1LF8oOfX0Gg= =lf4C -----END PGP SIGNATURE----- _______________________________________________ Sent through the nmap-dev mailing list http://cgi.insecure.org/mailman/listinfo/nmap-dev Archived at http://SecLists.Org
Current thread:
- [NSE] generic file parsing for datafiles.lua jah (Aug 23)
- Re: [NSE] generic file parsing for datafiles.lua Kris Katterjohn (Aug 24)
- Re: [NSE] generic file parsing for datafiles.lua jah (Aug 24)
- Re: [NSE] generic file parsing for datafiles.lua Kris Katterjohn (Aug 25)
- Re: [NSE] generic file parsing for datafiles.lua jah (Aug 24)
- Re: [NSE] generic file parsing for datafiles.lua Fyodor (Sep 02)
- Re: [NSE] generic file parsing for datafiles.lua Kris Katterjohn (Aug 24)