Skip to main content

p0f v3 with impersonation spoofing, written in Python

Project description

pyp0f

Native implementation of p0f v3 in typed Python 3.


Documentation: https://github.com/Nisitay/pyp0f/blob/master/docs/README.md

Source Code: https://github.com/Nisitay/pyp0f


pyp0f is able to accurately guess the source OS or user application of a given packet with passive fingerprinting, as well as impersonate packets so that p0f will think it has been sent by a specific OS.

Motivation

  • pyp0f is platform independent (using Scapy), while p0f can be cumbersome to run on some platforms (such as Windows).
  • The implementation and concepts behind p0f are very sophisticated, but the tool is written in C which makes it harder to understand and extend. Performance is expected to be slower in Python, but pyp0f still performs well enough (see Performance benchmarks)
  • p0f heavily depends on full packet flow details, while pyp0f attempts to use as little information as possible. For example, you may be able to fingerprint a SYN+ACK packet from a session without having the matching SYN packet.
  • pyp0f aims to be highly configurable and used as a library, without limiting its effectiveness to one packet format/library, as opposed to p0f which runs on a seperate process and you query the results using an API.

Installation

$ pip install pyp0f

Features

  • Full p0f fingerprinting (MTU, TCP, HTTP)
  • p0f spoofing - impersonation (MTU, TCP)

In Progress

  • Flow tracking
  • TCP uptime detection
  • NAT detection

Getting Started

from scapy.layers.inet import IP, TCP
from pyp0f.database import DATABASE
from pyp0f.fingerprint import fingerprint_mtu, fingerprint_tcp, fingerprint_http
from pyp0f.fingerprint.results import MTUResult, TCPResult, HTTPResult

DATABASE.load()  # Load the fingerprints database

# MTU Fingerprinting
google_packet = IP() / TCP(options=[("MSS", 1430)])
mtu_result: MTUResult = fingerprint_mtu(google_packet)

# TCP Fingerprinting
linux_packet = IP(tos=0x10, flags=0x02, ttl=58) / TCP(
    seq=1,
    window=29200,
    options=[("MSS", 1460), ("SAckOK", b""), ("Timestamp", (177816630, 0)), ("NOP", None), ("WScale", 7)],
)
tcp_result: TCPResult = fingerprint_tcp(linux_packet)

# HTTP Fingerprinting
apache_payload = b"HTTP/1.1 200 OK\r\nDate: Fri, 10 Jun 2011 13:27:01 GMT\r\nServer: Apache\r\nLast-Modified: Thu, 09 Jun 2011 17:25:43 GMT\r\nExpires: Mon, 13 Jun 2011 17:25:43 GMT\r\nETag: 963D6BC0ED128283945AF1FB57899C9F3ABF50B3\r\nCache-Control: max-age=272921,public,no-transform,must-revalidate\r\nContent-Length: 491\r\nConnection: close\r\nContent-Type: application/ocsp-response\r\n\r\n"
http_result: HTTPResult = fingerprint_http(apache_payload)

Sources

Authors

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

pyp0f-0.2.1.tar.gz (34.3 kB view details)

Uploaded Source

Built Distribution

pyp0f-0.2.1-py3-none-any.whl (50.1 kB view details)

Uploaded Python 3

File details

Details for the file pyp0f-0.2.1.tar.gz.

File metadata

  • Download URL: pyp0f-0.2.1.tar.gz
  • Upload date:
  • Size: 34.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.7.8

File hashes

Hashes for pyp0f-0.2.1.tar.gz
Algorithm Hash digest
SHA256 20ba98819a4b9239037c02e51298b9a9b1271b26df87a1522b7cccf3fa762b17
MD5 4cd693e554528d59c73813ecbe5bda2e
BLAKE2b-256 12c3d3dddcd7f9edcaf3c60e3ea5000f7a88acb670370ecdbdb2dcf319bf543f

See more details on using hashes here.

File details

Details for the file pyp0f-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: pyp0f-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 50.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.7.8

File hashes

Hashes for pyp0f-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 60506e301d3731a2f74e9b8912dc613659a5898737fc55716c51cd5d7bda735f
MD5 0eaf6f040727adc2ceca673ba3dd7ae5
BLAKE2b-256 8e79f3f20bdfc6b587f2710631c87b7f15d0f672cbd6b8b21100ded632da2aee

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