Skip to content
KitploitKITPLOIT
工具博客
提交
工具博客
提交

黑客、渗透测试和网络安全工具,武装您的安全武器库!

Kitploit 是一个黑客、网络安全和渗透测试工具的目录。发现最新的项目更新,查找漏洞、分析系统、自动化测试并加强你的安全。

··订阅源·联系·隐私·© 2026 Kitploit

工具目录

分类

查看所有分类
Loading categories
meg — 为多个主机获取多个路径 - 不损害主机 | Kitploit
工具/GitHubGitHub/tomnomnom/meg
侦察信息收集Web安全网络爬虫
GitHubtomnomnom/meg

meg

为多个主机获取多个路径 - 不损害主机

查看仓库
1.7k2674年前Kitploit 审核通过

最受欢迎

查看全部 →

发现我们社区最常用的工具。

探索所有工具

浏览我们的工具集合

查看所有工具 →
分享

meg

meg 是一个用于批量获取URL的工具,同时保持对服务器的“友好”。

它可以用来为多个主机获取多个路径;在移动到下一个路径并重复之前,为所有主机获取一个路径。

您可以快速获得大量结果,但不会对单个主机造成流量泛滥。

安装

meg 是用 Go 编写的,没有运行时依赖项。如果您已安装并配置了 Go 1.9 或更高版本,可以使用 go install 安装 meg:

root@kitploit:~
▶ go install github.com/tomnomnom/meg@latest

或者下载二进制文件并将其放在您的 $PATH 中(例如在 /usr/bin/ 下)。

安装错误

如果您看到类似这样的错误,说明您的 Go 版本太旧:

root@kitploit:~
# github.com/tomnomnom/rawhttp
/root/go/src/github.com/tomnomnom/rawhttp/request.go:102: u.Hostname undefined (
type *url.URL has no field or method Hostname)
/root/go/src/github.com/tomnomnom/rawhttp/request.go:103: u.Port undefined (type
 *url.URL has no field or method Port)
 /root/go/src/github.com/tomnomnom/rawhttp/request.go:259: undefined: x509.System
 CertPool

您应该更新您的 Go 版本,或者使用针对您平台的二进制发布版本。

基本用法

给定一个包含路径的文件:

root@kitploit:~
/robots.txt
/.well-known/security.txt
/package.json

以及一个包含主机(带有协议)的文件:

root@kitploit:~
http://example.com
https://example.com
http://example.net

meg 将为每个 host 请求每个 path:

root@kitploit:~
▶ meg --verbose paths hosts
out/example.com/45ed6f717d44385c5e9c539b0ad8dc71771780e0 http://example.com/robots.txt (404 Not Found)
out/example.com/61ac5fbb9d3dd054006ae82630b045ba730d8618 https://example.com/robots.txt (404 Not Found)
out/example.net/1432c16b671043271eab84111242b1fe2a28eb98 http://example.net/robots.txt (404 Not Found)
out/example.net/61deaa4fa10a6f601adb74519a900f1f0eca38b7 http://example.net/.well-known/security.txt (404 Not Found)
out/example.com/20bc94a296f17ce7a4e2daa2946d0dc12128b3f1 http://example.com/.well-known/security.txt (404 Not Found)
...

并将输出保存在名为 ./out 的目录中:

root@kitploit:~
▶ head -n 20 ./out/example.com/45ed6f717d44385c5e9c539b0ad8dc71771780e0
http://example.com/robots.txt

> GET /robots.txt HTTP/1.1
> Host: example.com

