mirror of
https://github.com/nmap/nmap.git
synced 2025-12-06 04:31:29 +00:00
Remove unneeded g_has_npcap_loopback
This commit is contained in:
@@ -76,8 +76,6 @@ extern NmapOps o;
|
|||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
/* Need DnetName2PcapName */
|
/* Need DnetName2PcapName */
|
||||||
#include "libnetutil/netutil.h"
|
#include "libnetutil/netutil.h"
|
||||||
/* from libdnet's intf-win32.c */
|
|
||||||
extern "C" int g_has_npcap_loopback;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
@@ -159,7 +157,7 @@ void FPNetworkControl::init(const char *ifname, devtype iftype) {
|
|||||||
/* Obtain raw socket or check that we can obtain an eth descriptor. */
|
/* Obtain raw socket or check that we can obtain an eth descriptor. */
|
||||||
if ((o.sendpref & PACKET_SEND_ETH) && (iftype == devt_ethernet
|
if ((o.sendpref & PACKET_SEND_ETH) && (iftype == devt_ethernet
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
|| (g_has_npcap_loopback && iftype == devt_loopback)
|
|| (o.have_pcap && iftype == devt_loopback)
|
||||||
#endif
|
#endif
|
||||||
) && ifname != NULL) {
|
) && ifname != NULL) {
|
||||||
/* We don't need to store the eth handler because FPProbes come with a
|
/* We don't need to store the eth handler because FPProbes come with a
|
||||||
@@ -1810,7 +1808,7 @@ int FPHost6::build_probe_list() {
|
|||||||
/* ICMP Probe #3: Neighbor Solicitation. (only sent to on-link targets) */
|
/* ICMP Probe #3: Neighbor Solicitation. (only sent to on-link targets) */
|
||||||
if (this->target_host->directlyConnected()
|
if (this->target_host->directlyConnected()
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
&& !(g_has_npcap_loopback && this->target_host->ifType() == devt_loopback)
|
&& this->target_host->ifType() != devt_loopback
|
||||||
#endif
|
#endif
|
||||||
) {
|
) {
|
||||||
ip6 = new IPv6Header();
|
ip6 = new IPv6Header();
|
||||||
|
|||||||
@@ -107,10 +107,6 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
extern NmapOps o;
|
extern NmapOps o;
|
||||||
#ifdef WIN32
|
|
||||||
/* from libdnet's intf-win32.c */
|
|
||||||
extern "C" int g_has_npcap_loopback;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
struct idle_proxy_info {
|
struct idle_proxy_info {
|
||||||
Target host; /* contains name, IP, source IP, timing info, etc. */
|
Target host; /* contains name, IP, source IP, timing info, etc. */
|
||||||
@@ -605,7 +601,7 @@ static void initialize_idleproxy(struct idle_proxy_info *proxy, char *proxyName,
|
|||||||
/* First we need a raw socket ... */
|
/* First we need a raw socket ... */
|
||||||
if ((o.sendpref & PACKET_SEND_ETH) && (proxy->host.ifType() == devt_ethernet
|
if ((o.sendpref & PACKET_SEND_ETH) && (proxy->host.ifType() == devt_ethernet
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
|| (g_has_npcap_loopback && proxy->host.ifType() == devt_loopback)
|
|| (o.have_pcap && proxy->host.ifType() == devt_loopback)
|
||||||
#endif
|
#endif
|
||||||
)) {
|
)) {
|
||||||
if (!setTargetNextHopMAC(&proxy->host))
|
if (!setTargetNextHopMAC(&proxy->host))
|
||||||
|
|||||||
@@ -70,10 +70,6 @@
|
|||||||
#include "common_modified.h"
|
#include "common_modified.h"
|
||||||
|
|
||||||
extern NpingOps o;
|
extern NpingOps o;
|
||||||
#ifdef WIN32
|
|
||||||
/* from libdnet's intf-win32.c */
|
|
||||||
extern "C" int g_has_npcap_loopback;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
NpingTargets::NpingTargets(){
|
NpingTargets::NpingTargets(){
|
||||||
memset(specs, 0, 1024*(sizeof(char *)) );
|
memset(specs, 0, 1024*(sizeof(char *)) );
|
||||||
@@ -251,7 +247,7 @@ int NpingTargets::processSpecs(){
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
if (g_has_npcap_loopback == 0 && rnfo.ii.device_type == devt_loopback){
|
if (!o.havePcap() && rnfo.ii.device_type == devt_loopback){
|
||||||
nping_warning(QT_2, "Skipping %s because Windows does not allow localhost scans (try --unprivileged).", mytarget->getTargetIPstr() );
|
nping_warning(QT_2, "Skipping %s because Windows does not allow localhost scans (try --unprivileged).", mytarget->getTargetIPstr() );
|
||||||
delete mytarget;
|
delete mytarget;
|
||||||
continue;
|
continue;
|
||||||
@@ -287,7 +283,7 @@ int NpingTargets::processSpecs(){
|
|||||||
/* Determine next hop MAC address and target MAC address */
|
/* Determine next hop MAC address and target MAC address */
|
||||||
if( o.sendEth() ){
|
if( o.sendEth() ){
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
if (g_has_npcap_loopback == 1 && rnfo.ii.device_type == devt_loopback) {
|
if (o.havePcap() && rnfo.ii.device_type == devt_loopback) {
|
||||||
mytarget->setNextHopMACAddress(mytarget->getSrcMACAddress());
|
mytarget->setNextHopMACAddress(mytarget->getSrcMACAddress());
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|||||||
10
nse_dnet.cc
10
nse_dnet.cc
@@ -14,10 +14,6 @@
|
|||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
extern NmapOps o;
|
extern NmapOps o;
|
||||||
#ifdef WIN32
|
|
||||||
/* from libdnet's intf-win32.c */
|
|
||||||
extern "C" int g_has_npcap_loopback;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
DNET_METATABLE = lua_upvalueindex(1),
|
DNET_METATABLE = lua_upvalueindex(1),
|
||||||
@@ -169,7 +165,7 @@ static int ethernet_open (lua_State *L)
|
|||||||
|
|
||||||
if (ii == NULL || ii->device_type != devt_ethernet
|
if (ii == NULL || ii->device_type != devt_ethernet
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
&& !(g_has_npcap_loopback && ii->device_type == devt_loopback)
|
&& ii->device_type != devt_loopback
|
||||||
#endif
|
#endif
|
||||||
)
|
)
|
||||||
return luaL_argerror(L, 2, "device is not valid ethernet interface");
|
return luaL_argerror(L, 2, "device is not valid ethernet interface");
|
||||||
@@ -314,7 +310,7 @@ static int ip_send (lua_State *L)
|
|||||||
|
|
||||||
if (! (route.ii.device_type == devt_ethernet
|
if (! (route.ii.device_type == devt_ethernet
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
|| (g_has_npcap_loopback && route.ii.device_type == devt_loopback)
|
|| (o.have_pcap && route.ii.device_type == devt_loopback)
|
||||||
#endif
|
#endif
|
||||||
) ) {
|
) ) {
|
||||||
goto usesock;
|
goto usesock;
|
||||||
@@ -339,7 +335,7 @@ static int ip_send (lua_State *L)
|
|||||||
// Only determine mac addr info if it's not the Npcap Loopback Adapter.
|
// Only determine mac addr info if it's not the Npcap Loopback Adapter.
|
||||||
// Npcap loopback doesn't have a MAC address and isn't an ethernet device,
|
// Npcap loopback doesn't have a MAC address and isn't an ethernet device,
|
||||||
// so getNextHopMAC crashes.
|
// so getNextHopMAC crashes.
|
||||||
if (!(g_has_npcap_loopback && route.ii.device_type == devt_loopback)) {
|
if (route.ii.device_type != devt_loopback) {
|
||||||
#endif
|
#endif
|
||||||
if (!getNextHopMAC(route.ii.devfullname, route.ii.mac, &hdr.src, nexthop, dstmac))
|
if (!getNextHopMAC(route.ii.devfullname, route.ii.mac, &hdr.src, nexthop, dstmac))
|
||||||
return luaL_error(L, "failed to determine next hop MAC address");
|
return luaL_error(L, "failed to determine next hop MAC address");
|
||||||
|
|||||||
13
osscan2.cc
13
osscan2.cc
@@ -80,10 +80,6 @@
|
|||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
extern NmapOps o;
|
extern NmapOps o;
|
||||||
#ifdef WIN32
|
|
||||||
/* from libdnet's intf-win32.c */
|
|
||||||
extern "C" int g_has_npcap_loopback;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* 8 options:
|
/* 8 options:
|
||||||
* 0~5: six options for SEQ/OPS/WIN/T1 probes.
|
* 0~5: six options for SEQ/OPS/WIN/T1 probes.
|
||||||
@@ -1342,7 +1338,7 @@ HostOsScan::HostOsScan(Target *t) {
|
|||||||
|
|
||||||
if ((o.sendpref & PACKET_SEND_ETH) && (t->ifType() == devt_ethernet
|
if ((o.sendpref & PACKET_SEND_ETH) && (t->ifType() == devt_ethernet
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
|| (g_has_npcap_loopback && t->ifType() == devt_loopback)
|
|| (o.have_pcap && t->ifType() == devt_loopback)
|
||||||
#endif
|
#endif
|
||||||
)) {
|
)) {
|
||||||
if ((ethsd = eth_open_cached(t->deviceName())) == NULL)
|
if ((ethsd = eth_open_cached(t->deviceName())) == NULL)
|
||||||
@@ -3283,13 +3279,6 @@ OsScanInfo::OsScanInfo(std::vector<Target *> &Targets) {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef WIN32
|
|
||||||
if (g_has_npcap_loopback == 0 && Targets[targetno]->ifType() == devt_loopback) {
|
|
||||||
log_write(LOG_STDOUT, "Skipping OS Scan against %s because it doesn't work against your own machine (localhost)\n", Targets[targetno]->NameIP());
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (Targets[targetno]->ports.getStateCounts(IPPROTO_TCP, PORT_OPEN) == 0 ||
|
if (Targets[targetno]->ports.getStateCounts(IPPROTO_TCP, PORT_OPEN) == 0 ||
|
||||||
(Targets[targetno]->ports.getStateCounts(IPPROTO_TCP, PORT_CLOSED) == 0 &&
|
(Targets[targetno]->ports.getStateCounts(IPPROTO_TCP, PORT_CLOSED) == 0 &&
|
||||||
Targets[targetno]->ports.getStateCounts(IPPROTO_TCP, PORT_UNFILTERED) == 0)) {
|
Targets[targetno]->ports.getStateCounts(IPPROTO_TCP, PORT_UNFILTERED) == 0)) {
|
||||||
|
|||||||
@@ -92,10 +92,6 @@
|
|||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
extern NmapOps o;
|
extern NmapOps o;
|
||||||
#ifdef WIN32
|
|
||||||
/* from libdnet's intf-win32.c */
|
|
||||||
extern "C" int g_has_npcap_loopback;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* How long extra to wait before retransmitting for rate-limit detection */
|
/* How long extra to wait before retransmitting for rate-limit detection */
|
||||||
#define RLD_TIME_MS 1000
|
#define RLD_TIME_MS 1000
|
||||||
@@ -956,7 +952,7 @@ void UltraScanInfo::Init(std::vector<Target *> &Targets, const struct scan_lists
|
|||||||
if (ping_scan_arp || (ping_scan_nd && o.sendpref != PACKET_SEND_IP_STRONG) || ((o.sendpref & PACKET_SEND_ETH) &&
|
if (ping_scan_arp || (ping_scan_nd && o.sendpref != PACKET_SEND_IP_STRONG) || ((o.sendpref & PACKET_SEND_ETH) &&
|
||||||
(Targets[0]->ifType() == devt_ethernet
|
(Targets[0]->ifType() == devt_ethernet
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
|| (g_has_npcap_loopback && Targets[0]->ifType() == devt_loopback)
|
|| (Targets[0]->ifType() == devt_loopback)
|
||||||
#endif
|
#endif
|
||||||
))) {
|
))) {
|
||||||
/* We'll send ethernet packets with dnet */
|
/* We'll send ethernet packets with dnet */
|
||||||
@@ -2755,7 +2751,7 @@ void ultra_scan(std::vector<Target *> &Targets, const struct scan_lists *ports,
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
if (g_has_npcap_loopback == 0 && scantype != CONNECT_SCAN && Targets[0]->ifType() == devt_loopback) {
|
if (!o.have_pcap && scantype != CONNECT_SCAN && Targets[0]->ifType() == devt_loopback) {
|
||||||
log_write(LOG_STDOUT, "Skipping %s against %s because Windows does not support scanning your own machine (localhost) this way.\n", scantype2str(scantype), Targets[0]->NameIP());
|
log_write(LOG_STDOUT, "Skipping %s against %s because Windows does not support scanning your own machine (localhost) this way.\n", scantype2str(scantype), Targets[0]->NameIP());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -77,10 +77,6 @@
|
|||||||
#include "output.h"
|
#include "output.h"
|
||||||
|
|
||||||
extern NmapOps o;
|
extern NmapOps o;
|
||||||
#ifdef WIN32
|
|
||||||
/* from libdnet's intf-win32.c */
|
|
||||||
extern "C" int g_has_npcap_loopback;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Conducts an ARP ping sweep of the given hosts to determine which ones
|
/* Conducts an ARP ping sweep of the given hosts to determine which ones
|
||||||
are up on a local ethernet network */
|
are up on a local ethernet network */
|
||||||
@@ -378,7 +374,7 @@ static Target *setup_target(const HostGroupState *hs,
|
|||||||
t->setSrcMACAddress(rnfo.ii.mac);
|
t->setSrcMACAddress(rnfo.ii.mac);
|
||||||
}
|
}
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
else if (g_has_npcap_loopback && rnfo.ii.device_type == devt_loopback) {
|
else if (o.have_pcap && rnfo.ii.device_type == devt_loopback) {
|
||||||
if (o.spoofMACAddress())
|
if (o.spoofMACAddress())
|
||||||
t->setSrcMACAddress(o.spoofMACAddress());
|
t->setSrcMACAddress(o.spoofMACAddress());
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -836,8 +836,6 @@ TracerouteState::TracerouteState(std::vector<Target *> &targets) {
|
|||||||
assert(targets.size() > 0);
|
assert(targets.size() > 0);
|
||||||
|
|
||||||
if ((o.sendpref & PACKET_SEND_ETH) && targets[0]->ifType() == devt_ethernet) {
|
if ((o.sendpref & PACKET_SEND_ETH) && targets[0]->ifType() == devt_ethernet) {
|
||||||
/* No need to check for g_has_npcap_loopback on WIN32 because devt_loopback
|
|
||||||
* is checked earlier. */
|
|
||||||
ethsd = eth_open_cached(targets[0]->deviceName());
|
ethsd = eth_open_cached(targets[0]->deviceName());
|
||||||
if (ethsd == NULL)
|
if (ethsd == NULL)
|
||||||
fatal("dnet: failed to open device %s", targets[0]->deviceName());
|
fatal("dnet: failed to open device %s", targets[0]->deviceName());
|
||||||
|
|||||||
Reference in New Issue
Block a user