Linux操作系统中弱口令检测、端口扫描

发布时间:2020-06-02 06:50:18 作者:俊伟祺i
来源:网络 阅读:687

博文目录
一、弱口令检测——John the Ripper
1、下载并安装John the Ripper
2、检测弱口令账号
3、使用密码字典文件
二、网络扫描——NMAP
1、安装NMAP软件包
2、扫描语法及类型
3、扫描操作示例:

一、弱口令检测——John the Ripper

John the Ripper是一款开源的密码破解工具,能够在已知密文的情况下快速分析出明文的密码字串,支持DES、MD5等多种加密算法,而且允许使用密码字典(包含各种密码组合的列表文件)来进行第三方破解。通过使用John the Ripper,可以检测Linux/UNIX系统用户账号的密码强度。

1、下载并安装John the Ripper

John the Ripper的源码包提取地址:
https://pan.baidu.com/s/1-l5LiXjGnBb787gvURvDvQ
提取码:vph7
John the Ripper官网直接下载:
https://www.openwall.com/john/

[root@centos01 ~]# tar zxvf /mnt/john-1.8.0.tar.gz -C /usr/src/
[root@centos01 ~]# cd /usr/src/john-1.8.0/src/ 
[root@centos01 src]# make clean linux-x86-64  <!--在run子目录下生成一个名为john的可执行程序-->
[root@centos01 src]# ls ../run/john <!--确认已经生成可执行程序john-->
../run/john

2、检测弱口令账号

在安装有John the Ripper的服务器中,可以直接对/etc/shadow文件进行检测,对于其他Linux服务器,可以对shadow文件进行复制,并传递给John程序进行检测,只需执行run目录下的John程序,将待检测的shadow文件作为命令行参数,就可以开始弱口令分析了:

[root@centos01 ~]# cp /etc/shadow ./shadow.txt  <!--准备待破解的密码文件-->
[root@centos01 ~]# /usr/src/john-1.8.0/run/john ./shadow.txt  <!--执行暴力破解-->
Loaded 1 password hash (crypt, generic crypt(3) [?/64])
Press 'q' or Ctrl-C to abort, almost any other key for status
12345            (lisi)
1g 0:00:00:11 100% 2/3 0.08826g/s 265.9p/s 265.9c/s 265.9C/s 12
Use the "--show" option to display all of the cracked passwords
Session completed

3、使用密码字典文件

John the Ripper默认提供的字典文件为password.lst,其中包括3000多个常见的弱口令,如果有必要,可以在字典文件中添加更多的密码组合,也可以直接使用更加完整的其他字典文件。执行john程序时,可以结合“--wordlist=”选项来指定字典文件的位置,以便对指定的密码文件进行第三方分析。

[root@centos01 run]# > john.pot                <!--清空已破解的密码,以便重新分析-->
[root@centos01 run]# ./john --wordlist=./password.lst /root/a.txt         <!--使用密码字典进行检测-->
Loaded 4 password hashes with 4 different salts (crypt, generic crypt(3) [?/64])
Press 'q' or Ctrl-C to abort, almost any other key for status
123456           (wangwu)
123456           (zhangsan)
123456           (admin)
123456           (root)
4g 0:00:00:00 100% 4.301g/s 103.2p/s 412.9c/s 412.9C/s 123456..pepper
Use the "--show" option to display all of the cracked passwords reliably
Session completed

二、网络扫描——NMAP

NMAP是一个强大的端口扫描类安全评测工具,在Linux系统盘中提供了该安装包,官网站点是https://nmap.org/ 下载最新的源码包,NMAP被设计为检测众多主机数量的巨大网络,支持ping扫描、多端口检测、OS识别等多种技术,使用NMAP定期扫描内部网络,可以找出网络中不可控的应用服务,我们运维人员应该及时关闭不安全的服务,以减少安全风险。

1、安装NMAP软件包

在Centos7系统中,即可以使用光盘自带的nmap-6.40-7.e17.x86_64.rpm安装包,也可以使用从NMAP官方网站下载的最新版源码包,这里以YUM方式安装的nmap软件包为例。

[root@centos01 ~]# yum -y install nmap

2、扫描语法及类型

