saeeddhqan/evine

GitHub: saeeddhqan/evine

Evine 是一个用 Go 编写的交互式命令行 Web 爬虫和抓取工具,支持通过关键词、文件扩展名和 jQuery 选择器从网页中快速提取数据。

Stars: 180 | Forks: 28

[![Go Report Card](https://goreportcard.com/badge/github.com/saeeddhqan/evine)](https://goreportcard.com/report/github.com/saeeddhqan/evine) [![License](https://img.shields.io/github/license/saeeddhqan/evine?color=%234ac41c)](https://opensource.org/licenses/GPL-3.0) [![Build Status](https://travis-ci.com/saeeddhqan/evine.svg?branch=master)](https://travis-ci.com/saeeddhqan/evine) # Evine 交互式 CLI Web Crawler。 Evine 是一个使用 Golang 编写的简单、快速且交互式的 web crawler 和 web scraper。 Evine 适用于各种用途,例如元数据和数据提取、数据挖掘、侦察和测试。 [![asciicast](https://asciinema.org/a/351624.svg)](https://asciinema.org/a/351624) ## 安装 ### 从二进制文件安装 我们也提供了预构建的[二进制发布版本](https://github.com/saeeddhqan/evine/releases)(推荐)。 ### 从源码安装 ``` go get github.com/saeeddhqan/evine "$GOPATH/bin/evine" -h ``` ### 从 GitHub 安装 ``` git clone https://github.com/saeeddhqan/evine.git cd evine go build . mv evine /usr/local/bin evine --help ``` 注意:需要 golang 1.13.x。 ## 命令与用法 快捷键 | 描述 ----------------------------------------|--------------------------------------- Enter | 运行爬虫(从 URL 视图) Enter | 显示响应(从 Keys 和 Regex 视图) Tab | 下一个视图 Ctrl+Space | 运行爬虫 Ctrl+S | 保存响应 Ctrl+Z | 退出 Ctrl+R | 恢复默认值(从 Options 和 Headers 视图) Ctrl+Q | 关闭响应保存视图(从 Save 视图) ``` evine -h ``` 它会显示该工具的帮助信息: | flag | 描述 | 示例 | |------|-------------|---------| | -url | 要爬取的 URL | evine -url toscrape.com | | -url-exclude string | 排除匹配此正则表达式的 URL (默认 ".*") | evine -url-exclude ?id= | | -domain-exclude string | 排除爬取的作用域内域名。用逗号分隔。默认=根域名 | evine -domain-exclude host1.tld,host2.tld | | -code-exclude string | 排除带有这些状态码的 HTTP 状态码。用 '\|' 分隔 (默认 ".*") | evine -code-exclude 200,201 | | -delay int | 每次请求之间的休眠时间(毫秒) | evine -delay 300 | | -depth | Scraper 深度搜索级别 (默认 1) | evine -depth 2 | | -thread int | 用于解析的并发 goroutines 数量 (默认 5) | evine -thread 10 | | -header | 每个请求的 HTTP Header (字段之间应使用 \n 分隔)。 | evine -header KEY: VALUE\nKEY1: VALUE1 | | -proxy string | 通过 scheme://ip:port 设置代理 | evine -proxy http://1.1.1.1:8080 | | -scheme string | 为请求设置协议 scheme (默认 "https") | evine -scheme http | | -timeout int | 超时前等待的秒数 (默认 10) | evine -timeout 15 | | -query string | JQuery 表达式 (它可以是文件扩展名(pdf)、关键键值(url,script,css,..) 或者是 jquery 选择器($("a[class='hdr']).attr('hdr'))) | evine -query url,pdf,txt | | -regex string | 在页面内容中搜索正则表达式 | evine -regex 'User.+' | | -logger string | 将错误记录到文件中 | evine -logger log.txt | | -max-regex int | regex 字段中正则表达式搜索的最大结果数 (默认 1000) | evine -max-regex -1 | | -robots | 爬取 robots.txt 获取 URL 并将它们作为种子使用 | evine -robots | | -sitemap | 爬取 sitemap.xml 获取 URL 并将它们作为种子使用 | evine -sitemap | | -wayback | 爬取 WayBackURLs(web.archive.org) 获取 URL 并将它们作为种子使用 | evine -sitemap | ### 视图 - URL, 在此视图中,你需要输入 URL 字符串。 - Options, 此视图用于设置选项。 - Headers, 此视图用于设置 HTTP Headers。 - Query, 此视图在爬取网页后使用。 它将用于从已爬取的网页中提取数据(文档、URL 等)。 - Regex, 此视图可用于在已爬取的网页中搜索正则表达式。在此视图中编写你的 Regex 并按下 Enter。 - Response, 所有的结果都会写入此视图。 - Search, 此视图用于在 Response 视图的内容中搜索正则表达式。 ### 提取方法 #### 从 Keys 提取 Keys 是预定义的关键词,可用于指定如作用域内 URL、作用域外 URL、电子邮件等数据。 所有 keys 的列表: - url, 提取作用域内的 URL。这些 URL 经过了完全的清洗。 - email, 提取作用域内和作用域外的电子邮件。 - query_urls, 提取包含 get 请求查询参数 (?foo=bar) 的作用域内 URL。 - all_urls, 提取作用域外的 URL。 - phone, 提取包含电话号码的 a[href]。 - media, 提取非 web 可执行文件。如 .exe,.bat,.tar.xz,.zip 等格式的地址。 - css, 提取 CSS 文件。 - script, 提取 JavaScript 文件。 - cdn, 提取内容分发网络(CDNs)地址。如 //api.foo.bar/jquery.min.js - comment, 提取 html 注释, <\!-- .* !--> - dns, 提取属于该网站的子域名。 - network, 提取社交网络 ID。如 facebook, twitter 等。 - all, 提取所有 keys 列表。(url,query_url,..) keys 是区分大小写的。此外,可以通过逗号分隔写入两到三个 key。 #### 从扩展名提取 也许你想要一个未在 keys 中定义的文件。你能做什么?你可以直接在 Query 视图中写入文件的扩展名。如 png,xml,txt,docx,xlsx,a,mp3 等。 #### 从 JQuery 选择器提取 如果你具备基础的 JQuery 技能,你可以轻松使用此功能,如果没有,这也不是很难。要快速了解选择器,[w3schools](https://www.w3schools.com/jquery/jquery_ref_selectors.asp) 是一个很好的资源。
示例(查找 source[src]): ``` $("source").attr("src") // To find all of source[src] urls $("h1").text() // To find h1 values ``` 模板: ``` $("SELECTOR").METHOD_NAME("arg") ``` 它不支持类似下面的查询: ``` $('SELECTOR').METHOD("arg") $('SELECTOR').METHOD('arg') $("SELECTOR" ).METHOD("arg" ) ``` 方法描述如下: - text(), 返回不带 html 标签的 SELECTOR 内容。 - html(), 返回带有 html 标签的 SELECTOR 内容。 - attr("ATTR"), 获取 SELECTOR 的属性。例如 $("a").attr("href") ## Bug 或建议 如需报告 bug 或提出建议,请创建一个 [issue](https://github.com/saeeddhqan/evine/issues)。 Evine 深受 [wuzz](https://github.com/asciimoo/wuzz) 的启发。
标签:BeEF, EVTX分析, Golang, Web抓取, 信息搜集, 安全编程, 实时处理, 密码管理, 数据提取, 文档结构分析, 日志审计, 爬虫