< HTTP/1.1 404 Not Found
< Expires: Sat, 06 Jan 2018 01:05:38 GMT
< Server: ECS (lga/13A2)
< Accept-Ranges: bytes
< Cache-Control: max-age=604800
< Content-Type: text/*
< Content-Length: 1270
< Date: Sat, 30 Dec 2017 01:05:38 GMT
< Last-Modified: Sun, 24 Dec 2017 06:53:36 GMT
< X-Cache: 404-HIT

<!doctype html>
<html>
<head>

如果不带任何参数,meg 将从名为 ./paths 的文件读取路径,从名为 ./hosts 的文件读取主机。并且不会有输出:

root@kitploit:~
▶ meg
▶

但它会将一个 index 文件保存到 ./out/index:

root@kitploit:~
▶ head -n 2 ./out/index
out/example.com/538565d7ab544bc3bec5b2f0296783aaec25e756 http://example.com/package.json (404 Not Found)
out/example.com/20bc94a296f17ce7a4e2daa2946d0dc12128b3f1 http://example.com/.well-known/security.txt (404 Not Found)

您可以使用索引文件查找响应存储在哪里,但使用 grep 通常更容易找到您要找的内容:

root@kitploit:~
▶ grep -Hnri '< Server:' out/
out/example.com/61ac5fbb9d3dd054006ae82630b045ba730d8618:14:< Server: ECS (lga/13A2)
out/example.com/bd8d9f4c470ffa0e6ec8cfa8ba1c51d62289b6dd:16:< Server: ECS (lga/13A3)

如果只想请求一个路径,可以直接将其作为参数指定:

root@kitploit:~
▶ meg /admin.php

详细用法

meg 的帮助输出试图真正有用:

root@kitploit:~
▶ meg --help
Request many paths for many hosts

Usage:
  meg [options] [path|pathsFile] [hostsFile] [outputDir]

Options:
  -c, --concurrency <val>    Set the concurrency level (defaut: 20)
  -d, --delay <val>          Milliseconds between requests to the same host (default: 5000)
  -H, --header <header>      Send a custom HTTP header
  -r, --rawhttp              Use the rawhttp library for requests (experimental)
  -s, --savestatus <status>  Save only responses with specific status code
  -v, --verbose              Verbose mode
  -X, --method <method>      HTTP method (default: GET)

Defaults:
  pathsFile: ./paths
  hostsFile: ./hosts
  outputDir:  ./out

Paths file format:
  /robots.txt
  /package.json
  /security.txt

Hosts file format:
  http://example.com
  https://example.edu
  https://example.net

Examples:
  meg /robots.txt
  meg -s 200 -X HEAD
  meg -c 30 /
  meg hosts.txt paths.txt output

并发

默认情况下,meg 将尝试发出 20 个并发请求。您可以使用 -c 或 --concurrency 选项更改:

root@kitploit:~
▶ meg --concurrency 5

将并发级别设置得高于主机数量并不太友好 - 您可能会同时向一个主机发送大量请求。

延迟

默认情况下,meg 在向同一主机发送请求之间将等待 5000 毫秒。您可以使用 -d 或 --delay 选项覆盖该值:

root@kitploit:~
▶ meg --delay 10000

警告: 在减少延迟之前,请确保您有权向目标主机发送大量请求。

添加标头

您可以使用 -H 或 --header 选项在请求上设置额外的标头:

root@kitploit:~
▶ meg --header "Origin: https://evil.com"
▶ grep -h '^>' out/example.com/*
> GET /.well-known/security.txt HTTP/1.1
> Origin: https://evil.com
> Host: example.com
...

原始 HTTP(实验性)

如果您想发送无效的请求 - 例如包含无效的 URL 编码 - Go HTTP 客户端将失败:

root@kitploit:~
▶ meg /%%0a0afoo:bar
request failed: parse https://example.org/%%0a0afoo:bar: invalid URL escape "%%0"

您可以使用 -r 或 --rawhttp 标志来启用 rawhttp 库,该库对请求几乎不进行验证:

root@kitploit:~
▶ meg --verbose --rawhttp /%%0a0afoo:bar
out/example.com/eac3a4978bfb95992e270c311582e6da4568d83d https://example.com/%%0a0afoo:bar (HTTP/1.1 404 Not Found)

rawhttp 库及其使用是实验性的。除其他外,它还不支持分块传输编码,因此如果您使用它,可能会注意到输出中散布着块长度。

仅保存特定状态码

如果只想保存返回特定状态码的结果,可以使用 -s 或 --savestatus 选项:

root@kitploit:~
▶ meg --savestatus 200 /robots.txt

指定方法

您可以使用 -X 或 --method 选项指定要使用的 HTTP 方法:

root@kitploit:~
▶ meg --method TRACE
▶ grep -nri 'TRACE' out/
out/example.com/61ac5fbb9d3dd054006ae82630b045ba730d8618:3:> TRACE /robots.txt HTTP/1.1
out/example.com/bd8d9f4c470ffa0e6ec8cfa8ba1c51d62289b6dd:3:> TRACE /.well-known/security.txt HTTP/1.1
...
下载工具