Skip to main content

具有可插入递归策略的简单网络蜘蛛

项目描述

间谍

具有多种递归策略的简单网络蜘蛛。主页位于http://github.com/slinkp/spydey

除了关注链接和报告状态之外,它并没有做太多事情。我主要将它用于快速和肮脏的烟雾测试和链接检查。

唯一不寻常的功能是--traversal=pattern选项,它以不寻常的顺序进行递归遍历:它尝试识别 URL 中的模式,并且将在具有以前见过的模式的 URL 之前跟踪具有新模式的 URL。当没有新的模式可以遵循时,它会随机链接到已知模式的 URL。如果您使用它来对将 URL 模式映射到视图/控制器的典型现代 Web 应用程序进行冒烟测试,这将很快地至少命中您的所有视图/控制器一次……通常。但是,当指向具有任意深度树(静态文件、VCS 存储库等)的网站时,它并不是很有趣。

此外,它的设计使得添加新的递归策略是微不足道的。Spydey 最初是为了试验不同的递归爬取策略而编写的。阅读源代码。

哦,如果你安装了 Fabulous,控制台输出是彩色的。

对于懒惰的零配置冒烟测试,我通常像这样运行它:

spydey -r --stop-on-error --max-requests=200 --traversal=pattern --profile --log-referrer URL

还有许多其他命令行选项,其中许多是从 wget 窃取的。使用--help查看它们是什么。

用法

Usage: spydey [options] URL

Options:
  -h, --help            show this help message and exit
  -r, --recursive       Recur into subdirectories
  -p, --page-requisites
                        Get all images, etc. needed to display HTML page.
  --no-parent           Don't ascend to the parent directory.
  -R REJECT, --reject=REJECT
                        Regex for filenames to reject. May be given multiple
                        times.
  -A ACCEPT, --accept=ACCEPT
                        Regex for filenames to accept. May be given multiple
                        times.
  -t TRAVERSAL, --traversal=TRAVERSAL, --traverse=TRAVERSAL
                        Recursive traversal strategy. Choices are: breadth-
                        first, depth-first, hybrid, pattern, random
  -H, --span-hosts      Go to foreign hosts when recursive.
  -w WAIT, --wait=WAIT  Wait SECONDS between retrievals.
  --random-wait=RANDOM_WAIT
                        Wait from 0...2*WAIT secs between retrievals.
  --loglevel=LOGLEVEL   Log level.
  --log-referrer, --log-referer
                        Log referrer URL for each request.
  --transient-log       Use Fabulous transient logging config.
  --max-redirect=MAX_REDIRECT
                        Maximum number of redirections to follow for a
                        resource.
  --max-requests=MAX_REQUESTS
                        Maximum number of requests to make before exiting. (-1
                        used with --traversal=pattern means exit when out of
                        new patterns)
  --stop-on-error       Stop after the first HTTP error (response code 400 or
                        greater).
  -T TIMEOUT, --timeout=TIMEOUT
                        Set the network timeout in seconds. 0 means no
                        timeout.
  -P, --profile         Print the time to download each resource, and a
                        summary of the 20 slowest at the end.
  --stats               Print a summary of traversal patterns, if
                        --traversal=pattern
  -v, --version         Print version information and exit.

变更日志

0.5

  • 删除无用的模式统计信息,除非给出 –stats

  • 修复以防止在跟随重定向时跨越主机,除非 -H 打开。

0.4

  • 添加--stop-on-error选项

  • 添加--max-requests=-1表示在看到所有模式后停止(与 --traversal=pattern 一起使用时)

  • 将使用文本自动添加到 pkg info

0.3

  • 更好的重定向处理:遵循 -A、-R、-max-redirect 和 -max-requests 选项

  • 小错误修复和重构

项目详情


下载文件

下载适用于您平台的文件。如果您不确定要选择哪个,请了解有关安装包的更多信息。

源分布

spydey-0.5.tar.gz (10.5 kB 查看哈希)

已上传 source