p0f v3 written in Python
Reason this release was yanked:
Database file (p0f.fp) not included
Project description
pyp0f
Native implementation of p0f
v3 in typed Python 3.
pyp0f
is able to accurately guess the source OS or user application of a given packet with passive fingerprinting.
Motivation
-
pyp0f
is platform independent, while p0f can be cumbersome to run on some platforms (such as Windows). -
pyp0f
is mainly used as a library, as opposed to p0f which runs on a seperate process and you query the results using an API. -
p0f depends on full packet flow details, while
pyp0f
attempts to use as little information as possible. For example, you can easily fingerprint one packet from a session without knowing the session history.
Installation
pip install pyp0f
Features
-
MTU fingerprinting
-
TCP fingerprinting
-
HTTP fingerprinting
TODO
-
Flow tracking
-
TCP uptime detection
-
p0f tool loop
-
Impersonation tool
-
NAT detection
Usage
pyp0f accepts SYN, SYN+ACK and HTTP packets. If the packet is invalid for fingerprint, pyp0f.exceptions.PacketError
is raised.
Database
Before fingerprinting, make sure to load the p0f signatures database.
By default, the included (v3.09b) database will be loaded. However, you can specify a custom database path to
parse.
from pyp0f.database import DATABASE
DATABASE.load()
# or DATABASE.load("path/to/database/file/p0f.fp")
print(len(DATABASE)) # 322
Fingerprinting
pyp0f has 3 main functions:
from pyp0f.fingerprint import fingerprint_mtu, fingerprint_tcp, fingerprint_http
Each fingerprint function returns a custom result object which includes some informative fields that are typed appropriately, such as:
-
The parsed packet
-
The calculated packet signature
-
The matched record, if any
Examples
from scapy.layers.inet import IP
from pyp0f.fingerprint import fingerprint_mtu, fingerprint_tcp, fingerprint_http
packet = IP(b'...')
mtu_result = fingerprint_mtu(packet)
tcp_result = fingerprint_tcp(packet)
http_result = fingerprint_http(packet)
print(mtu_result.match.label.name) # Ethernet or modem
print(tcp_result.match.record.label.dump()) # s:win:Windows:7 or 8
print(http_result.match.label.dump()) # s:!:nginx:1.x
Authors
- Itay Margolin - Nisitay
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file pyp0f-0.1.1.tar.gz
.
File metadata
- Download URL: pyp0f-0.1.1.tar.gz
- Upload date:
- Size: 28.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.7.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a084d453af256c756d70794e2f81bb677e7e869d0da115ad0acf6eaddc2a0845 |
|
MD5 | abb42ab7d3a6ad328879937cb532043c |
|
BLAKE2b-256 | a40746af827ef907a2c5797c89fe2597ffd77f0fc8fed22389ad0153ea778e49 |
File details
Details for the file pyp0f-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: pyp0f-0.1.1-py3-none-any.whl
- Upload date:
- Size: 37.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.7.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c9a3f071f636e751f2cf743e57a4f1614b23762796e2628ca0ca3efdf146c5a2 |
|
MD5 | 94d4483c82f5cf56927f3a1ec4fc2ccf |
|
BLAKE2b-256 | f186ac29e1849577930b4eae1b1b080cd3dcba7200e309d3d0bd375325e57870 |