Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged 3.07b #1

Open
wants to merge 90 commits into
base: ssl
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
90 commits
Select commit Hold shift + click to select a range
cdc3efe
Merge remote-tracking branch 'p0f/master'
majek May 17, 2012
d30cfdc
Merge remote-tracking branch 'p0f/master'
majek Oct 11, 2012
64d0c85
p0f-3.07b
majek May 21, 2014
ec9969c
Merge branch 'master' of https://github.com/p0f/p0f
splitice Jun 7, 2014
d82728d
Merge remote-tracking branch 'origin/master' into ssl
splitice Jun 7, 2014
f4d1180
Merge master to SSL branch
splitice Jun 7, 2014
b8e94d4
Should work with nflog sockets if BPF is disabled
splitice Jun 15, 2014
a1523eb
add stdbool header
splitice Jun 15, 2014
db4a4e0
added -b to help output and getopt
splitice Jun 15, 2014
7db3a92
I have never used geopt before, one more attempt before man
splitice Jun 15, 2014
2fe3b70
Check for multiple -b options
splitice Jun 15, 2014
b30fe4d
use u8 for consistency
splitice Jun 15, 2014
01b9d71
attempt to make work
splitice Jun 15, 2014
f3d6c71
.
splitice Jun 15, 2014
cecb9aa
who cares about the check?
splitice Jun 15, 2014
ada2337
read getopt manual, now I know what I was doing wrong!
splitice Jun 15, 2014
977fa70
NFLOG packet parsing support
splitice Jun 15, 2014
1456dd2
added [#] for debug message consistency
splitice Jun 15, 2014
ee5591f
nflog support tested as working.
splitice Jun 15, 2014
367047c
added check for a packet where payload TLV isnt found
splitice Jun 15, 2014
893190a
urgh no booleans in this C version
splitice Jun 15, 2014
c2b547f
missing semicolon
splitice Jun 15, 2014
e1edea4
Allow for our traffic to be one-sided.
splitice Jun 15, 2014
5e3bb94
add p0f_open_live to increase the read buffer length to hopefully pre…
splitice Jun 16, 2014
011dee4
remove reliance on pcap internals
splitice Jun 16, 2014
85d8518
Missed one place of reliance on internals.
splitice Jun 16, 2014
e6fd682
readme updated with information on this fork.
splitice Jun 16, 2014
5289432
fix newline in README
splitice Jun 16, 2014
942e025
NETLINK_NO_ENOBUFS added
splitice Jun 16, 2014
8aee80f
re-factored NFLOG buffer setopt to only be applied to nflog sockets
splitice Jun 16, 2014
7a31820
fix incorrect variable name
splitice Jun 16, 2014
dfcf540
re-order NETLINK_NO_ENOBUFS
splitice Jun 20, 2014
6a83b67
pt isnt initialized yet
splitice Jun 20, 2014
4c7f1f3
added ifdef around DLT_NFLOG and pcap promisc constants
splitice Jun 20, 2014
517425e
added debug to pcap opening
splitice Jun 20, 2014
4531e45
add DLT_LOOP, unsure of offset.
splitice Jun 20, 2014
bccd21a
comment out old DLT_LOOP
splitice Jun 20, 2014
bf9182c
value appears to be wrong
splitice Jun 20, 2014
ace481a
debug statement, what DLT?
splitice Jun 20, 2014
6529840
ok, this might work.
splitice Jun 20, 2014
38214f7
correct offset
splitice Jun 20, 2014
131a933
initial code to support epoll
splitice Jun 27, 2014
ed2fc93
correct function name
splitice Jun 27, 2014
996f211
reorder includes so epoll is included
splitice Jun 27, 2014
c47cf51
fix some C errors
splitice Jun 27, 2014
d4c930e
more error fixes
splitice Jun 27, 2014
35f2f67
fixes, and epoll_ctl error handling
splitice Jun 27, 2014
291f163
epoll - write out the response
splitice Jun 27, 2014
9c8607c
simple fixes
splitice Jun 27, 2014
10eee5c
missing brace and comma added
splitice Jun 27, 2014
e504dc0
add initial api & pcap fds to epol
splitice Jun 27, 2014
f767af0
only declare res once, and re-use it in more places
splitice Jun 27, 2014
aed58b1
only add api_fd if it is set (API enabled)
splitice Jun 27, 2014
fa24ea5
Check the flag api_sock not the unintialized varaible
splitice Jun 27, 2014
0ed548a
added info message (same as poll)
splitice Jun 27, 2014
3c7a6cd
be a good function and close the epoll fd
splitice Jun 27, 2014
a8f02c2
improve api socket limiting, and increase limit to 250 inline with ep…
splitice Jun 27, 2014
0599002
prevent overflow of array
splitice Jun 27, 2014
5cb40b5
reset in offset so that further queries work :)
splitice Jun 27, 2014
7738aca
set no flags
splitice Jun 27, 2014
5140da2
extended readme for epoll
splitice Jun 27, 2014
42eac4d
possible memory overrun
splitice Jul 2, 2014
785ce61
first version supporting nfnetlink direct. untested.
splitice Jul 14, 2014
846b70f
configuration to enable libmnfl by default
splitice Jul 14, 2014
36de025
work on compiler errors
splitice Jul 14, 2014
b47e4d9
compiles
splitice Jul 14, 2014
52f2649
works, but segmentation faults after a few packets
splitice Jul 14, 2014
a70459f
build appears to work
splitice Jul 14, 2014
022e520
made log received debug only
splitice Jul 14, 2014
26f623d
fixed compiler warnings
splitice Jul 14, 2014
f26ea1c
updated readme to reflect recent features
splitice Jul 14, 2014
cbd992e
set ENOBUFS on nflog socket
splitice Jul 14, 2014
35b6411
increase buffer size to hopefully reduce dropped packets
splitice Jul 14, 2014
d70738f
added reasoning for libmnl
splitice Jul 14, 2014
3c6ed6e
fix netlink socket taking all processing from API sockets
splitice Aug 6, 2014
f768082
Remove max API connection limitation, scale as needed
splitice Nov 5, 2014
044c70c
Handle broken API connection
splitice Nov 13, 2014
419b35c
syntax error fix
splitice Nov 13, 2014
7a7653f
mistaken start brace removed
splitice Nov 13, 2014
5fd7c35
add signal handler to ignore sigpipe
splitice Dec 9, 2014
92679ad
Start of better handling for EPIPE & non blocking epoll write
splitice Jan 16, 2015
bb3de4a
Bug fixes
splitice Jan 16, 2015
43283d2
...
splitice Jan 16, 2015
7951b1e
mistake, not pointer access
splitice Jan 16, 2015
27dd301
zero epoll event before using, valgrind warning
splitice Jan 20, 2015
c81e4af
sigpipe fix
splitice Feb 11, 2015
6904638
change EPIPE handling on write()
splitice Feb 11, 2015
216a0cd
zero api sock to make more resiliant
splitice Feb 11, 2015
8c68ccc
.
splitice Feb 11, 2015
e12dea0
reset in_off for a more consistent query state
splitice Feb 12, 2015
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#

PROGNAME="p0f"
VERSION="3.06b"
VERSION="3.07b"

test "$CC" = "" && CC="gcc"

Expand All @@ -28,7 +28,7 @@ if [ "$OSTYPE" = "cygwin" ]; then
elif [ "$OSTYPE" = "solaris" ]; then
USE_LIBS="-lsocket -lnsl $LIBS"
else
USE_LIBS="-lpcap $LIBS"
USE_LIBS="-lpcap -lmnl $LIBS"
fi

OBJFILES="api.c process.c fp_tcp.c fp_mtu.c fp_http.c fp_ssl.c readfp.c"
Expand Down
7 changes: 7 additions & 0 deletions config.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@
* Things you may reasonably want to change *
********************************************/

/* Use epoll, enable only if available */
#define USE_EPOLL

/* Use pcap or libmnl */
#define USE_LIBMNL 1
//#define USE_LIBPCAP 1

/* Default location of p0f.fp: */

#ifndef FP_FILE
Expand Down
10 changes: 10 additions & 0 deletions debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,16 @@
#define ERRORF(x...) fprintf(stderr, x)
#define SAYF(x...) printf(x)

#define PWARN(x...) do { \
ERRORF("[!] SYSTEM WARNING: " x); \
ERRORF("\n Location : %s(), %s:%u\n", \
__FUNCTION__, __FILE__, __LINE__); \
perror(" OS message "); \
ERRORF("\n"); \
exit(1); \
} while (0)


#define WARN(x...) do { \
ERRORF("[!] WARNING: " x); \
ERRORF("\n"); \
Expand Down
13 changes: 13 additions & 0 deletions docs/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
Version 3.07b:
--------------

Bug fixes:

- Improvement to API handling to avoid FATAL() on short API reads & writes.

- Minor bug fix to IP parsing in one of the companion utilities.

Improvements:

- New signatures.

Version 3.06b:
--------------

Expand Down
52 changes: 40 additions & 12 deletions docs/README
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ information about the actors they are talking to.

