diff --git a/TargetGroup.cc b/TargetGroup.cc index a14b4c3e4..6b2870b13 100644 --- a/TargetGroup.cc +++ b/TargetGroup.cc @@ -568,6 +568,7 @@ const std::list &TargetGroup::get_resolved_addrs(void) } #ifndef NOLUA +/* debug level for the adding target is: 3 */ NewTargets *NewTargets::get (void) { if (new_targets) return new_targets; @@ -600,8 +601,11 @@ unsigned long NewTargets::push (const char *target) { /* push target onto the queue for future scans */ queue.push(tg); - if (o.debugging > 3) + if (o.debugging > 2) log_write(LOG_PLAIN, "New target %s pushed onto the queue.\n", tg.c_str()); + } else { + if (o.debugging > 2) + log_write(LOG_PLAIN, "Target %s is already in the queue.\n", tg.c_str()); } } @@ -645,11 +649,11 @@ unsigned long NewTargets::get_queued (void) { unsigned long NewTargets::insert (const char *target) { if (*target) { if (new_targets == NULL) { - error("Error: to add targets run with -sC or --script options."); + error("ERROR: to add targets run with -sC or --script options."); return 0; } if (o.current_scantype == SCRIPT_POST_SCAN) { - error("Error: adding targets is disabled in the Post-scanning phase."); + error("ERROR: adding targets is disabled in the Post-scanning phase."); return 0; } } diff --git a/nse_nmaplib.cc b/nse_nmaplib.cc index 55a8efc85..43d42075d 100644 --- a/nse_nmaplib.cc +++ b/nse_nmaplib.cc @@ -715,8 +715,7 @@ static int l_add_targets (lua_State *L) /* errors */ } else { lua_pushnumber(L, ntarget); - lua_pushstring(L, - "Error: failed to add targets, post-scanning phase or no resources."); + lua_pushstring(L, "failed to add new targets."); return 2; } } else { diff --git a/nselib/target.lua b/nselib/target.lua index 0064c47a0..2f0f0effb 100644 --- a/nselib/target.lua +++ b/nselib/target.lua @@ -83,16 +83,16 @@ add = function (...) -- Force the check here, but it would be better if scripts -- check ALLOW_NEW_TARGETS before calling target.add() if not ALLOW_NEW_TARGETS then - stdnse.print_debug(3, - "Error: to add targets run with --script-args 'newtargets'") - return false, "Error: to add targets run with --script-args 'newtargets'" + stdnse.print_debug(1, + "ERROR: to add targets run with --script-args 'newtargets'") + return false, "to add targets run with --script-args 'newtargets'" end local new_targets = {count = select("#", ...), ...} -- function called without arguments if new_targets.count == 0 then - return true, nmap.add_targets() + return true, nmap.add_targets() end new_targets.count = calc_max_targets(new_targets.count) @@ -100,7 +100,7 @@ add = function (...) if new_targets.count == 0 then stdnse.print_debug(3, "Warning: Maximum new targets reached, no more new targets.") - return false, "Warning: Maximum new targets reached, no more new targets." + return false, "Maximum new targets reached, no more new targets." end local hosts, err = nmap.add_targets(unpack(new_targets,1,new_targets.count))