English 中文(简体)
如何确定特定距离中的哪些IP有80港口使用Nmap?
原标题:How to determine which IPs in a given range have port 80 using nmap?

I m New to bashscripting and I m seeking to go this work:

Scanning an IP range for finding devices with the port 80 open... I think it has to look like this:

#!/bin/bash
echo -----------------------------------
for ip in 192.168.0.{1,.255}; do
nmap -p80 192.168.0.1
      if #open; then
            echo "{ip} has the port 80 open"
      else
            #do nothing
fi
done
echo -----------------------------------
exit 0

我也只想看到这样的结果:

-----------------------------------
192.168.0.1 has the port 80 open
192.168.0.10 has the port 80 open
192.168.0.13 has the port 80 open
192.168.0.15 has the port 80 open
-----------------------------------

(无差错或nmap) 正常产出。

谁能帮助我这样做?

问题回答

含有一个冰量输出参数-oG (grepable输出),使平价更为容易。 同样,没有必要通过你想要扫描的所有IP地址进行修复。 nmap is Netmasknow.

你的榜样可以写成:

nmap -p80 192.168.0.0/24 -oG - | grep 80/open

<代码>-oG使可复制产出><>>>>和-具体列明了(此处为<编码>stdout)至(>)。 管道符号将Nmap (stdout)的输出转向灰色,此处只有包含80/open的回归线。

引言

nmap --open -p80 192.168.0.*

<代码>-开放将仅列出开放港的东道方。 这样,你就不必在你的手稿中检查过滤器,这已经由地图本身完成。

rel=“noretinger”>https://nmap.org/book/man-briefoptions.html





相关问题
Parse players currently in lobby

I m attempting to write a bash script to parse out the following log file and give me a list of CURRENT players in the room (so ignoring players that left, but including players that may have rejoined)...

encoding of file shell script

How can I check the file encoding in a shell script? I need to know if a file is encoded in utf-8 or iso-8859-1. Thanks

Bash usage of vi or emacs

From a programming standpoint, when you set the bash shell to use vi or emacs via set -o vi or set -o emacs What is actually going on here? I ve been reading a book where it claims the bash shell ...

Dynamically building a command in bash

I am construcing a command in bash dynamically. This works fine: COMMAND="java myclass" ${COMMAND} Now I want to dynamically construct a command that redirectes the output: LOG=">> myfile.log ...

Perform OR on two hash outputs of sha1sum

I want perform sha1sum file1 and sha1sum file2 and perform bitwise OR operation with them using bash. Output should be printable i.e 53a23bc2e24d039 ... (160 bit) How can I do this? I know echo $(( ...

Set screen-title from shellscript

Is it possible to set the Screen Title using a shell script? I thought about something like sending the key commands ctrl+A shift-A Name enter I searched for about an hour on how to emulate ...

热门标签