Hakrawler:简单、快速的网络爬虫,旨在轻松、快速地发现网络应用程序中的端点和资产

2025-06-09 10:44:57 0 165

Hakrawler

用于收集 URL 和 JavaScript 文件位置的快速 golang 网络爬虫。这基本上是令人敬畏的 Gocolly 库的简单实现。

Github:https://github.com/hakluke/hakrawler

示例用法

单个 URL:

echo https://google.com | hakrawler

多个 URL:

cat urls.txt | hakrawler

每行 stdin 的超时时间为 5 秒:

cat urls.txt | hakrawler -timeout 5

通过代理发送所有请求:

cat urls.txt | hakrawler -proxy http://localhost:8080

包括子域名:

echo https://google.com | hakrawler -subs

注意:一个常见问题是该工具不返回任何 URL。这通常发生在指定域名 ( https://example.com ) 时,但它重定向到子域名 ( https://www.example.com )。由于子域名不包含在范围之内,因此不会打印任何 URL。为了解决这个问题,请在重定向链中指定最终 URL,或使用 -subs 包含子域名的选项。

示例工具链

获取 google 的所有子域名,找到响应 http(s) 的子域名,并全部抓取它们。

echo google.com | haktrails subdomains | httpx | hakrawler

安装

正常安装

首先,需要安装Go:

然后运行此命令下载+编译hakrawler:

go install github.com/hakluke/hakrawler@latest

现在可以运行 ~/go/bin/hakrawler。如果只想运行 hakrawler 而不需要完整路径,需要执行 export PATH=“~/go/bin/:$PATH”。如果想让这一行持续存在,也可以在~/.bashrc 文件中添加这一行。

Docker 安装(来自 dockerhub)

echo https://www.google.com | docker run --rm -i hakluke/hakrawler:v2 -subs

本地 Docker 安装

使用上面的 dockerhub 方法要容易得多,但如果更喜欢在本地运行它:

git clone https://github.com/hakluke/hakrawler
cd hakrawler
sudo docker build -t hakluke/hakrawler .
sudo docker run --rm -i hakluke/hakrawler --help

Kali Linux:使用 apt

注意:这将安装 hakrawler 的旧版本,不包含所有功能,并且可能存在 bug。

sudo apt install hakrawler

然后,运行 hakrawler:

echo https://www.google.com | docker run --rm -i hakluke/hakrawler -subs

命令行选项

Usage of hakrawler:
  -d int
        Depth to crawl. (default 2)
  -dr
        Disable following HTTP redirects.
  -h string
        Custom headers separated by two semi-colons. E.g. -h "Cookie: foo=bar;;Referer: http://example.com/"
  -i    Only crawl inside path
  -insecure
        Disable TLS verification.
  -json
        Output as JSON.
  -proxy string
        Proxy URL. E.g. -proxy http://127.0.0.1:8080
  -s    Show the source of URL based on where it was found. E.g. href, form, script, etc.
  -size int
        Page size limit, in KB. (default -1)
  -subs
        Include subdomains for crawling.
  -t int
        Number of threads to utilise. (default 8)
  -timeout int
        Maximum time to crawl each URL from stdin, in seconds. (default -1)
  -u    Show only unique urls.
  -w    Show at which link the URL is found.

关于作者

whoami111篇文章163篇回复

勤快的搬运工。

评论0次

要评论?请先  登录  或  注册