
FATT /fingerprintAllTheThings - pysharkベースのスクリプトで、pcapファイルやライブネットワークトラフィックからネットワークメタデータとフィンガープリントを抽出します。
66 61 74 74 2e
すべてのものをフィンガープリント!
フィンガープリント手法、サンプルユースケース、調査結果に関する詳細情報は、後日リポジトリに追加される予定です。お楽しみに!
パケットキャプチャファイル(pcap)またはライブネットワークトラフィックから、JA3やHASSHなどのネットワークメタデータとフィンガープリントを抽出するスクリプトです。主なユースケースはハニーポットの監視ですが、ネットワークフォレンジック分析などの他の用途にも使用できます。fattはLinux、macOS、Windowsで動作します。
注意:fattはpyshark(tsharkのPythonラッパー)を使用しているため、パフォーマンスはあまり良くありません!しかし、これは明らかに本番環境で使用するツールではないので、大きな問題ではありません。より本格的なユースケースでは、Bro/Zeek、Suricata、Netcapなどの他のネットワーク分析ツールを使用できます。Joyもネットワークフローデータのキャプチャと分析に使用できる優れたツールです。
その他に、私はより高速なGoベースのfattバージョンに取り組んでおり、そのライブラリをpacketbeatなどのgopacketベースのツールで使用できます。gQUICライブラリ(QUICk)の初期バージョンをリリースしました。
最初にtsharkをインストールする必要があります。バージョンv2.9.0以降を使用していることを確認してください。Tshark/Wiresharkはバージョンv2.9.0から'ssl'を'tls'に名称変更しており、fattは新しいバージョンのtsharkに基づいて作成されています。
古いバージョンのtshark(< v2.9.0)を使用している場合は、"old-tshark"ブランチからfattスクリプトを使用できます。
cd fatt/
pip3 install pipenv
pipenv install
または、仮想環境を使用したくない場合は、pysharkをインストールするだけです:
pip3 install pyshark==0.4.2.2
仮想環境を有効化するには、pipenv shellを実行します:
$ pipenv shell
Launching subshell in virtual environment…
bash-3.2$ . /Users/adel/.local/share/virtualenvs/fatt-ucJHMzzt/bin/activate
(fatt-ucJHMzzt) bash-3.2$ python3 fatt.py -h
または、仮想環境内でpipenv runを使用してコマンドを実行します:
$ pipenv run python3 fatt.py -h
出力:
usage: fatt.py [-h] [-r READ_FILE] [-d READ_DIRECTORY] [-i INTERFACE]
[-fp [{tls,ssh,rdp,http,gquic} [{tls,ssh,rdp,http,gquic} ...]]]
[-da DECODE_AS] [-f BPF_FILTER] [-j] [-o OUTPUT_FILE]
[-w WRITE_PCAP] [-p]
A python script for extracting network fingerprints
optional arguments:
-h, --help show this help message and exit
-r READ_FILE, --read_file READ_FILE
pcap file to process
-d READ_DIRECTORY, --read_directory READ_DIRECTORY
directory of pcap files to process
-i INTERFACE, --interface INTERFACE
listen on interface
-fp [{tls,ssh,rdp,http,gquic} [{tls,ssh,rdp,http,gquic} ...]], --fingerprint [{tls,ssh,rdp,http,gquic} [{tls,ssh,rdp,http,gquic} ...]]
protocols to fingerprint. Default: all
-da DECODE_AS, --decode_as DECODE_AS
a dictionary of {decode_criterion_string:
decode_as_protocol} that is used to tell tshark to
decode protocols in situations it wouldn't usually.
-f BPF_FILTER, --bpf_filter BPF_FILTER
BPF capture filter to use (for live capture only).'
-j, --json_logging log the output in json format
-o OUTPUT_FILE, --output_file OUTPUT_FILE
specify the output log file. Default: fatt.log
-w WRITE_PCAP, --write_pcap WRITE_PCAP
save the live captured packets to this file
-p, --print_output print the output
$ python3 fatt.py -i en0 --print_output --json_logging
192.168.1.10:59565 -> 192.168.1.3:80 [HTTP] hash=598c34a2838e82f9ec3175305f233b89 userAgent="Spotify/109600181 OSX/0 (MacBookPro14,3)"
192.168.1.10:59566 -> 13.237.44.5:22 [SSH] hassh=ec7378c1a92f5a8dde7e8b7a1ddf33d1 client=SSH-2.0-OpenSSH_7.9
13.237.44.5:22 -> 192.168.1.10:59566 [SSH] hasshS=3f0099d323fed5119bbfcca064478207 server=SSH-2.0-babeld-80573d3e
192.168.1.10:59584 -> 93.184.216.34:443 [TLS] ja3=e6573e91e6eb777c0933c5b8f97f10cd serverName=example.com
93.184.216.34:443 -> 192.168.1.10:59584 [TLS] ja3s=ae53107a2e47ea20c72ac44821a728bf
192.168.1.10:59588 -> 192.168.1.3:80 [HTTP] hash=598c34a2838e82f9ec3175305f233b89 userAgent="Spotify/109600181 OSX/0 (MacBookPro14,3)"
192.168.1.10:59601 -> 216.58.196.142:80 [HTTP] hash=d6662c018cd4169689ddf7c6c0f8ca1b userAgent="curl/7.54.0"
216.58.196.142:80 -> 192.168.1.10:59601 [HTTP] hash=c5241aca9a7c86f06f476592f5dda9a1 server=gws
192.168.1.10:54387 -> 216.58.203.99:443 [QUIC] UAID="Chrome/74.0.3729.169 Intel Mac OS X 10_14_5" SNI=clientservices.googleapis.com AEAD=AESG KEXS=C255
JSON出力: