本页内容

  • 先决条件
  • 开始使用
  • 安装 SpiderFoot
  • 以 Web UI 模式运行 SpiderFoot
  • 配置 SpiderFoot 身份验证
  • 访问 SpiderFoot
  • 结论

SpiderFoot 是一款免费的开源漏洞测试工具,可帮助你减少来自黑客的攻击。它用于分析 Linux 服务器上的漏洞和恶意功能。它是一款跨平台软件工具,支持 Linux 和 Windows 机器,并可与 GitHub 协作。它使用 Python 编写,并使用 SQLite 作为数据库后端。它提供了一个基于 Web 的界面,可通过 Web 浏览器同时对多个目标执行渗透测试。

在本教程中,我们将向你展示如何在 Ubuntu 20.04 服务器上安装 SpiderFoot。

先决条件

  • 一台运行 Ubuntu 20.04 的服务器。
  • 服务器上已配置 root 密码。

开始使用

在开始之前,建议将软件包缓存更新到最新版本。你可以使用以下命令进行更新:

apt-get update -y

所有软件包更新完成后,使用以下命令安装其他所需的软件包:

apt-get install python3 python3-pip -y

所有软件包安装完成后,你可以继续下一步。

安装 SpiderFoot

首先,你需要从 Git 仓库下载最新版本的 SpiderFoot。你可以使用以下命令下载:

wget https://github.com/smicallef/spiderfoot/archive/v3.3.tar.gz

下载完成后,使用以下命令解压下载的文件:

tar -xvzf v3.3.tar.gz

接下来,切换到解压后的目录,并使用以下命令安装所有 Python 依赖:

cd spiderfoot-3.3
pip3 install -r requirements.txt

安装完成后,你可以使用以下命令列出 SpiderFoot 提供的所有可用选项:

python3 sf.py --help

你应该会看到如下输出:

usage: sf.py [-h] [-d] [-l IP:port] [-m mod1,mod2,...] [-M] [-s TARGET] [-t type1,type2,...] [-T] [-o tab|csv|json] [-H] [-n] [-r]
             [-S LENGTH] [-D DELIMITER] [-f] [-F type1,type2,...] [-x] [-q]

SpiderFoot 3.3: Open Source Intelligence Automation.

optional arguments:
  -h, --help          show this help message and exit
  -d, --debug         Enable debug output.
  -l IP:port          IP and port to listen on.
  -m mod1,mod2,...    Modules to enable.
  -M, --modules       List available modules.
  -s TARGET           Target for the scan.
  -t type1,type2,...  Event types to collect (modules selected automatically).
  -T, --types         List available event types.
  -o tab|csv|json     Output format. Tab is default. If using json, -q is enforced.
  -H                  Don't print field headers, just data.
  -n                  Strip newlines from data.
  -r                  Include the source data field in tab/csv output.
  -S LENGTH           Maximum data length to display. By default, all data is shown.
  -D DELIMITER        Delimiter to use for CSV output. Default is ,.
  -f                  Filter out other event types that weren't requested with -t.
  -F type1,type2,...  Show only a set of event types, comma-separated.
  -x                  STRICT MODE. Will only enable modules that can directly consume your target, and if -t was specified only those events
                      will be consumed by modules. This overrides -t and -m options.
  -q                  Disable logging. This will also hide errors!

以 Web UI 模式运行 SpiderFoot

此时,SpiderFoot 已安装在你的服务器上。现在,你需要以 Web UI 模式启动 SpiderFoot,以便通过 Web 浏览器访问它。

你可以使用以下命令运行它:

python3 sf.py -l your-server-ip:5001

你应该会看到如下输出:

2021-03-01 11:16:53,927 [INFO] Starting web server at 45.58.43.9:5001 ...
2021-03-01 11:16:53,937 [WARNING] 
********************************************************************
Warning: passwd file contains no passwords. Authentication disabled.
Please consider adding authentication to protect this instance!
Refer to https://www.spiderfoot.net/documentation/#security.
********************************************************************


