Skip to content

Commit

Permalink
Move log_bogus_target() to output.cc
Browse files Browse the repository at this point in the history
  • Loading branch information
bonsaiviking committed May 1, 2024
1 parent 9c15b1e commit 5829b53
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 13 deletions.
9 changes: 9 additions & 0 deletions output.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1320,6 +1320,15 @@ void write_xml_hosthint(const Target *currenths) {
log_flush_all();
}

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();
}

static void write_xml_osclass(const OS_Classification *osclass, double accuracy) {
xml_open_start_tag("osclass");
xml_attribute("type", "%s", osclass->Device_Type);
Expand Down
5 changes: 5 additions & 0 deletions output.h
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,11 @@ void write_host_status(const Target *currenths);
/* Writes host status info to the XML stream wrapped in a <hosthint> tag */
void write_xml_hosthint(const Target *currenths);

/* 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. */
void log_bogus_target(const char *expr);

/* Prints the formatted OS Scan output to stdout, logfiles, etc (but only
if an OS Scan was performed */
void printosscanoutput(const Target *currenths);
Expand Down
14 changes: 1 addition & 13 deletions targets.cc
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
#include "nmap_dns.h"
#include "utils.h"
#include "nmap_error.h"
#include "xml.h"
#include "output.h"

extern NmapOps o;
#ifdef WIN32
Expand Down Expand Up @@ -349,18 +349,6 @@ const char *HostGroupState::next_expression() {
return NULL;
}

/* 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();
}

/* Returns a newly allocated Target with the given address. Handles all the
details like setting the Target's address and next hop. */
static Target *setup_target(const HostGroupState *hs,
Expand Down

0 comments on commit 5829b53

Please sign in to comment.