Common uses for p0f include reconnaissance during penetration tests; routine
network monitoring; detection of unauthorized network interconnects in corporate
environments; providing signals for abuse-prevention tools; and miscellanous
environments; providing signals for abuse-prevention tools; and miscellaneous
forensics.

A snippet of typical p0f output may look like this:
Expand Down Expand Up @@ -84,8 +84,26 @@ A live demonstration can be seen here:

http://lcamtuf.coredump.cx/p0f3/

------------------------------
2. What does this fork change?
------------------------------

- Inclusion of SSL fingerprint support from majek/p0f
- Support for nflog capturing (capture after IPTables)
- One sided stream support (SYN+ACK not required)
- Capture buffer size increased to fix crash on heavily loaded systems.
- epoll support for increased performance and scalability (increased API connections)
- optional support for using libmnl instead of libpcap (tiny cpu usage, no ENOBUFS issues)

This forks releases are possibly production ready, a version of it is in use at http://www.x4b.net/

Software is provided 'as-is'. No warranty is implied, we are not responsible for any
damages or loss resulting your use of this software.

Contributions (via pull requests) welcome.

--------------------
2. How does it work?
3. How does it work?
--------------------

A vast majority of metrics used by p0f were invented specifically for this tool,
Expand Down Expand Up @@ -113,7 +131,7 @@ just plain trickery. For example, a system where TCP timestamps jump back
and forth, or where TTLs and MTUs change subtly, is probably a NAT device.

-------------------------------
3. How do I compile and use it?
4. How do I compile and use it?
-------------------------------

To compile p0f, try running './build.sh'; if that fails, you will be probably
Expand All @@ -125,7 +143,7 @@ verbose packet parsing and signature matching information will be written to
stderr. This is useful when troubleshooting problems, but that's about it.

The tool should compile cleanly under any reasonably new version of Linux,
FreeBSD, OpenBSD, MacOS X, and so forth. You can also builtdit on Windows using
FreeBSD, OpenBSD, MacOS X, and so forth. You can also build it on Windows using
cygwin and winpcap. I have not tested it on all possible varieties of un*x, but
if there are issues, they should be fairly superficial.

Expand Down Expand Up @@ -181,6 +199,9 @@ command-line options:

Only one instance of p0f can be listening on a particular socket
at any given time. The mode is also incompatible with -r.

-b - disables the compiling and filtering by BPF. This is required to
listen to a nflog:{X} interface

-d - runs p0f in daemon mode: the program will fork into background
and continue writing to the specified log file or API socket. It
Expand Down Expand Up @@ -286,8 +307,13 @@ that fails, try this URL:
Filters work both for online capture (-i) and for previously collected data
produced by any other tool (-r).

It is also possible to listen to a NFLOG (LINKTYPE_NFLOG) interface. BPF can
not be used on this interface. To listen to nflog group 1:

# ./p0f -i nflog:1 -b

-------------
4. API access
5. API access
-------------

The API allows other applications running on the same system to get p0f's
Expand Down Expand Up @@ -391,7 +417,7 @@ Developers using the API should be aware of several important constraints:
go back hours or days, parse the logs instead of wasting RAM.

-----------------------
5. Fingerprint database
6. Fingerprint database
-----------------------

Whenever p0f obtains a fingerprint from the observed traffic, it defers to
Expand Down Expand Up @@ -780,7 +806,7 @@ bottom of the list.
*** NOT IMPLEMENTED YET ***

----------------
6. NAT detection
7. NAT detection
----------------

In addition to fairly straightforward measurements of intrinsic properties of
Expand Down Expand Up @@ -837,7 +863,7 @@ even to very homogenous environments behind NAT. If you end up seeing false
positives or other detection problems in your environment, please let me know!

-----------
7. Security
8. Security
-----------

You should treat the output from this tool as advisory; the fingerprinting can
Expand Down Expand Up @@ -889,7 +915,7 @@ able to compromise your system. The same goes for many other uses of sudo, by
the way.

--------------
8. Limitations
9. Limitations
--------------

Here are some of the known issues you may run into:
Expand Down Expand Up @@ -938,9 +964,9 @@ Here are some of the known issues you may run into:
Windows raw sockets (this should be relatively easy to fix if there are any
users who care).

---------------------------
9. Acknowledgments and more
---------------------------
----------------------------
10. Acknowledgments and more
----------------------------

P0f is made possible thanks to the contributions of several good souls,
including:
Expand All @@ -962,6 +988,8 @@ including:
Anthony Howe
Tomoyuki Murakami
Marek Majkowski
Michael Petch
Mathew Heard

If you wish to help, the most immediate way to do so is to simply gather new
signatures, especially from less popular or older platforms (servers, networking
Expand Down
Loading