fate0/webanalyzer: WhatWeb + Wappalyzer in python

栏目: Python · 发布时间: 6年前

内容简介:usage:作为类库使用例子:

webanalyzer

安装

pip install -U webanalyzer

使用

命令行

webanalyzer -u "http://www.fatezero.org"

usage:

[*] webanalyzer --help
Usage: webanalyzer [OPTIONS]

Options:
  -u, --url TEXT                  Target  [required]
  -a, --aggression INTEGER RANGE  Aggression mode, 1 enable custom plugins
                                  aggression mode, 2 enable all plugins
                                  aggression mode
  -U, --user-agent TEXT           Custom user agent
  -H, --header TEXT               Pass custom header LINE to serve
  -r, --disallow-redirect         Disallow redirect
  -l, --list-plugins              List the plugins
  -v, --verbose INTEGER           Verbose level
  --help                          Show this message and exit.

类库

作为类库使用

import webanalyzer

w = webanalyzer.WebAnalyzer()

w.headers = {
    "User-Agent": "custom ua",
    "header-key": "header-value"
}

w.allow_redirect = True
w.aggression = 0
r = w.start("http://www.fatezero.org")

print(r)

规则编写

基础信息

例子:

{
    "name": "wordpress",
    "author": "fate0",
    "version": "0.1.0",
    "description": "wordpress 是世界上最为广泛使用的博客系统",
    "website": "http://www.wordpress.org/",
    "matches": [],
    "condition": "0 and 1 and not 2",
    "implies": "PHP",
    "excludes": "Apache"
}

描述:

FIELD TYPE DESCRIPTION EXAMPLE REQUIRED
name string 组件名称 wordpress true
author string 作者名 fate0 false
version string 插件版本 0.1.0 false
description string 组件描述 wordpress 是世界上最为广泛使用的博客系统 false
website string 组件网站 http://www.wordpress.org/ false
matches array 规则 [{"regexp": "wordpress"}] true
condition string 规则组合条件 0 and 1 and not 2 false
implies string/array 依赖的其他组件 PHP false
excludes string/array 肯定不依赖的其他组件 Apache false

规则信息

例子:

[
    {
        "name": "rule name"
        "search": "all"
    }
]

描述:

FIELD TYPE DESCRIPTION EXAMPLE
name string 规则名称 rulename
search string 搜索的位置,可选值为 all , headers , body , script , cookies , headers[key] , meta[key] , cookies[key] body
regexp string 正则表达式 wordpress.*
text string 明文搜索 wordpress
version string 匹配的版本号 0.1
offset int regexp 中版本搜索的偏移 1
certainty int 确信度 75
md5 string 目标文件的 md5 hash 值 beb816a701a4cee3c2f586171458ceec
url string 需要请求的 url /properties/aboutprinter.html
status int 请求 url 的返回状态码,默认是 200 400

返回信息

例子:

[
    {
        "name": "4images",
        "version": "1.1",
        "certainty": 100,
        "origin": "custom"
    }
]

描述:

FIELD TYPE DESCRIPTION EXAMPLE REQUIRED
name string 组件名称 wordpress true
version string 插件版本 0.1.0 false
certainty int 确信度 75 false
origin string 插件来源 custom false

检测逻辑

aggression
or

Q & A

  • WhatWeb 的规则如何转换成 webanalyzer 的规则?

可以看下 tools/whatweb.rb 代码,实际上我这并没有成功转换全部规则,依旧有部分 passive, aggressive 函数规则以及其他规则并没去转换, 不过成功转换比例占大多数。

  • Wappalyzer 的规则如何转换成 webanalyzer 的规则?

可以看下 tools/wappalyzer.py 代码,因为 Wappalyzer 的规则本来就是 json 格式,所以比较容易转换,但是依旧有部分字段我没有保留在我的规则中。

  • 为什么使用 json 作为规则格式?

更通用,即便更换编程语言,也可以继续复用本来的规则。

  • 和 WhatWeb、Wappalyzer 的区别?

WhatWeb 的规则使用 ruby 编写,在规则方面,其他编程语言很难复用,也只能通过子进程的方式调用 WhatWeb。 Wappalyzer 更多的作为一个浏览器插件使用。

  • 如何同步 WhatWeb、Wappalyzer 的规则?

可以看下 .travis.yml ,通过 travis-ci 达到每天自动同步规则,每周自动同步至 pypi 。

引用


以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

The Art of Computer Programming, Volume 2

The Art of Computer Programming, Volume 2

Knuth, Donald E. / Addison-Wesley Professional / 1997-11-04 / USD 79.99

Finally, after a wait of more than thirty-five years, the first part of Volume 4 is at last ready for publication. Check out the boxed set that brings together Volumes 1 - 4A in one elegant case, and ......一起来看看 《The Art of Computer Programming, Volume 2》 这本书的介绍吧!

MD5 加密
MD5 加密

MD5 加密工具

XML 在线格式化
XML 在线格式化

在线 XML 格式化压缩工具

HEX HSV 转换工具
HEX HSV 转换工具

HEX HSV 互换工具