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:
@@ -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
|
||||
|
||||
@@ -79,13 +79,14 @@
|
||||
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
|
||||
scanflags CDATA #IMPLIED
|
||||
protocol %port_protocols; #REQUIRED
|
||||
numservices %attr_numeric; #REQUIRED
|
||||
services CDATA #REQUIRED
|
||||
|
||||
2
nmap.cc
2
nmap.cc
@@ -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);
|
||||
|
||||
27
output.cc
27
output.cc
@@ -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");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user