*************************************************************
 Use SpiderFoot by starting your web browser of choice and 
 browse to http://45.58.43.9:5001/
*************************************************************

2021-03-01 11:16:53,996 [INFO] [01/Mar/2021:11:16:53] ENGINE Listening for SIGTERM.
2021-03-01 11:16:53,996 [INFO] [01/Mar/2021:11:16:53] ENGINE Listening for SIGHUP.
2021-03-01 11:16:53,996 [INFO] [01/Mar/2021:11:16:53] ENGINE Listening for SIGUSR1.
2021-03-01 11:16:53,996 [INFO] [01/Mar/2021:11:16:53] ENGINE Bus STARTING
2021-03-01 11:16:54,099 [INFO] [01/Mar/2021:11:16:54] ENGINE Serving on http://45.58.43.9:5001
2021-03-01 11:16:54,100 [INFO] [01/Mar/2021:11:16:54] ENGINE Bus STARTED

如你所见,SpiderFoot 已启动并监听 5001 端口。按 CTRL+C 可停止 SpiderFoot。

配置 SpiderFoot 身份验证

默认情况下,无需任何身份验证即可访问 SpiderFoot。因此建议启用基本身份验证。

为此,请使用以下命令切换到 SpiderFoot 目录:

cd spiderfoot-3.3

接下来,使用以下命令在 passwd 文件中添加你的用户名和密码:

echo "admin:yourpassword" > passwd

现在,使用以下命令再次以 Web UI 模式启动 SpiderFoot:

python3 sf.py -l your-server-ip:5001

你应该会看到如下输出:

2021-03-01 11:17:56,108 [INFO] Starting web server at 45.58.43.9:5001 ...
2021-03-01 11:17:56,118 [INFO] Enabling authentication based on supplied passwd file.

*************************************************************
 Use SpiderFoot by starting your web browser of choice and 
 browse to http://45.58.43.9:5001/
*************************************************************

2021-03-01 11:17:56,138 [INFO] [01/Mar/2021:11:17:56] ENGINE Listening for SIGTERM.
2021-03-01 11:17:56,138 [INFO] [01/Mar/2021:11:17:56] ENGINE Listening for SIGHUP.
2021-03-01 11:17:56,138 [INFO] [01/Mar/2021:11:17:56] ENGINE Listening for SIGUSR1.
2021-03-01 11:17:56,138 [INFO] [01/Mar/2021:11:17:56] ENGINE Bus STARTING
2021-03-01 11:17:56,240 [INFO] [01/Mar/2021:11:17:56] ENGINE Serving on http://45.58.43.9:5001
2021-03-01 11:17:56,241 [INFO] [01/Mar/2021:11:17:56] ENGINE Bus STARTED

访问 SpiderFoot

现在,打开你的 Web 浏览器,使用 URL http://your-server-ip:5001 访问 SpiderFoot Web 界面。你将被重定向到 SpiderFoot 登录页面:

如何在 Ubuntu 20.04 上安装 SpiderFoot 安全扫描器教程

输入你的管理员用户名和密码,然后点击 Sign In 按钮。登录后,你应该会在如下页面看到 SpiderFoot 仪表盘:

如何在 Ubuntu 20.04 上安装 SpiderFoot 安全扫描器教程

现在,点击 New Scan 按钮创建一个新扫描。你应该会看到如下页面:

如何在 Ubuntu 20.04 上安装 SpiderFoot 安全扫描器教程

输入你的目标服务器 IP,然后点击 Run Scan Now。你应该会看到如下页面:

如何在 Ubuntu 20.04 上安装 SpiderFoot 安全扫描器教程

结论

你已成功在 Ubuntu 20.04 服务器上安装 SpiderFoot。现在,你可以通过 SpiderFoot 仪表盘扫描远程计算机的任何漏洞。如有任何问题,欢迎随时提问。