1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-06 04:31:29 +00:00

Updated DTD, XML version, and anded scanflags attribute to scaninfo element.

This commit is contained in:
michael
2008-08-13 00:59:22 +00:00
parent 57ffa96d51
commit 931285f765
4 changed files with 36 additions and 6 deletions

View File

@@ -138,6 +138,10 @@ o The NSE C modules in nselib-bin are now linked explicitly against
Because RPM builds are static this fixes NSE C modules in
RPMs. [David]
o A new attribute has been added to XML output, scanflags, which lists
all user specified --scanflags for the scan. The XML output version
and DTD have been modified to account for this. [Michael]
Nmap 4.68 [2008-6-28]
o Doug integrated all of your version detection submissions and

View File

@@ -79,16 +79,17 @@
start %attr_numeric; #IMPLIED
startstr CDATA #IMPLIED
version CDATA #REQUIRED
xmloutputversion (1.02) #REQUIRED
xmloutputversion (1.03) #REQUIRED
>
<!-- this element is written in output.c:doscaninfo() -->
<!ELEMENT scaninfo EMPTY >
<!ATTLIST scaninfo
type %scan_types; #REQUIRED
type %scan_types; #REQUIRED
scanflags CDATA #IMPLIED
protocol %port_protocols; #REQUIRED
numservices %attr_numeric; #REQUIRED
services CDATA #REQUIRED
numservices %attr_numeric; #REQUIRED
services CDATA #REQUIRED
>
<!-- these elements are written in nmap.c:nmap_main() -->

View File

@@ -1499,7 +1499,7 @@ int nmap_main(int argc, char *argv[]) {
for(i=0; i < argc; i++)
log_write(LOG_XML, (i == argc-1)? "%s\" " : "%s ", fakeargv[i]);
log_write(LOG_XML, "start=\"%lu\" startstr=\"%s\" version=\"%s\" xmloutputversion=\"1.02\">\n",
log_write(LOG_XML, "start=\"%lu\" startstr=\"%s\" version=\"%s\" xmloutputversion=\"1.03\">\n",
(unsigned long) timep, mytime, NMAP_VERSION);
output_xml_scaninfo_records(&ports);

View File

@@ -1228,10 +1228,35 @@ void output_ports_to_machine_parseable_output(struct scan_lists *ports,
log_flush_all();
}
//A simple helper function for doscaninfo handles the c14n of o.scanflags
static void doscanflags(){
struct {
unsigned char flag;
const char *name;
} flags[] = {
{ TH_FIN, "FIN" }, { TH_SYN, "SYN" }, { TH_RST, "RST" },
{ TH_PUSH, "PSH" }, { TH_ACK, "ACK" }, { TH_URG, "URG" },
{ TH_ECE, "ECE" }, { TH_CWR, "CWR" }
};
if(o.scanflags!=-1){
log_write(LOG_XML, "scanflags=\"");
for(unsigned int i=0;i<sizeof(flags) / sizeof(flags[0]);i++){
if(o.scanflags & flags[i].flag){
log_write(LOG_XML, "%s",flags[i].name);
}
}
log_write(LOG_XML, "\"");
}
}
/* Simple helper function for output_xml_scaninfo_records */
static void doscaninfo(const char *type, const char *proto, unsigned short *ports,
int numports) {
log_write(LOG_XML, "<scaninfo type=\"%s\" protocol=\"%s\" numservices=\"%d\" services=\"", type, proto, numports);
log_write(LOG_XML, "<scaninfo type=\"%s\" ", type);
if(strncmp(proto,"tcp",3)==0){
doscanflags();
}
log_write(LOG_XML, " protocol=\"%s\" numservices=\"%d\" services=\"", proto, numports);
output_rangelist_given_ports(LOG_XML, ports, numports);
log_write(LOG_XML, "\" />\n");
}