【故障描述】 我想学习wireshark软件,使用dsniff中的macof。kali未安装macof。需要更新,原来系统带的源地址更新时异常报错。 本文讲述作为新人的我,如何解决问题,希望触类旁通,可以解决同类安装问题。

┌──(root💀kali)-[/home/kali]
└─# macof
Command 'macof' not found, but can be installed with:
apt install dsniff
Do you want to install it? (N/y)y
apt install dsniff
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
  libnids1.21
The following NEW packages will be installed:
  dsniff libnids1.21
0 upgraded, 2 newly installed, 0 to remove and 135 not upgraded.
Need to get 132 kB of archives.
After this operation, 512 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Ign:1 http://mirrors.neusoft.edu.cn/kali kali-rolling/main amd64 libnids1.21 amd64 1.25-1
Ign:2 http://http.kali.org/kali kali-rolling/main amd64 dsniff amd64 2.4b1+debian-30
Ign:1 http://mirrors.neusoft.edu.cn/kali kali-rolling/main amd64 libnids1.21 amd64 1.25-1
Ign:2 http://http.kali.org/kali kali-rolling/main amd64 dsniff amd64 2.4b1+debian-30
Ign:1 http://mirrors.neusoft.edu.cn/kali kali-rolling/main amd64 libnids1.21 amd64 1.25-1
Ign:2 http://http.kali.org/kali kali-rolling/main amd64 dsniff amd64 2.4b1+debian-30
Err:1 http://mirrors.neusoft.edu.cn/kali kali-rolling/main amd64 libnids1.21 amd64 1.25-1
  Cannot initiate the connection to mirrors.neusoft.edu.cn:80 (2001:da8:a807::25). - connect (101: Network is unreachable) Could not connect to mirrors.neusoft.edu.cn:80 (219.216.128.25). - connect (111: Connection refused)
Err:2 http://http.kali.org/kali kali-rolling/main amd64 dsniff amd64 2.4b1+debian-30
  Cannot initiate the connection to mirrors.neusoft.edu.cn:80 (2001:da8:a807::25). - connect (101: Network is unreachable)
E: Failed to fetch http://mirrors.neusoft.edu.cn/kali/pool/main/libn/libnids/libnids1.21_1.25-1_amd64.deb  Cannot initiate the connection to mirrors.neusoft.edu.cn:80 (2001:da8:a807::25). - connect (101: Network is unreachable) Could not connect to mirrors.neusoft.edu.cn:80 (219.216.128.25). - connect (111: Connection refused)
E: Failed to fetch http://mirrors.neusoft.edu.cn/kali/pool/main/d/dsniff/dsniff_2.4b1+debian-30_amd64.deb  Cannot initiate the connection to mirrors.neusoft.edu.cn:80 (2001:da8:a807::25). - connect (101: Network is unreachable)
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?

解决办法: 1、kali使用root权限

┌──(kali㉿kali)-[~]
└─$ sudo passwd root                                                     1 ⨯
New password: 
Retype new password: 
passwd: password updated successfully

┌──(kali㉿kali)-[~]
└─$ su root                                                              1 ⨯
Password: 
┌──(root💀kali)-[/home/kali]
└─# 

2、修改更新源配置文件:

┌──(root💀kali)-[/home/kali]
└─# vim /etc/apt/sources.list  

先i进入修改状态,修改deb http://http.kali.org/kali kali-rolling main contrib non-free为新地址,我这里使用的是

deb http://mirrors.tuna.tsinghua.edu.cn/kali kali-rolling main contrib non-free

效果如下图: KaliLinux2021.3vmwareamd6420210928205553.png Esc键退出修改状态,输入:wq保存 3、使用apt-get update命令获取更新列表

┌──(root💀kali)-[/home/kali]
└─# apt-get update && apt-get upgrade && apt-get dist-upgrade

4、安装macof

┌──(root💀kali)-[/home/kali]
└─# macof
Command 'macof' not found, but can be installed with:
apt install dsniff
Do you want to install it? (N/y)y
apt install dsniff
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages were automatically installed and are no longer required:
  libdav1d4 libepsilon1 libgdal28 libidn11 libntfs-3g883 libx265-192
  libyara4 python3-ipython-genutils
Use 'apt autoremove' to remove them.
The following additional packages will be installed:
  libnids1.21
The following NEW packages will be installed:
  dsniff libnids1.21
0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
Need to get 132 kB of archives.
After this operation, 512 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://mirrors.tuna.tsinghua.edu.cn/kali kali-rolling/main amd64 libnids1.21 amd64 1.25-1 [27.3 kB]
Get:2 http://mirrors.tuna.tsinghua.edu.cn/kali kali-rolling/main amd64 dsniff amd64 2.4b1+debian-30 [105 kB]
Fetched 132 kB in 1s (163 kB/s) 
Selecting previously unselected package libnids1.21:amd64.
(Reading database ... 268673 files and directories currently installed.)
Preparing to unpack .../libnids1.21_1.25-1_amd64.deb ...
Unpacking libnids1.21:amd64 (1.25-1) ...
Selecting previously unselected package dsniff.
Preparing to unpack .../dsniff_2.4b1+debian-30_amd64.deb ...
Unpacking dsniff (2.4b1+debian-30) ...
Setting up libnids1.21:amd64 (1.25-1) ...
Setting up dsniff (2.4b1+debian-30) ...
Processing triggers for kali-menu (2021.4.0) ...
Processing triggers for libc-bin (2.31-17) ...
Processing triggers for man-db (2.9.4-2) ...