Skip to main content

No project description provided

Project description

webanalyzer

PyPI

安装

pip install -U webanalyzer

使用

命令行

第一次运行程序必须先下载指纹规则

[*] webanalyzer --update -d /path/to/rules

也可以使用 git 自行下载规则

[*] git clone https://github.com/webanalyzer/rules.git /path/to/rules

使用方法:

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

Options:
  -u, --url TEXT                  Target  [required]
  -d, --directory TEXT            Rules directory, default ./rules
  -a, --aggression INTEGER RANGE  Aggression mode, default 0
  -U, --user-agent TEXT           Custom user agent
  -H, --header TEXT               Pass custom header LINE to serve
  -v, --verbose INTEGER RANGE     Verbose level, default 2
  -r, --rule TEXT                 Specify rule
  --disallow-redirect             Disallow redirect
  --list-rules                    List rules
  --update                        Update rules
  --version                       Show the version and exit.
  --help                          Show this message and exit.

例子:

[*] webanalyzer -u "http://blog.fatezero.org" -d path/to/rules
[
    {
        "name": "Fastly",
        "origin": "wappalyzer"
    },
    {
        "name": "Hexo",
        "origin": "wappalyzer",
        "version": "3.8.0"
    },
    {
        "name": "Varnish",
        "origin": "wappalyzer"
    },
    {
        "name": "GitHub Pages",
        "origin": "wappalyzer"
    },
    {
        "name": "Ruby on Rails",
        "origin": "implies"
    },
    {
        "name": "Ruby",
        "origin": "implies"
    }
]

使用路径指定某个 rule

[*] webanalyzer -u "http://blog.fatezero.org" -p /path/to/hexo.json
{
    "name": "Hexo",
    "origin": "test",
    "version": "3.8.0"
}

类库

作为类库使用

import webanalyzer

# 初始化
w = webanalyzer.WebAnalyzer()

# 设置自定义 headers
w.headers = {
    "User-Agent": "custom ua",
    "header-key": "header-value"
}

# 是否允许跳转
w.allow_redirect = True

# aggression 模式级别
w.aggression = 0

# 设置 requests timeout 时间
w.timeout = 30

# 设置 rules 路径
w.rule_dir = "rules"

# 下载或更新某个路径下的 rules
if w.update_rules():
    print("update rules successful")

# 重新加载 rules
n = w.reload_rules()
print("reload %d rules" % n)

# 获取所有 rules
r = w.list_rules()
print("list %d rules" % n)

# 使用某个 rule 进行检测
r = w.test_rule("http://blog.fatezero.org", "rules/wappalyzer/hexo.json")
print(r)

# 使用所有 rules 进行检测,默认会重新 reload rules
r = w.start("http://blog.fatezero.org", reload=False)
print(r)

Q & A

  • 和 WhatWeb、Wappalyzer 的区别?

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

  • 为什么只支持 Python3.6 以及以上的 Python 版本?

因为有些正则规则使用了 (?-flag:...) 这样的写法,然而在 https://docs.python.org/3/whatsnew/3.6.html#re 才开始支持。

引用

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

webanalyzer-2019.8.22.tar.gz (15.5 kB view details)

Uploaded Source

File details

Details for the file webanalyzer-2019.8.22.tar.gz.

File metadata

  • Download URL: webanalyzer-2019.8.22.tar.gz
  • Upload date:
  • Size: 15.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.33.0 CPython/3.7.3

File hashes

Hashes for webanalyzer-2019.8.22.tar.gz
Algorithm Hash digest
SHA256 3834abe870a5786c58f85ac9ee26f9878e050c9e5a6db139abec0cfee3e59596
MD5 5b77d1a89918501f78697cef2d10667b
BLAKE2b-256 3e0e5814412b435b3e706044be06b930f64cb85e6dea9666e59f929605c05e73

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page