mirror of
https://github.com/nmap/nmap.git
synced 2026-10-20 19:01:56 +00:00
Add the new <target> element to XML output.
This element is intended to report information about command-line target specifications. Now it's used with status="skipped" to indicate that a specification was ignored.
This commit is contained in:
parent
a3efccc448
commit
5067f767b7
3 changed files with 29 additions and 2 deletions
|
|
@ -1,5 +1,11 @@
|
|||
# Nmap Changelog ($Id$); -*-text-*-
|
||||
|
||||
o Added a new <target> element to XML output that indicates when a
|
||||
target specification was ignored, perhaps because of a syntax error
|
||||
or DNS failure. It looks like this:
|
||||
<target specification="1.2.3.4.5" status="skipped" reason="invalid"/>
|
||||
[David Fifield]
|
||||
|
||||
o [NSE] Added the script mmouse-exec that connects to a Mobile Mouse server,
|
||||
starts an application, and sends a sequence of keystrokes to it. [Patrik
|
||||
Karlsson]
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@
|
|||
It represents to the topmost element of the output document.
|
||||
-->
|
||||
<!ELEMENT nmaprun (scaninfo*, verbose, debugging,
|
||||
( taskbegin | taskprogress | taskend |
|
||||
( target | taskbegin | taskprogress | taskend |
|
||||
prescript | postscript | host | output)*,
|
||||
runstats) >
|
||||
<!ATTLIST nmaprun
|
||||
|
|
@ -103,6 +103,12 @@
|
|||
<!ELEMENT debugging EMPTY >
|
||||
<!ATTLIST debugging level %attr_numeric; #IMPLIED >
|
||||
|
||||
<!ELEMENT target EMPTY >
|
||||
<!ATTLIST target specification CDATA #REQUIRED
|
||||
status (skipped) #IMPLIED
|
||||
reason (invalid) #IMPLIED
|
||||
>
|
||||
|
||||
<!-- this element is written in timing.c:beginOrEndTask() -->
|
||||
<!ELEMENT taskbegin EMPTY >
|
||||
<!ATTLIST taskbegin
|
||||
|
|
|
|||
17
targets.cc
17
targets.cc
|
|
@ -105,6 +105,7 @@
|
|||
#include "nmap_dns.h"
|
||||
#include "nmap_tty.h"
|
||||
#include "utils.h"
|
||||
#include "xml.h"
|
||||
using namespace std;
|
||||
extern NmapOps o;
|
||||
|
||||
|
|
@ -309,6 +310,18 @@ static bool target_needs_new_hostgroup(const HostGroupState *hs, const Target *t
|
|||
return false;
|
||||
}
|
||||
|
||||
/* Add a <target> element to the XML stating that a target specification was
|
||||
ignored. This can be because of, for example, a DNS resolution failure, or a
|
||||
syntax error. */
|
||||
static void log_bogus_target(const char *expr) {
|
||||
xml_open_start_tag("target");
|
||||
xml_attribute("specification", "%s", expr);
|
||||
xml_attribute("status", "skipped");
|
||||
xml_attribute("reason", "invalid");
|
||||
xml_close_empty_tag();
|
||||
xml_newline();
|
||||
}
|
||||
|
||||
Target *nexthost(HostGroupState *hs, const addrset *exclude_group,
|
||||
struct scan_lists *ports, int pingtype) {
|
||||
int i;
|
||||
|
|
@ -400,7 +413,9 @@ Target *nexthost(HostGroupState *hs, const addrset *exclude_group,
|
|||
while (hs->next_expression < hs->num_expressions) {
|
||||
const char *expr;
|
||||
expr = hs->target_expressions[hs->next_expression++];
|
||||
if (hs->current_expression.parse_expr(expr, o.af()) == 0)
|
||||
if (hs->current_expression.parse_expr(expr, o.af()) != 0)
|
||||
log_bogus_target(expr);
|
||||
else
|
||||
break;
|
||||
}
|
||||
} else break;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue