Skip to main content

API client for p0f3

Project description

This is a simple API client for p0f3, available at http://lcamtuf.coredump.cx/p0f3/ . It is not compatible with version 2.x or 1.x.

Basic usage:

python
from p0f import P0f, P0fException

data = None
p0f = P0f("p0f.sock") # point this to socket defined with "-s" argument.
try:
    data = p0f.get_info("192.168.0.1")
except P0fException, e:
    # Invalid query was sent to p0f. Maybe the API has changed?
    print e
except KeyError, e:
    # No data is available for this IP address.
    print e
except ValueError, e:
    # p0f returned invalid constant values. Maybe the API has changed?
    print e

if data:
    print "First seen:", data["first_seen"]
    print "Last seen:", data["last_seen"]

Data fields

Parts of these descriptions are shamelessly copied from [here](http://lcamtuf.coredump.cx/p0f3/README):

By default, following fields are parsed:

  • datetime: first_seen

  • datetime: last_seen

  • timedelta: uptime

  • int: uptime_sec

  • timedelta: up_mod_days

  • datetime: last_nat

  • datetime: last_chg

Additionally, bad_sw and os_match_q are validated. “ValueError” is raised, if incorrect value is encountered. For all empty fields, None is used instead of empty strings or constants:

  • uptime_min

  • uptime_sec

  • uptime

  • up_mod_days

  • last_nat

  • last_chg

  • distance

  • bad_sw

  • os_name

  • os_flavor

  • http_flavor

  • link_type

  • language

This parsing and validation can be disabled with

p0f.get_info("192.168.0.1", True)

Full descriptions of the fields:

  • int: first_seen - unix time (seconds) of first observation of the host.

  • int: last_seen - unix time (seconds) of most recent traffic.

  • int: total_conn - total number of connections seen.

  • int: uptime_min - calculated system uptime, in minutes. Zero if not known.

  • int: up_mod_days - uptime wrap-around interval, in days.

  • int: last_nat - time of the most recent detection of IP sharing (NAT,

    load balancing, proxying). Zero if never detected.

  • int: last_chg - time of the most recent individual OS mismatch (e.g.,

    due to multiboot or IP reuse).

  • int: distance - system distance (derived from TTL; -1 if no data).

  • int: bad_sw - p0f thinks the User-Agent or Server strings aren’t

    accurate. The value of 1 means OS difference (possibly due to proxying), while 2 means an outright mismatch. NOTE: If User-Agent is not present at all, this value stays at 0.

  • int: os_match_q - OS match quality: 0 for a normal match; 1 for fuzzy

    (e.g., TTL or DF difference); 2 for a generic signature; and 3 for both.

  • string: os_name - Name of the most recent positively matched

    OS. If OS not known, os_name is empty string. NOTE: If the host is first seen using an known system and then switches to an unknown one, this field is not reset.

  • string: os_flavor - OS version. May be empty if no data.

  • string: http_name - most recent positively identified HTTP application

    (e.g. ‘Firefox’).

  • string: http_flavor - version of the HTTP application, if any.

  • string: link_type - network link type, if recognized.

  • string: language - system language, if recognized.

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

p0f-0.0.2.tar.gz (5.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

p0f-0.0.2.macosx-10.8-x86_64.exe (70.9 kB view details)

Uploaded Source

File details

Details for the file p0f-0.0.2.tar.gz.

File metadata

  • Download URL: p0f-0.0.2.tar.gz
  • Upload date:
  • Size: 5.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for p0f-0.0.2.tar.gz
Algorithm Hash digest
SHA256 05a5a3fc9f42e0433b38227098cdf44dcd90f209bbf7a81648c7a43f9d366db3
MD5 7eb33bc2a7f95c8a3c05d201c39b33e3
BLAKE2b-256 c3211403ed296cd84dd76463e5286533b1f0ca3697e44fdd6e4eb6c8ecd8a103

See more details on using hashes here.

File details

Details for the file p0f-0.0.2.macosx-10.8-x86_64.exe.

File metadata

File hashes

Hashes for p0f-0.0.2.macosx-10.8-x86_64.exe
Algorithm Hash digest
SHA256 0ee5e67f57da6216a09654f9ae2bf5d0b28e790d4dab58192f8dcf9323534d20
MD5 eff850cfef68258ffce337c895eeb6fd
BLAKE2b-256 64cc50af3ba49e7820456320514b056e7f743792509837d99c9b729cd4bba505

See more details on using hashes here.

Supported by

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