AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题

问题[nmap](server)

Martin Hope
Fabio Rovati
Asked: 2021-10-27 08:01:24 +0800 CST

是否可以仅使用 IPtables 拦截 nmap 扫描?

  • 0

我正在尝试将来自 nmap 的所有扫描重定向到另一个目的地。我正在尝试 IPTABLES,但我不知道如何将 nmap 扫描与合法流量区分开来。

它是可以通过 IPTABLES 实现的,还是我应该去其他地方看看?

iptables nmap
  • 1 个回答
  • 62 Views
Martin Hope
Johannes
Asked: 2021-03-08 06:30:52 +0800 CST

以非管理员用户身份在 Docker 容器中运行 nmap

  • 1

我想在 Docker 容器中运行 Nmap 工具,但不使用默认的 root 用户帐户。我已经通过 setcap 设置了(希望)正确的功能。不幸的是,当我尝试运行它时,我只收到“不允许操作”错误。

这是我的码头文件:

FROM registry.access.redhat.com/ubi8/ubi-minimal:8.3

ENV LANG='en_US.UTF-8' LANGUAGE='en_US:en'

RUN microdnf install nmap which
RUN setcap cap_net_raw,cap_net_admin,cap_net_bind_service+eip $(which nmap)

USER 1001

CMD ["nmap", "--privileged", "-sU", "localhost"]

关于如何解决这个问题的任何想法?

linux security docker nmap
  • 1 个回答
  • 1257 Views
Martin Hope
m0ss
Asked: 2020-09-08 02:22:30 +0800 CST

为什么要按两次回车在 ncap/nmap 中发送 HTTP 请求?

  • 0

我需要建立与域的手动连接并发送 HTTP 请求。像这样:https ://nmap.org/ncat/guide/ncat-usage.html 正如它所提到的,我应该按两次回车。但是我曾经使用过的 CMD 上的所有命令都可以通过一次输入来完成。有人知道原因吗?谢谢。

nmap
  • 1 个回答
  • 300 Views
Martin Hope
xparks37
Asked: 2020-09-07 17:36:57 +0800 CST

我无法阻止通过端口 80 的 ACK 数据包

  • 0

我想阻止 nmap 的 ack ping 探测,为了做到这一点,我首先需要阻止所有传入端口 80 的 ack 数据包。我使用了这个命令,但它没有工作:

iptables -A INPUT -p tcp --dport 80 --tcp-falgs ALL ACK -j DROP

问题是它适用于 80 和 443 以外的任何端口,它们恰好是 http/https 协议的端口。有什么方法可以使这项工作并阻止这些端口上那些意外的 ACK 数据包?

这是我输入链中的所有规则:

iptables -P INPUT DROP

iptables -A INPUT -p tcp --dport 80 --tcp-flags ALL ACK -j LOG --log-prefix "PSAD: ACK PING "
iptables -A INPUT -p tcp --dport 80 --tcp-flags ALL ACK -j DROP

iptables -A INPUT -m conntrack --ctstate INVALID -j LOG --log-prefix "DROP INVALID " --log-ip-options --log-tcp-options
iptables -A INPUT -m conntrack --ctstate INVALID -j DROP
iptables -A INPUT -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT

iptables -A INPUT -p icmp --icmp-type echo-request -j DROP
iptables -A INPUT -p tcp --dport 22 -m conntrack --ctstate NEW -j ACCEPT

先感谢您...

networking iptables port-scanning nmap block
  • 1 个回答
  • 90 Views
Martin Hope
JeremyCanfield
Asked: 2020-09-03 03:33:34 +0800 CST

firewalld 导致 nmap 返回主机似乎已关闭

  • -1

我有两台机器,server1 和 server2。在 server2 上,我停止了 firewalld。

[root@server2 ~]# systemctl stop firewalld

从 server1,nmap 返回Host is up.

[root@server1 ~]$ nmap -sn server2

