1. 程式人生 > >每日記載內容總結46

每日記載內容總結46

alt let rest The done inux emctl ip add 2.6

nmap
Nmap 又叫做Network Mapper(網絡映射器)是一個開源並且為了Linux系統管理員或者網絡管理員的萬能的工具。Nmap用於瀏覽網絡,執行安全掃描,網絡審計以及在遠程機器找到開放端口。它可以掃描在線主機,操作系統,濾包器和遠程主機打開的端口。(來源)

--

安裝:

yum install nmap
  1. 使用Hostname和IP地址來掃描系統,掃描出他的系統所有開放端口,服務和MAC地址。

    [root@ssqs-test1 ~]# nmap baidu.com
    
    Starting Nmap 5.51 ( http://nmap.org ) at 2018-06-12 17:34 CST
    Nmap scan report for baidu.com (123.125.115.110)
    Host is up (0.0026s latency).
    Other addresses for baidu.com (not scanned): 220.181.57.216
    Not shown: 998 filtered ports
    PORT    STATE SERVICE
    80/tcp  open  http
    443/tcp open  https
    
    Nmap done: 1 IP address (1 host up) scanned in 4.02 seconds
    
    [root@ssqs-test1 ~]# nmap 47.92.65.98
    
    Starting Nmap 5.51 ( http://nmap.org ) at 2018-06-12 17:34 CST
    Nmap scan report for 47.92.65.98
    Host is up (0.0070s latency).
    Not shown: 996 filtered ports
    PORT     STATE  SERVICE
    22/tcp   open   ssh
    80/tcp   closed http
    443/tcp  closed https
    3389/tcp closed ms-term-serv
    
    Nmap done: 1 IP address (1 host up) scanned in 4.54 seconds
  2. 使用 “-v” 選項,此選項給了更多的遠程設備的細節。

    [root@ssqs-test1 ~]# nmap -v 47.92.65.98
    
    Starting Nmap 5.51 ( http://nmap.org ) at 2018-06-12 17:36 CST
    Initiating Ping Scan at 17:36
    Scanning 47.92.65.98 [4 ports]
    Completed Ping Scan at 17:36, 0.01s elapsed (1 total hosts)
    Initiating Parallel DNS resolution of 1 host. at 17:36
    Completed Parallel DNS resolution of 1 host. at 17:36, 0.02s elapsed
    Initiating SYN Stealth Scan at 17:36
    Scanning 47.92.65.98 [1000 ports]
    Discovered open port 22/tcp on 47.92.65.98
    Completed SYN Stealth Scan at 17:36, 4.04s elapsed (1000 total ports)
    Nmap scan report for 47.92.65.98
    Host is up (0.0070s latency).
    Not shown: 996 filtered ports
    PORT     STATE  SERVICE
    22/tcp   open   ssh
    80/tcp   closed http
    443/tcp  closed https
    3389/tcp closed ms-term-serv
    
    Read data files from: /usr/share/nmap
    Nmap done: 1 IP address (1 host up) scanned in 4.13 seconds
    Raw packets sent: 1996 (87.800KB) | Rcvd: 9 (480B)
  3. 掃描特定的端口,Nmap有多種多樣的選項去發現遠程機器的端口。通過“-p”選項,你可以指定你想要掃描的端口,默認情況下Nmap掃描只掃描TCP端口。可掃描單個或者多個,用逗號分隔。

    [root@ssqs-test1 ~]# nmap 47.92.65.98 -p 5672
    
    Starting Nmap 5.51 ( http://nmap.org ) at 2018-06-12 17:40 CST
    Nmap scan report for 47.92.65.98
    Host is up (0.0065s latency).
    PORT     STATE SERVICE
    5672/tcp open  amqp
    
    Nmap done: 1 IP address (1 host up) scanned in 0.10 seconds
    
    [root@ssqs-test1 ~]# nmap 47.92.65.98 -p 5672,15672
    
    Starting Nmap 5.51 ( http://nmap.org ) at 2018-06-12 17:40 CST
    Nmap scan report for 47.92.65.98
    Host is up (0.0064s latency).
    PORT      STATE SERVICE
    5672/tcp  open  amqp
    15672/tcp open  unknown
    
    Nmap done: 1 IP address (1 host up) scanned in 0.13 seconds

Linux基本命令不能用解決方法

--

先執行如下命令:

export PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin  

然後在當前命令界面,基本命令都已經可用,繼續如下操作

vim /etc/profile
source /etc/profile

/etc/sysconfig/iptables文件不存在

--

在虛擬機上裝的centos7是最小安裝方式,所以許多東西都沒裝,需要自己手動安裝。
因此/etc/sysconfig/iptables不存在,沒有安裝iptables防火墻
可以通過以下命令安裝iptables防火墻

systemctl stop firewalld

systemctl mask firewalld

// 安裝
yum install iptables-services

// 查看狀態
service iptables status

//設置開機啟動
systemctl enable iptables

//管理
systemctl stop iptables  

systemctl start iptables  

systemctl restart iptables  

service iptables save

每日記載內容總結46