Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
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. Start p0f with -s path/to/unix_socket
option.
Basic usage:
::
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"]
See examples/django_models.py for complete Django model of the data returned by p0f.
Django middleware is available in p0f.django.middleware
.
To use, add P0FSOCKET = "path/to/p0f_unix_socket"
to your project's settings.py,
and p0f.django.middleware.P0fMiddleware
to MIDDLEWARE_CLASSES
.
The middleware adds p0f
attribute to all incoming requests. request.p0f
is
None if connection to p0f failed or p0f did not return data for remote IP address.
Parts of these descriptions are shamelessly copied from http://lcamtuf.coredump.cx/p0f3/README :
By default, following fields are parsed:
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:
This parsing and validation can be disabled with
::
p0f.get_info("192.168.0.1", True)
Full descriptions of the fields:
FAQs
API client for p0f3
We found that p0f demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.