Starting Nmap 6.40 ( http://nmap.org ) at 2020-09-02 11:27 CDT
Nmap scan report for server2 (10.17.45.13)
Host is up (0.00045s latency).
Nmap done: 1 IP address (1 host up) scanned in 0.01 seconds

我在 server2 上启用了 firewalld。

[root@server2 ~]# systemctl start firewalld

从 server1,nmap 返回Host seems down,因此server2上的 firewalld 导致 nmap 返回 Host 似乎已关闭。

[root@server1 ~]$ nmap -sn server2

Starting Nmap 6.40 ( http://nmap.org ) at 2020-09-02 11:29 CDT
Note: Host seems down. If it is really up, but blocking our ping probes, try -Pn
Nmap done: 1 IP address (0 hosts up) scanned in 0.01 seconds

在 server1 上,ping/echo/ICMP 有效。

[root@server1 ~]$ ping -c4 server2
PING server2 (10.17.45.13) 56(84) bytes of data.
64 bytes from server2 (10.17.45.13): icmp_seq=1 ttl=64 time=0.436 ms
64 bytes from server2 (10.17.45.13): icmp_seq=2 ttl=64 time=0.388 ms
64 bytes from server2 (10.17.45.13): icmp_seq=3 ttl=64 time=0.338 ms
64 bytes from server2 (10.17.45.13): icmp_seq=4 ttl=64 time=0.390 ms

--- server2 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3000ms
rtt min/avg/max/mdev = 0.338/0.388/0.436/0.034 ms

以下是server2 上public和区域的防火墙设置。dropicmp-block 为空意味着没有 ICMP 类型被阻止,并且 icmp-block-inversion 设置no为允许所有 IMCP 流量。

[root@server2 ~]# firewall-cmd --zone=public --list-all
public (active)
  target: default
  icmp-block-inversion: no
  interfaces: eno16777984
  sources:
  services: ssh dhcpv6-client
  ports:
  protocols:
  masquerade: no
  forward-ports:
  source-ports:
  icmp-blocks:
  rich rules:

[root@server2 ~]# firewall-cmd --zone=drop --list-all
drop
  target: DROP
  icmp-block-inversion: no
  interfaces:
  sources:
  services:
  ports:
  protocols:
  masquerade: no
  forward-ports:
  source-ports:
  icmp-blocks:
  rich rules:

/var/log/firewalld当 nmap 返回时没有记录任何内容Host seems down。

ping icmp firewalld nmap
  • 1 个回答
  • 1888 Views
Martin Hope
JeremyCanfield
Asked: 2020-09-02 03:19:06 +0800 CST

nmap 无法将某些 IP 解析为主机名

  • 1

我的目标是让 nmap 将 IP 解析为没有 --system-dns 标志或 --dns-servers 选项的主机名。

当我发出以下不带 --system-dns 标志或 --dns-servers 选项的 nmap 命令时,192.168.0.16 被解析为主机名 server1.example.com。192.168.0.17 未解析为主机名。我知道这是因为根据https://nmap.org/book/host-discovery-dns.html,“Nmap 使用自定义存根解析器”,这意味着 nmap 有它自己的 DNS 解析器,而不是我们的本地 DNS 服务器. 有趣的。

[root@client1]# nmap -sn 192.168.0.0/24 -vvv

Initiating Parallel DNS resolution of 256 hosts. at 11:22
Completed Parallel DNS resolution of 256 hosts. at 11:22, 0.02s elapsed
DNS resolution of 18 IPs took 0.02s. Mode: Async [#: 2, OK: 5, NX: 13, DR: 0, SF: 0, TR: 18, CN: 0]

Nmap scan report for server1.example.com (192.168.0.16)
Host is up (0.00063s latency).
Nmap scan report for 192.168.0.17
Host is up (0.00059s latency).

--system-dns使用标志时不会发生此问题。

[root@client1]# nmap -sn 192.168.0.0/24 --system-dns

Nmap scan report for server1.example.com (192.168.0.16)
Host is up (0.00029s latency).
Nmap scan report for server2.example.com (192.168.0.17)
Host is up (0.00026s latency).

--dns-servers当该选项用于声明应使用我们的主 DNS 服务器 (192.168.0.6)时,不会出现此问题。

[root@client1]# nmap -sn 192.168.0.0/24 --dns-servers 192.168.0.6

Nmap scan report for server1.example.com (192.168.0.16)
Host is up (0.00039s latency).
Nmap scan report for server2.example.com (192.168.0.17)
Host is up (0.00036s latency).

nslookup 显示两个 IP 都可以解析为相应的主机名。

[root@client1]#  nslookup 192.168.0.16
16.0.168.192.in-addr.arpa       name = server1.example.com.

[root@client1]# nslookup 192.168.0.17
17.0.168.192.in-addr.arpa       name = server2.example.com.

我们使用 CentOs 7 作为我们的操作系统。/etc/resolv.conf包含以下内容,表示 192.168.0.6 是我们的主 DNS 服务器。

[root@client1]# cat /etc/resolv.conf

nameserver 192.168.0.6
nameserver 8.8.8.8

192.168.0.6(我们的主 DNS 服务器)使用 Bind 版本 9 作为 DNS 服务。

[root@dns1]# named -v
BIND 9.9.4-RedHat-9.9.4-51.el7 (Extended Support Version)

这是相关的片段/var/named/forward.example.com。

[root@dns1]# cat /var/named/forward.example.com

$ORIGIN example.com.
$TTL 1D
@       IN      SOA     ns1.example.com. hostmaster.example.com. (
                                        2016032200 ; serial
                                        1D         ; refresh
                                        1H         ; retry
                                        1W         ; expire
                                        3H         ; minimum
)

;name used for the nameserver
        IN      NS      ns1.example.com.

;ip address of the nameserver
ns1     IN      A       192.168.0.6

;hostname to ip address resolutions
server1         IN      A       192.168.0.16
server2         IN      A       192.168.0.17

这里是一个片段/var/named/reverse.example.com。

[root@client1]# cat /var/named/reverse.example.com

$TTL 1D
@       IN      SOA     ns1.example.com. root.example.com. (
                                        0 ; serial
                                        1D ; refresh
                                        1H ; retry
                                        1W ; expire
                                        3H ; minimum
)

0.168.192.in-addr.arpa. IN      NS      ns1.example.com.

@       IN      NS      ns1.example.com.
ns1     IN      A       192.168.0.6
16      IN      PTR     server1.example.com.
17      IN      PTR     server2.example.com.
domain-name-system bind nmap
  • 1 个回答
  • 7237 Views
Martin Hope
Bahamas
Asked: 2020-06-10 13:08:33 +0800 CST

ufw打不开端口

  • 0

我需要8081为我的应用程序打开端口。我想从另一台服务器连接到应用程序。问题我无法打开端口。我使用端口 8081 和 ip 0.0.0.0 和 127.0.0.1 启动应用程序,我启用了 ufw /disabled ufw,我阅读了教程https://www.digitalocean.com/community/tutorials/how-to-set-up-防火墙与 ufw-on-ubuntu-20-04

我的系统:

经销商编号:Ubuntu D

描述:Ubuntu 20.04 LTS

发布时间:20.04

代号:焦点

输出sudo lsof -i -P -n | grep LISTEN:

应用程序 4431 foo 27u IPv4 64011 0t0 TCP *:8081 (LISTEN)

的输出sudo ufw status

状态:活跃

采取行动 -- ------ ---- 22/tcp ALLOW Anywhere
8081/tcp ALLOW Anywhere
22 ALLOW Anywhere
8081 ALLOW Anywhere
22/tcp (v6) ALLOW Anywhere (v6)
8081/tcp (v6) ALLOW Anywhere (v6)
22 (v6) 允许在任何地方 (v6)
8081 (v6) 允许在任何地方 (v6)

nmap输出:

在 2020-06-09 21:03 UTC启动 Nmap 7.80 ( https://nmap.org ) myip.bc.googleusercontent.com (myip) 的 Nmap 扫描报告主机已启动(0.00062 秒延迟)。未显示:999 个过滤端口 PORT STATE SERVICE 22/tcp open ssh

Nmap 完成:在 8.19 秒内扫描了 1 个 IP 地址(1 个主机启动)

firewall linux ubuntu ufw nmap
  • 1 个回答
  • 2195 Views
Martin Hope
Wolf
Asked: 2020-05-21 07:35:58 +0800 CST

nmap 主机发现以获取 MAC 地址

  • 1

我注意到nmap -sn不再提供远程主机的 MAC 地址,如我可以使用 nmap 发现 IP 和 MAC 地址吗?

我想得到类似netdiscover输出的东西。仅 IP 和 MAC 地址。

Nmap 7.80 版

wolf@linux:~$ nmap -V
Nmap version 7.80 ( https://nmap.org )
Platform: x86_64-pc-linux-gnu

例如

wolf@linux:~$ nmap -sn -oG - 10.10.10.*
# Nmap 7.80 scan initiated Wed May 20 12:38:57 2020 as: nmap -sn -oG - 10.10.10.*
Host: 10.10.10.1 () Status: Up
Host: 10.10.10.2 () Status: Up
Host: 10.10.10.3 () Status: Up
# Nmap done at Wed May 20 12:38:59 2020 -- 256 IP addresses (3 hosts up) scanned in 2.25 seconds
wolf@linux:~$ 
nmap
  • 2 个回答
  • 3446 Views
Martin Hope
cweiske
Asked: 2019-03-06 01:39:36 +0800 CST

常规 nmap 扫描片状;主机有时会丢失

  • 0

我每分钟都在使用 nmap 7.6 扫描我的本地有线网络。

问题是扫描结果不稳定:有时主机会在结果中丢失,尽管它们确实可用(例如,我用来进入该网络的路由器)。一分钟后,同样的扫描再次找到了机器。

我的 nmap 命令是:

nmap -sS -n -p T:21,22,80,443,2101,9009\
     -oX "/tmp/nmap-`date -u --rfc-3339=seconds`"\
     192.168.178.0/24

由于 ARP 响应,nmap 在 XML 文件中将主机报告为“up”:

<status state="up" reason="arp-response" reason_ttl="0"/>

报告为“失踪”的主机因情况而异;报告丢失的主机并不总是同一台主机。

我现在的问题是:

  1. 为什么 nmap 检测不到主机已启动?
  2. 我可以做些什么来提高扫描的可靠性?

有关的:

  • https://security.stackexchange.com/q/191318/25645
nmap
  • 1 个回答
  • 551 Views
Martin Hope
asinix
Asked: 2019-02-06 05:21:13 +0800 CST

IP 摄像机不显示 RTP 流的打开端口,但显示 RTSP 端口打开

  • 0

我在我的 IP 摄像机上运行 nmap 以查看打开了哪些端口。正如预期的那样,我看到在端口号 554 上打开了一个 RTSP 端口。但是,我没有看到任何为 RTP-RTCP 流打开的端口。

这是 nmap 的输出:

    PORT      STATE    SERVICE
    22/tcp    filtered ssh
    80/tcp    open     http
    554/tcp   open     rtsp
    8000/tcp  open     http-alt
    8200/tcp  open     trivnet1
    9010/tcp  open     sdr
    9020/tcp  open     tambora
    49152/tcp open     unknown

据我了解,如果我向 RTSP 服务器发送一个 RTSP 命令,我会得到一个 SDP 或一些类似的演示文稿,提供我可以在 UDP 端口上获取 RTP/RTCP 流的端口。我的期望不正确吗?摄像机确实支持 H.264、RTSP、RTP、RTCP。

nmap
  • 1 个回答
  • 1807 Views

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve