1、准备
(1)获得激活码
地址:https://zh-cn.tenable.com/products/nessus/nessus-essentials
https://zh-cn.tenable.com/products/nessus/activation-code?tns_redirect=true
邮箱收到激活码:
(2)安装包下载
地址:https://www.tenable.com/downloads/nessus?loginAttempted=true
2、安装
(1)安装
#sudo dpkg -i Nessus-8.12.1-debian6_amd64.deb
(2)启动nessus
# sudo service nessusd start
(3)配置
浏览器打开:https://ip:8834,选择“Managed Scanner”,点击“Continue”
选择“Tenable.s”,点击“Continue”
输入账号密码,点击“Submit”
完成配置后,将进入Nessus设置页
(4)激活(离线激活)
查看安装目录
# find / -name nessus
获取查询码:
# sudo /opt/nessus/sbin/nessuscli fetch --challenge
用浏览器打开:https://plugins.nessus.org/v2/offline.php,输入查询码和激活码,点击“Submit”
获得all-2.0.tar.gz插件包下载地址
保存这段license证书,后面会用到。
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
下载更新插件包:
# sudo service nessusd stop
# sudo /opt/nessus/sbin/nessuscli update ./all-2.0.tar.gz
保存日期这个数字串202010191623,破解文件将使用会。
# sudo service nessusd start
回到Nessus设置页,点击Activation Code旁边的小笔🖊,进行激活。
选择“Offline”,输入license证书,点击Activate。
初始化中……
++++++++异常处置+++++++++++++++++++++++++++++++++++++
若初始化失败:
在执行:
sudo /opt/nessus/sbin/nessuscli update ./all-2.0.tar.gz
+++++++++++++++++++++++++++++++++++++++++++++++++++
完成后进入设置页,显示激活成功,但只能扫描16个IP。
(5)解除IP限制
新建一个文件,名称为:plugin_feed_info.inc,内容为:
PLUGIN_SET = "202010191623";
PLUGIN_FEED = "ProfessionalFeed (Direct)";
PLUGIN_FEED_TRANSPORT = "Tenable Network Security Lightning";
其中,PLUGIN_SET值为上文保存的字符串数字。
查找plugin_feed_info.inc
# sudo find /opt -name plugin_feed_info.inc
停用nessus
# sudo service nessusd stop
备份插件目录/opt/nessus/lib/nessus/plugins/,新版本的Nessus会对plugin_feed_info.inc的信息进行对比,发现plugin_feed_info.inc信息不一致时,会删除/opt/nessus/lib/nessus/plugins/下的插件。
# cp -r /opt/nessus/lib/nessus/plugins /opt/nessus/lib/nessus/plugins.bak //文件有点大,备份时间有点长
将plugin_feed_info.inc替换/opt/nessus/var/nessus/plugin_feed_info.inc、/opt/nessus/lib/nessus/plugins/plugin_feed_info.inc两个文件。
#sudo cp plugin_feed_info.inc /opt/nessus/lib/nessus/plugins/
#sudo cp plugin_feed_info.inc /opt/nessus/var/nessus/
启动nessus
#sudo service nessusd start
在浏览器中访问:https://ip:8834,进行第一次初始化。
完成后,发现设置页面没有变化,但/opt/nessus/lib/nessus/plugins/目录下的插件不见了。
停用nessus
# sudo service nessusd stop
将备份插件目录/opt/nessus/lib/nessus/plugins/还原
#sudo cp -r /opt/nessus/lib/nessus/plugins.bak /opt/nessus/lib/nessus/plugins
再次将plugin_feed_info.inc替换/opt/nessus/var/nessus/plugin_feed_info.inc、/opt/nessus/lib/nessus/plugins/plugin_feed_info.inc两个文件。
#sudo cp plugin_feed_info.inc /opt/nessus/lib/nessus/plugins/
#sudo cp plugin_feed_info.inc /opt/nessus/var/nessus/
启动nessus
#sudo service nessusd start
在浏览器中访问:https://ip:8834,进行第二次初始化。
完成后,发现插件恢复正常,扫描恢复正常,解除IP限制成功。
以后每次更新都要通过以上操作解除IP限制。
(6)自动更新shell脚本:
++++++++脚本代码+++++++++++++++++++++++++++
#!/bin/bash
#下载更新插件包all-2.0.tar.gz
rm -f all-2.0.tar.gz
wget -o all-2.0.tar.gz "https://plugins.nessus.org/v2/nessus.php?f=all-2.0.tar.gz&u=......"
#将“https://plugins.nessus.org/v2/nessus.php?f=all-2.0.tar.gz&u=......”替换为自己的更新插件包all-2.0.tar.gz下载地址
#第一次初始化
#停用nessus服务
sudo service nessusd stop
#更新插件,输出log
sudo /opt/nessus/sbin/nessuscli update ./all-2.0.tar.gz > all-2.0.log
#更新plugin_feed_info.inc
chmod 777 plugin_feed_info.inc
export new_PLUGIN_SET=$(cat all-2.0.log|tr -cd '0-9'|cut -c1-12)
export old_PLUGIN_SET=$(cat plugin_feed_info.inc|tr -cd '0-9'|cut -c1-12)
sed -i "s/$old_PLUGIN_SET/$new_PLUGIN_SET/g" plugin_feed_info.inc
#备份plugin
Path1="/opt/nessus/lib/nessus/plugins.bak"
if [[ ! -d "$Path1" ]]; then
echo "/opt/nessus/lib/nessus/plugins.bak文件夹不存在"
else
rm -r /opt/nessus/lib/nessus/plugins.bak
fi
cp -r /opt/nessus/lib/nessus/plugins /opt/nessus/lib/nessus/plugins.bak
sudo cp plugin_feed_info.inc /opt/nessus/lib/nessus/plugins/
sudo cp plugin_feed_info.inc /opt/nessus/var/nessus/
#curl访问
sudo service nessusd start
#第二次初始化
sleep 5
sudo service nessusd stop
sudo chown root:root ./plugin_feed_info.inc && sudo chmod 644 ./plugin_feed_info.inc
sudo cp -r /opt/nessus/lib/nessus/plugins.bak /opt/nessus/lib/nessus/plugins
sudo cp plugin_feed_info.inc /opt/nessus/lib/nessus/plugins/
sudo cp plugin_feed_info.inc /opt/nessus/var/nessus/
sudo service nessusd start
+++++++++++++++++++++++++++++++++++++++++
本文转自 https://blog.csdn.net/zhengshaolin128/article/details/109488655,如有侵权,请联系删除。