NMAP的扫描程序位于/usr/bin/nmap目录下,使用时基本命令格式如下所示:

nmap [扫描类型] [选项] <扫描目标...>

其中,扫描目标可以是主机名、IP地址或网络地址等,多个目标需以空格分隔;常用的选项有“-p”、“-n”,分别用来指定扫描的端口、禁用反向DNS解析(以加快扫描速度);扫描类型决定这检测的方式,也直接影响扫描的结果。

比较常用的几种扫描类型如下:

3、扫描操作示例:

[root@centos01 ~]# nmap 192.168.100.10  <!--扫描TCP端口-->

Starting Nmap 6.40 ( http://nmap.org ) at 2019-11-23 08:30 CST
mass_dns: warning: Unable to determine any DNS servers. Reverse DNS is disabled. Try using --system-dns or specify valid servers with --dns-servers
RTTVAR has grown to over 2.3 seconds, decreasing to 2.0
……
Nmap scan report for 192.168.100.10
Host is up (0.0000060s latency).
Not shown: 997 closed ports
PORT    STATE SERVICE
21/tcp  open  ftp
22/tcp  open  ssh
111/tcp open  rpcbind

Nmap done: 1 IP address (1 host up) scanned in 0.05 seconds
[root@centos01 ~]# nmap -p 20,22 192.168.100.10  <!--扫描特定端口-->

Starting Nmap 6.40 ( http://nmap.org ) at 2019-11-23 08:31 CST
mass_dns: warning: Unable to determine any DNS servers. Reverse DNS is disabled. Try using --system-dns or specify valid servers with --dns-servers
RTTVAR has grown to over 2.3 seconds, decreasing to 2.0
RTTVAR has grown to over 2.3 seconds, decreasing to 2.0
Nmap scan report for 192.168.100.10
Host is up (67s latency).
PORT   STATE  SERVICE
20/tcp closed ftp-data
22/tcp open   ssh

Nmap done: 1 IP address (1 host up) scanned in 0.03 seconds
[root@centos01 ~]# nmap -p 20,22 192.168.100.0/24  <!--扫描网段端口-->

Starting Nmap 6.40 ( http://nmap.org ) at 2019-11-23 08:32 CST
mass_dns: warning: Unable to determine any DNS servers. Reverse DNS is disabled. Try using --system-dns or specify valid servers with --dns-servers
Nmap scan report for 192.168.100.254
Host is up (0.00015s latency).
PORT   STATE    SERVICE
20/tcp filtered ftp-data
22/tcp filtered ssh
MAC Address: 00:50:56:C0:00:01 (VMware)

Nmap scan report for 192.168.100.10
Host is up (-1400s latency).
PORT   STATE  SERVICE
20/tcp closed ftp-data
22/tcp open   ssh

Nmap done: 256 IP addresses (2 hosts up) scanned in 7.14 seconds
[root@centos01 ~]# nmap -p 20,22 192.168.100.10-200  <!--扫描网段范围-->

Starting Nmap 6.40 ( http://nmap.org ) at 2019-11-23 08:32 CST
mass_dns: warning: Unable to determine any DNS servers. Reverse DNS is disabled. Try using --system-dns or specify valid servers with --dns-servers
RTTVAR has grown to over 2.3 seconds, decreasing to 2.0
RTTVAR has grown to over 2.3 seconds, decreasing to 2.0
Nmap scan report for 192.168.100.10
Host is up (1100s latency).
PORT   STATE  SERVICE
20/tcp closed ftp-data
22/tcp open   ssh

Nmap done: 191 IP addresses (1 host up) scanned in 7.68 seconds

在扫描结果中,STATE列若为open则表示端口为开放状态,为filtered表示可能被防火墙过滤,为closed表示端口为关闭状态。

—————— 本文至此结束,感谢阅读 ——————

推荐阅读:
  1. Centos7系统安全及应用(四)弱口令检测和NMAP扫描
  2. 弱口令检测

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

使用nmap扫描工具 linux系统中的弱口令扫描 nmap的扫描语句

上一篇:js 排序Json数组

下一篇:数据库系统的基本组成内容

相关阅读

您好,登录后才能下订单哦!

密码登录
登录注册
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》