Github: https://github.com/mozilla/http-observatory
Mozilla HTTP Observatory –
Mozilla HTTP Observatoryは、あなたのウェブサイトを分析し、利用可能な多くの方法を利用しているかどうかを知らせる一連のツールです。
それは3つのプロジェクトに分割されます:
- http-observatory – スキャナー/グレーダー
- observatory-cli – コマンドラインインターフェイス
- http-observatory-website – ウェブインターフェース
HTTP天文台でサイトをスキャンする
サイトは以下を使用してスキャンできます。
- observatory.mozilla.org – オンラインインターフェース
- observatory-cli – 公式のnode.jsコマンドラインインターフェイス
- java-http-observatory-api – サードパーティのJavaライブラリとコマンドラインインタフェース
貢献する
前提条件
- Python 3
- Git
- パイプ3
ノート
これらの手順ではpip3
インストールされ、要件を構築できるPython3開発環境があり、追加のPython OSパッケージ( -dev
、 -devel
)のインストールが必要な場合があると想定しています。
これがお使いの環境に適していない場合は、OSパッケージマネージャ(または他の手段)を使用して適切な要件をインストールし、 pip3 -r requirements
コマンドをスキップすることがpip3 -r requirements
。
継続的な統合のために、DBなしでローカルコードベースからスキャンを実行する
# Install the HTTP Observatory
$ git clone https://github.com/mozilla/http-observatory.git
$ cd http-observatory
$ pip3 install --upgrade .
$ pip3 install --upgrade -r requirements.txt
ローカルスキャナ機能の呼び出し
>>> from httpobs.scanner.local import scan
>>> scan('observatory.mozilla.org') # a scan with default options
>>> scan('observatory.mozilla.org', # all the custom options
http_port=8080, # http server runs on port 8080
https_port=8443, # https server runs on port 8443
path='/foo/bar', # don't scan /, instead scan /foo/bar
cookies={'foo': 'bar'}, # set the "foo" cookie to "bar"
headers={'X-Foo': 'bar'}, # send an X-Foo: bar HTTP header
verify=False) # treat self-signed certs as valid for tests like HSTS/HPKP
同じですがローカルのCLIを使用しています
$ httpobs-local-scan --http-port 8080 --https-port 8443 --path '/foo/bar' \
--cookies '{"foo": "bar"}' --headers '{"X-Foo": "bar"}' --no-verify mozilla.org
Dockerでローカルスキャナを実行する
- Docker ToolboxとVirtualBoxをインストールする
# Install the HTTP Observatory client and requests library
$ git clone https://github.com/mozilla/http-observatory.git
$ cd http-observatory
$ pip3 install .
$ pip3 install --upgrade requests
# Create docker machine
$ docker-machine create --driver virtualbox --virtualbox-disk-size "40000" http-observatory
# Save the URL to the API in your .profile, .bash_profile, or whatever
$ echo export HTTPOBS_API_URL=http://$(docker-machine ip http-observatory):57001/api/v1 >> ~/.profile
$ . ~/.profile
# Start up the docker instance and install all the pieces
$ eval $(docker-machine env http-observatory)
$ docker-compose up -d
ローカルインストールを作成する(Ubuntu 15でテスト済み)
# Install git, postgresql, and redis
# sudo -s
# apt-get install -y git libpq-dev postgresql redis-server
# Clone the repo
# cd /opt
# git clone https://github.com/mozilla/http-observatory.git
# cd http-observatory
# Install the observatory and scanner
# pip install .
# pip3 install -r requirements.txt
# Install the database
# su - postgres
$ createdb http_observatory
$ psql http_observatory < httpobs/database/schema.sql
$ psql http_observatory
http_observatory=# \password httpobsapi
http_observatory=# \password httpobsscanner
# vi /etc/postgresql/9.4/main/postgresql.conf (set max_connections = 512, shared_buffers = 256MB)
# service postgresql restart
# Create the httpobs user, and log/pid directories
# useradd -m httpobs
# install -m 750 -o httpobs -g httpobs -d /var/run/httpobs /var/log/httpobs
# Update the environmental variables
# su - httpobs
$ echo export HTTPOBS_API_URL="http://localhost:57001/api/v1" >> ~/.profile
# Start the scanner
$ cd /opt/http-observatory
$ HTTPOBS_DATABASE_USER="httpobsscanner" HTTPOBS_DATABASE_PASS="....." \
/opt/http-observatory/httpobs/scripts/httpobs-scan-worker
# Start the API (in another terminal)
# HTTPOBS_DATABASE_USER="httpobsapi" HTTPOBS_DATABASE_PASS="....." \
uwsgi --http :57001 --wsgi-file httpobs/website/main.py --processes 8 --callable app --master
著者
- エイプリルキング
ライセンス
- Mozilla Public License Version 2.0