Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
747fc651c2 |
-37
@@ -1,37 +0,0 @@
|
||||
*.[oa]
|
||||
*~
|
||||
*o.cmd
|
||||
*.lo
|
||||
*.obj
|
||||
*o.cmd
|
||||
*.ko
|
||||
*.swp
|
||||
*.in
|
||||
*.la
|
||||
.libs
|
||||
.dirstamp
|
||||
stamp-h1
|
||||
/configure
|
||||
/config.guess
|
||||
/config.h
|
||||
/config.h.in
|
||||
/config.sub
|
||||
/config.log
|
||||
/config.status
|
||||
/depcomp
|
||||
/install-sh
|
||||
/ltmain.sh
|
||||
/missing
|
||||
/Makefile
|
||||
/libndpi.pc
|
||||
/libtool
|
||||
/src/lib/Makefile
|
||||
/src/include/Makefile
|
||||
/example/ndpiReader
|
||||
/example/Makefile
|
||||
/aclocal.m4
|
||||
/m4/libtool.m4
|
||||
/m4/ltoptions.m4
|
||||
/m4/ltsugar.m4
|
||||
/m4/ltversion.m4
|
||||
/m4/lt~obsolete.m4
|
||||
-22
@@ -1,22 +0,0 @@
|
||||
language: c
|
||||
|
||||
compiler:
|
||||
- clang
|
||||
- gcc
|
||||
|
||||
install:
|
||||
- sudo apt-get update || true
|
||||
- sudo apt-get install build-essential
|
||||
- sudo apt-get install libpcap-dev libtool autoconf automake autogen
|
||||
|
||||
before_script:
|
||||
- ./autogen.sh
|
||||
|
||||
script:
|
||||
- ./configure
|
||||
- make
|
||||
|
||||
after_script:
|
||||
- cd tests
|
||||
- ./do.sh
|
||||
|
||||
@@ -1,165 +0,0 @@
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
|
||||
This version of the GNU Lesser General Public License incorporates
|
||||
the terms and conditions of version 3 of the GNU General Public
|
||||
License, supplemented by the additional permissions listed below.
|
||||
|
||||
0. Additional Definitions.
|
||||
|
||||
As used herein, "this License" refers to version 3 of the GNU Lesser
|
||||
General Public License, and the "GNU GPL" refers to version 3 of the GNU
|
||||
General Public License.
|
||||
|
||||
"The Library" refers to a covered work governed by this License,
|
||||
other than an Application or a Combined Work as defined below.
|
||||
|
||||
An "Application" is any work that makes use of an interface provided
|
||||
by the Library, but which is not otherwise based on the Library.
|
||||
Defining a subclass of a class defined by the Library is deemed a mode
|
||||
of using an interface provided by the Library.
|
||||
|
||||
A "Combined Work" is a work produced by combining or linking an
|
||||
Application with the Library. The particular version of the Library
|
||||
with which the Combined Work was made is also called the "Linked
|
||||
Version".
|
||||
|
||||
The "Minimal Corresponding Source" for a Combined Work means the
|
||||
Corresponding Source for the Combined Work, excluding any source code
|
||||
for portions of the Combined Work that, considered in isolation, are
|
||||
based on the Application, and not on the Linked Version.
|
||||
|
||||
The "Corresponding Application Code" for a Combined Work means the
|
||||
object code and/or source code for the Application, including any data
|
||||
and utility programs needed for reproducing the Combined Work from the
|
||||
Application, but excluding the System Libraries of the Combined Work.
|
||||
|
||||
1. Exception to Section 3 of the GNU GPL.
|
||||
|
||||
You may convey a covered work under sections 3 and 4 of this License
|
||||
without being bound by section 3 of the GNU GPL.
|
||||
|
||||
2. Conveying Modified Versions.
|
||||
|
||||
If you modify a copy of the Library, and, in your modifications, a
|
||||
facility refers to a function or data to be supplied by an Application
|
||||
that uses the facility (other than as an argument passed when the
|
||||
facility is invoked), then you may convey a copy of the modified
|
||||
version:
|
||||
|
||||
a) under this License, provided that you make a good faith effort to
|
||||
ensure that, in the event an Application does not supply the
|
||||
function or data, the facility still operates, and performs
|
||||
whatever part of its purpose remains meaningful, or
|
||||
|
||||
b) under the GNU GPL, with none of the additional permissions of
|
||||
this License applicable to that copy.
|
||||
|
||||
3. Object Code Incorporating Material from Library Header Files.
|
||||
|
||||
The object code form of an Application may incorporate material from
|
||||
a header file that is part of the Library. You may convey such object
|
||||
code under terms of your choice, provided that, if the incorporated
|
||||
material is not limited to numerical parameters, data structure
|
||||
layouts and accessors, or small macros, inline functions and templates
|
||||
(ten or fewer lines in length), you do both of the following:
|
||||
|
||||
a) Give prominent notice with each copy of the object code that the
|
||||
Library is used in it and that the Library and its use are
|
||||
covered by this License.
|
||||
|
||||
b) Accompany the object code with a copy of the GNU GPL and this license
|
||||
document.
|
||||
|
||||
4. Combined Works.
|
||||
|
||||
You may convey a Combined Work under terms of your choice that,
|
||||
taken together, effectively do not restrict modification of the
|
||||
portions of the Library contained in the Combined Work and reverse
|
||||
engineering for debugging such modifications, if you also do each of
|
||||
the following:
|
||||
|
||||
a) Give prominent notice with each copy of the Combined Work that
|
||||
the Library is used in it and that the Library and its use are
|
||||
covered by this License.
|
||||
|
||||
b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
||||
document.
|
||||
|
||||
c) For a Combined Work that displays copyright notices during
|
||||
execution, include the copyright notice for the Library among
|
||||
these notices, as well as a reference directing the user to the
|
||||
copies of the GNU GPL and this license document.
|
||||
|
||||
d) Do one of the following:
|
||||
|
||||
0) Convey the Minimal Corresponding Source under the terms of this
|
||||
License, and the Corresponding Application Code in a form
|
||||
suitable for, and under terms that permit, the user to
|
||||
recombine or relink the Application with a modified version of
|
||||
the Linked Version to produce a modified Combined Work, in the
|
||||
manner specified by section 6 of the GNU GPL for conveying
|
||||
Corresponding Source.
|
||||
|
||||
1) Use a suitable shared library mechanism for linking with the
|
||||
Library. A suitable mechanism is one that (a) uses at run time
|
||||
a copy of the Library already present on the user's computer
|
||||
system, and (b) will operate properly with a modified version
|
||||
of the Library that is interface-compatible with the Linked
|
||||
Version.
|
||||
|
||||
e) Provide Installation Information, but only if you would otherwise
|
||||
be required to provide such information under section 6 of the
|
||||
GNU GPL, and only to the extent that such information is
|
||||
necessary to install and execute a modified version of the
|
||||
Combined Work produced by recombining or relinking the
|
||||
Application with a modified version of the Linked Version. (If
|
||||
you use option 4d0, the Installation Information must accompany
|
||||
the Minimal Corresponding Source and Corresponding Application
|
||||
Code. If you use option 4d1, you must provide the Installation
|
||||
Information in the manner specified by section 6 of the GNU GPL
|
||||
for conveying Corresponding Source.)
|
||||
|
||||
5. Combined Libraries.
|
||||
|
||||
You may place library facilities that are a work based on the
|
||||
Library side by side in a single library together with other library
|
||||
facilities that are not Applications and are not covered by this
|
||||
License, and convey such a combined library under terms of your
|
||||
choice, if you do both of the following:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work based
|
||||
on the Library, uncombined with any other library facilities,
|
||||
conveyed under the terms of this License.
|
||||
|
||||
b) Give prominent notice with the combined library that part of it
|
||||
is a work based on the Library, and explaining where to find the
|
||||
accompanying uncombined form of the same work.
|
||||
|
||||
6. Revised Versions of the GNU Lesser General Public License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions
|
||||
of the GNU Lesser General Public License from time to time. Such new
|
||||
versions will be similar in spirit to the present version, but may
|
||||
differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Library as you received it specifies that a certain numbered version
|
||||
of the GNU Lesser General Public License "or any later version"
|
||||
applies to it, you have the option of following the terms and
|
||||
conditions either of that published version or of any later version
|
||||
published by the Free Software Foundation. If the Library as you
|
||||
received it does not specify a version number of the GNU Lesser
|
||||
General Public License, you may choose any version of the GNU Lesser
|
||||
General Public License ever published by the Free Software Foundation.
|
||||
|
||||
If the Library as you received it specifies that a proxy can decide
|
||||
whether future versions of the GNU Lesser General Public License shall
|
||||
apply, that proxy's public statement of acceptance of any version is
|
||||
permanent authorization for you to choose that version for the
|
||||
Library.
|
||||
@@ -1,16 +0,0 @@
|
||||
2014-03-21:
|
||||
- improved support for eDonkey/eMule/Kademlia
|
||||
- improved support for PPLive
|
||||
|
||||
2014-03-20:
|
||||
- code optimizations
|
||||
- consistency improvements
|
||||
- added support for new applications: Pando Media Booster
|
||||
- improved support for Steam
|
||||
- added support for new web services: Wikipedia, MSN, Amazon, eBay, CNN
|
||||
|
||||
2014-03-19:
|
||||
- added new protocols: FTP, code improvements
|
||||
|
||||
2014-03-17:
|
||||
- added new protocols: SOCKSv4, SOCKSv5, RTMP
|
||||
@@ -1,365 +0,0 @@
|
||||
Installation Instructions
|
||||
*************************
|
||||
|
||||
Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005,
|
||||
2006, 2007, 2008, 2009 Free Software Foundation, Inc.
|
||||
|
||||
Copying and distribution of this file, with or without modification,
|
||||
are permitted in any medium without royalty provided the copyright
|
||||
notice and this notice are preserved. This file is offered as-is,
|
||||
without warranty of any kind.
|
||||
|
||||
Basic Installation
|
||||
==================
|
||||
|
||||
Briefly, the shell commands `./configure; make; make install' should
|
||||
configure, build, and install this package. The following
|
||||
more-detailed instructions are generic; see the `README' file for
|
||||
instructions specific to this package. Some packages provide this
|
||||
`INSTALL' file but do not implement all of the features documented
|
||||
below. The lack of an optional feature in a given package is not
|
||||
necessarily a bug. More recommendations for GNU packages can be found
|
||||
in *note Makefile Conventions: (standards)Makefile Conventions.
|
||||
|
||||
The `configure' shell script attempts to guess correct values for
|
||||
various system-dependent variables used during compilation. It uses
|
||||
those values to create a `Makefile' in each directory of the package.
|
||||
It may also create one or more `.h' files containing system-dependent
|
||||
definitions. Finally, it creates a shell script `config.status' that
|
||||
you can run in the future to recreate the current configuration, and a
|
||||
file `config.log' containing compiler output (useful mainly for
|
||||
debugging `configure').
|
||||
|
||||
It can also use an optional file (typically called `config.cache'
|
||||
and enabled with `--cache-file=config.cache' or simply `-C') that saves
|
||||
the results of its tests to speed up reconfiguring. Caching is
|
||||
disabled by default to prevent problems with accidental use of stale
|
||||
cache files.
|
||||
|
||||
If you need to do unusual things to compile the package, please try
|
||||
to figure out how `configure' could check whether to do them, and mail
|
||||
diffs or instructions to the address given in the `README' so they can
|
||||
be considered for the next release. If you are using the cache, and at
|
||||
some point `config.cache' contains results you don't want to keep, you
|
||||
may remove or edit it.
|
||||
|
||||
The file `configure.ac' (or `configure.in') is used to create
|
||||
`configure' by a program called `autoconf'. You need `configure.ac' if
|
||||
you want to change it or regenerate `configure' using a newer version
|
||||
of `autoconf'.
|
||||
|
||||
The simplest way to compile this package is:
|
||||
|
||||
1. `cd' to the directory containing the package's source code and type
|
||||
`./configure' to configure the package for your system.
|
||||
|
||||
Running `configure' might take a while. While running, it prints
|
||||
some messages telling which features it is checking for.
|
||||
|
||||
2. Type `make' to compile the package.
|
||||
|
||||
3. Optionally, type `make check' to run any self-tests that come with
|
||||
the package, generally using the just-built uninstalled binaries.
|
||||
|
||||
4. Type `make install' to install the programs and any data files and
|
||||
documentation. When installing into a prefix owned by root, it is
|
||||
recommended that the package be configured and built as a regular
|
||||
user, and only the `make install' phase executed with root
|
||||
privileges.
|
||||
|
||||
5. Optionally, type `make installcheck' to repeat any self-tests, but
|
||||
this time using the binaries in their final installed location.
|
||||
This target does not install anything. Running this target as a
|
||||
regular user, particularly if the prior `make install' required
|
||||
root privileges, verifies that the installation completed
|
||||
correctly.
|
||||
|
||||
6. You can remove the program binaries and object files from the
|
||||
source code directory by typing `make clean'. To also remove the
|
||||
files that `configure' created (so you can compile the package for
|
||||
a different kind of computer), type `make distclean'. There is
|
||||
also a `make maintainer-clean' target, but that is intended mainly
|
||||
for the package's developers. If you use it, you may have to get
|
||||
all sorts of other programs in order to regenerate files that came
|
||||
with the distribution.
|
||||
|
||||
7. Often, you can also type `make uninstall' to remove the installed
|
||||
files again. In practice, not all packages have tested that
|
||||
uninstallation works correctly, even though it is required by the
|
||||
GNU Coding Standards.
|
||||
|
||||
8. Some packages, particularly those that use Automake, provide `make
|
||||
distcheck', which can by used by developers to test that all other
|
||||
targets like `make install' and `make uninstall' work correctly.
|
||||
This target is generally not run by end users.
|
||||
|
||||
Compilers and Options
|
||||
=====================
|
||||
|
||||
Some systems require unusual options for compilation or linking that
|
||||
the `configure' script does not know about. Run `./configure --help'
|
||||
for details on some of the pertinent environment variables.
|
||||
|
||||
You can give `configure' initial values for configuration parameters
|
||||
by setting variables in the command line or in the environment. Here
|
||||
is an example:
|
||||
|
||||
./configure CC=c99 CFLAGS=-g LIBS=-lposix
|
||||
|
||||
*Note Defining Variables::, for more details.
|
||||
|
||||
Compiling For Multiple Architectures
|
||||
====================================
|
||||
|
||||
You can compile the package for more than one kind of computer at the
|
||||
same time, by placing the object files for each architecture in their
|
||||
own directory. To do this, you can use GNU `make'. `cd' to the
|
||||
directory where you want the object files and executables to go and run
|
||||
the `configure' script. `configure' automatically checks for the
|
||||
source code in the directory that `configure' is in and in `..'. This
|
||||
is known as a "VPATH" build.
|
||||
|
||||
With a non-GNU `make', it is safer to compile the package for one
|
||||
architecture at a time in the source code directory. After you have
|
||||
installed the package for one architecture, use `make distclean' before
|
||||
reconfiguring for another architecture.
|
||||
|
||||
On MacOS X 10.5 and later systems, you can create libraries and
|
||||
executables that work on multiple system types--known as "fat" or
|
||||
"universal" binaries--by specifying multiple `-arch' options to the
|
||||
compiler but only a single `-arch' option to the preprocessor. Like
|
||||
this:
|
||||
|
||||
./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
|
||||
CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
|
||||
CPP="gcc -E" CXXCPP="g++ -E"
|
||||
|
||||
This is not guaranteed to produce working output in all cases, you
|
||||
may have to build one architecture at a time and combine the results
|
||||
using the `lipo' tool if you have problems.
|
||||
|
||||
Installation Names
|
||||
==================
|
||||
|
||||
By default, `make install' installs the package's commands under
|
||||
`/usr/local/bin', include files under `/usr/local/include', etc. You
|
||||
can specify an installation prefix other than `/usr/local' by giving
|
||||
`configure' the option `--prefix=PREFIX', where PREFIX must be an
|
||||
absolute file name.
|
||||
|
||||
You can specify separate installation prefixes for
|
||||
architecture-specific files and architecture-independent files. If you
|
||||
pass the option `--exec-prefix=PREFIX' to `configure', the package uses
|
||||
PREFIX as the prefix for installing programs and libraries.
|
||||
Documentation and other data files still use the regular prefix.
|
||||
|
||||
In addition, if you use an unusual directory layout you can give
|
||||
options like `--bindir=DIR' to specify different values for particular
|
||||
kinds of files. Run `configure --help' for a list of the directories
|
||||
you can set and what kinds of files go in them. In general, the
|
||||
default for these options is expressed in terms of `${prefix}', so that
|
||||
specifying just `--prefix' will affect all of the other directory
|
||||
specifications that were not explicitly provided.
|
||||
|
||||
The most portable way to affect installation locations is to pass the
|
||||
correct locations to `configure'; however, many packages provide one or
|
||||
both of the following shortcuts of passing variable assignments to the
|
||||
`make install' command line to change installation locations without
|
||||
having to reconfigure or recompile.
|
||||
|
||||
The first method involves providing an override variable for each
|
||||
affected directory. For example, `make install
|
||||
prefix=/alternate/directory' will choose an alternate location for all
|
||||
directory configuration variables that were expressed in terms of
|
||||
`${prefix}'. Any directories that were specified during `configure',
|
||||
but not in terms of `${prefix}', must each be overridden at install
|
||||
time for the entire installation to be relocated. The approach of
|
||||
makefile variable overrides for each directory variable is required by
|
||||
the GNU Coding Standards, and ideally causes no recompilation.
|
||||
However, some platforms have known limitations with the semantics of
|
||||
shared libraries that end up requiring recompilation when using this
|
||||
method, particularly noticeable in packages that use GNU Libtool.
|
||||
|
||||
The second method involves providing the `DESTDIR' variable. For
|
||||
example, `make install DESTDIR=/alternate/directory' will prepend
|
||||
`/alternate/directory' before all installation names. The approach of
|
||||
`DESTDIR' overrides is not required by the GNU Coding Standards, and
|
||||
does not work on platforms that have drive letters. On the other hand,
|
||||
it does better at avoiding recompilation issues, and works well even
|
||||
when some directory options were not specified in terms of `${prefix}'
|
||||
at `configure' time.
|
||||
|
||||
Optional Features
|
||||
=================
|
||||
|
||||
If the package supports it, you can cause programs to be installed
|
||||
with an extra prefix or suffix on their names by giving `configure' the
|
||||
option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
|
||||
|
||||
Some packages pay attention to `--enable-FEATURE' options to
|
||||
`configure', where FEATURE indicates an optional part of the package.
|
||||
They may also pay attention to `--with-PACKAGE' options, where PACKAGE
|
||||
is something like `gnu-as' or `x' (for the X Window System). The
|
||||
`README' should mention any `--enable-' and `--with-' options that the
|
||||
package recognizes.
|
||||
|
||||
For packages that use the X Window System, `configure' can usually
|
||||
find the X include and library files automatically, but if it doesn't,
|
||||
you can use the `configure' options `--x-includes=DIR' and
|
||||
`--x-libraries=DIR' to specify their locations.
|
||||
|
||||
Some packages offer the ability to configure how verbose the
|
||||
execution of `make' will be. For these packages, running `./configure
|
||||
--enable-silent-rules' sets the default to minimal output, which can be
|
||||
overridden with `make V=1'; while running `./configure
|
||||
--disable-silent-rules' sets the default to verbose, which can be
|
||||
overridden with `make V=0'.
|
||||
|
||||
Particular systems
|
||||
==================
|
||||
|
||||
On HP-UX, the default C compiler is not ANSI C compatible. If GNU
|
||||
CC is not installed, it is recommended to use the following options in
|
||||
order to use an ANSI C compiler:
|
||||
|
||||
./configure CC="cc -Ae -D_XOPEN_SOURCE=500"
|
||||
|
||||
and if that doesn't work, install pre-built binaries of GCC for HP-UX.
|
||||
|
||||
On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot
|
||||
parse its `<wchar.h>' header file. The option `-nodtk' can be used as
|
||||
a workaround. If GNU CC is not installed, it is therefore recommended
|
||||
to try
|
||||
|
||||
./configure CC="cc"
|
||||
|
||||
and if that doesn't work, try
|
||||
|
||||
./configure CC="cc -nodtk"
|
||||
|
||||
On Solaris, don't put `/usr/ucb' early in your `PATH'. This
|
||||
directory contains several dysfunctional programs; working variants of
|
||||
these programs are available in `/usr/bin'. So, if you need `/usr/ucb'
|
||||
in your `PATH', put it _after_ `/usr/bin'.
|
||||
|
||||
On Haiku, software installed for all users goes in `/boot/common',
|
||||
not `/usr/local'. It is recommended to use the following options:
|
||||
|
||||
./configure --prefix=/boot/common
|
||||
|
||||
Specifying the System Type
|
||||
==========================
|
||||
|
||||
There may be some features `configure' cannot figure out
|
||||
automatically, but needs to determine by the type of machine the package
|
||||
will run on. Usually, assuming the package is built to be run on the
|
||||
_same_ architectures, `configure' can figure that out, but if it prints
|
||||
a message saying it cannot guess the machine type, give it the
|
||||
`--build=TYPE' option. TYPE can either be a short name for the system
|
||||
type, such as `sun4', or a canonical name which has the form:
|
||||
|
||||
CPU-COMPANY-SYSTEM
|
||||
|
||||
where SYSTEM can have one of these forms:
|
||||
|
||||
OS
|
||||
KERNEL-OS
|
||||
|
||||
See the file `config.sub' for the possible values of each field. If
|
||||
`config.sub' isn't included in this package, then this package doesn't
|
||||
need to know the machine type.
|
||||
|
||||
If you are _building_ compiler tools for cross-compiling, you should
|
||||
use the option `--target=TYPE' to select the type of system they will
|
||||
produce code for.
|
||||
|
||||
If you want to _use_ a cross compiler, that generates code for a
|
||||
platform different from the build platform, you should specify the
|
||||
"host" platform (i.e., that on which the generated programs will
|
||||
eventually be run) with `--host=TYPE'.
|
||||
|
||||
Sharing Defaults
|
||||
================
|
||||
|
||||
If you want to set default values for `configure' scripts to share,
|
||||
you can create a site shell script called `config.site' that gives
|
||||
default values for variables like `CC', `cache_file', and `prefix'.
|
||||
`configure' looks for `PREFIX/share/config.site' if it exists, then
|
||||
`PREFIX/etc/config.site' if it exists. Or, you can set the
|
||||
`CONFIG_SITE' environment variable to the location of the site script.
|
||||
A warning: not all `configure' scripts look for a site script.
|
||||
|
||||
Defining Variables
|
||||
==================
|
||||
|
||||
Variables not defined in a site shell script can be set in the
|
||||
environment passed to `configure'. However, some packages may run
|
||||
configure again during the build, and the customized values of these
|
||||
variables may be lost. In order to avoid this problem, you should set
|
||||
them in the `configure' command line, using `VAR=value'. For example:
|
||||
|
||||
./configure CC=/usr/local2/bin/gcc
|
||||
|
||||
causes the specified `gcc' to be used as the C compiler (unless it is
|
||||
overridden in the site shell script).
|
||||
|
||||
Unfortunately, this technique does not work for `CONFIG_SHELL' due to
|
||||
an Autoconf bug. Until the bug is fixed you can use this workaround:
|
||||
|
||||
CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash
|
||||
|
||||
`configure' Invocation
|
||||
======================
|
||||
|
||||
`configure' recognizes the following options to control how it
|
||||
operates.
|
||||
|
||||
`--help'
|
||||
`-h'
|
||||
Print a summary of all of the options to `configure', and exit.
|
||||
|
||||
`--help=short'
|
||||
`--help=recursive'
|
||||
Print a summary of the options unique to this package's
|
||||
`configure', and exit. The `short' variant lists options used
|
||||
only in the top level, while the `recursive' variant lists options
|
||||
also present in any nested packages.
|
||||
|
||||
`--version'
|
||||
`-V'
|
||||
Print the version of Autoconf used to generate the `configure'
|
||||
script, and exit.
|
||||
|
||||
`--cache-file=FILE'
|
||||
Enable the cache: use and save the results of the tests in FILE,
|
||||
traditionally `config.cache'. FILE defaults to `/dev/null' to
|
||||
disable caching.
|
||||
|
||||
`--config-cache'
|
||||
`-C'
|
||||
Alias for `--cache-file=config.cache'.
|
||||
|
||||
`--quiet'
|
||||
`--silent'
|
||||
`-q'
|
||||
Do not print messages saying which checks are being made. To
|
||||
suppress all normal output, redirect it to `/dev/null' (any error
|
||||
messages will still be shown).
|
||||
|
||||
`--srcdir=DIR'
|
||||
Look for the package's source code in directory DIR. Usually
|
||||
`configure' can determine that directory automatically.
|
||||
|
||||
`--prefix=DIR'
|
||||
Use DIR as the installation prefix. *note Installation Names::
|
||||
for more details, including other options available for fine-tuning
|
||||
the installation locations.
|
||||
|
||||
`--no-create'
|
||||
`-n'
|
||||
Run the configure checks, but stop before creating any output
|
||||
files.
|
||||
|
||||
`configure' also accepts some other, not widely useful, options. Run
|
||||
`configure --help' for more details.
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
ACLOCAL_AMFLAGS = -I m4
|
||||
|
||||
SUBDIRS = src/lib example
|
||||
|
||||
pkgconfigdir = $(libdir)/pkgconfig
|
||||
pkgconfig_DATA = libndpi.pc
|
||||
|
||||
EXTRA_DIST = libndpi.sym autogen.sh
|
||||
@@ -1,42 +0,0 @@
|
||||
# What is nDPI ?
|
||||
|
||||
nDPI is an open source LGPLv3 library for deep-packet inspection. Based on OpenDPI it includes ntop extensions. We have tried to push them into the OpenDPI source tree but nobody answered emails so we have decided to create our own source tree
|
||||
|
||||
# How To Compile nDPI
|
||||
|
||||
In order to compile this library do
|
||||
|
||||
- ./autogen.sh
|
||||
- ./configure
|
||||
- make
|
||||
|
||||
Please note that the pre-requisites for compilation include:
|
||||
- GNU tools (autogen, automake, autoconf, libtool)
|
||||
- GNU C compiler (gcc)
|
||||
|
||||
# How To Add A New Protocol Dissector
|
||||
|
||||
The entire procedure of adding new protocols in detail:
|
||||
|
||||
1. Add new protocol together with its unique ID to: src/include/ndpi_protocols_osdpi.h
|
||||
2. Create a new protocol in: src/lib/protocols/
|
||||
3. Variables to be kept for the duration of the entire flow (as state variables) needs to be placed in: /include/ndpi_structs.h in ndpi_flow_tcp_struct (for TCP only), ndpi_flow_udp_struct (for UDP only), or ndpi_flow_struct (for both).
|
||||
4. Add a new entry for the search function for the new protocol in: src/include/ndpi_protocols.h
|
||||
5. Choose (do not change anything) a selection bitmask from: src/include/ndpi_define.h
|
||||
6. Add a new entry in ndpi_set_protocol_detection_bitmask2 in: src/lib/ndpi_main.c
|
||||
7. Set protocol default ports in ndpi_init_protocol_defaults in: src/lib/ndpi_main.c
|
||||
8. Add the new protocol file to: src/lib/Makefile.am
|
||||
9. ./autogen.sh
|
||||
10. ./configure
|
||||
11. make
|
||||
|
||||
# Creating A Source File Tar Ball
|
||||
|
||||
If you want to distribute a source tar file of nDPI do:
|
||||
|
||||
- make dist
|
||||
|
||||
|
||||
# Acknowledgements
|
||||
|
||||
Many thanks to <A HREF=http://www.radcom.com>Radcom</A> Ltd for supporting the development of nDPI.
|
||||
-20
@@ -1,20 +0,0 @@
|
||||
rerequisites for Compilation
|
||||
-----------------------------
|
||||
|
||||
Prerequisites
|
||||
- GNU autotools/libtool
|
||||
- libpcap or PF_RING (optional but recommended)
|
||||
|
||||
On Ubuntu/Debian
|
||||
- apt-get install build-essential
|
||||
- apt-get install git autoconf automake autogen libpcap-dev libtool
|
||||
|
||||
On Fedora/CentOS
|
||||
- yum groupinstall "Development tools"
|
||||
- yum install git autoconf automake autogen libpcap-devel libtool
|
||||
|
||||
On MacOSX (using http://brew.sh)
|
||||
brew install autoconf automake libtool git
|
||||
|
||||
On FreeBSD
|
||||
- pkg install autoconf automake libtool gmake git
|
||||
@@ -1,18 +0,0 @@
|
||||
Tor
|
||||
---
|
||||
|
||||
Tor protocol can use SSL to hide itself. These are examples:
|
||||
|
||||
TCP 37.128.208.46:9001 <-> 172.16.253.130:2078 [VLAN: 0][proto: 91/SSL][132 pkts/93834 bytes][SSL client: www.jwrpsthzrih.com]
|
||||
TCP 172.16.253.130:2021 <-> 75.147.140.249:443 [VLAN: 0][proto: 91/SSL][28 pkts/8053 bytes][SSL client: www.5akw23dx.com]
|
||||
TCP 172.16.253.130:2077 <-> 77.247.181.163:443 [VLAN: 0][proto: 91/SSL][136 pkts/94329 bytes][SSL client: www.fk4pprq42hsvl2wey.com]
|
||||
|
||||
It can be detected by analyzing the SSL client certificate and checking the name that does not match to a real host in
|
||||
addition of begin a bit weird. As doing DNS resolution is not a task for nDPI we let applications do and then recognize
|
||||
SSL-tunnelled connections.
|
||||
|
||||
See http://www.netresec.com/?page=Blog&month=2013-04&post=Detecting-TOR-Communication-in-Network-Traffic
|
||||
|
||||
For this reason nDPI uses a heuristic, non-DNS based, approach to detect tor communications. If possible, apps
|
||||
should validate the certificate using the DNS. This is not something nDPI can afford to do for performance
|
||||
reasons
|
||||
-33
@@ -1,33 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
|
||||
/bin/rm -f configure config.h config.h.in src/lib/Makefile.in
|
||||
|
||||
AUTOCONF=$(which autoconf)
|
||||
AUTOMAKE=$(which automake)
|
||||
LIBTOOL=$(which libtool)
|
||||
LIBTOOLIZE=$(which libtoolize)
|
||||
AUTORECONF=$(which autoreconf)
|
||||
|
||||
if test -z $AUTOCONF; then
|
||||
echo "autoconf is missing: please install it and try again"
|
||||
exit
|
||||
fi
|
||||
|
||||
if test -z $AUTOMAKE; then
|
||||
echo "automake is missing: please install it and try again"
|
||||
exit
|
||||
fi
|
||||
|
||||
if test -z $LIBTOOL && test -z $LIBTOOLIZE ; then
|
||||
echo "libtool and libtoolize is missing: please install it and try again"
|
||||
exit
|
||||
fi
|
||||
|
||||
if test -z $AUTORECONF; then
|
||||
echo "autoreconf is missing: please install it and try again"
|
||||
exit
|
||||
fi
|
||||
|
||||
autoreconf -ivf
|
||||
./configure
|
||||
@@ -1,97 +0,0 @@
|
||||
AC_INIT([libndpi], [1.7.0])
|
||||
|
||||
AC_CONFIG_MACRO_DIR([m4])
|
||||
|
||||
AM_INIT_AUTOMAKE([foreign subdir-objects])
|
||||
|
||||
LT_INIT
|
||||
|
||||
AC_PROG_CC
|
||||
AX_PTHREAD
|
||||
|
||||
if test -d ".git"; then :
|
||||
GIT_TAG=`git log -1 --format=%h`
|
||||
GIT_DATE=`git log -1 --format=%cd`
|
||||
#
|
||||
# On CentOS 6 `git rev-list HEAD --count` does not work
|
||||
#
|
||||
#
|
||||
GIT_NUM=`git log --pretty=oneline | wc -l | tr -d '[[:space:]]'`
|
||||
GIT_BRANCH=`git rev-parse --abbrev-ref HEAD`
|
||||
GIT_RELEASE="${PACKAGE_VERSION}-${GIT_BRANCH}-${GIT_NUM}-${GIT_TAG}"
|
||||
else
|
||||
GIT_RELEASE="${PACKAGE_VERSION}"
|
||||
GIT_DATE=`date`
|
||||
fi
|
||||
|
||||
AC_DEFINE_UNQUOTED(NDPI_GIT_RELEASE, "${GIT_RELEASE}", [GIT Release])
|
||||
AC_DEFINE_UNQUOTED(NDPI_GIT_DATE, "${GIT_DATE}", [Last GIT change])
|
||||
|
||||
AC_CHECK_HEADERS([netinet/in.h stdint.h stdlib.h string.h unistd.h])
|
||||
|
||||
PCAP_HOME=$HOME/PF_RING/userland
|
||||
|
||||
if test -d $PCAP_HOME; then :
|
||||
echo -n ""
|
||||
else
|
||||
PCAP_HOME=`pwd`/../../PF_RING/userland
|
||||
fi
|
||||
SHORT_MACHINE=`uname -m | cut -b1-3`
|
||||
if test $SHORT_MACHINE = "arm"; then
|
||||
LIBNUMA=""
|
||||
else
|
||||
LIBNUMA="-lnuma"
|
||||
fi
|
||||
|
||||
if test -f $PCAP_HOME/libpcap/libpcap.a; then :
|
||||
echo "Using libpcap from $PCAP_HOME"
|
||||
PCAP_INC="-I $PCAP_HOME/libpcap"
|
||||
PCAP_LIB="$PCAP_HOME/libpcap/libpcap.a $PCAP_HOME/lib/libpfring.a $LIBNUMA"
|
||||
|
||||
AC_CHECK_LIB([rt], [clock_gettime], [PCAP_LIB="$PCAP_LIB -lrt"])
|
||||
AC_CHECK_LIB([nl], [nl_handle_alloc], [PCAP_LIB="$PCAP_LIB -lnl"])
|
||||
else
|
||||
AC_CHECK_LIB([pcap], [pcap_open_live], [PCAP_LIB="-lpcap"])
|
||||
|
||||
if test $ac_cv_lib_pcap_pcap_open_live = "no"; then :
|
||||
echo ""
|
||||
echo "ERROR: Missing libpcap(-dev) library required to compile the example application"
|
||||
echo "ERROR: Please install it and try again"
|
||||
exit
|
||||
fi
|
||||
fi
|
||||
|
||||
PKG_CONFIG=$(which pkg-config)
|
||||
|
||||
if test -d /usr/local/include/json-c/; then :
|
||||
CFLAGS="$CFLAGS -I/usr/local/include/json-c/"
|
||||
LDFLAGS="$LDFLAGS -L/usr/local/lib -ljson-c"
|
||||
else
|
||||
if ! test -z "$PKG_CONFIG"; then :
|
||||
CFLAGS="$CFLAGS $(pkg-config --cflags json-c)"
|
||||
LDFLAGS="$LDFLAGS $(pkg-config --libs json-c)"
|
||||
fi
|
||||
fi
|
||||
|
||||
OLD_LIBS=$LIBS
|
||||
LIBS="-L/opt/napatech3/lib $LIBS"
|
||||
AC_CHECK_LIB([ntapi],
|
||||
[NT_Init],
|
||||
[PCAP_LIB="$PCAP_LIB -L/opt/napatech3/lib -lntapi"],
|
||||
[], [] )
|
||||
LIBS=$OLD_LIBS
|
||||
|
||||
AC_CHECK_LIB(json-c, json_object_new_object, AC_DEFINE_UNQUOTED(HAVE_JSON_C, 1, [The JSON-C library is present]))
|
||||
|
||||
AC_CHECK_LIB(pthread, pthread_setaffinity_np, AC_DEFINE_UNQUOTED(HAVE_PTHREAD_SETAFFINITY_NP, 1, [libc has pthread_setaffinity_np]))
|
||||
|
||||
AC_CONFIG_FILES([Makefile src/lib/Makefile example/Makefile libndpi.pc])
|
||||
AC_CONFIG_HEADERS(config.h)
|
||||
AC_SUBST(GIT_RELEASE)
|
||||
AC_SUBST(SVN_DATE)
|
||||
AC_SUBST(JSON_C_LIB)
|
||||
AC_SUBST(PCAP_INC)
|
||||
AC_SUBST(PCAP_LIB)
|
||||
AC_SUBST(HAVE_PTHREAD_SETAFFINITY_NP)
|
||||
|
||||
AC_OUTPUT
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,12 +0,0 @@
|
||||
bin_PROGRAMS = ndpiReader
|
||||
|
||||
AM_CPPFLAGS = -I$(top_srcdir)/src/include @PCAP_INC@
|
||||
AM_CFLAGS = @PTHREAD_CFLAGS@
|
||||
|
||||
LDADD = $(top_builddir)/src/lib/libndpi.la @JSON_C_LIB@ @PTHREAD_LIBS@ @PCAP_LIB@
|
||||
AM_LDFLAGS = -static
|
||||
|
||||
ndpiReader_SOURCES = ndpiReader.c
|
||||
|
||||
ndpiReader.o: ndpiReader.c
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 11.00
|
||||
# Visual C++ Express 2010
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pcapExample", "pcapExample\pcapExample.vcxproj", "{F6A2C0AE-2110-438A-87E4-7C1CFCE064C6}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
Release|Win32 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{F6A2C0AE-2110-438A-87E4-7C1CFCE064C6}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{F6A2C0AE-2110-438A-87E4-7C1CFCE064C6}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{F6A2C0AE-2110-438A-87E4-7C1CFCE064C6}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{F6A2C0AE-2110-438A-87E4-7C1CFCE064C6}.Release|Win32.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
Binary file not shown.
@@ -1,11 +0,0 @@
|
||||
// pcapExample.cpp : Defines the entry point for the console application.
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
|
||||
|
||||
int _tmain(int argc, _TCHAR* argv[])
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1,231 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{F6A2C0AE-2110-438A-87E4-7C1CFCE064C6}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>pcapExample</RootNamespace>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>C:\ntop\nprobe\nprobe-win-32;C:\ntop\winpcap\Include;C:\ntop\dependencies\nDPI\src\lib\third_party\include;C:\ntop\dependencies\nDPI\src\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalDependencies>Wsock32.lib;Ws2_32.lib;C:\ntop\winpcap\Lib\Packet.lib;C:\ntop\winpcap\Lib\wpcap.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\..\..\..\nprobe\nprobe-win-32\getopt.c" />
|
||||
<ClCompile Include="..\..\..\..\..\nprobe\nprobe-win-32\getopt1.c" />
|
||||
<ClCompile Include="..\..\..\src\lib\ndpi_main.c" />
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\afp.c" />
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\aimini.c" />
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\applejuice.c" />
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\armagetron.c" />
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\battlefield.c" />
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\bgp.c" />
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\bittorrent.c" />
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\ciscovpn.c" />
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\citrix.c" />
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\corba.c" />
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\crossfire.c" />
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\dcerpc.c" />
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\dhcp.c" />
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\dhcpv6.c" />
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\directconnect.c" />
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\directdownloadlink.c" />
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\dns.c" />
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\dofus.c" />
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\dropbox.c" />
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\edonkey.c" />
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\fasttrack.c" />
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\feidian.c" />
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\fiesta.c" />
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\filetopia.c" />
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\flash.c" />
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\florensia.c" />
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\ftp.c" />
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\gadu_gadu.c" />
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\gnutella.c" />
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\gtp.c" />
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\guildwars.c" />
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\h323.c" />
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\halflife2_and_mods.c" />
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\http.c" />
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\http_activesync.c" />
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\i23v5.c" />
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\iax.c" />
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\icecast.c" />
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\imesh.c" />
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\ipp.c" />
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\irc.c" />
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\jabber.c" />
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\kerberos.c" />
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\kontiki.c" />
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\ldap.c" />
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\lotus_notes.c" />
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\mail_imap.c" />
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\mail_pop.c" />
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\mail_smtp.c" />
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\maplestory.c" />
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\mdns.c" />
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\meebo.c" />
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\mgcp.c" />
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\mms.c" />
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\msn.c" />
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\mssql.c" />
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\mysql.c" />
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\netbios.c" />
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\netflow.c" />
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\nfs.c" />
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\noe.c" />
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\non_tcp_udp.c" />
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\ntp.c" />
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\openft.c" />
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\openvpn.c" />
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\oracle.c" />
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\oscar.c" />
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\pando.c" />
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\pcanywhere.c" />
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\popo.c" />
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\postgres.c" />
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\pplive.c" />
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\ppstream.c" />
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\pptp.c" />
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\qq.c" />
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\quake.c" />
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\quic.c" />
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\radius.c" />
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\rdp.c" />
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\rsync.c" />
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\rtcp.c" />
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\rtp.c" />
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\rtsp.c" />
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\sflow.c" />
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\shoutcast.c" />
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\sip.c" />
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\skinny.c" />
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\skype.c" />
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\smb.c" />
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\snmp.c" />
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\socrates.c" />
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\sopcast.c" />
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\soulseek.c" />
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\spotify.c" />
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\ssdp.c" />
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\ssh.c" />
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\ssl.c" />
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\stealthnet.c" />
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\steam.c" />
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\stun.c" />
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\syslog.c" />
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\tcp_udp.c" />
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\tds.c" />
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\teamspeak.c" />
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\teamviewer.c" />
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\telnet.c" />
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\tftp.c" />
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\thunder.c" />
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\tor.c" />
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\tvants.c" />
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\tvuplayer.c" />
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\usenet.c" />
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\veohtv.c" />
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\viber.c" />
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\vmware.c" />
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\vnc.c" />
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\warcraft3.c" />
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\winmx.c" />
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\world_of_kung_fu.c" />
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\world_of_warcraft.c" />
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\xbox.c" />
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\xdmcp.c" />
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\yahoo.c" />
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\zattoo.c" />
|
||||
<ClCompile Include="..\..\..\src\lib\third_party\src\ahocorasick.c" />
|
||||
<ClCompile Include="..\..\..\src\lib\third_party\src\node.c" />
|
||||
<ClCompile Include="..\..\..\src\lib\third_party\src\sort.c" />
|
||||
<ClCompile Include="..\..\pcapReader.c" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\..\..\..\..\nprobe\nprobe-win-32\getopt.h" />
|
||||
<ClInclude Include="..\..\..\src\include\linux_compat.h" />
|
||||
<ClInclude Include="..\..\..\src\include\ndpi_api.h" />
|
||||
<ClInclude Include="..\..\..\src\include\ndpi_debug_functions.h" />
|
||||
<ClInclude Include="..\..\..\src\include\ndpi_define.h" />
|
||||
<ClInclude Include="..\..\..\src\include\ndpi_macros.h" />
|
||||
<ClInclude Include="..\..\..\src\include\ndpi_main.h" />
|
||||
<ClInclude Include="..\..\..\src\include\ndpi_protocols.h" />
|
||||
<ClInclude Include="..\..\..\src\include\ndpi_protocols_osdpi.h" />
|
||||
<ClInclude Include="..\..\..\src\include\ndpi_protocol_history.h" />
|
||||
<ClInclude Include="..\..\..\src\include\ndpi_public_functions.h" />
|
||||
<ClInclude Include="..\..\..\src\include\ndpi_structs.h" />
|
||||
<ClInclude Include="..\..\..\src\include\ndpi_utils.h" />
|
||||
<ClInclude Include="..\..\..\src\lib\third_party\include\actypes.h" />
|
||||
<ClInclude Include="..\..\..\src\lib\third_party\include\ahocorasick.h" />
|
||||
<ClInclude Include="..\..\..\src\lib\third_party\include\node.h" />
|
||||
<ClInclude Include="..\..\..\src\lib\third_party\include\sort.h" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
@@ -1,465 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Resource Files">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\pcapReader.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\lib\ndpi_main.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\zattoo.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\afp.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\aimini.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\applejuice.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\armagetron.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\battlefield.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\bgp.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\bittorrent.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\ciscovpn.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\citrix.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\corba.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\crossfire.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\dcerpc.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\dhcp.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\dhcpv6.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\directconnect.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\directdownloadlink.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\dns.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\dofus.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\dropbox.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\edonkey.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\fasttrack.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\feidian.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\fiesta.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\filetopia.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\flash.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\florensia.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\ftp.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\gadu_gadu.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\gnutella.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\gtp.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\guildwars.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\h323.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\halflife2_and_mods.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\http.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\http_activesync.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\i23v5.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\iax.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\icecast.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\imesh.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\ipp.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\irc.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\jabber.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\kerberos.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\kontiki.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\ldap.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\lotus_notes.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\mail_imap.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\mail_pop.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\mail_smtp.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\maplestory.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\mdns.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\meebo.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\mgcp.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\mms.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\msn.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\mssql.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\mysql.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\netbios.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\netflow.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\nfs.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\noe.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\non_tcp_udp.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\ntp.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\openft.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\openvpn.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\oracle.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\oscar.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\pando.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\pcanywhere.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\popo.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\postgres.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\pplive.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\ppstream.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\pptp.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\qq.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\quake.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\quic.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\radius.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\rdp.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\rsync.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\rtcp.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\rtp.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\rtsp.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\sflow.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\shoutcast.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\sip.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\skinny.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\skype.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\smb.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\snmp.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\socrates.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\sopcast.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\soulseek.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\spotify.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\ssdp.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\ssh.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\ssl.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\stealthnet.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\steam.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\stun.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\syslog.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\tcp_udp.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\tds.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\teamspeak.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\teamviewer.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\telnet.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\tftp.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\thunder.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\tor.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\tvants.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\tvuplayer.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\usenet.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\veohtv.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\viber.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\vmware.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\vnc.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\warcraft3.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\winmx.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\world_of_kung_fu.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\world_of_warcraft.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\xbox.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\xdmcp.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\lib\protocols\yahoo.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\lib\third_party\src\ahocorasick.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\lib\third_party\src\node.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\lib\third_party\src\sort.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\..\nprobe\nprobe-win-32\getopt.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\..\nprobe\nprobe-win-32\getopt1.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\..\..\src\lib\third_party\include\actypes.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\src\lib\third_party\include\ahocorasick.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\src\lib\third_party\include\node.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\src\lib\third_party\include\sort.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\src\include\ndpi_api.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\src\include\ndpi_debug_functions.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\src\include\ndpi_define.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\src\include\ndpi_macros.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\src\include\ndpi_main.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\src\include\ndpi_protocol_history.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\src\include\ndpi_protocols.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\src\include\ndpi_protocols_osdpi.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\src\include\ndpi_public_functions.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\src\include\ndpi_structs.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\src\include\ndpi_utils.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\src\include\linux_compat.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\..\nprobe\nprobe-win-32\getopt.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -1,3 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
</Project>
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,24 +0,0 @@
|
||||
# Format:
|
||||
# <tcp|udp>:<port>,<tcp|udp>:<port>,.....@<proto>
|
||||
|
||||
tcp:81,tcp:8181@HTTP
|
||||
udp:5061-5062@SIP
|
||||
tcp:860,udp:860,tcp:3260,udp:3260@iSCSI
|
||||
tcp:3000@ntop
|
||||
|
||||
# Subprotocols
|
||||
# Format:
|
||||
# host:"<value>",host:"<value>",.....@<subproto>
|
||||
|
||||
host:"googlesyndacation.com"@Google
|
||||
host:"venere.com"@Venere
|
||||
host:"kataweb.it",host:"repubblica.it"@Repubblica
|
||||
host:"ntop"@ntop
|
||||
# IP based Subprotocols
|
||||
# Format:
|
||||
# ip:<value>,ip:<value>,.....@<subproto>
|
||||
|
||||
ip:213.75.170.11@CustomProtocol
|
||||
|
||||
|
||||
|
||||
+58
@@ -0,0 +1,58 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="chrome=1">
|
||||
<title>nDPI by ntop</title>
|
||||
|
||||
<link rel="stylesheet" href="stylesheets/styles.css">
|
||||
<link rel="stylesheet" href="stylesheets/pygment_trac.css">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
|
||||
<!--[if lt IE 9]>
|
||||
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
|
||||
<![endif]-->
|
||||
</head>
|
||||
<body>
|
||||
<div class="wrapper">
|
||||
<header>
|
||||
<h1>nDPI</h1>
|
||||
<p>Open Source Deep Packet Inspection Software Toolkit</p>
|
||||
|
||||
<p class="view"><a href="https://github.com/ntop/nDPI">View the Project on GitHub <small>ntop/nDPI</small></a></p>
|
||||
|
||||
|
||||
<ul>
|
||||
<li><a href="https://github.com/ntop/nDPI/zipball/master">Download <strong>ZIP File</strong></a></li>
|
||||
<li><a href="https://github.com/ntop/nDPI/tarball/master">Download <strong>TAR Ball</strong></a></li>
|
||||
<li><a href="https://github.com/ntop/nDPI">View On <strong>GitHub</strong></a></li>
|
||||
</ul>
|
||||
</header>
|
||||
<section>
|
||||
<h3>
|
||||
<a id="welcome-to-ndpi" class="anchor" href="#welcome-to-ndpi" aria-hidden="true"><span class="octicon octicon-link"></span></a>Welcome to nDPI</h3>
|
||||
|
||||
<p>Deep packet inspection (DPI) is a technique that allows you to identify application traffic protocol such as SSH, HTTP, WhatsApp or Facebook, simply dissecting the first few packets. In addition to that it can extract attributes such as the HTTP URL or DNS query.</p>
|
||||
|
||||
<p>There are many DPI toolkits available on the market, but they are closed, costly and usually not available in source format. For this reason we have developed nDPI. We wanted it free (LGPL v3), open and available in source format so you can see what we do with your packets and make sure that your privacy is respected.</p>
|
||||
|
||||
<p>Currently it supports almost 200 protocols. While we do our best to keep nDPI updated as new protocols are introduced, we need your help. Please contribute!</p>
|
||||
</section>
|
||||
<footer>
|
||||
<p>This project is maintained by <a href="https://github.com/ntop">ntop</a></p>
|
||||
<p><small>Hosted on GitHub Pages — Theme by <a href="https://github.com/orderedlist">orderedlist</a></small></p>
|
||||
</footer>
|
||||
</div>
|
||||
<script src="javascripts/scale.fix.js"></script>
|
||||
<script type="text/javascript">
|
||||
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
|
||||
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
try {
|
||||
var pageTracker = _gat._getTracker("UA-129330-01");
|
||||
pageTracker._trackPageview();
|
||||
} catch(err) {}
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,17 @@
|
||||
var metas = document.getElementsByTagName('meta');
|
||||
var i;
|
||||
if (navigator.userAgent.match(/iPhone/i)) {
|
||||
for (i=0; i<metas.length; i++) {
|
||||
if (metas[i].name == "viewport") {
|
||||
metas[i].content = "width=device-width, minimum-scale=1.0, maximum-scale=1.0";
|
||||
}
|
||||
}
|
||||
document.addEventListener("gesturestart", gestureStart, false);
|
||||
}
|
||||
function gestureStart() {
|
||||
for (i=0; i<metas.length; i++) {
|
||||
if (metas[i].name == "viewport") {
|
||||
metas[i].content = "width=device-width, minimum-scale=0.25, maximum-scale=1.6";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
prefix=@prefix@
|
||||
exec_prefix=@exec_prefix@
|
||||
libdir=@libdir@
|
||||
includedir=@includedir@
|
||||
|
||||
Name: libndpi
|
||||
Description: deep packet inspection library
|
||||
Version: @VERSION@
|
||||
Libs: -L${libdir} -lndpi
|
||||
Cflags: -I${includedir}/libndpi-@VERSION@
|
||||
-30
@@ -1,30 +0,0 @@
|
||||
ndpi_dump_protocols
|
||||
ndpi_get_proto_name
|
||||
ndpi_free
|
||||
ndpi_guess_undetected_protocol
|
||||
ndpi_tfind
|
||||
ndpi_tsearch
|
||||
ndpi_set_protocol_detection_bitmask2
|
||||
ndpi_detection_get_sizeof_ndpi_id_struct
|
||||
ndpi_detection_get_sizeof_ndpi_flow_struct
|
||||
ndpi_load_protocols_file
|
||||
ndpi_tdestroy
|
||||
ndpi_exit_detection_module
|
||||
ndpi_detection_process_packet
|
||||
ndpi_twalk
|
||||
ndpi_tdelete
|
||||
ndpi_revision
|
||||
ndpi_init_detection_module
|
||||
ndpi_get_num_supported_protocols
|
||||
ndpi_set_proto_defaults
|
||||
ndpi_get_protocol_id
|
||||
ndpi_find_port_based_protocol
|
||||
ndpi_get_http_method
|
||||
ndpi_get_http_url
|
||||
ndpi_get_http_content_type
|
||||
ndpi_free_flow
|
||||
ndpi_get_proto_breed
|
||||
ndpi_get_proto_breed_name
|
||||
ndpi_get_proto_by_id
|
||||
ndpi_get_protocol_id_master_proto
|
||||
ndpi_guess_protocol_id
|
||||
@@ -1,332 +0,0 @@
|
||||
# ===========================================================================
|
||||
# http://www.gnu.org/software/autoconf-archive/ax_pthread.html
|
||||
# ===========================================================================
|
||||
#
|
||||
# SYNOPSIS
|
||||
#
|
||||
# AX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
|
||||
#
|
||||
# DESCRIPTION
|
||||
#
|
||||
# This macro figures out how to build C programs using POSIX threads. It
|
||||
# sets the PTHREAD_LIBS output variable to the threads library and linker
|
||||
# flags, and the PTHREAD_CFLAGS output variable to any special C compiler
|
||||
# flags that are needed. (The user can also force certain compiler
|
||||
# flags/libs to be tested by setting these environment variables.)
|
||||
#
|
||||
# Also sets PTHREAD_CC to any special C compiler that is needed for
|
||||
# multi-threaded programs (defaults to the value of CC otherwise). (This
|
||||
# is necessary on AIX to use the special cc_r compiler alias.)
|
||||
#
|
||||
# NOTE: You are assumed to not only compile your program with these flags,
|
||||
# but also link it with them as well. e.g. you should link with
|
||||
# $PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS $LIBS
|
||||
#
|
||||
# If you are only building threads programs, you may wish to use these
|
||||
# variables in your default LIBS, CFLAGS, and CC:
|
||||
#
|
||||
# LIBS="$PTHREAD_LIBS $LIBS"
|
||||
# CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
|
||||
# CC="$PTHREAD_CC"
|
||||
#
|
||||
# In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute constant
|
||||
# has a nonstandard name, defines PTHREAD_CREATE_JOINABLE to that name
|
||||
# (e.g. PTHREAD_CREATE_UNDETACHED on AIX).
|
||||
#
|
||||
# Also HAVE_PTHREAD_PRIO_INHERIT is defined if pthread is found and the
|
||||
# PTHREAD_PRIO_INHERIT symbol is defined when compiling with
|
||||
# PTHREAD_CFLAGS.
|
||||
#
|
||||
# ACTION-IF-FOUND is a list of shell commands to run if a threads library
|
||||
# is found, and ACTION-IF-NOT-FOUND is a list of commands to run it if it
|
||||
# is not found. If ACTION-IF-FOUND is not specified, the default action
|
||||
# will define HAVE_PTHREAD.
|
||||
#
|
||||
# Please let the authors know if this macro fails on any platform, or if
|
||||
# you have any other suggestions or comments. This macro was based on work
|
||||
# by SGJ on autoconf scripts for FFTW (http://www.fftw.org/) (with help
|
||||
# from M. Frigo), as well as ac_pthread and hb_pthread macros posted by
|
||||
# Alejandro Forero Cuervo to the autoconf macro repository. We are also
|
||||
# grateful for the helpful feedback of numerous users.
|
||||
#
|
||||
# Updated for Autoconf 2.68 by Daniel Richard G.
|
||||
#
|
||||
# LICENSE
|
||||
#
|
||||
# Copyright (c) 2008 Steven G. Johnson <stevenj@alum.mit.edu>
|
||||
# Copyright (c) 2011 Daniel Richard G. <skunk@iSKUNK.ORG>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public License as published by the
|
||||
# Free Software Foundation, either version 3 of the License, or (at your
|
||||
# option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
||||
# Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License along
|
||||
# with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
# As a special exception, the respective Autoconf Macro's copyright owner
|
||||
# gives unlimited permission to copy, distribute and modify the configure
|
||||
# scripts that are the output of Autoconf when processing the Macro. You
|
||||
# need not follow the terms of the GNU General Public License when using
|
||||
# or distributing such scripts, even though portions of the text of the
|
||||
# Macro appear in them. The GNU General Public License (GPL) does govern
|
||||
# all other use of the material that constitutes the Autoconf Macro.
|
||||
#
|
||||
# This special exception to the GPL applies to versions of the Autoconf
|
||||
# Macro released by the Autoconf Archive. When you make and distribute a
|
||||
# modified version of the Autoconf Macro, you may extend this special
|
||||
# exception to the GPL to apply to your modified version as well.
|
||||
|
||||
#serial 21
|
||||
|
||||
AU_ALIAS([ACX_PTHREAD], [AX_PTHREAD])
|
||||
AC_DEFUN([AX_PTHREAD], [
|
||||
AC_REQUIRE([AC_CANONICAL_HOST])
|
||||
AC_LANG_PUSH([C])
|
||||
ax_pthread_ok=no
|
||||
|
||||
# We used to check for pthread.h first, but this fails if pthread.h
|
||||
# requires special compiler flags (e.g. on True64 or Sequent).
|
||||
# It gets checked for in the link test anyway.
|
||||
|
||||
# First of all, check if the user has set any of the PTHREAD_LIBS,
|
||||
# etcetera environment variables, and if threads linking works using
|
||||
# them:
|
||||
if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then
|
||||
save_CFLAGS="$CFLAGS"
|
||||
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
|
||||
save_LIBS="$LIBS"
|
||||
LIBS="$PTHREAD_LIBS $LIBS"
|
||||
AC_MSG_CHECKING([for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS])
|
||||
AC_TRY_LINK_FUNC([pthread_join], [ax_pthread_ok=yes])
|
||||
AC_MSG_RESULT([$ax_pthread_ok])
|
||||
if test x"$ax_pthread_ok" = xno; then
|
||||
PTHREAD_LIBS=""
|
||||
PTHREAD_CFLAGS=""
|
||||
fi
|
||||
LIBS="$save_LIBS"
|
||||
CFLAGS="$save_CFLAGS"
|
||||
fi
|
||||
|
||||
# We must check for the threads library under a number of different
|
||||
# names; the ordering is very important because some systems
|
||||
# (e.g. DEC) have both -lpthread and -lpthreads, where one of the
|
||||
# libraries is broken (non-POSIX).
|
||||
|
||||
# Create a list of thread flags to try. Items starting with a "-" are
|
||||
# C compiler flags, and other items are library names, except for "none"
|
||||
# which indicates that we try without any flags at all, and "pthread-config"
|
||||
# which is a program returning the flags for the Pth emulation library.
|
||||
|
||||
ax_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config"
|
||||
|
||||
# The ordering *is* (sometimes) important. Some notes on the
|
||||
# individual items follow:
|
||||
|
||||
# pthreads: AIX (must check this before -lpthread)
|
||||
# none: in case threads are in libc; should be tried before -Kthread and
|
||||
# other compiler flags to prevent continual compiler warnings
|
||||
# -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h)
|
||||
# -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able)
|
||||
# lthread: LinuxThreads port on FreeBSD (also preferred to -pthread)
|
||||
# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads)
|
||||
# -pthreads: Solaris/gcc
|
||||
# -mthreads: Mingw32/gcc, Lynx/gcc
|
||||
# -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it
|
||||
# doesn't hurt to check since this sometimes defines pthreads too;
|
||||
# also defines -D_REENTRANT)
|
||||
# ... -mt is also the pthreads flag for HP/aCC
|
||||
# pthread: Linux, etcetera
|
||||
# --thread-safe: KAI C++
|
||||
# pthread-config: use pthread-config program (for GNU Pth library)
|
||||
|
||||
case ${host_os} in
|
||||
solaris*)
|
||||
|
||||
# On Solaris (at least, for some versions), libc contains stubbed
|
||||
# (non-functional) versions of the pthreads routines, so link-based
|
||||
# tests will erroneously succeed. (We need to link with -pthreads/-mt/
|
||||
# -lpthread.) (The stubs are missing pthread_cleanup_push, or rather
|
||||
# a function called by this macro, so we could check for that, but
|
||||
# who knows whether they'll stub that too in a future libc.) So,
|
||||
# we'll just look for -pthreads and -lpthread first:
|
||||
|
||||
ax_pthread_flags="-pthreads pthread -mt -pthread $ax_pthread_flags"
|
||||
;;
|
||||
|
||||
darwin*)
|
||||
ax_pthread_flags="-pthread $ax_pthread_flags"
|
||||
;;
|
||||
esac
|
||||
|
||||
# Clang doesn't consider unrecognized options an error unless we specify
|
||||
# -Werror. We throw in some extra Clang-specific options to ensure that
|
||||
# this doesn't happen for GCC, which also accepts -Werror.
|
||||
|
||||
AC_MSG_CHECKING([if compiler needs -Werror to reject unknown flags])
|
||||
save_CFLAGS="$CFLAGS"
|
||||
ax_pthread_extra_flags="-Werror"
|
||||
CFLAGS="$CFLAGS $ax_pthread_extra_flags -Wunknown-warning-option -Wsizeof-array-argument"
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([int foo(void);],[foo()])],
|
||||
[AC_MSG_RESULT([yes])],
|
||||
[ax_pthread_extra_flags=
|
||||
AC_MSG_RESULT([no])])
|
||||
CFLAGS="$save_CFLAGS"
|
||||
|
||||
if test x"$ax_pthread_ok" = xno; then
|
||||
for flag in $ax_pthread_flags; do
|
||||
|
||||
case $flag in
|
||||
none)
|
||||
AC_MSG_CHECKING([whether pthreads work without any flags])
|
||||
;;
|
||||
|
||||
-*)
|
||||
AC_MSG_CHECKING([whether pthreads work with $flag])
|
||||
PTHREAD_CFLAGS="$flag"
|
||||
;;
|
||||
|
||||
pthread-config)
|
||||
AC_CHECK_PROG([ax_pthread_config], [pthread-config], [yes], [no])
|
||||
if test x"$ax_pthread_config" = xno; then continue; fi
|
||||
PTHREAD_CFLAGS="`pthread-config --cflags`"
|
||||
PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`"
|
||||
;;
|
||||
|
||||
*)
|
||||
AC_MSG_CHECKING([for the pthreads library -l$flag])
|
||||
PTHREAD_LIBS="-l$flag"
|
||||
;;
|
||||
esac
|
||||
|
||||
save_LIBS="$LIBS"
|
||||
save_CFLAGS="$CFLAGS"
|
||||
LIBS="$PTHREAD_LIBS $LIBS"
|
||||
CFLAGS="$CFLAGS $PTHREAD_CFLAGS $ax_pthread_extra_flags"
|
||||
|
||||
# Check for various functions. We must include pthread.h,
|
||||
# since some functions may be macros. (On the Sequent, we
|
||||
# need a special flag -Kthread to make this header compile.)
|
||||
# We check for pthread_join because it is in -lpthread on IRIX
|
||||
# while pthread_create is in libc. We check for pthread_attr_init
|
||||
# due to DEC craziness with -lpthreads. We check for
|
||||
# pthread_cleanup_push because it is one of the few pthread
|
||||
# functions on Solaris that doesn't have a non-functional libc stub.
|
||||
# We try pthread_create on general principles.
|
||||
AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <pthread.h>
|
||||
static void routine(void *a) { a = 0; }
|
||||
static void *start_routine(void *a) { return a; }],
|
||||
[pthread_t th; pthread_attr_t attr;
|
||||
pthread_create(&th, 0, start_routine, 0);
|
||||
pthread_join(th, 0);
|
||||
pthread_attr_init(&attr);
|
||||
pthread_cleanup_push(routine, 0);
|
||||
pthread_cleanup_pop(0) /* ; */])],
|
||||
[ax_pthread_ok=yes],
|
||||
[])
|
||||
|
||||
LIBS="$save_LIBS"
|
||||
CFLAGS="$save_CFLAGS"
|
||||
|
||||
AC_MSG_RESULT([$ax_pthread_ok])
|
||||
if test "x$ax_pthread_ok" = xyes; then
|
||||
break;
|
||||
fi
|
||||
|
||||
PTHREAD_LIBS=""
|
||||
PTHREAD_CFLAGS=""
|
||||
done
|
||||
fi
|
||||
|
||||
# Various other checks:
|
||||
if test "x$ax_pthread_ok" = xyes; then
|
||||
save_LIBS="$LIBS"
|
||||
LIBS="$PTHREAD_LIBS $LIBS"
|
||||
save_CFLAGS="$CFLAGS"
|
||||
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
|
||||
|
||||
# Detect AIX lossage: JOINABLE attribute is called UNDETACHED.
|
||||
AC_MSG_CHECKING([for joinable pthread attribute])
|
||||
attr_name=unknown
|
||||
for attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do
|
||||
AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <pthread.h>],
|
||||
[int attr = $attr; return attr /* ; */])],
|
||||
[attr_name=$attr; break],
|
||||
[])
|
||||
done
|
||||
AC_MSG_RESULT([$attr_name])
|
||||
if test "$attr_name" != PTHREAD_CREATE_JOINABLE; then
|
||||
AC_DEFINE_UNQUOTED([PTHREAD_CREATE_JOINABLE], [$attr_name],
|
||||
[Define to necessary symbol if this constant
|
||||
uses a non-standard name on your system.])
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING([if more special flags are required for pthreads])
|
||||
flag=no
|
||||
case ${host_os} in
|
||||
aix* | freebsd* | darwin*) flag="-D_THREAD_SAFE";;
|
||||
osf* | hpux*) flag="-D_REENTRANT";;
|
||||
solaris*)
|
||||
if test "$GCC" = "yes"; then
|
||||
flag="-D_REENTRANT"
|
||||
else
|
||||
# TODO: What about Clang on Solaris?
|
||||
flag="-mt -D_REENTRANT"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
AC_MSG_RESULT([$flag])
|
||||
if test "x$flag" != xno; then
|
||||
PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS"
|
||||
fi
|
||||
|
||||
AC_CACHE_CHECK([for PTHREAD_PRIO_INHERIT],
|
||||
[ax_cv_PTHREAD_PRIO_INHERIT], [
|
||||
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <pthread.h>]],
|
||||
[[int i = PTHREAD_PRIO_INHERIT;]])],
|
||||
[ax_cv_PTHREAD_PRIO_INHERIT=yes],
|
||||
[ax_cv_PTHREAD_PRIO_INHERIT=no])
|
||||
])
|
||||
AS_IF([test "x$ax_cv_PTHREAD_PRIO_INHERIT" = "xyes"],
|
||||
[AC_DEFINE([HAVE_PTHREAD_PRIO_INHERIT], [1], [Have PTHREAD_PRIO_INHERIT.])])
|
||||
|
||||
LIBS="$save_LIBS"
|
||||
CFLAGS="$save_CFLAGS"
|
||||
|
||||
# More AIX lossage: compile with *_r variant
|
||||
if test "x$GCC" != xyes; then
|
||||
case $host_os in
|
||||
aix*)
|
||||
AS_CASE(["x/$CC"],
|
||||
[x*/c89|x*/c89_128|x*/c99|x*/c99_128|x*/cc|x*/cc128|x*/xlc|x*/xlc_v6|x*/xlc128|x*/xlc128_v6],
|
||||
[#handle absolute path differently from PATH based program lookup
|
||||
AS_CASE(["x$CC"],
|
||||
[x/*],
|
||||
[AS_IF([AS_EXECUTABLE_P([${CC}_r])],[PTHREAD_CC="${CC}_r"])],
|
||||
[AC_CHECK_PROGS([PTHREAD_CC],[${CC}_r],[$CC])])])
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
fi
|
||||
|
||||
test -n "$PTHREAD_CC" || PTHREAD_CC="$CC"
|
||||
|
||||
AC_SUBST([PTHREAD_LIBS])
|
||||
AC_SUBST([PTHREAD_CFLAGS])
|
||||
AC_SUBST([PTHREAD_CC])
|
||||
|
||||
# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
|
||||
if test x"$ax_pthread_ok" = xyes; then
|
||||
ifelse([$1],,[AC_DEFINE([HAVE_PTHREAD],[1],[Define if you have POSIX threads libraries and header files.])],[$1])
|
||||
:
|
||||
else
|
||||
ax_pthread_ok=no
|
||||
$2
|
||||
fi
|
||||
AC_LANG_POP
|
||||
])dnl AX_PTHREAD
|
||||
@@ -1,4 +0,0 @@
|
||||
This package is a GPL implementation of an iptables and netfilter module for
|
||||
nDPI integration into the Linux kernel.
|
||||
|
||||
https://github.com/ewildgoose/ndpi-netfilter
|
||||
@@ -1,11 +0,0 @@
|
||||
=== HOMEBREW PACKAGE ===
|
||||
|
||||
NB: Work in progress
|
||||
|
||||
- SUBMIT FORMULA
|
||||
cp ndpi.rb /usr/local/Library/Formula/
|
||||
|
||||
- INSTALL FORMULA
|
||||
#check the formula
|
||||
brew audit ndpi
|
||||
brew install -vd ndpi
|
||||
@@ -1,30 +0,0 @@
|
||||
class Ndpi < Formula
|
||||
desc "Deep Packet Inspection (DPI) library"
|
||||
homepage "http://www.ntop.org/products/ndpi/"
|
||||
url "https://downloads.sourceforge.net/project/ntop/nDPI/nDPI-1.7.tar.gz"
|
||||
sha256 "714b745103a072462130b0e14cf31b2eb5270f580b7c839da5cf5ea75150262d"
|
||||
|
||||
bottle do
|
||||
cellar :any
|
||||
sha256 "e9464d314479ba3e7a91422e0bc606cfd5f6e72e94d6441cc4fa30e9c925da5c" => :yosemite
|
||||
sha256 "1d6b1d860669b42766baa276ed948c342e2fa4fd28663ba64a90fd0e200ba9c4" => :mavericks
|
||||
sha256 "b814918b4fb9588de7126061ce4ac3eb41a5c3eee27c7432b669f6dc6921bfde" => :mountain_lion
|
||||
end
|
||||
|
||||
depends_on "autoconf" => :build
|
||||
depends_on "automake" => :build
|
||||
depends_on "pkg-config" => :build
|
||||
depends_on "libtool" => :build
|
||||
depends_on "json-c"
|
||||
|
||||
def install
|
||||
system "./autogen.sh"
|
||||
system "./configure", "--prefix=#{prefix}"
|
||||
system "make"
|
||||
system "make", "install"
|
||||
end
|
||||
|
||||
test do
|
||||
system "#{bin}/ndpiReader", "-i", test_fixtures("test.pcap")
|
||||
end
|
||||
end
|
||||
@@ -1,42 +0,0 @@
|
||||
#
|
||||
# Change it according to your setup
|
||||
#
|
||||
NDPI_HOME=$(PWD)/../..
|
||||
NDPI_BUILD=${NDPI_HOME}/packages/ubuntu
|
||||
|
||||
all: clean ndpi
|
||||
|
||||
ndpi:
|
||||
\rm -rf ./usr ./debian/tmp ./debian/ndpi-dev
|
||||
mkdir -p ./usr/local ./debian/ndpi-dev
|
||||
mkdir -p ./usr/local/ndpi/lib ./usr/local/ndpi/bin ./ndpi-dev/usr/local/include/ndpi/
|
||||
cd ${NDPI_HOME}; ./autogen.sh; ./configure; make
|
||||
cp $(NDPI_HOME)/lib/libndpi.a $(NDPI_HOME)/lib/libndpi.so* ./usr/local/ndpi/lib/
|
||||
cp $(NDPI_HOME)/example/ndpiReader ./usr/local/ndpi/bin/
|
||||
cp $(NDPI_HOME)/src/include/*.h ndpi-dev/usr/local/include/ndpi/
|
||||
-rm -fr ndpi-dev/usr/local/include/nprobe/ndpi/.svn ndpi-dev/usr/local/include/ndpi/Makefile* ndpi-dev/usr/local/include/ndpi/ndpi_win32.h* ndpi-dev/usr/local/include/ndpi/include
|
||||
-find ./usr/local/lib -name "*.la" -exec /bin/rm {} ';'
|
||||
@echo
|
||||
@find . -name "*~" -exec /bin/rm {} ';'
|
||||
dpkg-buildpackage -rfakeroot -d -us -uc
|
||||
dpkg-sig --sign builder -k 7921DF34 ../ndpi*deb
|
||||
@\rm -f ../ndpi*dsc ../ndpi*.gz ../ndpi*changes
|
||||
@/bin/mv ../ndpi*deb .
|
||||
@echo
|
||||
@echo "Package built."
|
||||
@/bin/ls ndpi*deb
|
||||
@echo "-------------------------------"
|
||||
-dpkg --contents ndpi*amd64.deb
|
||||
@echo "-------------------------------"
|
||||
@echo "-------------------------------"
|
||||
-dpkg --contents ndpi*all.deb
|
||||
@echo "-------------------------------"
|
||||
|
||||
distclean:
|
||||
echo "dummy distclean"
|
||||
|
||||
install:
|
||||
echo "dummy install"
|
||||
|
||||
clean:
|
||||
-rm -rf *~ *deb debian/tmp ./usr
|
||||
@@ -1,42 +0,0 @@
|
||||
#
|
||||
# Change it according to your setup
|
||||
#
|
||||
NDPI_HOME=$(PWD)/../..
|
||||
NDPI_BUILD=${NDPI_HOME}/packages/ubuntu
|
||||
|
||||
all: clean ndpi
|
||||
|
||||
ndpi:
|
||||
\rm -rf ./usr ./debian/tmp ./debian/ndpi-dev
|
||||
mkdir -p ./usr/local ./debian/ndpi-dev
|
||||
mkdir -p ./usr/local/ndpi/lib ./usr/local/ndpi/bin ./ndpi-dev/usr/local/include/ndpi/
|
||||
cd ${NDPI_HOME}; ./autogen.sh; ./configure; make
|
||||
cp $(NDPI_HOME)/lib/libndpi.a $(NDPI_HOME)/lib/libndpi.so* ./usr/local/ndpi/lib/
|
||||
cp $(NDPI_HOME)/example/ndpiReader ./usr/local/ndpi/bin/
|
||||
cp $(NDPI_HOME)/src/include/*.h ndpi-dev/usr/local/include/ndpi/
|
||||
-rm -fr ndpi-dev/usr/local/include/nprobe/ndpi/.svn ndpi-dev/usr/local/include/ndpi/Makefile* ndpi-dev/usr/local/include/ndpi/ndpi_win32.h* ndpi-dev/usr/local/include/ndpi/include
|
||||
-find ./usr/local/lib -name "*.la" -exec /bin/rm {} ';'
|
||||
@echo
|
||||
@find . -name "*~" -exec /bin/rm {} ';'
|
||||
dpkg-buildpackage -rfakeroot -d -us -uc
|
||||
dpkg-sig --sign builder -k 7921DF34 ../ndpi*deb
|
||||
@\rm -f ../ndpi*dsc ../ndpi*.gz ../ndpi*changes
|
||||
@/bin/mv ../ndpi*deb .
|
||||
@echo
|
||||
@echo "Package built."
|
||||
@/bin/ls ndpi*deb
|
||||
@echo "-------------------------------"
|
||||
-dpkg --contents ndpi*amd64.deb
|
||||
@echo "-------------------------------"
|
||||
@echo "-------------------------------"
|
||||
-dpkg --contents ndpi*all.deb
|
||||
@echo "-------------------------------"
|
||||
|
||||
distclean:
|
||||
echo "dummy distclean"
|
||||
|
||||
install:
|
||||
echo "dummy install"
|
||||
|
||||
clean:
|
||||
-rm -rf *~ *deb debian/tmp ./usr
|
||||
Vendored
-2863
File diff suppressed because it is too large
Load Diff
@@ -1,32 +0,0 @@
|
||||
AC_INIT([Makefile.in], 1.0)
|
||||
|
||||
NDPI_VERS=`cat ../../config.h | grep -w VERSION | cut -d \" -f 2`
|
||||
PFRING_VERS=`cat $HOME/PF_RING/kernel/linux/pf_ring.h | grep RING_VERSION | head -1 | cut -d '"' -f 2`
|
||||
SVN_RELEASE=`svn info ../.. | grep "^Revision"|cut -d " " -f 2`
|
||||
PFRING_SVN_RELEASE=`svn info $HOME/PF_RING | grep "^Revision"|cut -d " " -f 2`
|
||||
MACHINE=`uname -m`
|
||||
|
||||
if test $MACHINE = "x86_64"; then
|
||||
EXTN="amd64"
|
||||
else
|
||||
EXTN="i386"
|
||||
fi
|
||||
|
||||
DATE=`date -R`
|
||||
KERNEL=`uname -r`
|
||||
|
||||
AC_SUBST(NDPI_VERS)
|
||||
AC_SUBST(PFRING_VERS)
|
||||
AC_SUBST(MACHINE)
|
||||
AC_SUBST(EXTN)
|
||||
AC_SUBST(DATE)
|
||||
AC_SUBST(KERNEL)
|
||||
AC_SUBST(SVN_RELEASE)
|
||||
AC_SUBST(PFRING_SVN_RELEASE)
|
||||
|
||||
AC_CONFIG_FILES(Makefile)
|
||||
AC_CONFIG_FILES(debian/changelog)
|
||||
AC_CONFIG_FILES(debian/files)
|
||||
AC_CONFIG_FILES(debian/control)
|
||||
|
||||
AC_OUTPUT
|
||||
@@ -1,340 +0,0 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Library General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) year name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Library General
|
||||
Public License instead of this License.
|
||||
@@ -1,2 +0,0 @@
|
||||
This directory contains the files needed to build the package
|
||||
named 'nprobe' for the Debian GNU/Linux distribution.
|
||||
@@ -1,4 +0,0 @@
|
||||
ndpi (@NDPI_VERS@-@SVN_RELEASE@) stable; urgency=high
|
||||
* Last packaged version
|
||||
|
||||
-- Luca Deri <deri@ntop.org> @DATE@
|
||||
@@ -1 +0,0 @@
|
||||
1
|
||||
@@ -1,28 +0,0 @@
|
||||
Source: ndpi
|
||||
Section: free
|
||||
Priority: optional
|
||||
Maintainer: Luca Deri <deri@ntop.org>
|
||||
Standards-Version: @NDPI_VERSION@
|
||||
Build-Depends:
|
||||
Build-Conflicts:
|
||||
|
||||
Package: ndpi
|
||||
Architecture: @EXTN@
|
||||
Depends: pfring (=@PFRING_VERS@-@PFRING_SVN_RELEASE@), libnuma
|
||||
Recommends:
|
||||
Suggests:
|
||||
Pre-Depends:
|
||||
Conflicts:
|
||||
Provides:
|
||||
Replaces:
|
||||
Description: A network probe.
|
||||
|
||||
Package: ndpi-dev
|
||||
Section: libdevel
|
||||
Architecture: all
|
||||
Depends: ndpi (= ${binary:Version}), ${misc:Depends}
|
||||
Conflicts:
|
||||
Description: development library and header files for ndpi
|
||||
Headers, static libraries, and documentation for the ndpi library
|
||||
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
usr/local/ndpi
|
||||
@@ -1 +0,0 @@
|
||||
README
|
||||
@@ -1 +0,0 @@
|
||||
ndpi_@NDPI_VERS@_@EXTN@.deb free optional
|
||||
@@ -1,34 +0,0 @@
|
||||
#!/bin/sh -e
|
||||
|
||||
case "$1" in
|
||||
configure)
|
||||
# continue below
|
||||
;;
|
||||
|
||||
abort-upgrade|abort-remove|abort-deconfigure)
|
||||
exit 0
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "postinst called with unknown argument \`$1'" >&2
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
|
||||
umask 022
|
||||
|
||||
# Update shared libs
|
||||
echo "/usr/local/lib\n" > /etc/ld.so.conf.d/nprobe.conf
|
||||
echo "Rebuilding ld cache..."
|
||||
/sbin/ldconfig
|
||||
|
||||
echo "Adding the nprobe startup script"
|
||||
update-rc.d nprobe defaults 93 >/dev/null
|
||||
|
||||
echo "Making the /etc/nprobe directory..."
|
||||
mkdir -p /etc/nprobe/
|
||||
|
||||
echo "Making the /var/log/nprobe directory..."
|
||||
mkdir -p /var/log/nprobe
|
||||
|
||||
exit 0
|
||||
@@ -1,13 +0,0 @@
|
||||
#!/bin/sh -e
|
||||
|
||||
set -e
|
||||
|
||||
#\/bin/rm /etc/ld.so.conf.d/nprobe.conf
|
||||
/sbin/ldconfig
|
||||
|
||||
# Not needed: upstart does it
|
||||
if [ "$1" = "purge" ] ; then
|
||||
update-rc.d nprobe remove >/dev/null
|
||||
fi
|
||||
|
||||
exit 0
|
||||
@@ -1,35 +0,0 @@
|
||||
#! /bin/sh
|
||||
# preinst script for nbox
|
||||
#
|
||||
# see: dh_installdeb(1)
|
||||
|
||||
set -e
|
||||
|
||||
# summary of how this script can be called:
|
||||
# * <new-preinst> `install'
|
||||
# * <new-preinst> `install' <old-version>
|
||||
# * <new-preinst> `upgrade' <old-version>
|
||||
# * <old-preinst> `abort-upgrade' <new-version>
|
||||
|
||||
case "$1" in
|
||||
install|upgrade)
|
||||
if test -f /usr/local/sbin/nprobe; then
|
||||
rm /usr/local/sbin/nprobe
|
||||
fi
|
||||
;;
|
||||
|
||||
abort-upgrade)
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "preinst called with unknown argument \`$1'" >&2
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
|
||||
# dh_installdeb will replace this with shell code automatically
|
||||
# generated by other debhelper scripts.
|
||||
|
||||
|
||||
|
||||
exit 0
|
||||
@@ -1,14 +0,0 @@
|
||||
#!/bin/sh -e
|
||||
|
||||
# Only shut the daemon down if we're really removing the package. If this is
|
||||
# an upgrade, we will instead do a restart in the postinst... this keeps nprobe
|
||||
# from being left shut down for a long time, which could pose problems.
|
||||
case "$1" in
|
||||
upgrade)
|
||||
;;
|
||||
*)
|
||||
/etc/init.d/nprobe stop
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
||||
@@ -1,59 +0,0 @@
|
||||
#!/usr/bin/make -f
|
||||
|
||||
# Uncomment this to turn on verbose mode.
|
||||
# export DH_VERBOSE=1
|
||||
|
||||
#
|
||||
# debian/compat
|
||||
# We should use at least comparibily version 5
|
||||
# but this requires the whole building process
|
||||
# to be remade and this is something we leave
|
||||
# to when we will have more time
|
||||
# http://www.tin.org/bin/man.cgi?section=7&topic=debhelper
|
||||
#
|
||||
|
||||
package=ndpi
|
||||
|
||||
build: build-stamp
|
||||
build-stamp:
|
||||
dh_testdir
|
||||
|
||||
clean:
|
||||
dh_testdir
|
||||
dh_testroot
|
||||
dh_clean
|
||||
|
||||
install: build
|
||||
dh_testdir
|
||||
dh_testroot
|
||||
dh_clean -k
|
||||
dh_installdirs
|
||||
|
||||
# Build architecture-independent files here.
|
||||
binary-indep: build install
|
||||
# We have nothing to do by default.
|
||||
|
||||
# Build architecture-dependent files here.
|
||||
binary-arch: build install
|
||||
dh_testdir
|
||||
dh_testroot
|
||||
dh_clean -k
|
||||
dh_installdirs
|
||||
dh_installinit
|
||||
dh_installman
|
||||
# install the files into debian/tmp.
|
||||
cp -r ./usr/ ./debian/tmp
|
||||
cp -r ./ndpi-dev/* ./debian/ndpi-dev/
|
||||
-find ./debian/tmp -name .svn -exec /bin/rm -rf {} ';'
|
||||
-find ./debian/tmp -executable -type f |xargs strip
|
||||
dh_link
|
||||
dh_strip
|
||||
dh_compress
|
||||
dh_fixperms
|
||||
dh_installdeb
|
||||
dh_gencontrol
|
||||
dh_md5sums
|
||||
dh_builddeb
|
||||
|
||||
binary: binary-indep binary-arch
|
||||
.PHONY: build clean binary-indep binary-arch binary install
|
||||
@@ -0,0 +1 @@
|
||||
{"name":"nDPI","tagline":"Open Source Deep Packet Inspection Software Toolkit","body":"### Welcome to nDPI\r\nDeep packet inspection (DPI) is a technique that allows you to identify application traffic protocol such as SSH, HTTP, WhatsApp or Facebook, simply dissecting the first few packets. In addition to that it can extract attributes such as the HTTP URL or DNS query.\r\n\r\nThere are many DPI toolkits available on the market, but they are closed, costly and usually not available in source format. For this reason we have developed nDPI. We wanted it free (LGPL v3), open and available in source format so you can see what we do with your packets and make sure that your privacy is respected.\r\n\r\nCurrently it supports almost 200 protocols. While we do our best to keep nDPI updated as new protocols are introduced, we need your help. Please contribute!","google":"UA-129330-01","note":"Don't delete this file! It's used internally to help with page regeneration."}
|
||||
@@ -1,10 +0,0 @@
|
||||
library_includedir=$(includedir)/libndpi-1.4/libndpi
|
||||
|
||||
library_include_HEADERS = ndpi_api.h \
|
||||
ndpi_define.h \
|
||||
ndpi_typedefs.h \
|
||||
ndpi_main.h \
|
||||
ndpi_protocol_ids.h \
|
||||
ndpi_protocols.h \
|
||||
ndpi_win32.h \
|
||||
ndpi_includes.h
|
||||
@@ -1,240 +0,0 @@
|
||||
/*
|
||||
* ndpi_api.h
|
||||
*
|
||||
* Copyright (C) 2011-15 - ntop.org
|
||||
* Copyright (C) 2009-2011 by ipoque GmbH
|
||||
*
|
||||
* This file is part of nDPI, an open source deep packet inspection
|
||||
* library based on the OpenDPI and PACE technology by ipoque GmbH
|
||||
*
|
||||
* nDPI is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* nDPI is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with nDPI. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __NDPI_API_H__
|
||||
#define __NDPI_API_H__
|
||||
|
||||
#include "ndpi_main.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* This function returns the size of the flow struct
|
||||
* @return the size of the flow struct
|
||||
*/
|
||||
u_int32_t ndpi_detection_get_sizeof_ndpi_flow_struct(void);
|
||||
|
||||
/**
|
||||
* This function returns the size of the id struct
|
||||
* @return the size of the id struct
|
||||
*/
|
||||
u_int32_t ndpi_detection_get_sizeof_ndpi_id_struct(void);
|
||||
|
||||
/* Public malloc/free */
|
||||
void* ndpi_malloc(unsigned long size);
|
||||
void* ndpi_calloc(unsigned long count, unsigned long size);
|
||||
void ndpi_free(void *ptr);
|
||||
void *ndpi_realloc(void *ptr, size_t old_size, size_t new_size);
|
||||
char *ndpi_strdup(const char *s);
|
||||
|
||||
/**
|
||||
* Find the first occurrence of find in s, where the search is limited to the
|
||||
* first slen characters of s.
|
||||
*/
|
||||
char* ndpi_strnstr(const char *s, const char *find, size_t slen);
|
||||
|
||||
/**
|
||||
* This function returns the nDPI protocol id for IP-based protocol detection
|
||||
*/
|
||||
u_int16_t ndpi_network_ptree_match(struct ndpi_detection_module_struct *ndpi_struct, struct in_addr *pin);
|
||||
|
||||
/**
|
||||
* Same as ndpi_network_ptree_match
|
||||
*/
|
||||
u_int16_t ndpi_host_ptree_match(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t host);
|
||||
|
||||
/**
|
||||
* This function returns a new initialized detection module.
|
||||
* @param ticks_per_second the timestamp resolution per second (like 1000 for millisecond resolution)
|
||||
* @param __ndpi_malloc function pointer to a memory allocator
|
||||
* @param ndpi_debug_printf a function pointer to a debug output function, use NULL in productive envionments
|
||||
* @return the initialized detection module
|
||||
*/
|
||||
struct ndpi_detection_module_struct *ndpi_init_detection_module(u_int32_t ticks_per_second,
|
||||
void* (*__ndpi_malloc)(unsigned long size),
|
||||
void (*__ndpi_free)(void *ptr),
|
||||
ndpi_debug_function_ptr ndpi_debug_printf);
|
||||
|
||||
|
||||
/**
|
||||
* This function frees the memory allocated in the specified flow
|
||||
* @param flow to free
|
||||
*/
|
||||
void ndpi_free_flow(struct ndpi_flow_struct *flow);
|
||||
|
||||
/**
|
||||
* This function enables cache support in nDPI used for some protocol such as Skype
|
||||
* @param host host name
|
||||
* @param port port number
|
||||
*/
|
||||
void ndpi_enable_cache(struct ndpi_detection_module_struct *ndpi_mod, char* host, u_int port);
|
||||
|
||||
/**
|
||||
* This function destroys the detection module
|
||||
* @param ndpi_struct the to clearing detection module
|
||||
* @param ndpi_free function pointer to a memory free function
|
||||
*/
|
||||
void
|
||||
ndpi_exit_detection_module(struct ndpi_detection_module_struct
|
||||
*ndpi_struct, void (*ndpi_free) (void *ptr));
|
||||
|
||||
/**
|
||||
* This function sets the protocol bitmask2
|
||||
* @param ndpi_struct the detection module
|
||||
* @param detection_bitmask the protocol bitmask
|
||||
*/
|
||||
void
|
||||
ndpi_set_protocol_detection_bitmask2(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
const NDPI_PROTOCOL_BITMASK * detection_bitmask);
|
||||
/**
|
||||
* This function will processes one packet and returns the ID of the detected protocol.
|
||||
* This is the main packet processing function.
|
||||
*
|
||||
* @param ndpi_struct the detection module
|
||||
* @param flow void pointer to the connection state machine
|
||||
* @param packet the packet as unsigned char pointer with the length of packetlen. the pointer must point to the Layer 3 (IP header)
|
||||
* @param packetlen the length of the packet
|
||||
* @param current_tick the current timestamp for the packet
|
||||
* @param src void pointer to the source subscriber state machine
|
||||
* @param dst void pointer to the destination subscriber state machine
|
||||
* @return returns the detected ID of the protocol
|
||||
*/
|
||||
ndpi_protocol ndpi_detection_process_packet(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
struct ndpi_flow_struct *flow,
|
||||
const unsigned char *packet,
|
||||
const unsigned short packetlen,
|
||||
const u_int64_t current_tick,
|
||||
struct ndpi_id_struct *src,
|
||||
struct ndpi_id_struct *dst);
|
||||
|
||||
u_int16_t ndpi_get_flow_masterprotocol(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
struct ndpi_flow_struct *flow);
|
||||
|
||||
#define NDPI_DETECTION_ONLY_IPV4 ( 1 << 0 )
|
||||
#define NDPI_DETECTION_ONLY_IPV6 ( 1 << 1 )
|
||||
|
||||
/**
|
||||
* query the pointer to the layer 4 packet
|
||||
*
|
||||
* @param l3 pointer to the layer 3 data
|
||||
* @param l3_len length of the layer 3 data
|
||||
* @param l4_return filled with the pointer the layer 4 data if return value == 0, undefined otherwise
|
||||
* @param l4_len_return filled with the length of the layer 4 data if return value == 0, undefined otherwise
|
||||
* @param l4_protocol_return filled with the protocol of the layer 4 data if return value == 0, undefined otherwise
|
||||
* @param flags limit operation on ipv4 or ipv6 packets, possible values are NDPI_DETECTION_ONLY_IPV4 or NDPI_DETECTION_ONLY_IPV6; 0 means any
|
||||
* @return 0 if correct layer 4 data could be found, != 0 otherwise
|
||||
*/
|
||||
u_int8_t ndpi_detection_get_l4(const u_int8_t * l3, u_int16_t l3_len, const u_int8_t ** l4_return, u_int16_t * l4_len_return,
|
||||
u_int8_t * l4_protocol_return, u_int32_t flags);
|
||||
|
||||
/**
|
||||
* returns true if the protocol history of the flow of the last packet given to the detection
|
||||
* contains the given protocol.
|
||||
*
|
||||
* @param ndpi_struct the detection module
|
||||
* @return 1 if protocol has been found, 0 otherwise
|
||||
*/
|
||||
u_int8_t ndpi_detection_flow_protocol_history_contains_protocol(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
struct ndpi_flow_struct *flow,
|
||||
u_int16_t protocol_id);
|
||||
ndpi_protocol ndpi_find_port_based_protocol(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
u_int8_t proto, u_int32_t shost, u_int16_t sport, u_int32_t dhost, u_int16_t dport);
|
||||
ndpi_protocol ndpi_guess_undetected_protocol(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
u_int8_t proto, u_int32_t shost, u_int16_t sport, u_int32_t dhost, u_int16_t dport);
|
||||
int ndpi_match_host_subprotocol(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
struct ndpi_flow_struct *flow, char *string_to_match, u_int string_to_match_len,
|
||||
u_int16_t master_protocol_id);
|
||||
int ndpi_match_content_subprotocol(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
struct ndpi_flow_struct *flow,
|
||||
char *string_to_match, u_int string_to_match_len,
|
||||
u_int16_t master_protocol_id);
|
||||
int ndpi_match_bigram(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
ndpi_automa *automa, char *bigram_to_match);
|
||||
char* ndpi_protocol2name(struct ndpi_detection_module_struct *ndpi_mod, ndpi_protocol proto, char *buf, u_int buf_len);
|
||||
char* ndpi_get_proto_name(struct ndpi_detection_module_struct *mod, u_int16_t proto_id);
|
||||
ndpi_protocol_breed_t ndpi_get_proto_breed(struct ndpi_detection_module_struct *ndpi_struct, u_int16_t proto);
|
||||
char* ndpi_get_proto_breed_name(struct ndpi_detection_module_struct *ndpi_struct, ndpi_protocol_breed_t breed_id);
|
||||
int ndpi_get_protocol_id(struct ndpi_detection_module_struct *ndpi_mod, char *proto);
|
||||
void ndpi_dump_protocols(struct ndpi_detection_module_struct *mod);
|
||||
int matchStringProtocol(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow,
|
||||
char *string_to_match, u_int string_to_match_len);
|
||||
|
||||
int ndpi_load_protocols_file(struct ndpi_detection_module_struct *ndpi_mod, char* path);
|
||||
u_int ndpi_get_num_supported_protocols(struct ndpi_detection_module_struct *ndpi_mod);
|
||||
char* ndpi_revision(void);
|
||||
void ndpi_set_automa(struct ndpi_detection_module_struct *ndpi_struct, void* automa);
|
||||
|
||||
#define ADD_TO_DETECTION_BITMASK 1
|
||||
#define NO_ADD_TO_DETECTION_BITMASK 0
|
||||
#define SAVE_DETECTION_BITMASK_AS_UNKNOWN 1
|
||||
#define NO_SAVE_DETECTION_BITMASK_AS_UNKNOWN 0
|
||||
|
||||
/**
|
||||
* This function sets a single protocol bitmask
|
||||
* @param label Protocol name
|
||||
* @param ndpi_struct the detection module
|
||||
* @param detection_bitmask the protocol bitmask
|
||||
* @param idx the index of the callback_buffer
|
||||
* @param func void function point of the protocol search
|
||||
* @param ndpi_selection_bitmask the protocol selected bitmask
|
||||
* @param b_save_bitmask_unknow set true if you want save the detection bitmask as unknow
|
||||
* @param b_add_detection_bitmask set true if you want add the protocol bitmask to the detection bitmask
|
||||
* NB: this function does not increment the index of the callback_buffer
|
||||
*/
|
||||
void ndpi_set_bitmask_protocol_detection(char * label, struct ndpi_detection_module_struct *ndpi_struct,
|
||||
const NDPI_PROTOCOL_BITMASK * detection_bitmask,
|
||||
const u_int32_t idx,
|
||||
u_int16_t ndpi_protocol_id,
|
||||
void (*func) (struct ndpi_detection_module_struct *, struct ndpi_flow_struct *flow),
|
||||
const NDPI_SELECTION_BITMASK_PROTOCOL_SIZE ndpi_selection_bitmask,
|
||||
u_int8_t b_save_bitmask_unknow,
|
||||
u_int8_t b_add_detection_bitmask);
|
||||
|
||||
#ifdef NDPI_PROTOCOL_HTTP
|
||||
/*
|
||||
API used to retrieve information for HTTP flows
|
||||
*/
|
||||
ndpi_http_method ndpi_get_http_method(struct ndpi_detection_module_struct *ndpi_mod,
|
||||
struct ndpi_flow_struct *flow);
|
||||
|
||||
char* ndpi_get_http_url(struct ndpi_detection_module_struct *ndpi_mod,
|
||||
struct ndpi_flow_struct *flow);
|
||||
|
||||
char* ndpi_get_http_content_type(struct ndpi_detection_module_struct *ndpi_mod,
|
||||
struct ndpi_flow_struct *flow);
|
||||
#endif
|
||||
|
||||
#ifdef NDPI_PROTOCOL_TOR
|
||||
int ndpi_is_ssl_tor(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
struct ndpi_flow_struct *flow, char *certificate);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __NDPI_API_H__ */
|
||||
@@ -1,295 +0,0 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (C) 2011-15 - ntop.org
|
||||
* Copyright (C) 2009-2011 by ipoque GmbH
|
||||
*
|
||||
* This file is part of nDPI, an open source deep packet inspection
|
||||
* library based on the OpenDPI and PACE technology by ipoque GmbH
|
||||
*
|
||||
* nDPI is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* nDPI is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with nDPI. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __NDPI_DEFINE_INCLUDE_FILE__
|
||||
#define __NDPI_DEFINE_INCLUDE_FILE__
|
||||
|
||||
/*
|
||||
gcc -E -dM - < /dev/null |grep ENDIAN
|
||||
*/
|
||||
|
||||
#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
#include <machine/endian.h>
|
||||
#endif
|
||||
|
||||
#ifdef __OpenBSD__
|
||||
#include <endian.h>
|
||||
#define __BYTE_ORDER BYTE_ORDER
|
||||
#if BYTE_ORDER == LITTLE_ENDIAN
|
||||
#define __LITTLE_ENDIAN__
|
||||
#else
|
||||
#define __BIG_ENDIAN__
|
||||
#endif/* BYTE_ORDER */
|
||||
#endif/* __OPENBSD__ */
|
||||
|
||||
|
||||
#if __BYTE_ORDER == __LITTLE_ENDIAN
|
||||
#ifndef __LITTLE_ENDIAN__
|
||||
#define __LITTLE_ENDIAN__
|
||||
#endif
|
||||
#else
|
||||
#ifndef __BIG_ENDIAN__
|
||||
#define __BIG_ENDIAN__
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
#ifndef __LITTLE_ENDIAN__
|
||||
#define __LITTLE_ENDIAN__ 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if !(defined(__LITTLE_ENDIAN__) || defined(__BIG_ENDIAN__))
|
||||
#if defined(__mips__)
|
||||
#undef __LITTLE_ENDIAN__
|
||||
#undef __LITTLE_ENDIAN
|
||||
#define __BIG_ENDIAN__
|
||||
#endif
|
||||
|
||||
/* Everything else */
|
||||
#if (defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__))
|
||||
#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
|
||||
#define __LITTLE_ENDIAN__
|
||||
#else
|
||||
#define __BIG_ENDIAN__
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#define NDPI_USE_ASYMMETRIC_DETECTION 0
|
||||
#define NDPI_SELECTION_BITMASK_PROTOCOL_SIZE u_int32_t
|
||||
|
||||
#define NDPI_SELECTION_BITMASK_PROTOCOL_IP (1<<0)
|
||||
#define NDPI_SELECTION_BITMASK_PROTOCOL_INT_TCP (1<<1)
|
||||
#define NDPI_SELECTION_BITMASK_PROTOCOL_INT_UDP (1<<2)
|
||||
#define NDPI_SELECTION_BITMASK_PROTOCOL_INT_TCP_OR_UDP (1<<3)
|
||||
#define NDPI_SELECTION_BITMASK_PROTOCOL_HAS_PAYLOAD (1<<4)
|
||||
#define NDPI_SELECTION_BITMASK_PROTOCOL_NO_TCP_RETRANSMISSION (1<<5)
|
||||
#define NDPI_SELECTION_BITMASK_PROTOCOL_IPV6 (1<<6)
|
||||
#define NDPI_SELECTION_BITMASK_PROTOCOL_IPV4_OR_IPV6 (1<<7)
|
||||
#define NDPI_SELECTION_BITMASK_PROTOCOL_COMPLETE_TRAFFIC (1<<8)
|
||||
/* now combined detections */
|
||||
|
||||
/* v4 */
|
||||
#define NDPI_SELECTION_BITMASK_PROTOCOL_TCP (NDPI_SELECTION_BITMASK_PROTOCOL_IP | NDPI_SELECTION_BITMASK_PROTOCOL_INT_TCP)
|
||||
#define NDPI_SELECTION_BITMASK_PROTOCOL_UDP (NDPI_SELECTION_BITMASK_PROTOCOL_IP | NDPI_SELECTION_BITMASK_PROTOCOL_INT_UDP)
|
||||
#define NDPI_SELECTION_BITMASK_PROTOCOL_TCP_OR_UDP (NDPI_SELECTION_BITMASK_PROTOCOL_IP | NDPI_SELECTION_BITMASK_PROTOCOL_INT_TCP_OR_UDP)
|
||||
|
||||
/* v6 */
|
||||
#define NDPI_SELECTION_BITMASK_PROTOCOL_V6_TCP (NDPI_SELECTION_BITMASK_PROTOCOL_IPV6 | NDPI_SELECTION_BITMASK_PROTOCOL_INT_TCP)
|
||||
#define NDPI_SELECTION_BITMASK_PROTOCOL_V6_UDP (NDPI_SELECTION_BITMASK_PROTOCOL_IPV6 | NDPI_SELECTION_BITMASK_PROTOCOL_INT_UDP)
|
||||
#define NDPI_SELECTION_BITMASK_PROTOCOL_V6_TCP_OR_UDP (NDPI_SELECTION_BITMASK_PROTOCOL_IPV6 | NDPI_SELECTION_BITMASK_PROTOCOL_INT_TCP_OR_UDP)
|
||||
|
||||
/* v4 or v6 */
|
||||
#define NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP (NDPI_SELECTION_BITMASK_PROTOCOL_IPV4_OR_IPV6 | NDPI_SELECTION_BITMASK_PROTOCOL_INT_TCP)
|
||||
#define NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_UDP (NDPI_SELECTION_BITMASK_PROTOCOL_IPV4_OR_IPV6 | NDPI_SELECTION_BITMASK_PROTOCOL_INT_UDP)
|
||||
#define NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP_OR_UDP (NDPI_SELECTION_BITMASK_PROTOCOL_IPV4_OR_IPV6 | NDPI_SELECTION_BITMASK_PROTOCOL_INT_TCP_OR_UDP)
|
||||
|
||||
|
||||
#define NDPI_SELECTION_BITMASK_PROTOCOL_TCP_WITH_PAYLOAD (NDPI_SELECTION_BITMASK_PROTOCOL_TCP | NDPI_SELECTION_BITMASK_PROTOCOL_HAS_PAYLOAD)
|
||||
#define NDPI_SELECTION_BITMASK_PROTOCOL_V6_TCP_WITH_PAYLOAD (NDPI_SELECTION_BITMASK_PROTOCOL_V6_TCP | NDPI_SELECTION_BITMASK_PROTOCOL_HAS_PAYLOAD)
|
||||
#define NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP_WITH_PAYLOAD (NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP | NDPI_SELECTION_BITMASK_PROTOCOL_HAS_PAYLOAD)
|
||||
|
||||
/* does it make sense to talk about udp with payload ??? have you ever seen empty udp packets ? */
|
||||
#define NDPI_SELECTION_BITMASK_PROTOCOL_UDP_WITH_PAYLOAD (NDPI_SELECTION_BITMASK_PROTOCOL_UDP | NDPI_SELECTION_BITMASK_PROTOCOL_HAS_PAYLOAD)
|
||||
#define NDPI_SELECTION_BITMASK_PROTOCOL_V6_UDP_WITH_PAYLOAD (NDPI_SELECTION_BITMASK_PROTOCOL_V6_UDP | NDPI_SELECTION_BITMASK_PROTOCOL_HAS_PAYLOAD)
|
||||
#define NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_UDP_WITH_PAYLOAD (NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_UDP | NDPI_SELECTION_BITMASK_PROTOCOL_HAS_PAYLOAD)
|
||||
|
||||
#define NDPI_SELECTION_BITMASK_PROTOCOL_TCP_OR_UDP_WITH_PAYLOAD (NDPI_SELECTION_BITMASK_PROTOCOL_TCP_OR_UDP | NDPI_SELECTION_BITMASK_PROTOCOL_HAS_PAYLOAD)
|
||||
#define NDPI_SELECTION_BITMASK_PROTOCOL_V6_TCP_OR_UDP_WITH_PAYLOAD (NDPI_SELECTION_BITMASK_PROTOCOL_V6_TCP_OR_UDP | NDPI_SELECTION_BITMASK_PROTOCOL_HAS_PAYLOAD)
|
||||
#define NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP_OR_UDP_WITH_PAYLOAD (NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP_OR_UDP | NDPI_SELECTION_BITMASK_PROTOCOL_HAS_PAYLOAD)
|
||||
|
||||
#define NDPI_SELECTION_BITMASK_PROTOCOL_TCP_WITHOUT_RETRANSMISSION (NDPI_SELECTION_BITMASK_PROTOCOL_TCP | NDPI_SELECTION_BITMASK_PROTOCOL_NO_TCP_RETRANSMISSION)
|
||||
#define NDPI_SELECTION_BITMASK_PROTOCOL_V6_TCP_WITHOUT_RETRANSMISSION (NDPI_SELECTION_BITMASK_PROTOCOL_V6_TCP | NDPI_SELECTION_BITMASK_PROTOCOL_NO_TCP_RETRANSMISSION)
|
||||
#define NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP_WITHOUT_RETRANSMISSION (NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP | NDPI_SELECTION_BITMASK_PROTOCOL_NO_TCP_RETRANSMISSION)
|
||||
|
||||
#define NDPI_SELECTION_BITMASK_PROTOCOL_TCP_OR_UDP_WITHOUT_RETRANSMISSION (NDPI_SELECTION_BITMASK_PROTOCOL_TCP_OR_UDP | NDPI_SELECTION_BITMASK_PROTOCOL_NO_TCP_RETRANSMISSION)
|
||||
#define NDPI_SELECTION_BITMASK_PROTOCOL_V6_TCP_OR_UDP_WITHOUT_RETRANSMISSION (NDPI_SELECTION_BITMASK_PROTOCOL_V6_TCP_OR_UDP | NDPI_SELECTION_BITMASK_PROTOCOL_NO_TCP_RETRANSMISSION)
|
||||
#define NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP_OR_UDP_WITHOUT_RETRANSMISSION (NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP_OR_UDP | NDPI_SELECTION_BITMASK_PROTOCOL_NO_TCP_RETRANSMISSION)
|
||||
|
||||
#define NDPI_SELECTION_BITMASK_PROTOCOL_TCP_WITH_PAYLOAD_WITHOUT_RETRANSMISSION (NDPI_SELECTION_BITMASK_PROTOCOL_TCP | NDPI_SELECTION_BITMASK_PROTOCOL_NO_TCP_RETRANSMISSION | NDPI_SELECTION_BITMASK_PROTOCOL_HAS_PAYLOAD)
|
||||
#define NDPI_SELECTION_BITMASK_PROTOCOL_V6_TCP_WITH_PAYLOAD_WITHOUT_RETRANSMISSION (NDPI_SELECTION_BITMASK_PROTOCOL_V6_TCP | NDPI_SELECTION_BITMASK_PROTOCOL_NO_TCP_RETRANSMISSION | NDPI_SELECTION_BITMASK_PROTOCOL_HAS_PAYLOAD)
|
||||
#define NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP_WITH_PAYLOAD_WITHOUT_RETRANSMISSION (NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP | NDPI_SELECTION_BITMASK_PROTOCOL_NO_TCP_RETRANSMISSION | NDPI_SELECTION_BITMASK_PROTOCOL_HAS_PAYLOAD)
|
||||
|
||||
#define NDPI_SELECTION_BITMASK_PROTOCOL_TCP_OR_UDP_WITH_PAYLOAD_WITHOUT_RETRANSMISSION (NDPI_SELECTION_BITMASK_PROTOCOL_TCP_OR_UDP | NDPI_SELECTION_BITMASK_PROTOCOL_NO_TCP_RETRANSMISSION | NDPI_SELECTION_BITMASK_PROTOCOL_HAS_PAYLOAD)
|
||||
#define NDPI_SELECTION_BITMASK_PROTOCOL_V6_TCP_OR_UDP_WITH_PAYLOAD_WITHOUT_RETRANSMISSION (NDPI_SELECTION_BITMASK_PROTOCOL_V6_TCP_OR_UDP | NDPI_SELECTION_BITMASK_PROTOCOL_NO_TCP_RETRANSMISSION | NDPI_SELECTION_BITMASK_PROTOCOL_HAS_PAYLOAD)
|
||||
#define NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP_OR_UDP_WITH_PAYLOAD_WITHOUT_RETRANSMISSION (NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP_OR_UDP | NDPI_SELECTION_BITMASK_PROTOCOL_NO_TCP_RETRANSMISSION | NDPI_SELECTION_BITMASK_PROTOCOL_HAS_PAYLOAD)
|
||||
|
||||
/* safe src/dst protocol check macros... */
|
||||
|
||||
#define NDPI_SRC_HAS_PROTOCOL(src,protocol) ((src) != NULL && NDPI_COMPARE_PROTOCOL_TO_BITMASK((src)->detected_protocol_bitmask,(protocol)) != 0)
|
||||
|
||||
#define NDPI_DST_HAS_PROTOCOL(dst,protocol) ((dst) != NULL && NDPI_COMPARE_PROTOCOL_TO_BITMASK((dst)->detected_protocol_bitmask,(protocol)) != 0)
|
||||
|
||||
#define NDPI_SRC_OR_DST_HAS_PROTOCOL(src,dst,protocol) (NDPI_SRC_HAS_PROTOCOL(src,protocol) || NDPI_SRC_HAS_PROTOCOL(dst,protocol))
|
||||
|
||||
/**
|
||||
* convenience macro to check for excluded protocol
|
||||
* a protocol is excluded if the flow is known and either the protocol is not detected at all
|
||||
* or the excluded bitmask contains the protocol
|
||||
*/
|
||||
#define NDPI_FLOW_PROTOCOL_EXCLUDED(ndpi_struct,flow,protocol) ((flow) != NULL && \
|
||||
( NDPI_COMPARE_PROTOCOL_TO_BITMASK((ndpi_struct)->detection_bitmask, (protocol)) == 0 || \
|
||||
NDPI_COMPARE_PROTOCOL_TO_BITMASK((flow)->excluded_protocol_bitmask, (protocol)) != 0 ) )
|
||||
|
||||
/* misc definitions */
|
||||
#define NDPI_DEFAULT_MAX_TCP_RETRANSMISSION_WINDOW_SIZE 0x10000
|
||||
|
||||
|
||||
/* TODO: rebuild all memory areas to have a more aligned memory block here */
|
||||
|
||||
/* DEFINITION OF MAX LINE NUMBERS FOR line parse algorithm */
|
||||
#define NDPI_MAX_PARSE_LINES_PER_PACKET 64
|
||||
|
||||
#define MAX_PACKET_COUNTER 65000
|
||||
#define MAX_DEFAULT_PORTS 5
|
||||
|
||||
#define NDPI_DIRECTCONNECT_CONNECTION_IP_TICK_TIMEOUT 600
|
||||
#define NDPI_IRC_CONNECTION_TIMEOUT 120
|
||||
#define NDPI_GNUTELLA_CONNECTION_TIMEOUT 60
|
||||
#define NDPI_BATTLEFIELD_CONNECTION_TIMEOUT 60
|
||||
#define NDPI_THUNDER_CONNECTION_TIMEOUT 30
|
||||
#define NDPI_RTSP_CONNECTION_TIMEOUT 5
|
||||
#define NDPI_TVANTS_CONNECTION_TIMEOUT 5
|
||||
#define NDPI_YAHOO_DETECT_HTTP_CONNECTIONS 1
|
||||
#define NDPI_YAHOO_LAN_VIDEO_TIMEOUT 30
|
||||
#define NDPI_ZATTOO_CONNECTION_TIMEOUT 120
|
||||
#define NDPI_ZATTOO_FLASH_TIMEOUT 5
|
||||
#define NDPI_JABBER_STUN_TIMEOUT 30
|
||||
#define NDPI_JABBER_FT_TIMEOUT 5
|
||||
#define NDPI_SOULSEEK_CONNECTION_IP_TICK_TIMEOUT 600
|
||||
|
||||
#ifdef NDPI_ENABLE_DEBUG_MESSAGES
|
||||
|
||||
#define NDPI_LOG(proto, mod, log_level, args...) \
|
||||
{ \
|
||||
if(mod != NULL) { \
|
||||
mod->ndpi_debug_print_file=__FILE__; \
|
||||
mod->ndpi_debug_print_function=__FUNCTION__; \
|
||||
mod->ndpi_debug_print_line=__LINE__; \
|
||||
mod->ndpi_debug_printf(proto, mod, log_level, args); \
|
||||
} \
|
||||
}
|
||||
|
||||
#else /* NDPI_ENABLE_DEBUG_MESSAGES */
|
||||
|
||||
#ifdef WIN32
|
||||
#define NDPI_LOG(...) {}
|
||||
#else
|
||||
#define NDPI_LOG(proto, mod, log_level, args...) {}
|
||||
#endif
|
||||
|
||||
#endif /* NDPI_ENABLE_DEBUG_MESSAGES */
|
||||
|
||||
/**
|
||||
* macro for getting the string len of a static string
|
||||
*
|
||||
* use it instead of strlen to avoid runtime calculations
|
||||
*/
|
||||
#define NDPI_STATICSTRING_LEN( s ) ( sizeof( s ) - 1 )
|
||||
|
||||
/** macro to compare 2 IPv6 addresses with each other to identify the "smaller" IPv6 address */
|
||||
#define NDPI_COMPARE_IPV6_ADDRESS_STRUCTS(x,y) \
|
||||
((((u_int64_t *)(x))[0]) < (((u_int64_t *)(y))[0]) || ( (((u_int64_t *)(x))[0]) == (((u_int64_t *)(y))[0]) && (((u_int64_t *)(x))[1]) < (((u_int64_t *)(y))[1])) )
|
||||
|
||||
#define NDPI_NUM_BITS 256
|
||||
|
||||
#define NDPI_BITS /* 32 */ (sizeof(ndpi_ndpi_mask) * 8 /* number of bits in a byte */) /* bits per mask */
|
||||
#define howmanybits(x, y) (((x)+((y)-1))/(y))
|
||||
|
||||
|
||||
#define NDPI_SET(p, n) ((p)->fds_bits[(n)/NDPI_BITS] |= (1 << (((u_int32_t)n) % NDPI_BITS)))
|
||||
#define NDPI_CLR(p, n) ((p)->fds_bits[(n)/NDPI_BITS] &= ~(1 << (((u_int32_t)n) % NDPI_BITS)))
|
||||
#define NDPI_ISSET(p, n) ((p)->fds_bits[(n)/NDPI_BITS] & (1 << (((u_int32_t)n) % NDPI_BITS)))
|
||||
#define NDPI_ZERO(p) memset((char *)(p), 0, sizeof(*(p)))
|
||||
#define NDPI_ONE(p) memset((char *)(p), 0xFF, sizeof(*(p)))
|
||||
|
||||
#define NDPI_NUM_FDS_BITS howmanybits(NDPI_NUM_BITS, NDPI_BITS)
|
||||
|
||||
#define NDPI_PROTOCOL_BITMASK ndpi_protocol_bitmask_struct_t
|
||||
|
||||
#define NDPI_BITMASK_ADD(a,b) NDPI_SET(&a,b)
|
||||
#define NDPI_BITMASK_DEL(a,b) NDPI_CLR(&a,b)
|
||||
#define NDPI_BITMASK_RESET(a) NDPI_ZERO(&a)
|
||||
#define NDPI_BITMASK_SET_ALL(a) NDPI_ONE(&a)
|
||||
#define NDPI_BITMASK_SET(a, b) { memcpy(&a, &b, sizeof(NDPI_PROTOCOL_BITMASK)); }
|
||||
|
||||
/* this is a very very tricky macro *g*,
|
||||
* the compiler will remove all shifts here if the protocol is static...
|
||||
*/
|
||||
#define NDPI_ADD_PROTOCOL_TO_BITMASK(bmask,value) NDPI_SET(&bmask,value)
|
||||
#define NDPI_DEL_PROTOCOL_FROM_BITMASK(bmask,value) NDPI_CLR(&bmask,value)
|
||||
#define NDPI_COMPARE_PROTOCOL_TO_BITMASK(bmask,value) NDPI_ISSET(&bmask,value)
|
||||
|
||||
#define NDPI_SAVE_AS_BITMASK(bmask,value) { NDPI_ZERO(&bmask) ; NDPI_ADD_PROTOCOL_TO_BITMASK(bmask, value); }
|
||||
|
||||
|
||||
#define ndpi_min(a,b) ((a < b) ? a : b)
|
||||
#define ndpi_max(a,b) ((a > b) ? a : b)
|
||||
|
||||
#define NDPI_PARSE_PACKET_LINE_INFO(ndpi_struct,flow,packet) \
|
||||
if (packet->packet_lines_parsed_complete != 1) { \
|
||||
ndpi_parse_packet_line_info(ndpi_struct,flow); \
|
||||
} \
|
||||
|
||||
#define NDPI_IPSEC_PROTOCOL_ESP 50
|
||||
#define NDPI_IPSEC_PROTOCOL_AH 51
|
||||
#define NDPI_GRE_PROTOCOL_TYPE 0x2F
|
||||
#define NDPI_ICMP_PROTOCOL_TYPE 0x01
|
||||
#define NDPI_IGMP_PROTOCOL_TYPE 0x02
|
||||
#define NDPI_EGP_PROTOCOL_TYPE 0x08
|
||||
#define NDPI_OSPF_PROTOCOL_TYPE 0x59
|
||||
#define NDPI_SCTP_PROTOCOL_TYPE 132
|
||||
#define NDPI_IPIP_PROTOCOL_TYPE 0x04
|
||||
#define NDPI_ICMPV6_PROTOCOL_TYPE 0x3a
|
||||
|
||||
/* the get_uXX will return raw network packet bytes !! */
|
||||
#define get_u_int8_t(X,O) (*(u_int8_t *)(((u_int8_t *)X) + O))
|
||||
#define get_u_int16_t(X,O) (*(u_int16_t *)(((u_int8_t *)X) + O))
|
||||
#define get_u_int32_t(X,O) (*(u_int32_t *)(((u_int8_t *)X) + O))
|
||||
#define get_u_int64_t(X,O) (*(u_int64_t *)(((u_int8_t *)X) + O))
|
||||
|
||||
/* new definitions to get little endian from network bytes */
|
||||
#define get_ul8(X,O) get_u_int8_t(X,O)
|
||||
|
||||
|
||||
#if defined(__LITTLE_ENDIAN__) || defined(_LITTLE_ENDIAN)
|
||||
#define get_l16(X,O) get_u_int16_t(X,O)
|
||||
#define get_l32(X,O) get_u_int32_t(X,O)
|
||||
#elif defined(__BIG_ENDIAN__) || defined(__BIG_ENDIAN)
|
||||
/* convert the bytes from big to little endian */
|
||||
# define get_l16(X,O) bswap_16(get_u_int16_t(X,O))
|
||||
# define get_l32(X,O) bswap_32(get_u_int32_t(X,O))
|
||||
#else
|
||||
#error "__BYTE_ORDER MUST BE DEFINED !"
|
||||
#endif /* __BYTE_ORDER */
|
||||
|
||||
/* define memory callback function */
|
||||
#define match_first_bytes(payload,st) (memcmp((payload),(st),(sizeof(st)-1))==0)
|
||||
|
||||
#if defined(WIN32) && !defined(snprintf)
|
||||
#define snprintf _snprintf
|
||||
#endif
|
||||
|
||||
#endif /* __NDPI_DEFINE_INCLUDE_FILE__ */
|
||||
@@ -1,68 +0,0 @@
|
||||
/*
|
||||
* ndpi_includes.h
|
||||
*
|
||||
* Copyright (C) 2011-15 - ntop.org
|
||||
*
|
||||
* This file is part of nDPI, an open source deep packet inspection
|
||||
* library based on the OpenDPI and PACE technology by ipoque GmbH
|
||||
*
|
||||
* nDPI is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* nDPI is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with nDPI. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __NDPI_INCLUDES_H__
|
||||
#define __NDPI_INCLUDES_H__
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <time.h>
|
||||
#include <limits.h>
|
||||
|
||||
#ifdef WIN32
|
||||
#include "ndpi_win32.h"
|
||||
#else
|
||||
#include <sys/param.h>
|
||||
#include <pthread.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/ip.h>
|
||||
#include <netinet/tcp.h>
|
||||
#include <netinet/udp.h>
|
||||
|
||||
#if !defined __APPLE__ && !defined __FreeBSD__ && !defined __NetBSD__ && !defined __OpenBSD__
|
||||
#include <endian.h>
|
||||
#include <byteswap.h>
|
||||
|
||||
#if defined __FreeBSD__ || defined __NetBSD__ || defined __OpenBSD__
|
||||
#include <netinet/in.h>
|
||||
|
||||
#if defined __NetBSD__ || defined __OpenBSD__
|
||||
#include <netinet/in_systm.h>
|
||||
|
||||
#ifdef __OpenBSD__
|
||||
#include <pthread.h>
|
||||
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif /* Win32 */
|
||||
|
||||
#endif /* __NDPI_INCLUDES_H__ */
|
||||
@@ -1,110 +0,0 @@
|
||||
/*
|
||||
* ndpi_main.h
|
||||
*
|
||||
* Copyright (C) 2011-15 - ntop.org
|
||||
* Copyright (C) 2009-2011 by ipoque GmbH
|
||||
*
|
||||
* This file is part of nDPI, an open source deep packet inspection
|
||||
* library based on the OpenDPI and PACE technology by ipoque GmbH
|
||||
*
|
||||
* nDPI is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* nDPI is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with nDPI. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __NDPI_MAIN_H__
|
||||
#define __NDPI_MAIN_H__
|
||||
|
||||
#include "ndpi_includes.h"
|
||||
#include "ndpi_define.h"
|
||||
#include "ndpi_protocol_ids.h"
|
||||
#include "ndpi_typedefs.h"
|
||||
#include "ndpi_protocols.h"
|
||||
#include "ndpi_api.h"
|
||||
|
||||
|
||||
void *ndpi_tdelete(const void * __restrict, void ** __restrict,
|
||||
int (*)(const void *, const void *));
|
||||
void *ndpi_tfind(const void *, void *, int (*)(const void *, const void *));
|
||||
void *ndpi_tsearch(const void *, void**, int (*)(const void *, const void *));
|
||||
void ndpi_twalk(const void *, void (*)(const void *, ndpi_VISIT, int, void*), void *user_data);
|
||||
void ndpi_tdestroy(void *vrootp, void (*freefct)(void *));
|
||||
|
||||
int NDPI_BITMASK_COMPARE(NDPI_PROTOCOL_BITMASK a, NDPI_PROTOCOL_BITMASK b);
|
||||
int NDPI_BITMASK_IS_EMPTY(NDPI_PROTOCOL_BITMASK a);
|
||||
void NDPI_DUMP_BITMASK(NDPI_PROTOCOL_BITMASK a);
|
||||
|
||||
extern u_int8_t ndpi_net_match(u_int32_t ip_to_check,
|
||||
u_int32_t net,
|
||||
u_int32_t num_bits);
|
||||
|
||||
extern u_int8_t ndpi_ips_match(u_int32_t src, u_int32_t dst,
|
||||
u_int32_t net, u_int32_t num_bits);
|
||||
|
||||
u_int16_t ntohs_ndpi_bytestream_to_number(const u_int8_t * str, u_int16_t max_chars_to_read, u_int16_t * bytes_read);
|
||||
|
||||
u_int32_t ndpi_bytestream_to_number(const u_int8_t * str, u_int16_t max_chars_to_read, u_int16_t * bytes_read);
|
||||
u_int64_t ndpi_bytestream_to_number64(const u_int8_t * str, u_int16_t max_chars_to_read, u_int16_t * bytes_read);
|
||||
u_int32_t ndpi_bytestream_dec_or_hex_to_number(const u_int8_t * str, u_int16_t max_chars_to_read, u_int16_t * bytes_read);
|
||||
u_int64_t ndpi_bytestream_dec_or_hex_to_number64(const u_int8_t * str, u_int16_t max_chars_to_read, u_int16_t * bytes_read);
|
||||
u_int32_t ndpi_bytestream_to_ipv4(const u_int8_t * str, u_int16_t max_chars_to_read, u_int16_t * bytes_read);
|
||||
|
||||
|
||||
void ndpi_set_detected_protocol(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
struct ndpi_flow_struct *flow,
|
||||
u_int16_t upper_detected_protocol,
|
||||
u_int16_t lower_detected_protocol);
|
||||
|
||||
extern void ndpi_parse_packet_line_info(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
extern void ndpi_parse_packet_line_info_any(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
|
||||
extern u_int16_t ndpi_check_for_email_address(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow, u_int16_t counter);
|
||||
|
||||
extern void ndpi_int_change_packet_protocol(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow,
|
||||
u_int16_t upper_detected_protocol,
|
||||
u_int16_t lower_detected_protocol);
|
||||
extern void ndpi_int_change_protocol(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow,
|
||||
u_int16_t upper_detected_protocol,
|
||||
u_int16_t lower_detected_protocol);
|
||||
extern void ndpi_set_proto_defaults(struct ndpi_detection_module_struct *ndpi_mod, ndpi_protocol_breed_t protoBreed, u_int16_t protoId,
|
||||
u_int16_t tcp_alias_protoId[2], u_int16_t udp_alias_protoId[2], char *protoName,
|
||||
ndpi_port_range *tcpDefPorts, ndpi_port_range *udpDefPorts);
|
||||
|
||||
extern void ndpi_int_reset_packet_protocol(struct ndpi_packet_struct *packet);
|
||||
extern void ndpi_int_reset_protocol(struct ndpi_flow_struct *flow);
|
||||
|
||||
extern int ndpi_packet_src_ip_eql(const struct ndpi_packet_struct *packet, const ndpi_ip_addr_t * ip);
|
||||
extern int ndpi_packet_dst_ip_eql(const struct ndpi_packet_struct *packet, const ndpi_ip_addr_t * ip);
|
||||
extern void ndpi_packet_src_ip_get(const struct ndpi_packet_struct *packet, ndpi_ip_addr_t * ip);
|
||||
extern void ndpi_packet_dst_ip_get(const struct ndpi_packet_struct *packet, ndpi_ip_addr_t * ip);
|
||||
|
||||
extern char *ndpi_get_ip_string(struct ndpi_detection_module_struct *ndpi_struct, const ndpi_ip_addr_t * ip);
|
||||
extern char *ndpi_get_packet_src_ip_string(struct ndpi_detection_module_struct *ndpi_struct, const struct ndpi_packet_struct *packet);
|
||||
extern char* ndpi_get_proto_by_id(struct ndpi_detection_module_struct *ndpi_mod, u_int id);
|
||||
|
||||
extern u_int16_t ndpi_guess_protocol_id(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
u_int8_t proto, u_int16_t sport, u_int16_t dport);
|
||||
|
||||
extern u_int8_t ndpi_is_proto(ndpi_protocol p, u_int16_t proto);
|
||||
|
||||
extern u_int16_t ndpi_get_lower_proto(ndpi_protocol p);
|
||||
extern int ndpi_get_protocol_id_master_proto(struct ndpi_detection_module_struct *ndpi_struct, u_int16_t protocol_id,
|
||||
u_int16_t** tcp_master_proto,
|
||||
u_int16_t** udp_master_proto);
|
||||
|
||||
#ifdef NDPI_ENABLE_DEBUG_MESSAGES
|
||||
void ndpi_debug_get_last_log_function_line(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
const char **file, const char **func, u_int32_t * line);
|
||||
#endif
|
||||
|
||||
#endif /* __NDPI_MAIN_H__ */
|
||||
@@ -1,275 +0,0 @@
|
||||
/*
|
||||
* ndpi_protocol_ids.h
|
||||
*
|
||||
* Copyright (C) 2011-15 - ntop.org
|
||||
* Copyright (C) 2009-11 - ipoque GmbH
|
||||
*
|
||||
* This file is part of nDPI, an open source deep packet inspection
|
||||
* library based on the OpenDPI and PACE technology by ipoque GmbH
|
||||
*
|
||||
* nDPI is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* nDPI is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with nDPI. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __NDPI_API_H__
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef __NDPI_PROTOCOLS_DEFAULT_H__
|
||||
#define __NDPI_PROTOCOLS_DEFAULT_H__
|
||||
|
||||
#define NDPI_DETECTION_SUPPORT_IPV6
|
||||
#define NDPI_PROTOCOL_HISTORY_SIZE 2
|
||||
|
||||
#define NDPI_PROTOCOL_UNKNOWN 0
|
||||
|
||||
#define NDPI_PROTOCOL_NO_MASTER_PROTO NDPI_PROTOCOL_UNKNOWN
|
||||
|
||||
#define NDPI_PROTOCOL_IP_VRRP 73
|
||||
#define NDPI_PROTOCOL_IP_IPSEC 79
|
||||
#define NDPI_PROTOCOL_IP_GRE 80
|
||||
#define NDPI_PROTOCOL_IP_ICMP 81
|
||||
#define NDPI_PROTOCOL_IP_IGMP 82
|
||||
#define NDPI_PROTOCOL_IP_EGP 83
|
||||
#define NDPI_PROTOCOL_IP_SCTP 84
|
||||
#define NDPI_PROTOCOL_IP_OSPF 85
|
||||
#define NDPI_PROTOCOL_IP_IP_IN_IP 86
|
||||
#define NDPI_PROTOCOL_IP_ICMPV6 102
|
||||
|
||||
#define NDPI_PROTOCOL_HTTP 7
|
||||
#define NDPI_PROTOCOL_HTTP_APPLICATION_VEOHTV 60
|
||||
#define NDPI_PROTOCOL_SSL_NO_CERT 64 /* SSL without certificate (Skype, Ultrasurf?) - ntop.org */
|
||||
#define NDPI_PROTOCOL_SSL 91
|
||||
#define NDPI_PROTOCOL_HTTP_APPLICATION_ACTIVESYNC 110
|
||||
#define NDPI_PROTOCOL_HTTP_CONNECT 130
|
||||
#define NDPI_PROTOCOL_HTTP_PROXY 131
|
||||
#define NDPI_PROTOCOL_SOCKS5 172 /* Tomasz Bujlow <tomasz@skatnet.dk> */
|
||||
#define NDPI_PROTOCOL_SOCKS4 173 /* Tomasz Bujlow <tomasz@skatnet.dk> */
|
||||
|
||||
#define NDPI_PROTOCOL_FTP_CONTROL 1 /* Tomasz Bujlow <tomasz@skatnet.dk> */
|
||||
#define NDPI_PROTOCOL_MAIL_POP 2
|
||||
#define NDPI_PROTOCOL_MAIL_SMTP 3
|
||||
#define NDPI_PROTOCOL_MAIL_IMAP 4
|
||||
#define NDPI_PROTOCOL_DNS 5
|
||||
#define NDPI_PROTOCOL_IPP 6
|
||||
#define NDPI_PROTOCOL_MDNS 8
|
||||
#define NDPI_PROTOCOL_NTP 9
|
||||
#define NDPI_PROTOCOL_NETBIOS 10
|
||||
#define NDPI_PROTOCOL_NFS 11
|
||||
#define NDPI_PROTOCOL_SSDP 12
|
||||
#define NDPI_PROTOCOL_BGP 13
|
||||
#define NDPI_PROTOCOL_SNMP 14
|
||||
#define NDPI_PROTOCOL_XDMCP 15
|
||||
#define NDPI_PROTOCOL_SMB 16
|
||||
#define NDPI_PROTOCOL_SYSLOG 17
|
||||
#define NDPI_PROTOCOL_DHCP 18
|
||||
#define NDPI_PROTOCOL_POSTGRES 19
|
||||
#define NDPI_PROTOCOL_MYSQL 20
|
||||
#define NDPI_PROTOCOL_TDS 21
|
||||
#define NDPI_PROTOCOL_DIRECT_DOWNLOAD_LINK 22
|
||||
#define NDPI_PROTOCOL_MAIL_POPS 23
|
||||
#define NDPI_PROTOCOL_APPLEJUICE 24
|
||||
#define NDPI_PROTOCOL_DIRECTCONNECT 25
|
||||
#define NDPI_PROTOCOL_SOCRATES 26
|
||||
#define NDPI_PROTOCOL_WINMX 27
|
||||
#define NDPI_PROTOCOL_VMWARE 28
|
||||
#define NDPI_PROTOCOL_MAIL_SMTPS 29
|
||||
#define NDPI_PROTOCOL_FILETOPIA 30
|
||||
#define NDPI_PROTOCOL_IMESH 31
|
||||
#define NDPI_PROTOCOL_KONTIKI 32
|
||||
#define NDPI_PROTOCOL_OPENFT 33
|
||||
#define NDPI_PROTOCOL_FASTTRACK 34
|
||||
#define NDPI_PROTOCOL_GNUTELLA 35
|
||||
#define NDPI_PROTOCOL_EDONKEY 36 /* Tomasz Bujlow <tomasz@skatnet.dk> */
|
||||
#define NDPI_PROTOCOL_BITTORRENT 37
|
||||
#define NDPI_PROTOCOL_EPP 38
|
||||
#define NDPI_PROTOCOL_XBOX 47
|
||||
#define NDPI_PROTOCOL_QQ 48
|
||||
#define NDPI_PROTOCOL_MOVE 49
|
||||
#define NDPI_PROTOCOL_RTSP 50
|
||||
#define NDPI_PROTOCOL_MAIL_IMAPS 51
|
||||
#define NDPI_PROTOCOL_ICECAST 52
|
||||
#define NDPI_PROTOCOL_PPLIVE 53 /* Tomasz Bujlow <tomasz@skatnet.dk> */
|
||||
#define NDPI_PROTOCOL_PPSTREAM 54
|
||||
#define NDPI_PROTOCOL_ZATTOO 55
|
||||
#define NDPI_PROTOCOL_SHOUTCAST 56
|
||||
#define NDPI_PROTOCOL_SOPCAST 57
|
||||
#define NDPI_PROTOCOL_TVANTS 58
|
||||
#define NDPI_PROTOCOL_TVUPLAYER 59
|
||||
#define NDPI_PROTOCOL_QQLIVE 61
|
||||
#define NDPI_PROTOCOL_THUNDER 62
|
||||
#define NDPI_PROTOCOL_SOULSEEK 63
|
||||
#define NDPI_PROTOCOL_IRC 65
|
||||
#define NDPI_PROTOCOL_AYIYA 66
|
||||
#define NDPI_PROTOCOL_UNENCRYPED_JABBER 67
|
||||
#define NDPI_PROTOCOL_MSN 68
|
||||
#define NDPI_PROTOCOL_OSCAR 69
|
||||
#define NDPI_PROTOCOL_YAHOO 70
|
||||
#define NDPI_PROTOCOL_BATTLEFIELD 71
|
||||
#define NDPI_PROTOCOL_QUAKE 72
|
||||
#define NDPI_PROTOCOL_STEAM 74 /* Tomasz Bujlow <tomasz@skatnet.dk> */
|
||||
#define NDPI_PROTOCOL_HALFLIFE2 75
|
||||
#define NDPI_PROTOCOL_WORLDOFWARCRAFT 76
|
||||
#define NDPI_PROTOCOL_TELNET 77
|
||||
#define NDPI_PROTOCOL_STUN 78
|
||||
#define NDPI_PROTOCOL_RTP 87
|
||||
#define NDPI_PROTOCOL_RDP 88
|
||||
#define NDPI_PROTOCOL_VNC 89
|
||||
#define NDPI_PROTOCOL_PCANYWHERE 90
|
||||
#define NDPI_PROTOCOL_SSH 92
|
||||
#define NDPI_PROTOCOL_USENET 93
|
||||
#define NDPI_PROTOCOL_MGCP 94
|
||||
#define NDPI_PROTOCOL_IAX 95
|
||||
#define NDPI_PROTOCOL_TFTP 96
|
||||
#define NDPI_PROTOCOL_AFP 97
|
||||
#define NDPI_PROTOCOL_STEALTHNET 98
|
||||
#define NDPI_PROTOCOL_AIMINI 99
|
||||
#define NDPI_PROTOCOL_SIP 100
|
||||
#define NDPI_PROTOCOL_TRUPHONE 101
|
||||
#define NDPI_PROTOCOL_DHCPV6 103
|
||||
#define NDPI_PROTOCOL_ARMAGETRON 104
|
||||
#define NDPI_PROTOCOL_CROSSFIRE 105
|
||||
#define NDPI_PROTOCOL_DOFUS 106
|
||||
#define NDPI_PROTOCOL_FIESTA 107
|
||||
#define NDPI_PROTOCOL_FLORENSIA 108
|
||||
#define NDPI_PROTOCOL_GUILDWARS 109
|
||||
#define NDPI_PROTOCOL_KERBEROS 111
|
||||
#define NDPI_PROTOCOL_LDAP 112
|
||||
#define NDPI_PROTOCOL_MAPLESTORY 113
|
||||
#define NDPI_PROTOCOL_MSSQL 114
|
||||
#define NDPI_PROTOCOL_PPTP 115
|
||||
#define NDPI_PROTOCOL_WARCRAFT3 116
|
||||
#define NDPI_PROTOCOL_WORLD_OF_KUNG_FU 117
|
||||
#define NDPI_PROTOCOL_MEEBO 118
|
||||
#define NDPI_PROTOCOL_DROPBOX 121
|
||||
#define NDPI_PROTOCOL_SKYPE 125
|
||||
#define NDPI_PROTOCOL_DCERPC 127
|
||||
#define NDPI_PROTOCOL_NETFLOW 128
|
||||
#define NDPI_PROTOCOL_SFLOW 129
|
||||
#define NDPI_PROTOCOL_CITRIX 132
|
||||
#define NDPI_PROTOCOL_SKYFILE_PREPAID 136
|
||||
#define NDPI_PROTOCOL_SKYFILE_RUDICS 137
|
||||
#define NDPI_PROTOCOL_SKYFILE_POSTPAID 138
|
||||
#define NDPI_PROTOCOL_CITRIX_ONLINE 139
|
||||
#define NDPI_PROTOCOL_WEBEX 141
|
||||
#define NDPI_PROTOCOL_VIBER 144
|
||||
#define NDPI_PROTOCOL_RADIUS 146
|
||||
#define NDPI_SERVICE_WINDOWS_UPDATE 147
|
||||
#define NDPI_PROTOCOL_TEAMVIEWER 148 /* xplico.org */
|
||||
#define NDPI_PROTOCOL_LOTUS_NOTES 150
|
||||
#define NDPI_PROTOCOL_SAP 151
|
||||
#define NDPI_PROTOCOL_GTP 152
|
||||
#define NDPI_PROTOCOL_UPNP 153
|
||||
#define NDPI_PROTOCOL_LLMNR 154
|
||||
#define NDPI_PROTOCOL_REMOTE_SCAN 155
|
||||
#define NDPI_PROTOCOL_SPOTIFY 156
|
||||
#define NDPI_PROTOCOL_H323 158 /* Remy Mudingay <mudingay@ill.fr> */
|
||||
#define NDPI_PROTOCOL_OPENVPN 159 /* Remy Mudingay <mudingay@ill.fr> */
|
||||
#define NDPI_PROTOCOL_NOE 160 /* Remy Mudingay <mudingay@ill.fr> */
|
||||
#define NDPI_PROTOCOL_CISCOVPN 161 /* Remy Mudingay <mudingay@ill.fr> */
|
||||
#define NDPI_PROTOCOL_TEAMSPEAK 162 /* Remy Mudingay <mudingay@ill.fr> */
|
||||
#define NDPI_PROTOCOL_TOR 163 /* Remy Mudingay <mudingay@ill.fr> */
|
||||
#define NDPI_PROTOCOL_SKINNY 164 /* Remy Mudingay <mudingay@ill.fr> */
|
||||
#define NDPI_PROTOCOL_RTCP 165 /* Remy Mudingay <mudingay@ill.fr> */
|
||||
#define NDPI_PROTOCOL_RSYNC 166 /* Remy Mudingay <mudingay@ill.fr> */
|
||||
#define NDPI_PROTOCOL_ORACLE 167 /* Remy Mudingay <mudingay@ill.fr> */
|
||||
#define NDPI_PROTOCOL_CORBA 168 /* Remy Mudingay <mudingay@ill.fr> */
|
||||
#define NDPI_PROTOCOL_UBUNTUONE 169 /* Remy Mudingay <mudingay@ill.fr> */
|
||||
#define NDPI_PROTOCOL_WHOIS_DAS 170
|
||||
#define NDPI_PROTOCOL_COLLECTD 171
|
||||
#define NDPI_PROTOCOL_RTMP 174 /* Tomasz Bujlow <tomasz@skatnet.dk> */
|
||||
#define NDPI_PROTOCOL_FTP_DATA 175 /* Tomasz Bujlow <tomasz@skatnet.dk> */
|
||||
#define NDPI_PROTOCOL_ZMQ 177
|
||||
#define NDPI_PROTOCOL_MEGACO 181 /* Gianluca Costa <g.costa@xplico.org> */
|
||||
#define NDPI_PROTOCOL_REDIS 182
|
||||
#define NDPI_PROTOCOL_PANDO 183 /* Tomasz Bujlow <tomasz@skatnet.dk> */
|
||||
#define NDPI_PROTOCOL_VHUA 184
|
||||
#define NDPI_PROTOCOL_TELEGRAM 185 /* Gianluca Costa <g.costa@xplico.org> */
|
||||
#define NDPI_PROTOCOL_QUIC 188 /* Andrea Buscarinu <andrea.buscarinu@gmail.com> - Michele Campus <michelecampus5@gmail.com> */
|
||||
#define NDPI_PROTOCOL_WHATSAPP_VOICE 189
|
||||
#define NDPI_PROTOCOL_STARCRAFT 213 /* Matteo Bracci <matteobracci1@gmail.com> */
|
||||
#define NDPI_PROTOCOL_TEREDO 214
|
||||
#define NDPI_PROTOCOL_HEP 216 /* Sipcapture.org QXIP BV */
|
||||
#define NDPI_PROTOCOL_UBNTAC2 217 /* Ubiquity UBNT AirControl 2 - Thomas Fjellstrom <thomas+ndpi@fjellstrom.ca> */
|
||||
#define NDPI_PROTOCOL_MS_LYNC 218
|
||||
|
||||
|
||||
|
||||
#define NDPI_CONTENT_AVI 39
|
||||
#define NDPI_CONTENT_FLASH 40
|
||||
#define NDPI_CONTENT_OGG 41
|
||||
#define NDPI_CONTENT_MPEG 42
|
||||
#define NDPI_CONTENT_QUICKTIME 43
|
||||
#define NDPI_CONTENT_REALMEDIA 44
|
||||
#define NDPI_CONTENT_WINDOWSMEDIA 45
|
||||
#define NDPI_CONTENT_MMS 46
|
||||
#define NDPI_CONTENT_WEBM 157
|
||||
|
||||
#define NDPI_SERVICE_FACEBOOK 119
|
||||
#define NDPI_SERVICE_TWITTER 120
|
||||
#define NDPI_SERVICE_GMAIL 122
|
||||
#define NDPI_SERVICE_GOOGLE_MAPS 123
|
||||
#define NDPI_SERVICE_YOUTUBE 124
|
||||
#define NDPI_SERVICE_VEVO 186
|
||||
#define NDPI_SERVICE_GOOGLE 126
|
||||
#define NDPI_SERVICE_NETFLIX 133
|
||||
#define NDPI_SERVICE_LASTFM 134
|
||||
#define NDPI_SERVICE_WAZE 135
|
||||
#define NDPI_SERVICE_APPLE 140
|
||||
#define NDPI_SERVICE_WHATSAPP 142
|
||||
#define NDPI_SERVICE_APPLE_ICLOUD 143
|
||||
#define NDPI_SERVICE_APPLE_ITUNES 145
|
||||
#define NDPI_SERVICE_TUENTI 149
|
||||
#define NDPI_SERVICE_WIKIPEDIA 176 /* Tomasz Bujlow <tomasz@skatnet.dk> */
|
||||
#define NDPI_SERVICE_MSN NDPI_PROTOCOL_MSN /* Tomasz Bujlow <tomasz@skatnet.dk> */
|
||||
#define NDPI_SERVICE_AMAZON 178 /* Tomasz Bujlow <tomasz@skatnet.dk> */
|
||||
#define NDPI_SERVICE_EBAY 179 /* Tomasz Bujlow <tomasz@skatnet.dk> */
|
||||
#define NDPI_SERVICE_CNN 180 /* Tomasz Bujlow <tomasz@skatnet.dk> */
|
||||
#define NDPI_SERVICE_DROPBOX NDPI_PROTOCOL_DROPBOX /* Tomasz Bujlow <tomasz@skatnet.dk> */
|
||||
#define NDPI_SERVICE_SKYPE NDPI_PROTOCOL_SKYPE /* Tomasz Bujlow <tomasz@skatnet.dk> */
|
||||
#define NDPI_SERVICE_VIBER NDPI_PROTOCOL_VIBER /* Tomasz Bujlow <tomasz@skatnet.dk> */
|
||||
#define NDPI_SERVICE_YAHOO NDPI_PROTOCOL_YAHOO /* Tomasz Bujlow <tomasz@skatnet.dk> */
|
||||
#define NDPI_SERVICE_PANDORA 187
|
||||
#define NDPI_PROTOCOL_EAQ 190
|
||||
#define NDPI_SERVICE_TIMMEU 191
|
||||
#define NDPI_SERVICE_TORCEDOR 192
|
||||
#define NDPI_SERVICE_KAKAOTALK 193 /* KakaoTalk Chat (no voice call) */
|
||||
#define NDPI_SERVICE_KAKAOTALK_VOICE 194 /* KakaoTalk Voice */
|
||||
#define NDPI_SERVICE_TWITCH 195 /* Edoardo Dominici <edoaramis@gmail.com> */
|
||||
#define NDPI_SERVICE_QUICKPLAY 196 /* Streaming service used by various services such as hooq.tv */
|
||||
#define NDPI_SERVICE_TIM 197 /* Traffic for tim.com.br and tim.it */
|
||||
#define NDPI_PROTOCOL_MPEGTS 198
|
||||
#define NDPI_SERVICE_SNAPCHAT 199
|
||||
#define NDPI_SERVICE_SIMET 200
|
||||
#define NDPI_SERVICE_OPENSIGNAL 201
|
||||
#define NDPI_SERVICE_99TAXI 202
|
||||
#define NDPI_SERVICE_EASYTAXI 203
|
||||
#define NDPI_SERVICE_GLOBOTV 204
|
||||
#define NDPI_SERVICE_TIMSOMDECHAMADA 205
|
||||
#define NDPI_SERVICE_TIMMENU 206
|
||||
#define NDPI_SERVICE_TIMPORTASABERTAS 207
|
||||
#define NDPI_SERVICE_TIMRECARGA 208
|
||||
#define NDPI_SERVICE_TIMBETA 209
|
||||
#define NDPI_SERVICE_DEEZER 210
|
||||
#define NDPI_SERVICE_INSTAGRAM 211 /* Andrea Buscarinu <andrea.buscarinu@gmail.com> */
|
||||
#define NDPI_SERVICE_MICROSOFT 212
|
||||
#define NDPI_SERVICE_HOTSPOT_SHIELD 215
|
||||
|
||||
/* UPDATE UPDATE UPDATE UPDATE UPDATE UPDATE UPDATE UPDATE UPDATE */
|
||||
#define NDPI_LAST_IMPLEMENTED_PROTOCOL NDPI_PROTOCOL_MS_LYNC
|
||||
|
||||
#define NDPI_MAX_SUPPORTED_PROTOCOLS (NDPI_LAST_IMPLEMENTED_PROTOCOL + 1)
|
||||
#define NDPI_MAX_NUM_CUSTOM_PROTOCOLS (NDPI_NUM_BITS-NDPI_LAST_IMPLEMENTED_PROTOCOL)
|
||||
#endif
|
||||
@@ -1,340 +0,0 @@
|
||||
/*
|
||||
* ndpi_protocols.h
|
||||
*
|
||||
* Copyright (C) 2011-15 - ntop.org
|
||||
* Copyright (C) 2009-2011 by ipoque GmbH
|
||||
*
|
||||
* This file is part of nDPI, an open source deep packet inspection
|
||||
* library based on the OpenDPI and PACE technology by ipoque GmbH
|
||||
*
|
||||
* nDPI is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* nDPI is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with nDPI. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __NDPI_PROTOCOLS_H__
|
||||
#define __NDPI_PROTOCOLS_H__
|
||||
|
||||
#include "ndpi_main.h"
|
||||
|
||||
|
||||
ndpi_port_range* ndpi_build_default_ports_range(ndpi_port_range *ports,
|
||||
u_int16_t portA_low, u_int16_t portA_high,
|
||||
u_int16_t portB_low, u_int16_t portB_high,
|
||||
u_int16_t portC_low, u_int16_t portC_high,
|
||||
u_int16_t portD_low, u_int16_t portD_high,
|
||||
u_int16_t portE_low, u_int16_t portE_high);
|
||||
|
||||
ndpi_port_range* ndpi_build_default_ports(ndpi_port_range *ports,
|
||||
u_int16_t portA,
|
||||
u_int16_t portB,
|
||||
u_int16_t portC,
|
||||
u_int16_t portD,
|
||||
u_int16_t portE);
|
||||
|
||||
/* TCP/UDP protocols */
|
||||
u_int ndpi_search_tcp_or_udp_raw(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
u_int8_t protocol,
|
||||
u_int32_t saddr, u_int32_t daddr,
|
||||
u_int16_t sport, u_int16_t dport);
|
||||
|
||||
void ndpi_search_tcp_or_udp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
|
||||
/* Applications and other protocols. */
|
||||
void ndpi_search_bittorrent(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_bittorrent_init(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t size,u_int32_t timeout);
|
||||
void ndpi_bittorrent_done(struct ndpi_detection_module_struct *ndpi_struct);
|
||||
int ndpi_bittorrent_gc(struct hash_ip4p_table *ht,int key,time_t now);
|
||||
|
||||
void ndpi_search_edonkey(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_fasttrack_tcp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_gnutella(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_winmx_tcp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_directconnect(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_applejuice_tcp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_i23v5(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_socrates(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_soulseek_tcp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_msn(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_yahoo(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_oscar(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_jabber_tcp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_irc_tcp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_sip(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_hep(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_direct_download_link_tcp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_mail_pop_tcp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_mail_imap_tcp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_mail_smtp_tcp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_http_tcp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_http_subprotocol_conf(struct ndpi_detection_module_struct *ndpi_struct, char *attr, char *value, int protocol_id);
|
||||
void ndpi_search_ftp_control(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_ftp_data(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_usenet_tcp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_dns(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_rtsp_tcp_udp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_filetopia_tcp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_vmware(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_imesh_tcp_udp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_ssl_tcp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_mms_tcp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_icecast_tcp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_shoutcast_tcp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_veohtv_tcp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_openft_tcp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_stun(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_tvants_udp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_sopcast(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_tvuplayer(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_ppstream(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_pplive(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_iax(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_mgcp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_zattoo(struct ndpi_detection_module_struct*ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_qq(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_feidian(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_ssh_tcp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_ayiya(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_thunder(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_activesync(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_in_non_tcp_udp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_vnc_tcp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_dhcp_udp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_steam(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_halflife2(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_xbox(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_smb_tcp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_telnet_tcp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_ntp_udp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_nfs(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_rtp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_ssdp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_worldofwarcraft(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_postgres_tcp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_mysql_tcp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_bgp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_quake(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_battlefield(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_secondlife(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_pcanywhere(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_rdp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_snmp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_kontiki(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_syslog(struct ndpi_detection_module_struct*ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_tds_tcp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_netbios(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_mdns(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_ipp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_ldap(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_warcraft3(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_kerberos(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_xdmcp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_tftp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_mssql(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_pptp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_stealthnet(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_dhcpv6_udp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_meebo(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_afp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_aimini(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_florensia(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_maplestory(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_dofus(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_world_of_kung_fu(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_fiesta(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_crossfire_tcp_udp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_guildwars_tcp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_armagetron_udp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_dropbox(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_citrix(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_dcerpc(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_netflow(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_sflow(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_radius(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_wsus(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_teamview(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_lotus_notes(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_gtp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_spotify(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_h323(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_openvpn(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_noe(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_ciscovpn(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_viber(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_teamspeak(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_corba(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_collectd(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_oracle(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_rsync(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_rtcp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_skinny(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_tor(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_whois_das(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_socks5(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_socks4(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_rtmp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_pando(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_megaco(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_redis(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_zmq(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_twitter(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_vhua(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_telegram(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_quic(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_eaq(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_kakaotalk_voice(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_mpegts(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_starcraft(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_ubntac2(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
|
||||
|
||||
/* --- INIT FUNCTIONS --- */
|
||||
void init_afp_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_aimini_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_applejuice_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_armagetron_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_ayiya_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_battlefield_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_bgp_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_bittorrent_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_teredo_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_ciscovpn_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_citrix_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_corba_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_crossfire_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_dcerpc_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_dhcp_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_dhcpv6_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_directconnect_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_dns_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_dofus_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_directdownloadlink_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_dropbox_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_eaq_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_edonkey_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_fasttrack_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_fiesta_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_filetopia_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_florensia_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_ftp_control_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_ftp_data_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_gnutella_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_gtp_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_guildwars_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_h323_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_halflife2_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_http_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_http_activesync_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_iax_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_icecast_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_imesh_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_ipp_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_irc_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_jabber_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_kakaotalk_voice_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_kerberos_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_kontiki_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_ldap_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_lotus_notes_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_mail_imap_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_mail_pop_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_mail_smtp_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_maplestory_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_mdns_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_meebo_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_megaco_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_mgpc_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_mms_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_msn_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_mpegts_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_mssql_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_mysql_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_netbios_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_netflow_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_nfs_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_noe_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_non_tcp_udp_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_ntp_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_openft_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_openvpn_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_oracle_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_oscar_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_pando_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_pcanywhere_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_postgres_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_pplive_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_ppstream_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_pptp_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_qq_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_quake_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_quic_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_radius_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_rdp_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_redis_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_rsync_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_rtcp_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_rtmp_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_rtp_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_rtsp_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_sflow_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_shoutcast_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_sip_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_hep_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_skinny_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_skype_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_smb_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_snmp_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_socrates_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_sopcast_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_soulseek_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_spotify_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_ssh_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_ssl_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_starcraft_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_stealthnet_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_steam_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_stun_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_syslog_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_ssdp_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_tds_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_teamspeak_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_teamviewer_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_telegram_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_telnet_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_tftp_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_thunder_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_tor_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_tvants_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_tvuplayer_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_twitter_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_usenet_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_veohtv_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_vhua_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_viber_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_vmware_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_vnc_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_warcraft3_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_whois_das_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_winmx_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_world_of_warcraft_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_world_of_kung_fu_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_xbox_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_xdmcp_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_yahoo_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_zattoo_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_zmq_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_stracraft_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_ubntac2_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
|
||||
#endif /* __NDPI_PROTOCOLS_H__ */
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,44 +0,0 @@
|
||||
/*
|
||||
* ndpi_unix.h
|
||||
*
|
||||
* Copyright (C) 2011-15 - ntop.org
|
||||
* Copyright (C) 2009-2011 by ipoque GmbH
|
||||
*
|
||||
* This file is part of nDPI, an open source deep packet inspection
|
||||
* library based on the OpenDPI and PACE technology by ipoque GmbH
|
||||
*
|
||||
* nDPI is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* nDPI is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with nDPI. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __NDPI_UNIX_INCLUDE_FILE__
|
||||
#define __NDPI_UNIX_INCLUDE_FILE__
|
||||
|
||||
#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
#include <netinet/in.h>
|
||||
#if defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
#include <netinet/in_systm.h>
|
||||
#if defined(__OpenBSD__)
|
||||
#include <pthread.h>
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef WIN32
|
||||
#include <netinet/ip.h>
|
||||
#include <netinet/tcp.h>
|
||||
#include <netinet/udp.h>
|
||||
#endif
|
||||
|
||||
#endif /* __NDPI_UNIX_INCLUDE_FILE__ */
|
||||
@@ -1,69 +0,0 @@
|
||||
/*
|
||||
* ndpi_win32.h
|
||||
*
|
||||
* Copyright (C) 2011-15 - ntop.org
|
||||
* Copyright (C) 2009-2011 by ipoque GmbH
|
||||
*
|
||||
* This file is part of nDPI, an open source deep packet inspection
|
||||
* library based on the OpenDPI and PACE technology by ipoque GmbH
|
||||
*
|
||||
* nDPI is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* nDPI is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with nDPI. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __NDPI_WIN32_H__
|
||||
#define __NDPI_WIN32_H__
|
||||
|
||||
#include <winsock2.h>
|
||||
#include <ws2tcpip.h>
|
||||
#include <process.h>
|
||||
#include <io.h>
|
||||
#include <getopt.h> /* getopt from: http://www.pwilson.net/sample.html. */
|
||||
#include <process.h> /* for getpid() and the exec..() family */
|
||||
#include <stdint.h>
|
||||
|
||||
#ifndef _CRT_SECURE_NO_WARNINGS
|
||||
#define _CRT_SECURE_NO_WARNINGS
|
||||
#endif
|
||||
|
||||
#define _WS2TCPIP_H_ /* Avoid compilation problems */
|
||||
|
||||
extern char* strsep(char **sp, const char *sep);
|
||||
|
||||
typedef unsigned char u_char;
|
||||
typedef unsigned short u_short;
|
||||
typedef unsigned int uint;
|
||||
typedef unsigned long u_long;
|
||||
typedef u_char u_int8_t;
|
||||
typedef u_short u_int16_t;
|
||||
typedef uint u_int32_t;
|
||||
typedef uint u_int;
|
||||
typedef unsigned __int64 u_int64_t;
|
||||
|
||||
#define pthread_t HANDLE
|
||||
#define pthread_mutex_t HANDLE
|
||||
#define pthread_rwlock_t pthread_mutex_t
|
||||
#define pthread_rwlock_init pthread_mutex_init
|
||||
#define pthread_rwlock_wrlock pthread_mutex_lock
|
||||
#define pthread_rwlock_rdlock pthread_mutex_lock
|
||||
#define pthread_rwlock_unlock pthread_mutex_unlock
|
||||
#define pthread_rwlock_destroy pthread_mutex_destroy
|
||||
|
||||
#define gmtime_r(a, b) memcpy(b, gmtime(a), sizeof(struct tm))
|
||||
|
||||
extern unsigned long waitForNextEvent(unsigned long ulDelay /* ms */);
|
||||
|
||||
#define sleep(a /* sec */) waitForNextEvent(1000*a /* ms */)
|
||||
|
||||
#endif /* __NDPI_WIN32_H__ */
|
||||
@@ -1,162 +0,0 @@
|
||||
lib_LTLIBRARIES = libndpi.la
|
||||
|
||||
CFLAGS += -fPIC -DPIC
|
||||
libndpi_la_CPPFLAGS = -I$(top_srcdir)/src/include/ -I$(top_srcdir)/src/lib/third_party/include/
|
||||
libndpi_la_LDFLAGS = -version-info 1:0:0 -export-symbols $(top_srcdir)/libndpi.sym
|
||||
|
||||
libndpi_la_includedir = $(includedir)/libndpi-@VERSION@/libndpi
|
||||
|
||||
libndpi_la_include_HEADERS = ../include/ndpi_api.h \
|
||||
../include/ndpi_define.h \
|
||||
../include/ndpi_main.h \
|
||||
../include/ndpi_protocol_ids.h \
|
||||
../include/ndpi_protocols.h \
|
||||
../include/ndpi_typedefs.h \
|
||||
../include/ndpi_includes.h
|
||||
|
||||
libndpi_la_SOURCES = ndpi_content_match.c.inc \
|
||||
ndpi_main.c \
|
||||
protocols/afp.c \
|
||||
protocols/aimini.c \
|
||||
protocols/applejuice.c \
|
||||
protocols/armagetron.c \
|
||||
protocols/ayiya.c \
|
||||
protocols/battlefield.c \
|
||||
protocols/bgp.c \
|
||||
protocols/bittorrent.c \
|
||||
protocols/ciscovpn.c \
|
||||
protocols/citrix.c \
|
||||
protocols/collectd.c \
|
||||
protocols/corba.c \
|
||||
protocols/crossfire.c \
|
||||
protocols/dcerpc.c \
|
||||
protocols/dhcp.c \
|
||||
protocols/dhcpv6.c \
|
||||
protocols/directconnect.c \
|
||||
protocols/directdownloadlink.c \
|
||||
protocols/dns.c \
|
||||
protocols/dofus.c \
|
||||
protocols/dropbox.c \
|
||||
protocols/eaq.c \
|
||||
protocols/edonkey.c \
|
||||
protocols/fasttrack.c \
|
||||
protocols/fiesta.c \
|
||||
protocols/filetopia.c \
|
||||
protocols/florensia.c \
|
||||
protocols/ftp_control.c \
|
||||
protocols/ftp_data.c \
|
||||
protocols/gnutella.c \
|
||||
protocols/gtp.c \
|
||||
protocols/guildwars.c \
|
||||
protocols/h323.c \
|
||||
protocols/halflife2_and_mods.c \
|
||||
protocols/http_activesync.c \
|
||||
protocols/http.c \
|
||||
protocols/iax.c \
|
||||
protocols/icecast.c \
|
||||
protocols/imesh.c \
|
||||
protocols/ipp.c \
|
||||
protocols/irc.c \
|
||||
protocols/jabber.c \
|
||||
protocols/kakaotalk_voice.c \
|
||||
protocols/kerberos.c \
|
||||
protocols/kontiki.c \
|
||||
protocols/ldap.c \
|
||||
protocols/lotus_notes.c \
|
||||
protocols/mail_imap.c \
|
||||
protocols/mail_pop.c \
|
||||
protocols/mail_smtp.c \
|
||||
protocols/maplestory.c \
|
||||
protocols/mdns.c \
|
||||
protocols/meebo.c \
|
||||
protocols/megaco.c \
|
||||
protocols/mgcp.c \
|
||||
protocols/mms.c \
|
||||
protocols/mpegts.c \
|
||||
protocols/msn.c \
|
||||
protocols/mssql.c \
|
||||
protocols/mysql.c \
|
||||
protocols/netbios.c \
|
||||
protocols/netflow.c \
|
||||
protocols/nfs.c \
|
||||
protocols/noe.c \
|
||||
protocols/non_tcp_udp.c \
|
||||
protocols/ntp.c \
|
||||
protocols/openft.c \
|
||||
protocols/openvpn.c \
|
||||
protocols/oracle.c \
|
||||
protocols/oscar.c \
|
||||
protocols/pando.c \
|
||||
protocols/pcanywhere.c \
|
||||
protocols/postgres.c \
|
||||
protocols/pplive.c \
|
||||
protocols/ppstream.c \
|
||||
protocols/pptp.c \
|
||||
protocols/qq.c \
|
||||
protocols/quake.c \
|
||||
protocols/quic.c \
|
||||
protocols/radius.c \
|
||||
protocols/rdp.c \
|
||||
protocols/redis_net.c \
|
||||
protocols/rsync.c \
|
||||
protocols/rtcp.c \
|
||||
protocols/rtmp.c \
|
||||
protocols/rtp.c \
|
||||
protocols/rtsp.c \
|
||||
protocols/sflow.c \
|
||||
protocols/shoutcast.c \
|
||||
protocols/sip.c \
|
||||
protocols/skinny.c \
|
||||
protocols/skype.c \
|
||||
protocols/smb.c \
|
||||
protocols/snmp.c \
|
||||
protocols/socks4.c \
|
||||
protocols/socks5.c \
|
||||
protocols/socrates.c \
|
||||
protocols/sopcast.c \
|
||||
protocols/soulseek.c \
|
||||
protocols/spotify.c \
|
||||
protocols/ssdp.c \
|
||||
protocols/ssh.c \
|
||||
protocols/ssl.c \
|
||||
protocols/starcraft.c \
|
||||
protocols/stealthnet.c \
|
||||
protocols/steam.c \
|
||||
protocols/stun.c \
|
||||
protocols/syslog.c \
|
||||
protocols/tcp_udp.c \
|
||||
protocols/tds.c \
|
||||
protocols/teamspeak.c \
|
||||
protocols/teamviewer.c \
|
||||
protocols/telegram.c \
|
||||
protocols/telnet.c \
|
||||
protocols/tftp.c \
|
||||
protocols/thunder.c \
|
||||
protocols/tor.c \
|
||||
protocols/teredo.c \
|
||||
protocols/tvants.c \
|
||||
protocols/tvuplayer.c \
|
||||
protocols/twitter.c \
|
||||
protocols/usenet.c \
|
||||
protocols/veohtv.c \
|
||||
protocols/viber.c \
|
||||
protocols/vhua.c \
|
||||
protocols/vmware.c \
|
||||
protocols/vnc.c \
|
||||
protocols/warcraft3.c \
|
||||
protocols/whoisdas.c \
|
||||
protocols/winmx.c \
|
||||
protocols/world_of_kung_fu.c \
|
||||
protocols/world_of_warcraft.c \
|
||||
protocols/xbox.c \
|
||||
protocols/xdmcp.c \
|
||||
protocols/yahoo.c \
|
||||
protocols/zattoo.c \
|
||||
protocols/zeromq.c \
|
||||
third_party/include/actypes.h \
|
||||
third_party/include/ahocorasick.h \
|
||||
third_party/include/node.h \
|
||||
third_party/include/sort.h \
|
||||
third_party/src/ahocorasick.c \
|
||||
third_party/src/node.c \
|
||||
third_party/src/sort.c
|
||||
File diff suppressed because it is too large
Load Diff
-4480
File diff suppressed because it is too large
Load Diff
@@ -1,87 +0,0 @@
|
||||
/*
|
||||
* afp.c
|
||||
*
|
||||
* Copyright (C) 2009-2011 by ipoque GmbH
|
||||
* Copyright (C) 2011-15 - ntop.org
|
||||
*
|
||||
* This file is part of nDPI, an open source deep packet inspection
|
||||
* library based on the OpenDPI and PACE technology by ipoque GmbH
|
||||
*
|
||||
* nDPI is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* nDPI is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with nDPI. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include "ndpi_protocols.h"
|
||||
#ifdef NDPI_PROTOCOL_AFP
|
||||
|
||||
static void ndpi_int_afp_add_connection(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
{
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_AFP, NDPI_PROTOCOL_UNKNOWN);
|
||||
}
|
||||
|
||||
|
||||
void ndpi_search_afp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
{
|
||||
struct ndpi_packet_struct *packet = &flow->packet;
|
||||
// struct ndpi_id_struct *src = flow->src;
|
||||
// struct ndpi_id_struct *dst = flow->dst;
|
||||
|
||||
/*
|
||||
* this will detect the OpenSession command of the Data Stream Interface (DSI) protocol
|
||||
* which is exclusively used by the Apple Filing Protocol (AFP) on TCP/IP networks
|
||||
*/
|
||||
if (packet->payload_packet_len >= 22 && get_u_int16_t(packet->payload, 0) == htons(0x0004) &&
|
||||
get_u_int16_t(packet->payload, 2) == htons(0x0001) && get_u_int32_t(packet->payload, 4) == 0 &&
|
||||
get_u_int32_t(packet->payload, 8) == htonl(packet->payload_packet_len - 16) &&
|
||||
get_u_int32_t(packet->payload, 12) == 0 && get_u_int16_t(packet->payload, 16) == htons(0x0104)) {
|
||||
|
||||
NDPI_LOG(NDPI_PROTOCOL_AFP, ndpi_struct, NDPI_LOG_DEBUG, "AFP: DSI OpenSession detected.\n");
|
||||
ndpi_int_afp_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* detection of GetStatus command of DSI protocl
|
||||
*/
|
||||
if (packet->payload_packet_len >= 18 && get_u_int16_t(packet->payload, 0) == htons(0x0003) &&
|
||||
get_u_int16_t(packet->payload, 2) == htons(0x0001) && get_u_int32_t(packet->payload, 4) == 0 &&
|
||||
get_u_int32_t(packet->payload, 8) == htonl(packet->payload_packet_len - 16) &&
|
||||
get_u_int32_t(packet->payload, 12) == 0 && get_u_int16_t(packet->payload, 16) == htons(0x0f00)) {
|
||||
|
||||
NDPI_LOG(NDPI_PROTOCOL_AFP, ndpi_struct, NDPI_LOG_DEBUG, "AFP: DSI GetStatus detected.\n");
|
||||
ndpi_int_afp_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
NDPI_LOG(NDPI_PROTOCOL_AFP, ndpi_struct, NDPI_LOG_DEBUG, "AFP excluded.\n");
|
||||
NDPI_ADD_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, NDPI_PROTOCOL_AFP);
|
||||
}
|
||||
|
||||
|
||||
void init_afp_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask)
|
||||
{
|
||||
ndpi_set_bitmask_protocol_detection("AFP", ndpi_struct, detection_bitmask, *id,
|
||||
NDPI_PROTOCOL_AFP,
|
||||
ndpi_search_afp,
|
||||
NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP_WITH_PAYLOAD_WITHOUT_RETRANSMISSION,
|
||||
SAVE_DETECTION_BITMASK_AS_UNKNOWN,
|
||||
ADD_TO_DETECTION_BITMASK);
|
||||
*id += 1;
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
@@ -1,297 +0,0 @@
|
||||
/*
|
||||
* aimini.c
|
||||
*
|
||||
* Copyright (C) 2009-2011 by ipoque GmbH
|
||||
* Copyright (C) 2011-15 - ntop.org
|
||||
*
|
||||
* This file is part of nDPI, an open source deep packet inspection
|
||||
* library based on the OpenDPI and PACE technology by ipoque GmbH
|
||||
*
|
||||
* nDPI is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* nDPI is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with nDPI. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include "ndpi_protocols.h"
|
||||
|
||||
#ifdef NDPI_PROTOCOL_AIMINI
|
||||
|
||||
|
||||
static void ndpi_int_aimini_add_connection(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow/* , */
|
||||
/* ndpi_protocol_type_t protocol_type */)
|
||||
{
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_AIMINI, NDPI_PROTOCOL_UNKNOWN);
|
||||
}
|
||||
|
||||
|
||||
static u_int8_t is_special_aimini_host(struct ndpi_int_one_line_struct host_line)
|
||||
{
|
||||
if (host_line.ptr != NULL && host_line.len >= NDPI_STATICSTRING_LEN("X.X.X.X.aimini.net")) {
|
||||
if ((get_u_int32_t(host_line.ptr, 0) & htonl(0x00ff00ff)) == htonl(0x002e002e) &&
|
||||
(get_u_int32_t(host_line.ptr, 4) & htonl(0x00ff00ff)) == htonl(0x002e002e) &&
|
||||
memcmp(&host_line.ptr[8], "aimini.net", NDPI_STATICSTRING_LEN("aimini.net")) == 0) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void ndpi_search_aimini(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
{
|
||||
struct ndpi_packet_struct *packet = &flow->packet;
|
||||
// struct ndpi_id_struct *src=ndpi_struct->src;
|
||||
// struct ndpi_id_struct *dst=ndpi_struct->dst;
|
||||
|
||||
|
||||
NDPI_LOG(NDPI_PROTOCOL_AIMINI, ndpi_struct, NDPI_LOG_DEBUG, "search aimini.\n");
|
||||
|
||||
if (packet->udp != NULL) {
|
||||
if (flow->l4.udp.aimini_stage == 0) {
|
||||
if (packet->payload_packet_len == 64 && ntohs(get_u_int16_t(packet->payload, 0)) == 0x010b) {
|
||||
flow->l4.udp.aimini_stage = 1;
|
||||
NDPI_LOG(NDPI_PROTOCOL_AIMINI, ndpi_struct, NDPI_LOG_DEBUG, "stage = 1.\n");
|
||||
return;
|
||||
}
|
||||
if (packet->payload_packet_len == 136
|
||||
&& (ntohs(get_u_int16_t(packet->payload, 0)) == 0x01c9 || ntohs(get_u_int16_t(packet->payload, 0)) == 0x0165)) {
|
||||
flow->l4.udp.aimini_stage = 4;
|
||||
NDPI_LOG(NDPI_PROTOCOL_AIMINI, ndpi_struct, NDPI_LOG_DEBUG, "stage = 4.\n");
|
||||
return;
|
||||
}
|
||||
if (packet->payload_packet_len == 88 && ntohs(get_u_int16_t(packet->payload, 0)) == 0x0101) {
|
||||
flow->l4.udp.aimini_stage = 7;
|
||||
NDPI_LOG(NDPI_PROTOCOL_AIMINI, ndpi_struct, NDPI_LOG_DEBUG, "stage = 7.\n");
|
||||
return;
|
||||
}
|
||||
if (packet->payload_packet_len == 104 && ntohs(get_u_int16_t(packet->payload, 0)) == 0x0102) {
|
||||
flow->l4.udp.aimini_stage = 10;
|
||||
NDPI_LOG(NDPI_PROTOCOL_AIMINI, ndpi_struct, NDPI_LOG_DEBUG, "stage = 10.\n");
|
||||
return;
|
||||
}
|
||||
if (packet->payload_packet_len == 32 && ntohs(get_u_int16_t(packet->payload, 0)) == 0x01ca) {
|
||||
flow->l4.udp.aimini_stage = 13;
|
||||
NDPI_LOG(NDPI_PROTOCOL_AIMINI, ndpi_struct, NDPI_LOG_DEBUG, "stage = 13.\n");
|
||||
return;
|
||||
}
|
||||
if (packet->payload_packet_len == 16 && ntohs(get_u_int16_t(packet->payload, 0)) == 0x010c) {
|
||||
flow->l4.udp.aimini_stage = 16;
|
||||
NDPI_LOG(NDPI_PROTOCOL_AIMINI, ndpi_struct, NDPI_LOG_DEBUG, "stage = 16.\n");
|
||||
return;
|
||||
}
|
||||
}
|
||||
/* first packet chronology: (len, value): (64, 0x010b), (>100, 0x0115), (16, 0x010c || 64, 0x010b || 88, 0x0115),
|
||||
* (16, 0x010c || 64, 0x010b || >100, 0x0115)
|
||||
*/
|
||||
if (flow->l4.udp.aimini_stage == 1 && packet->payload_packet_len > 100
|
||||
&& ntohs(get_u_int16_t(packet->payload, 0)) == 0x0115) {
|
||||
flow->l4.udp.aimini_stage = 2;
|
||||
NDPI_LOG(NDPI_PROTOCOL_AIMINI, ndpi_struct, NDPI_LOG_DEBUG, "stage = 2.\n");
|
||||
return;
|
||||
}
|
||||
if (flow->l4.udp.aimini_stage == 2 &&
|
||||
((packet->payload_packet_len == 16 && get_u_int16_t(packet->payload, 0) == htons(0x010c)) ||
|
||||
(packet->payload_packet_len == 64 && get_u_int16_t(packet->payload, 0) == htons(0x010b)) ||
|
||||
(packet->payload_packet_len == 88 && get_u_int16_t(packet->payload, 0) == ntohs(0x0115)))) {
|
||||
flow->l4.udp.aimini_stage = 3;
|
||||
NDPI_LOG(NDPI_PROTOCOL_AIMINI, ndpi_struct, NDPI_LOG_DEBUG, "stage = 3.\n");
|
||||
return;
|
||||
}
|
||||
if (flow->l4.udp.aimini_stage == 3
|
||||
&& ((packet->payload_packet_len == 16 && ntohs(get_u_int16_t(packet->payload, 0)) == 0x010c)
|
||||
|| (packet->payload_packet_len == 64 && ntohs(get_u_int16_t(packet->payload, 0)) == 0x010b)
|
||||
|| (packet->payload_packet_len > 100 && ntohs(get_u_int16_t(packet->payload, 0)) == 0x0115))) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_AIMINI, ndpi_struct, NDPI_LOG_DEBUG, "found aimini (64, 0x010b), (>300, 0x0115), "
|
||||
"(16, 0x010c || 64, 0x010b), (16, 0x010c || 64, 0x010b || >100, 0x0115).\n");
|
||||
ndpi_int_aimini_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
|
||||
/* second packet chronology: (len, value): (136, 0x01c9), (136, 0x01c9),(136, 0x01c9),(136, 0x01c9 || 32, 0x01ca) */
|
||||
|
||||
if (flow->l4.udp.aimini_stage == 4 && packet->payload_packet_len == 136
|
||||
&& (ntohs(get_u_int16_t(packet->payload, 0)) == 0x01c9 || ntohs(get_u_int16_t(packet->payload, 0)) == 0x0165)) {
|
||||
flow->l4.udp.aimini_stage = 5;
|
||||
NDPI_LOG(NDPI_PROTOCOL_AIMINI, ndpi_struct, NDPI_LOG_DEBUG, "stage = 5.\n");
|
||||
return;
|
||||
}
|
||||
if (flow->l4.udp.aimini_stage == 5 && (packet->payload_packet_len == 136
|
||||
&& (ntohs(get_u_int16_t(packet->payload, 0)) == 0x01c9
|
||||
|| ntohs(get_u_int16_t(packet->payload, 0)) == 0x0165))) {
|
||||
flow->l4.udp.aimini_stage = 6;
|
||||
NDPI_LOG(NDPI_PROTOCOL_AIMINI, ndpi_struct, NDPI_LOG_DEBUG, "stage = 6.\n");
|
||||
return;
|
||||
}
|
||||
if (flow->l4.udp.aimini_stage == 6 && ((packet->payload_packet_len == 136
|
||||
&& ((ntohs(get_u_int16_t(packet->payload, 0)) == 0x0165)
|
||||
|| ntohs(get_u_int16_t(packet->payload, 0)) == 0x01c9))
|
||||
|| (packet->payload_packet_len == 32
|
||||
&& ntohs(get_u_int16_t(packet->payload, 0)) == 0x01ca))) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_AIMINI, ndpi_struct, NDPI_LOG_DEBUG,
|
||||
"found aimini (136, 0x01c9), (136, 0x01c9)," "(136, 0x01c9),(136, 0x01c9 || 32, 0x01ca).\n");
|
||||
ndpi_int_aimini_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
|
||||
/* third packet chronology: (len, value): (88, 0x0101), (88, 0x0101),(88, 0x0101),(88, 0x0101) */
|
||||
|
||||
if (flow->l4.udp.aimini_stage == 7 && packet->payload_packet_len == 88
|
||||
&& ntohs(get_u_int16_t(packet->payload, 0)) == 0x0101) {
|
||||
flow->l4.udp.aimini_stage = 8;
|
||||
NDPI_LOG(NDPI_PROTOCOL_AIMINI, ndpi_struct, NDPI_LOG_DEBUG, "stage = 8.\n");
|
||||
return;
|
||||
}
|
||||
if (flow->l4.udp.aimini_stage == 8
|
||||
&& (packet->payload_packet_len == 88 && ntohs(get_u_int16_t(packet->payload, 0)) == 0x0101)) {
|
||||
flow->l4.udp.aimini_stage = 9;
|
||||
NDPI_LOG(NDPI_PROTOCOL_AIMINI, ndpi_struct, NDPI_LOG_DEBUG, "stage = 9.\n");
|
||||
return;
|
||||
}
|
||||
if (flow->l4.udp.aimini_stage == 9
|
||||
&& (packet->payload_packet_len == 88 && ntohs(get_u_int16_t(packet->payload, 0)) == 0x0101)) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_AIMINI, ndpi_struct, NDPI_LOG_DEBUG,
|
||||
"found aimini (88, 0x0101), (88, 0x0101)," "(88, 0x0101),(88, 0x0101).\n");
|
||||
ndpi_int_aimini_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
|
||||
/* fourth packet chronology: (len, value): (104, 0x0102), (104, 0x0102), (104, 0x0102), (104, 0x0102) */
|
||||
|
||||
if (flow->l4.udp.aimini_stage == 10 && packet->payload_packet_len == 104
|
||||
&& ntohs(get_u_int16_t(packet->payload, 0)) == 0x0102) {
|
||||
flow->l4.udp.aimini_stage = 11;
|
||||
NDPI_LOG(NDPI_PROTOCOL_AIMINI, ndpi_struct, NDPI_LOG_DEBUG, "stage = 11.\n");
|
||||
return;
|
||||
}
|
||||
if (flow->l4.udp.aimini_stage == 11
|
||||
&& (packet->payload_packet_len == 104 && ntohs(get_u_int16_t(packet->payload, 0)) == 0x0102)) {
|
||||
flow->l4.udp.aimini_stage = 12;
|
||||
NDPI_LOG(NDPI_PROTOCOL_AIMINI, ndpi_struct, NDPI_LOG_DEBUG, "stage = 12.\n");
|
||||
return;
|
||||
}
|
||||
if (flow->l4.udp.aimini_stage == 12
|
||||
&& ((packet->payload_packet_len == 104 && ntohs(get_u_int16_t(packet->payload, 0)) == 0x0102)
|
||||
|| (packet->payload_packet_len == 32 && ntohs(get_u_int16_t(packet->payload, 0)) == 0x01ca))) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_AIMINI, ndpi_struct, NDPI_LOG_DEBUG,
|
||||
"found aimini (104, 0x0102), (104, 0x0102), " "(104, 0x0102), (104, 0x0102).\n");
|
||||
ndpi_int_aimini_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
|
||||
/* fifth packet chronology (len, value): (32,0x01ca), (32,0x01ca), (32,0x01ca), ((136, 0x0166) || (32,0x01ca)) */
|
||||
|
||||
if (flow->l4.udp.aimini_stage == 13 && packet->payload_packet_len == 32
|
||||
&& ntohs(get_u_int16_t(packet->payload, 0)) == 0x01ca) {
|
||||
flow->l4.udp.aimini_stage = 14;
|
||||
NDPI_LOG(NDPI_PROTOCOL_AIMINI, ndpi_struct, NDPI_LOG_DEBUG, "stage = 14.\n");
|
||||
return;
|
||||
}
|
||||
if (flow->l4.udp.aimini_stage == 14
|
||||
&& ((packet->payload_packet_len == 32 && ntohs(get_u_int16_t(packet->payload, 0)) == 0x01ca)
|
||||
|| (packet->payload_packet_len == 136 && ntohs(get_u_int16_t(packet->payload, 0)) == 0x0166))) {
|
||||
flow->l4.udp.aimini_stage = 15;
|
||||
NDPI_LOG(NDPI_PROTOCOL_AIMINI, ndpi_struct, NDPI_LOG_DEBUG, "stage = 15.\n");
|
||||
return;
|
||||
}
|
||||
if (flow->l4.udp.aimini_stage == 15
|
||||
&& ((packet->payload_packet_len == 136 && ntohs(get_u_int16_t(packet->payload, 0)) == 0x0166)
|
||||
|| (packet->payload_packet_len == 32 && ntohs(get_u_int16_t(packet->payload, 0)) == 0x01ca))) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_AIMINI, ndpi_struct, NDPI_LOG_DEBUG,
|
||||
"found aimini (32,0x01ca), (32,0x01ca), (32,0x01ca), ((136, 0x0166)||(32,0x01ca)).\n");
|
||||
ndpi_int_aimini_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
|
||||
/* sixth packet chronology (len, value): (16, 0x010c), (16, 0x010c), (16, 0x010c), (16, 0x010c) */
|
||||
|
||||
if (flow->l4.udp.aimini_stage == 16 && packet->payload_packet_len == 16
|
||||
&& ntohs(get_u_int16_t(packet->payload, 0)) == 0x010c) {
|
||||
flow->l4.udp.aimini_stage = 17;
|
||||
NDPI_LOG(NDPI_PROTOCOL_AIMINI, ndpi_struct, NDPI_LOG_DEBUG, "stage = 17.\n");
|
||||
return;
|
||||
}
|
||||
if (flow->l4.udp.aimini_stage == 17
|
||||
&& (packet->payload_packet_len == 16 && ntohs(get_u_int16_t(packet->payload, 0)) == 0x010c)) {
|
||||
flow->l4.udp.aimini_stage = 18;
|
||||
NDPI_LOG(NDPI_PROTOCOL_AIMINI, ndpi_struct, NDPI_LOG_DEBUG, "stage = 18.\n");
|
||||
return;
|
||||
}
|
||||
if (flow->l4.udp.aimini_stage == 18
|
||||
&& (packet->payload_packet_len == 16 && ntohs(get_u_int16_t(packet->payload, 0)) == 0x010c)) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_AIMINI, ndpi_struct, NDPI_LOG_DEBUG,
|
||||
"found aimini (16, 0x010c), (16, 0x010c), (16, 0x010c), (16, 0x010c).\n");
|
||||
ndpi_int_aimini_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
} else if (packet->tcp != NULL) {
|
||||
if ((packet->payload_packet_len > NDPI_STATICSTRING_LEN("GET /player/") &&
|
||||
(memcmp(packet->payload, "GET /player/", NDPI_STATICSTRING_LEN("GET /player/")) == 0)) ||
|
||||
(packet->payload_packet_len > NDPI_STATICSTRING_LEN("GET /play/?fid=") &&
|
||||
(memcmp(packet->payload, "GET /play/?fid=", NDPI_STATICSTRING_LEN("GET /play/?fid=")) == 0))) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_AIMINI, ndpi_struct, NDPI_LOG_DEBUG, "HTTP packet detected.\n");
|
||||
ndpi_parse_packet_line_info(ndpi_struct, flow);
|
||||
if (packet->host_line.ptr != NULL && packet->host_line.len > 11
|
||||
&& (memcmp(&packet->host_line.ptr[packet->host_line.len - 11], ".aimini.net", 11) == 0)) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_AIMINI, ndpi_struct, NDPI_LOG_DEBUG, "AIMINI HTTP traffic detected.\n");
|
||||
ndpi_int_aimini_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (packet->payload_packet_len > 100) {
|
||||
if (memcmp(packet->payload, "GET /", NDPI_STATICSTRING_LEN("GET /")) == 0) {
|
||||
if (memcmp(&packet->payload[NDPI_STATICSTRING_LEN("GET /")], "play/",
|
||||
NDPI_STATICSTRING_LEN("play/")) == 0 ||
|
||||
memcmp(&packet->payload[NDPI_STATICSTRING_LEN("GET /")], "download/",
|
||||
NDPI_STATICSTRING_LEN("download/")) == 0) {
|
||||
ndpi_parse_packet_line_info(ndpi_struct, flow);
|
||||
if (is_special_aimini_host(packet->host_line) == 1) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_AIMINI, ndpi_struct, NDPI_LOG_DEBUG,
|
||||
"AIMINI HTTP traffic detected.\n");
|
||||
ndpi_int_aimini_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
}
|
||||
} else if (memcmp(packet->payload, "POST /", NDPI_STATICSTRING_LEN("POST /")) == 0) {
|
||||
if (memcmp(&packet->payload[NDPI_STATICSTRING_LEN("POST /")], "upload/",
|
||||
NDPI_STATICSTRING_LEN("upload/")) == 0) {
|
||||
ndpi_parse_packet_line_info(ndpi_struct, flow);
|
||||
if (is_special_aimini_host(packet->host_line) == 1) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_AIMINI, ndpi_struct, NDPI_LOG_DEBUG,
|
||||
"AIMINI HTTP traffic detected.\n");
|
||||
ndpi_int_aimini_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
NDPI_LOG(NDPI_PROTOCOL_AIMINI, ndpi_struct, NDPI_LOG_DEBUG, "exclude aimini.\n");
|
||||
NDPI_ADD_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, NDPI_PROTOCOL_AIMINI);
|
||||
|
||||
}
|
||||
|
||||
|
||||
void init_aimini_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask)
|
||||
{
|
||||
ndpi_set_bitmask_protocol_detection("Aimini", ndpi_struct, detection_bitmask, *id,
|
||||
NDPI_PROTOCOL_AIMINI,
|
||||
ndpi_search_aimini,
|
||||
NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP_OR_UDP_WITH_PAYLOAD,
|
||||
SAVE_DETECTION_BITMASK_AS_UNKNOWN,
|
||||
ADD_TO_DETECTION_BITMASK);
|
||||
|
||||
*id += 1;
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,70 +0,0 @@
|
||||
/*
|
||||
* applejuice.c
|
||||
*
|
||||
* Copyright (C) 2009-2011 by ipoque GmbH
|
||||
* Copyright (C) 2011-15 - ntop.org
|
||||
*
|
||||
* This file is part of nDPI, an open source deep packet inspection
|
||||
* library based on the OpenDPI and PACE technology by ipoque GmbH
|
||||
*
|
||||
* nDPI is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* nDPI is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with nDPI. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include "ndpi_protocols.h"
|
||||
#ifdef NDPI_PROTOCOL_APPLEJUICE
|
||||
|
||||
|
||||
static void ndpi_int_applejuice_add_connection(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
struct ndpi_flow_struct *flow)
|
||||
{
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_APPLEJUICE, NDPI_PROTOCOL_UNKNOWN);
|
||||
}
|
||||
|
||||
void ndpi_search_applejuice_tcp(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
struct ndpi_flow_struct *flow)
|
||||
{
|
||||
struct ndpi_packet_struct *packet = &flow->packet;
|
||||
// struct ndpi_id_struct *src=ndpi_struct->src;
|
||||
// struct ndpi_id_struct *dst=ndpi_struct->dst;
|
||||
|
||||
NDPI_LOG(NDPI_PROTOCOL_APPLEJUICE, ndpi_struct, NDPI_LOG_DEBUG, "search applejuice.\n");
|
||||
|
||||
if ((packet->payload_packet_len > 7) && (packet->payload[6] == 0x0d)
|
||||
&& (packet->payload[7] == 0x0a)
|
||||
&& (memcmp(packet->payload, "ajprot", 6) == 0)) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_APPLEJUICE, ndpi_struct, NDPI_LOG_DEBUG, "detected applejuice.\n");
|
||||
ndpi_int_applejuice_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
|
||||
NDPI_LOG(NDPI_PROTOCOL_APPLEJUICE, ndpi_struct, NDPI_LOG_DEBUG, "exclude applejuice.\n");
|
||||
NDPI_ADD_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, NDPI_PROTOCOL_APPLEJUICE);
|
||||
}
|
||||
|
||||
|
||||
void init_applejuice_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask)
|
||||
{
|
||||
ndpi_set_bitmask_protocol_detection("AppleJuice", ndpi_struct, detection_bitmask, *id,
|
||||
NDPI_PROTOCOL_APPLEJUICE,
|
||||
ndpi_search_applejuice_tcp,
|
||||
NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP_WITH_PAYLOAD_WITHOUT_RETRANSMISSION,
|
||||
SAVE_DETECTION_BITMASK_AS_UNKNOWN,
|
||||
ADD_TO_DETECTION_BITMASK);
|
||||
|
||||
*id += 1;
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,115 +0,0 @@
|
||||
/*
|
||||
* armagetron.c
|
||||
*
|
||||
* Copyright (C) 2009-2011 by ipoque GmbH
|
||||
* Copyright (C) 2011-15 - ntop.org
|
||||
*
|
||||
* This file is part of nDPI, an open source deep packet inspection
|
||||
* library based on the OpenDPI and PACE technology by ipoque GmbH
|
||||
*
|
||||
* nDPI is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* nDPI is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with nDPI. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
/* include files */
|
||||
#include "ndpi_protocols.h"
|
||||
#ifdef NDPI_PROTOCOL_ARMAGETRON
|
||||
|
||||
|
||||
static void ndpi_int_armagetron_add_connection(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
struct ndpi_flow_struct *flow)
|
||||
{
|
||||
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_ARMAGETRON, NDPI_PROTOCOL_UNKNOWN);
|
||||
}
|
||||
|
||||
void ndpi_search_armagetron_udp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
{
|
||||
struct ndpi_packet_struct *packet = &flow->packet;
|
||||
// struct ndpi_id_struct *src=ndpi_struct->src;
|
||||
// struct ndpi_id_struct *dst=ndpi_struct->dst;
|
||||
|
||||
NDPI_LOG(NDPI_PROTOCOL_ARMAGETRON, ndpi_struct, NDPI_LOG_DEBUG, "search armagetron.\n");
|
||||
|
||||
|
||||
if (packet->payload_packet_len > 10) {
|
||||
/* login request */
|
||||
if (get_u_int32_t(packet->payload, 0) == htonl(0x000b0000)) {
|
||||
const u_int16_t dataLength = ntohs(get_u_int16_t(packet->payload, 4));
|
||||
if (dataLength == 0 || dataLength * 2 + 8 != packet->payload_packet_len)
|
||||
goto exclude;
|
||||
if (get_u_int16_t(packet->payload, 6) == htons(0x0008)
|
||||
&& get_u_int16_t(packet->payload, packet->payload_packet_len - 2) == 0) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_ARMAGETRON, ndpi_struct, NDPI_LOG_DEBUG, "detected armagetron.\n");
|
||||
ndpi_int_armagetron_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
}
|
||||
/* sync_msg */
|
||||
if (packet->payload_packet_len == 16 && get_u_int16_t(packet->payload, 0) == htons(0x001c)
|
||||
&& get_u_int16_t(packet->payload, 2) != 0) {
|
||||
const u_int16_t dataLength = ntohs(get_u_int16_t(packet->payload, 4));
|
||||
if (dataLength != 4)
|
||||
goto exclude;
|
||||
if (get_u_int32_t(packet->payload, 6) == htonl(0x00000500) && get_u_int32_t(packet->payload, 6 + 4) == htonl(0x00010000)
|
||||
&& get_u_int16_t(packet->payload, packet->payload_packet_len - 2) == 0) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_ARMAGETRON, ndpi_struct, NDPI_LOG_DEBUG, "detected armagetron.\n");
|
||||
ndpi_int_armagetron_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/* net_sync combination */
|
||||
if (packet->payload_packet_len > 50 && get_u_int16_t(packet->payload, 0) == htons(0x0018)
|
||||
&& get_u_int16_t(packet->payload, 2) != 0) {
|
||||
u_int16_t val;
|
||||
const u_int16_t dataLength = ntohs(get_u_int16_t(packet->payload, 4));
|
||||
if (dataLength == 0 || dataLength * 2 + 8 > packet->payload_packet_len)
|
||||
goto exclude;
|
||||
val = get_u_int16_t(packet->payload, 6 + 2);
|
||||
if (val == get_u_int16_t(packet->payload, 6 + 6)) {
|
||||
val = ntohs(get_u_int16_t(packet->payload, 6 + 8));
|
||||
if ((6 + 10 + val + 4) < packet->payload_packet_len
|
||||
&& (get_u_int32_t(packet->payload, 6 + 10 + val) == htonl(0x00010000)
|
||||
|| get_u_int32_t(packet->payload, 6 + 10 + val) == htonl(0x00000001))
|
||||
&& get_u_int16_t(packet->payload, packet->payload_packet_len - 2) == 0) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_ARMAGETRON, ndpi_struct, NDPI_LOG_DEBUG, "detected armagetron.\n");
|
||||
ndpi_int_armagetron_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
exclude:
|
||||
NDPI_LOG(NDPI_PROTOCOL_ARMAGETRON, ndpi_struct, NDPI_LOG_DEBUG, "exclude armagetron.\n");
|
||||
NDPI_ADD_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, NDPI_PROTOCOL_ARMAGETRON);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void init_armagetron_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask)
|
||||
{
|
||||
ndpi_set_bitmask_protocol_detection("Armagetron", ndpi_struct, detection_bitmask, *id,
|
||||
NDPI_PROTOCOL_ARMAGETRON,
|
||||
ndpi_search_armagetron_udp,
|
||||
NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_UDP_WITH_PAYLOAD,
|
||||
SAVE_DETECTION_BITMASK_AS_UNKNOWN,
|
||||
ADD_TO_DETECTION_BITMASK);
|
||||
|
||||
*id += 1;
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
@@ -1,93 +0,0 @@
|
||||
/*
|
||||
* flash.c
|
||||
*
|
||||
* Copyright (C) 2009-2011 by ipoque GmbH
|
||||
* Copyright (C) 2011-15 - ntop.org
|
||||
*
|
||||
* This file is part of nDPI, an open source deep packet inspection
|
||||
* library based on the OpenDPI and PACE technology by ipoque GmbH
|
||||
*
|
||||
* nDPI is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* nDPI is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with nDPI. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include "ndpi_protocols.h"
|
||||
#ifdef NDPI_PROTOCOL_FLASH
|
||||
|
||||
static void ndpi_int_flash_add_connection(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
{
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_FLASH);
|
||||
}
|
||||
|
||||
void ndpi_search_flash(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
{
|
||||
struct ndpi_packet_struct *packet = &flow->packet;
|
||||
|
||||
// struct ndpi_id_struct *src=ndpi_struct->src;
|
||||
// struct ndpi_id_struct *dst=ndpi_struct->dst;
|
||||
|
||||
if (flow->l4.tcp.flash_stage == 0 && packet->payload_packet_len > 0
|
||||
&& (packet->payload[0] == 0x03 || packet->payload[0] == 0x06)) {
|
||||
flow->l4.tcp.flash_bytes = packet->payload_packet_len;
|
||||
if (packet->tcp->psh == 0) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_FLASH, ndpi_struct, NDPI_LOG_DEBUG, "FLASH pass 1: \n");
|
||||
flow->l4.tcp.flash_stage = packet->packet_direction + 1;
|
||||
|
||||
NDPI_LOG(NDPI_PROTOCOL_FLASH, ndpi_struct, NDPI_LOG_DEBUG,
|
||||
"FLASH pass 1: flash_stage: %u, flash_bytes: %u\n", flow->l4.tcp.flash_stage,
|
||||
flow->l4.tcp.flash_bytes);
|
||||
return;
|
||||
} else if (packet->tcp->psh != 0 && flow->l4.tcp.flash_bytes == 1537) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_FLASH, ndpi_struct, NDPI_LOG_DEBUG,
|
||||
"FLASH hit: flash_stage: %u, flash_bytes: %u\n", flow->l4.tcp.flash_stage,
|
||||
flow->l4.tcp.flash_bytes);
|
||||
flow->l4.tcp.flash_stage = 3;
|
||||
ndpi_int_flash_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
} else if (flow->l4.tcp.flash_stage == 1 + packet->packet_direction) {
|
||||
flow->l4.tcp.flash_bytes += packet->payload_packet_len;
|
||||
if (packet->tcp->psh != 0 && flow->l4.tcp.flash_bytes == 1537) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_FLASH, ndpi_struct, NDPI_LOG_DEBUG,
|
||||
"FLASH hit: flash_stage: %u, flash_bytes: %u\n", flow->l4.tcp.flash_stage,
|
||||
flow->l4.tcp.flash_bytes);
|
||||
flow->l4.tcp.flash_stage = 3;
|
||||
ndpi_int_flash_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
} else if (packet->tcp->psh == 0 && flow->l4.tcp.flash_bytes < 1537) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_FLASH, ndpi_struct, NDPI_LOG_DEBUG,
|
||||
"FLASH pass 2: flash_stage: %u, flash_bytes: %u\n", flow->l4.tcp.flash_stage,
|
||||
flow->l4.tcp.flash_bytes);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
NDPI_LOG(NDPI_PROTOCOL_FLASH, ndpi_struct, NDPI_LOG_DEBUG,
|
||||
"FLASH might be excluded: flash_stage: %u, flash_bytes: %u, packet_direction: %u\n",
|
||||
flow->l4.tcp.flash_stage, flow->l4.tcp.flash_bytes, packet->packet_direction);
|
||||
|
||||
#ifdef NDPI_PROTOCOL_HTTP
|
||||
if (NDPI_COMPARE_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, NDPI_PROTOCOL_HTTP) != 0) {
|
||||
#endif /* NDPI_PROTOCOL_HTTP */
|
||||
NDPI_LOG(NDPI_PROTOCOL_FLASH, ndpi_struct, NDPI_LOG_DEBUG, "FLASH: exclude\n");
|
||||
NDPI_ADD_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, NDPI_PROTOCOL_FLASH);
|
||||
#ifdef NDPI_PROTOCOL_HTTP
|
||||
} else {
|
||||
NDPI_LOG(NDPI_PROTOCOL_FLASH, ndpi_struct, NDPI_LOG_DEBUG, "FLASH avoid early exclude from http\n");
|
||||
}
|
||||
#endif /* NDPI_PROTOCOL_HTTP */
|
||||
|
||||
}
|
||||
#endif
|
||||
@@ -1,469 +0,0 @@
|
||||
/*
|
||||
* ftp.c
|
||||
*
|
||||
* Copyright (C) 2009-2011 by ipoque GmbH
|
||||
* Copyright (C) 2011-15 - ntop.org
|
||||
*
|
||||
* This file is part of nDPI, an open source deep packet inspection
|
||||
* library based on the OpenDPI and PACE technology by ipoque GmbH
|
||||
*
|
||||
* nDPI is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* nDPI is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with nDPI. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include "ndpi_protocols.h"
|
||||
#include "ndpi_utils.h"
|
||||
|
||||
#ifdef NDPI_PROTOCOL_FTP
|
||||
|
||||
|
||||
static void ndpi_int_ftp_add_connection(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
{
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_FTP);
|
||||
}
|
||||
|
||||
/**
|
||||
* checks for possible FTP command
|
||||
* not all valid commands are tested, it just need to be 3 or 4 characters followed by a space if the
|
||||
* packet is longer
|
||||
*
|
||||
* this functions is not used to accept, just to not reject
|
||||
*/
|
||||
#if !defined(WIN32)
|
||||
static inline
|
||||
#else
|
||||
__forceinline static
|
||||
#endif
|
||||
u_int8_t ndpi_int_check_possible_ftp_command(const struct ndpi_packet_struct *packet)
|
||||
{
|
||||
if (packet->payload_packet_len < 3)
|
||||
return 0;
|
||||
|
||||
if ((packet->payload[0] < 'a' || packet->payload[0] > 'z') &&
|
||||
(packet->payload[0] < 'A' || packet->payload[0] > 'Z'))
|
||||
return 0;
|
||||
if ((packet->payload[1] < 'a' || packet->payload[1] > 'z') &&
|
||||
(packet->payload[1] < 'A' || packet->payload[1] > 'Z'))
|
||||
return 0;
|
||||
if ((packet->payload[2] < 'a' || packet->payload[2] > 'z') &&
|
||||
(packet->payload[2] < 'A' || packet->payload[2] > 'Z'))
|
||||
return 0;
|
||||
|
||||
if (packet->payload_packet_len > 3) {
|
||||
if ((packet->payload[3] < 'a' || packet->payload[3] > 'z') &&
|
||||
(packet->payload[3] < 'A' || packet->payload[3] > 'Z') && packet->payload[3] != ' ')
|
||||
return 0;
|
||||
|
||||
if (packet->payload_packet_len > 4) {
|
||||
if (packet->payload[3] != ' ' && packet->payload[4] != ' ')
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* ftp replies are are 3-digit number followed by space or hyphen
|
||||
*/
|
||||
#if !defined(WIN32)
|
||||
static inline
|
||||
#else
|
||||
__forceinline static
|
||||
#endif
|
||||
u_int8_t ndpi_int_check_possible_ftp_reply(const struct ndpi_packet_struct *packet)
|
||||
{
|
||||
if (packet->payload_packet_len < 5)
|
||||
return 0;
|
||||
|
||||
if (packet->payload[3] != ' ' && packet->payload[3] != '-')
|
||||
return 0;
|
||||
|
||||
if (packet->payload[0] < '0' || packet->payload[0] > '9')
|
||||
return 0;
|
||||
if (packet->payload[1] < '0' || packet->payload[1] > '9')
|
||||
return 0;
|
||||
if (packet->payload[2] < '0' || packet->payload[2] > '9')
|
||||
return 0;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* check for continuation replies
|
||||
* there is no real indication whether it is a continuation message, we just
|
||||
* require that there are at least 5 ascii characters
|
||||
*/
|
||||
#if !defined(WIN32)
|
||||
static inline
|
||||
#else
|
||||
__forceinline static
|
||||
#endif
|
||||
u_int8_t ndpi_int_check_possible_ftp_continuation_reply(const struct ndpi_packet_struct *packet)
|
||||
{
|
||||
u_int16_t i;
|
||||
|
||||
if (packet->payload_packet_len < 5)
|
||||
return 0;
|
||||
|
||||
for (i = 0; i < 5; i++) {
|
||||
if (packet->payload[i] < ' ' || packet->payload[i] > 127)
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* these are the commands we tracking and expecting to see
|
||||
*/
|
||||
enum {
|
||||
FTP_USER_CMD = 1 << 0,
|
||||
FTP_FEAT_CMD = 1 << 1,
|
||||
FTP_COMMANDS = ((1 << 2) - 1),
|
||||
FTP_220_CODE = 1 << 2,
|
||||
FTP_331_CODE = 1 << 3,
|
||||
FTP_211_CODE = 1 << 4,
|
||||
FTP_CODES = ((1 << 5) - 1 - FTP_COMMANDS)
|
||||
};
|
||||
|
||||
/*
|
||||
return 0 if nothing has been detected
|
||||
return 1 if a pop packet
|
||||
*/
|
||||
|
||||
static u_int8_t search_ftp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
{
|
||||
|
||||
struct ndpi_packet_struct *packet = &flow->packet;
|
||||
|
||||
u_int8_t current_ftp_code = 0;
|
||||
|
||||
// struct ndpi_id_struct *src=ndpi_struct->src;
|
||||
// struct ndpi_id_struct *dst=ndpi_struct->dst;
|
||||
|
||||
|
||||
/* initiate client direction flag */
|
||||
if (flow->packet_counter == 1) {
|
||||
if (flow->l4.tcp.seen_syn) {
|
||||
flow->l4.tcp.ftp_client_direction = flow->setup_packet_direction;
|
||||
} else {
|
||||
/* no syn flag seen so guess */
|
||||
if (packet->payload_packet_len > 0) {
|
||||
if (packet->payload[0] >= '0' && packet->payload[0] <= '9') {
|
||||
/* maybe server side */
|
||||
flow->l4.tcp.ftp_client_direction = 1 - packet->packet_direction;
|
||||
} else {
|
||||
flow->l4.tcp.ftp_client_direction = packet->packet_direction;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (packet->packet_direction == flow->l4.tcp.ftp_client_direction) {
|
||||
if (packet->payload_packet_len > NDPI_STATICSTRING_LEN("USER ") &&
|
||||
(memcmp(packet->payload, "USER ", NDPI_STATICSTRING_LEN("USER ")) == 0 ||
|
||||
memcmp(packet->payload, "user ", NDPI_STATICSTRING_LEN("user ")) == 0)) {
|
||||
|
||||
NDPI_LOG(NDPI_PROTOCOL_FTP, ndpi_struct, NDPI_LOG_DEBUG, "FTP: found USER command\n");
|
||||
flow->l4.tcp.ftp_codes_seen |= FTP_USER_CMD;
|
||||
current_ftp_code = FTP_USER_CMD;
|
||||
} else if (packet->payload_packet_len >= NDPI_STATICSTRING_LEN("FEAT") &&
|
||||
(memcmp(packet->payload, "FEAT", NDPI_STATICSTRING_LEN("FEAT")) == 0 ||
|
||||
memcmp(packet->payload, "feat", NDPI_STATICSTRING_LEN("feat")) == 0)) {
|
||||
|
||||
NDPI_LOG(NDPI_PROTOCOL_FTP, ndpi_struct, NDPI_LOG_DEBUG, "FTP: found FEAT command\n");
|
||||
flow->l4.tcp.ftp_codes_seen |= FTP_FEAT_CMD;
|
||||
current_ftp_code = FTP_FEAT_CMD;
|
||||
} else if (!ndpi_int_check_possible_ftp_command(packet)) {
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
if (packet->payload_packet_len > NDPI_STATICSTRING_LEN("220 ") &&
|
||||
(memcmp(packet->payload, "220 ", NDPI_STATICSTRING_LEN("220 ")) == 0 ||
|
||||
memcmp(packet->payload, "220-", NDPI_STATICSTRING_LEN("220-")) == 0)) {
|
||||
|
||||
NDPI_LOG(NDPI_PROTOCOL_FTP, ndpi_struct, NDPI_LOG_DEBUG, "FTP: found 220 reply code\n");
|
||||
flow->l4.tcp.ftp_codes_seen |= FTP_220_CODE;
|
||||
current_ftp_code = FTP_220_CODE;
|
||||
} else if (packet->payload_packet_len > NDPI_STATICSTRING_LEN("331 ") &&
|
||||
(memcmp(packet->payload, "331 ", NDPI_STATICSTRING_LEN("331 ")) == 0 ||
|
||||
memcmp(packet->payload, "331-", NDPI_STATICSTRING_LEN("331-")) == 0)) {
|
||||
|
||||
NDPI_LOG(NDPI_PROTOCOL_FTP, ndpi_struct, NDPI_LOG_DEBUG, "FTP: found 331 reply code\n");
|
||||
flow->l4.tcp.ftp_codes_seen |= FTP_331_CODE;
|
||||
current_ftp_code = FTP_331_CODE;
|
||||
} else if (packet->payload_packet_len > NDPI_STATICSTRING_LEN("211 ") &&
|
||||
(memcmp(packet->payload, "211 ", NDPI_STATICSTRING_LEN("211 ")) == 0 ||
|
||||
memcmp(packet->payload, "211-", NDPI_STATICSTRING_LEN("211-")) == 0)) {
|
||||
|
||||
NDPI_LOG(NDPI_PROTOCOL_FTP, ndpi_struct, NDPI_LOG_DEBUG, "FTP: found 211reply code\n");
|
||||
flow->l4.tcp.ftp_codes_seen |= FTP_211_CODE;
|
||||
current_ftp_code = FTP_211_CODE;
|
||||
} else if (!ndpi_int_check_possible_ftp_reply(packet)) {
|
||||
if ((flow->l4.tcp.ftp_codes_seen & FTP_CODES) == 0 ||
|
||||
(!ndpi_int_check_possible_ftp_continuation_reply(packet))) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((flow->l4.tcp.ftp_codes_seen & FTP_COMMANDS) != 0 && (flow->l4.tcp.ftp_codes_seen & FTP_CODES) != 0) {
|
||||
|
||||
NDPI_LOG(NDPI_PROTOCOL_FTP, ndpi_struct, NDPI_LOG_DEBUG, "FTP detected\n");
|
||||
ndpi_int_ftp_add_connection(ndpi_struct, flow);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* if no valid code has been seen for the first packets reject */
|
||||
if (flow->l4.tcp.ftp_codes_seen == 0 && flow->packet_counter > 3)
|
||||
return 0;
|
||||
|
||||
/* otherwise wait more packets, wait more for traffic on known ftp port */
|
||||
if ((packet->packet_direction == flow->setup_packet_direction && packet->tcp && packet->tcp->dest == htons(21)) ||
|
||||
(packet->packet_direction != flow->setup_packet_direction && packet->tcp && packet->tcp->source == htons(21))) {
|
||||
/* flow to known ftp port */
|
||||
|
||||
/* wait much longer if this was a 220 code, initial messages might be long */
|
||||
if (current_ftp_code == FTP_220_CODE) {
|
||||
if (flow->packet_counter > 40)
|
||||
return 0;
|
||||
} else {
|
||||
if (flow->packet_counter > 20)
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
/* wait much longer if this was a 220 code, initial messages might be long */
|
||||
if (current_ftp_code == FTP_220_CODE) {
|
||||
if (flow->packet_counter > 20)
|
||||
return 0;
|
||||
} else {
|
||||
if (flow->packet_counter > 10)
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
return 2;
|
||||
}
|
||||
|
||||
|
||||
static void search_passive_ftp_mode(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
{
|
||||
struct ndpi_packet_struct *packet = &flow->packet;
|
||||
struct ndpi_id_struct *dst = flow->dst;
|
||||
struct ndpi_id_struct *src = flow->src;
|
||||
u_int16_t plen;
|
||||
u_int8_t i;
|
||||
u_int32_t ftp_ip;
|
||||
|
||||
|
||||
// TODO check if normal passive mode also needs adaption for ipv6
|
||||
if (packet->payload_packet_len > 3 && ndpi_mem_cmp(packet->payload, "227 ", 4) == 0) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_FTP, ndpi_struct, NDPI_LOG_DEBUG, "FTP passive mode initial string\n");
|
||||
|
||||
plen = 4; //=4 for "227 "
|
||||
while (1) {
|
||||
if (plen >= packet->payload_packet_len) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_FTP, ndpi_struct, NDPI_LOG_DEBUG,
|
||||
"plen >= packet->payload_packet_len, return\n");
|
||||
return;
|
||||
}
|
||||
if (packet->payload[plen] == '(') {
|
||||
NDPI_LOG(NDPI_PROTOCOL_FTP, ndpi_struct, NDPI_LOG_DEBUG, "found (. break.\n");
|
||||
break;
|
||||
}
|
||||
/* if (!isalnum(packet->payload[plen])) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_FTP, ndpi_struct, NDPI_LOG_DEBUG, "no alpha numeric symbol --> break.\n");
|
||||
return;
|
||||
}*/
|
||||
plen++;
|
||||
}
|
||||
plen++;
|
||||
|
||||
if (plen >= packet->payload_packet_len)
|
||||
return;
|
||||
|
||||
|
||||
ftp_ip = 0;
|
||||
for (i = 0; i < 4; i++) {
|
||||
u_int16_t oldplen = plen;
|
||||
ftp_ip =
|
||||
(ftp_ip << 8) +
|
||||
ndpi_bytestream_to_number(&packet->payload[plen], packet->payload_packet_len - plen, &plen);
|
||||
if (oldplen == plen || plen >= packet->payload_packet_len) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_FTP, ndpi_struct, NDPI_LOG_DEBUG, "FTP passive mode %u value parse failed\n",
|
||||
i);
|
||||
return;
|
||||
}
|
||||
if (packet->payload[plen] != ',') {
|
||||
|
||||
NDPI_LOG(NDPI_PROTOCOL_FTP, ndpi_struct, NDPI_LOG_DEBUG,
|
||||
"FTP passive mode %u value parse failed, char ',' is missing\n", i);
|
||||
return;
|
||||
}
|
||||
plen++;
|
||||
NDPI_LOG(NDPI_PROTOCOL_FTP, ndpi_struct, NDPI_LOG_DEBUG,
|
||||
"FTP passive mode %u value parsed, ip is now: %u\n", i, ftp_ip);
|
||||
|
||||
}
|
||||
if (dst != NULL) {
|
||||
dst->ftp_ip.ipv4 = htonl(ftp_ip);
|
||||
dst->ftp_timer = packet->tick_timestamp;
|
||||
dst->ftp_timer_set = 1;
|
||||
NDPI_LOG(NDPI_PROTOCOL_FTP, ndpi_struct, NDPI_LOG_DEBUG, "saved ftp_ip, ftp_timer, ftp_timer_set to dst");
|
||||
NDPI_LOG(NDPI_PROTOCOL_FTP, ndpi_struct, NDPI_LOG_DEBUG, "FTP PASSIVE MODE FOUND: use Server %s\n",
|
||||
ndpi_get_ip_string(ndpi_struct, &dst->ftp_ip));
|
||||
}
|
||||
if (src != NULL) {
|
||||
src->ftp_ip.ipv4 = packet->iph->daddr;
|
||||
src->ftp_timer = packet->tick_timestamp;
|
||||
src->ftp_timer_set = 1;
|
||||
NDPI_LOG(NDPI_PROTOCOL_FTP, ndpi_struct, NDPI_LOG_DEBUG, "saved ftp_ip, ftp_timer, ftp_timer_set to src");
|
||||
NDPI_LOG(NDPI_PROTOCOL_FTP, ndpi_struct, NDPI_LOG_DEBUG, "FTP PASSIVE MODE FOUND: use Server %s\n",
|
||||
ndpi_get_ip_string(ndpi_struct, &src->ftp_ip));
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (packet->payload_packet_len > 34 && ndpi_mem_cmp(packet->payload, "229 Entering Extended Passive Mode", 34) == 0) {
|
||||
if (dst != NULL) {
|
||||
ndpi_packet_src_ip_get(packet, &dst->ftp_ip);
|
||||
dst->ftp_timer = packet->tick_timestamp;
|
||||
dst->ftp_timer_set = 1;
|
||||
NDPI_LOG(NDPI_PROTOCOL_FTP, ndpi_struct, NDPI_LOG_DEBUG, "saved ftp_ip, ftp_timer, ftp_timer_set to dst");
|
||||
NDPI_LOG(NDPI_PROTOCOL_FTP, ndpi_struct, NDPI_LOG_DEBUG,
|
||||
"FTP Extended PASSIVE MODE FOUND: use Server %s\n", ndpi_get_ip_string(ndpi_struct, &dst->ftp_ip));
|
||||
}
|
||||
if (src != NULL) {
|
||||
ndpi_packet_dst_ip_get(packet, &src->ftp_ip);
|
||||
src->ftp_timer = packet->tick_timestamp;
|
||||
src->ftp_timer_set = 1;
|
||||
NDPI_LOG(NDPI_PROTOCOL_FTP, ndpi_struct, NDPI_LOG_DEBUG, "saved ftp_ip, ftp_timer, ftp_timer_set to src");
|
||||
NDPI_LOG(NDPI_PROTOCOL_FTP, ndpi_struct, NDPI_LOG_DEBUG,
|
||||
"FTP Extended PASSIVE MODE FOUND: use Server %s\n", ndpi_get_ip_string(ndpi_struct, &src->ftp_ip));
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void search_active_ftp_mode(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
{
|
||||
struct ndpi_packet_struct *packet = &flow->packet;
|
||||
struct ndpi_id_struct *src = flow->src;
|
||||
struct ndpi_id_struct *dst = flow->dst;
|
||||
|
||||
if (packet->payload_packet_len > 5
|
||||
&& (ndpi_mem_cmp(packet->payload, "PORT ", 5) == 0 || ndpi_mem_cmp(packet->payload, "EPRT ", 5) == 0)) {
|
||||
|
||||
//src->local_ftp_data_port = htons(data_port_number);
|
||||
if (src != NULL) {
|
||||
ndpi_packet_dst_ip_get(packet, &src->ftp_ip);
|
||||
src->ftp_timer = packet->tick_timestamp;
|
||||
src->ftp_timer_set = 1;
|
||||
NDPI_LOG(NDPI_PROTOCOL_FTP, ndpi_struct, NDPI_LOG_DEBUG, "FTP ACTIVE MODE FOUND, command is %.*s\n", 4,
|
||||
packet->payload);
|
||||
}
|
||||
if (dst != NULL) {
|
||||
ndpi_packet_src_ip_get(packet, &dst->ftp_ip);
|
||||
dst->ftp_timer = packet->tick_timestamp;
|
||||
dst->ftp_timer_set = 1;
|
||||
NDPI_LOG(NDPI_PROTOCOL_FTP, ndpi_struct, NDPI_LOG_DEBUG, "FTP ACTIVE MODE FOUND, command is %.*s\n", 4,
|
||||
packet->payload);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
void ndpi_search_ftp_tcp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
{
|
||||
|
||||
struct ndpi_packet_struct *packet = &flow->packet;
|
||||
|
||||
struct ndpi_id_struct *src = flow->src;
|
||||
struct ndpi_id_struct *dst = flow->dst;
|
||||
|
||||
|
||||
|
||||
if (src != NULL && ndpi_packet_dst_ip_eql(packet, &src->ftp_ip)
|
||||
&& packet->tcp->syn != 0 && packet->tcp->ack == 0
|
||||
&& packet->detected_protocol_stack[0] == NDPI_PROTOCOL_UNKNOWN
|
||||
&& NDPI_COMPARE_PROTOCOL_TO_BITMASK(src->detected_protocol_bitmask,
|
||||
NDPI_PROTOCOL_FTP) != 0 && src->ftp_timer_set != 0) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_FTP, ndpi_struct, NDPI_LOG_DEBUG, "possible ftp data, src!= 0.\n");
|
||||
|
||||
if (((u_int32_t)
|
||||
(packet->tick_timestamp - src->ftp_timer)) >= ndpi_struct->ftp_connection_timeout) {
|
||||
src->ftp_timer_set = 0;
|
||||
} else if (ntohs(packet->tcp->dest) > 1024
|
||||
&& (ntohs(packet->tcp->source) > 1024 || ntohs(packet->tcp->source) == 20)) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_FTP, ndpi_struct, NDPI_LOG_DEBUG, "detected FTP data stream.\n");
|
||||
ndpi_int_ftp_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (dst != NULL && ndpi_packet_src_ip_eql(packet, &dst->ftp_ip)
|
||||
&& packet->tcp->syn != 0 && packet->tcp->ack == 0
|
||||
&& packet->detected_protocol_stack[0] == NDPI_PROTOCOL_UNKNOWN
|
||||
&& NDPI_COMPARE_PROTOCOL_TO_BITMASK(dst->detected_protocol_bitmask,
|
||||
NDPI_PROTOCOL_FTP) != 0 && dst->ftp_timer_set != 0) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_FTP, ndpi_struct, NDPI_LOG_DEBUG, "possible ftp data; dst!= 0.\n");
|
||||
|
||||
if (((u_int32_t)
|
||||
(packet->tick_timestamp - dst->ftp_timer)) >= ndpi_struct->ftp_connection_timeout) {
|
||||
dst->ftp_timer_set = 0;
|
||||
|
||||
} else if (ntohs(packet->tcp->dest) > 1024
|
||||
&& (ntohs(packet->tcp->source) > 1024 || ntohs(packet->tcp->source) == 20)) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_FTP, ndpi_struct, NDPI_LOG_DEBUG, "detected FTP data stream.\n");
|
||||
ndpi_int_ftp_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
}
|
||||
// ftp data asymmetrically
|
||||
|
||||
|
||||
/* skip packets without payload */
|
||||
if (packet->payload_packet_len == 0) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_FTP, ndpi_struct, NDPI_LOG_DEBUG,
|
||||
"FTP test skip because of data connection or zero byte packet_payload.\n");
|
||||
return;
|
||||
}
|
||||
/* skip excluded connections */
|
||||
|
||||
// we test for FTP connection and search for passive mode
|
||||
if (packet->detected_protocol_stack[0] == NDPI_PROTOCOL_FTP) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_FTP, ndpi_struct, NDPI_LOG_DEBUG,
|
||||
"detected ftp command mode. going to test data mode.\n");
|
||||
search_passive_ftp_mode(ndpi_struct, flow);
|
||||
|
||||
search_active_ftp_mode(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (packet->detected_protocol_stack[0] == NDPI_PROTOCOL_UNKNOWN && search_ftp(ndpi_struct, flow) != 0) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_FTP, ndpi_struct, NDPI_LOG_DEBUG, "unknown. need next packet.\n");
|
||||
|
||||
return;
|
||||
}
|
||||
NDPI_ADD_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, NDPI_PROTOCOL_FTP);
|
||||
NDPI_LOG(NDPI_PROTOCOL_FTP, ndpi_struct, NDPI_LOG_DEBUG, "exclude ftp.\n");
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,180 +0,0 @@
|
||||
/*
|
||||
* manolito.c
|
||||
*
|
||||
* Copyright (C) 2009-2011 by ipoque GmbH
|
||||
* Copyright (C) 2011-15 - ntop.org
|
||||
*
|
||||
* This file is part of nDPI, an open source deep packet inspection
|
||||
* library based on the OpenDPI and PACE technology by ipoque GmbH
|
||||
*
|
||||
* nDPI is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* nDPI is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with nDPI. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include "ndpi_protocols.h"
|
||||
#ifdef NDPI_PROTOCOL_MANOLITO
|
||||
|
||||
static void ndpi_int_manolito_add_connection(struct
|
||||
ndpi_detection_module_struct
|
||||
*ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
{
|
||||
|
||||
struct ndpi_packet_struct *packet = &flow->packet;
|
||||
struct ndpi_id_struct *src = flow->src;
|
||||
struct ndpi_id_struct *dst = flow->dst;
|
||||
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_MANOLITO);
|
||||
|
||||
|
||||
if (src != NULL) {
|
||||
if (packet->udp != NULL) {
|
||||
src->manolito_last_pkt_arrival_time = packet->tick_timestamp;
|
||||
}
|
||||
}
|
||||
if (dst != NULL) {
|
||||
if (packet->udp != NULL) {
|
||||
dst->manolito_last_pkt_arrival_time = packet->tick_timestamp;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
return 0 if nothing has been detected
|
||||
return 1 if it is a megaupload packet
|
||||
*/
|
||||
u_int8_t search_manolito_tcp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
u_int8_t search_manolito_tcp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
{
|
||||
struct ndpi_packet_struct *packet = &flow->packet;
|
||||
|
||||
// struct ndpi_id_struct *src = flow->src;
|
||||
// struct ndpi_id_struct *dst = flow->dst;
|
||||
|
||||
NDPI_LOG(NDPI_PROTOCOL_MANOLITO, ndpi_struct, NDPI_LOG_DEBUG, "MANOLITO TCP DETECTION\n");
|
||||
|
||||
if (flow->l4.tcp.manolito_stage == 0 && packet->payload_packet_len > 6) {
|
||||
if (memcmp(packet->payload, "SIZ ", 4) != 0)
|
||||
goto end_manolito_nothing_found;
|
||||
|
||||
flow->l4.tcp.manolito_stage = 1 + packet->packet_direction;
|
||||
NDPI_LOG(NDPI_PROTOCOL_MANOLITO, ndpi_struct, NDPI_LOG_DEBUG, "MANOLITO Stage 1.\n");
|
||||
goto end_manolito_maybe_hit;
|
||||
|
||||
} else if ((flow->l4.tcp.manolito_stage == 2 - packet->packet_direction)
|
||||
&& packet->payload_packet_len > 4) {
|
||||
if (memcmp(packet->payload, "STR ", 4) != 0)
|
||||
goto end_manolito_nothing_found;
|
||||
NDPI_LOG(NDPI_PROTOCOL_MANOLITO, ndpi_struct, NDPI_LOG_DEBUG, "MANOLITO Stage 2.\n");
|
||||
flow->l4.tcp.manolito_stage = 3 + packet->packet_direction;
|
||||
goto end_manolito_maybe_hit;
|
||||
|
||||
} else if ((flow->l4.tcp.manolito_stage == 4 - packet->packet_direction) && packet->payload_packet_len > 5) {
|
||||
if (memcmp(packet->payload, "MD5 ", 4) != 0)
|
||||
goto end_manolito_nothing_found;
|
||||
NDPI_LOG(NDPI_PROTOCOL_MANOLITO, ndpi_struct, NDPI_LOG_DEBUG, "MANOLITO Stage 3.\n");
|
||||
flow->l4.tcp.manolito_stage = 5 + packet->packet_direction;
|
||||
goto end_manolito_maybe_hit;
|
||||
|
||||
} else if ((flow->l4.tcp.manolito_stage == 6 - packet->packet_direction) && packet->payload_packet_len == 4) {
|
||||
|
||||
if (memcmp(packet->payload, "GO!!", 4) != 0)
|
||||
goto end_manolito_nothing_found;
|
||||
NDPI_LOG(NDPI_PROTOCOL_MANOLITO, ndpi_struct, NDPI_LOG_DEBUG, "MANOLITO Stage 4.\n");
|
||||
goto end_manolito_found;
|
||||
}
|
||||
//NDPI_LOG(NDPI_PROTOCOL_MANOLITO,ndpi_struct, NDPI_LOG_DEBUG, "MANOLITO FLOW STAGE %d\n", flow->l4.tcp.manolito_stage);
|
||||
goto end_manolito_nothing_found;
|
||||
|
||||
end_manolito_found:
|
||||
NDPI_LOG(NDPI_PROTOCOL_MANOLITO, ndpi_struct, NDPI_LOG_DEBUG, "MANOLITO FOUND\n");
|
||||
ndpi_int_manolito_add_connection(ndpi_struct, flow);
|
||||
return 1;
|
||||
|
||||
end_manolito_maybe_hit:
|
||||
NDPI_LOG(NDPI_PROTOCOL_MANOLITO, ndpi_struct, NDPI_LOG_DEBUG, "MANOLITO maybe hit.\n");
|
||||
return 2;
|
||||
|
||||
end_manolito_nothing_found:
|
||||
NDPI_LOG(NDPI_PROTOCOL_MANOLITO, ndpi_struct, NDPI_LOG_DEBUG, "MANOLITO NOTHING FOUND\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
void ndpi_search_manolito_tcp_udp(struct
|
||||
ndpi_detection_module_struct
|
||||
*ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
{
|
||||
struct ndpi_packet_struct *packet = &flow->packet;
|
||||
|
||||
struct ndpi_id_struct *src = flow->src;
|
||||
struct ndpi_id_struct *dst = flow->dst;
|
||||
|
||||
|
||||
if (packet->tcp != NULL) {
|
||||
if (search_manolito_tcp(ndpi_struct, flow) != 0)
|
||||
return;
|
||||
} else if (packet->udp != NULL) {
|
||||
if (flow->detected_protocol_stack[0] == NDPI_PROTOCOL_MANOLITO) {
|
||||
if (src != NULL) {
|
||||
src->manolito_last_pkt_arrival_time = packet->tick_timestamp;
|
||||
}
|
||||
if (dst != NULL) {
|
||||
dst->manolito_last_pkt_arrival_time = packet->tick_timestamp;
|
||||
}
|
||||
return;
|
||||
} else if (packet->udp->source == htons(41170)
|
||||
|| packet->udp->dest == htons(41170)) {
|
||||
if (src != NULL && src->manolito_last_pkt_arrival_time != 0
|
||||
&& (packet->tick_timestamp - src->manolito_last_pkt_arrival_time <
|
||||
ndpi_struct->manolito_subscriber_timeout)) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_MANOLITO, ndpi_struct, NDPI_LOG_DEBUG, "MANOLITO: UDP detected \n");
|
||||
ndpi_int_manolito_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
} else if (src != NULL
|
||||
&& (packet->tick_timestamp - src->manolito_last_pkt_arrival_time) >=
|
||||
ndpi_struct->manolito_subscriber_timeout) {
|
||||
src->manolito_last_pkt_arrival_time = 0;
|
||||
}
|
||||
|
||||
if (dst != NULL && dst->manolito_last_pkt_arrival_time != 0
|
||||
&& (packet->tick_timestamp - dst->manolito_last_pkt_arrival_time <
|
||||
ndpi_struct->manolito_subscriber_timeout)) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_MANOLITO, ndpi_struct, NDPI_LOG_DEBUG, "MANOLITO: UDP detected \n");
|
||||
ndpi_int_manolito_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
} else if (dst != NULL
|
||||
&& (packet->tick_timestamp - dst->manolito_last_pkt_arrival_time) >=
|
||||
ndpi_struct->manolito_subscriber_timeout) {
|
||||
dst->manolito_last_pkt_arrival_time = 0;
|
||||
}
|
||||
|
||||
if ((packet->payload_packet_len == 20 && htons(0x3d4b) == get_u_int16_t(packet->payload, 0)
|
||||
&& packet->payload[2] == 0xd9 && htons(0xedbb) == get_u_int16_t(packet->payload, 16))
|
||||
|| (packet->payload_packet_len == 25 && htons(0x3e4a) == get_u_int16_t(packet->payload, 0)
|
||||
&& htons(0x092f) == get_u_int16_t(packet->payload, 20) && packet->payload[22] == 0x20)
|
||||
|| (packet->payload_packet_len == 20 && !get_u_int16_t(packet->payload, 2) && !get_u_int32_t(packet->payload, 8)
|
||||
&& !get_u_int16_t(packet->payload, 18) && get_u_int16_t(packet->payload, 0))
|
||||
) { //20B pkt is For PING
|
||||
NDPI_LOG(NDPI_PROTOCOL_MANOLITO, ndpi_struct, NDPI_LOG_DEBUG, "MANOLITO: UDP detected \n");
|
||||
ndpi_int_manolito_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
} else if (flow->packet_counter < 7) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
NDPI_ADD_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, NDPI_PROTOCOL_MANOLITO);
|
||||
}
|
||||
#endif
|
||||
@@ -1,86 +0,0 @@
|
||||
/*
|
||||
* popo.c
|
||||
*
|
||||
* Copyright (C) 2009-2011 by ipoque GmbH
|
||||
* Copyright (C) 2011-15 - ntop.org
|
||||
*
|
||||
* This file is part of nDPI, an open source deep packet inspection
|
||||
* library based on the OpenDPI and PACE technology by ipoque GmbH
|
||||
*
|
||||
* nDPI is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* nDPI is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with nDPI. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include "ndpi_protocols.h"
|
||||
#ifdef NDPI_PROTOCOL_POPO
|
||||
|
||||
static void ndpi_int_popo_add_connection(struct ndpi_detection_module_struct
|
||||
*ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
{
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_POPO);
|
||||
}
|
||||
|
||||
void ndpi_search_popo_tcp_udp(struct ndpi_detection_module_struct
|
||||
*ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
{
|
||||
struct ndpi_packet_struct *packet = &flow->packet;
|
||||
|
||||
struct ndpi_id_struct *src = flow->src;
|
||||
struct ndpi_id_struct *dst = flow->dst;
|
||||
|
||||
if (packet->tcp != NULL) {
|
||||
if ((packet->payload_packet_len == 20)
|
||||
&& get_u_int32_t(packet->payload, 0) == htonl(0x0c000000)
|
||||
&& get_u_int32_t(packet->payload, 4) == htonl(0x01010000)
|
||||
&& get_u_int32_t(packet->payload, 8) == htonl(0x06000000)
|
||||
&& get_u_int32_t(packet->payload, 12) == 0 && get_u_int32_t(packet->payload, 16) == 0) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_POPO, ndpi_struct, NDPI_LOG_DEBUG, "POPO detected\n");
|
||||
ndpi_int_popo_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
|
||||
if (NDPI_SRC_OR_DST_HAS_PROTOCOL(src, dst, NDPI_PROTOCOL_POPO) != 0) {
|
||||
#define NDPI_POPO_IP_SUBNET_START ( (220 << 24) + (181 << 16) + (28 << 8) + 220)
|
||||
#define NDPI_POPO_IP_SUBNET_END ( (220 << 24) + (181 << 16) + (28 << 8) + 238)
|
||||
|
||||
/* may match the first payload ip packet only ... */
|
||||
|
||||
if (ntohl(packet->iph->daddr) >= NDPI_POPO_IP_SUBNET_START
|
||||
&& ntohl(packet->iph->daddr) <= NDPI_POPO_IP_SUBNET_END) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_POPO, ndpi_struct, NDPI_LOG_DEBUG, "POPO ip subnet detected\n");
|
||||
ndpi_int_popo_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (packet->payload_packet_len > 13 && packet->payload_packet_len == get_l32(packet->payload, 0)
|
||||
&& !get_l16(packet->payload, 12)) {
|
||||
register u_int16_t ii;
|
||||
for (ii = 14; ii < 50 && ii < packet->payload_packet_len - 8; ++ii) {
|
||||
if (packet->payload[ii] == '@')
|
||||
if (!memcmp(&packet->payload[ii + 1], "163.com", 7)
|
||||
|| (ii <= packet->payload_packet_len - 13 && !memcmp(&packet->payload[ii + 1], "popo.163.com", 12))) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_POPO, ndpi_struct, NDPI_LOG_DEBUG, "POPO detected.\n");
|
||||
ndpi_int_popo_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
NDPI_ADD_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, NDPI_PROTOCOL_POPO);
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,123 +0,0 @@
|
||||
/*
|
||||
* secondlife.c
|
||||
*
|
||||
* Copyright (C) 2009-2011 by ipoque GmbH
|
||||
* Copyright (C) 2011-15 - ntop.org
|
||||
*
|
||||
* This file is part of nDPI, an open source deep packet inspection
|
||||
* library based on the OpenDPI and PACE technology by ipoque GmbH
|
||||
*
|
||||
* nDPI is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* nDPI is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with nDPI. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include "ndpi_utils.h"
|
||||
#ifdef NDPI_PROTOCOL_SECONDLIFE
|
||||
|
||||
static void ndpi_int_secondlife_add_connection(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
struct ndpi_flow_struct *flow/* , */
|
||||
/* ndpi_protocol_type_t protocol_type */)
|
||||
{
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_SECONDLIFE, protocol_type);
|
||||
}
|
||||
|
||||
void ndpi_search_secondlife(struct ndpi_detection_module_struct
|
||||
*ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
{
|
||||
struct ndpi_packet_struct *packet = &flow->packet;
|
||||
|
||||
// struct ndpi_id_struct *src=ndpi_struct->src;
|
||||
// struct ndpi_id_struct *dst=ndpi_struct->dst;
|
||||
|
||||
// if ((ntohs(packet->udp->dest) == 12035 || ntohs(packet->udp->dest) == 12036 || (ntohs(packet->udp->dest) >= 13000 && ntohs(packet->udp->dest) <= 13050)) //port
|
||||
// && packet->payload_packet_len > 6 // min length with no extra header, high frequency and 1 byte message body
|
||||
// && get_u_int8_t(packet->payload, 0) == 0x40 // reliable packet
|
||||
// && ntohl(get_u_int32_t(packet->payload, 1)) == 0x00000001 // sequence number equals 1
|
||||
// //ntohl (get_u_int32_t (packet->payload, 5)) == 0x00FFFF00 // no extra header, low frequency message - can't use, message may have higher frequency
|
||||
// ) {
|
||||
// NDPI_LOG(NDPI_PROTOCOL_SECONDLIFE, ndpi_struct, NDPI_LOG_DEBUG, "Second Life detected.\n");
|
||||
// ndpi_int_secondlife_add_connection(ndpi_struct, flow);
|
||||
// return;
|
||||
// }
|
||||
|
||||
if (packet->tcp != NULL) {
|
||||
if (packet->payload_packet_len > NDPI_STATICSTRING_LEN("GET /")
|
||||
&& memcmp(packet->payload, "GET /", NDPI_STATICSTRING_LEN("GET /")) == 0) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_SECONDLIFE, ndpi_struct, NDPI_LOG_DEBUG, "Second Life HTTP 'GET /'' found.\n");
|
||||
ndpi_parse_packet_line_info(ndpi_struct, flow);
|
||||
if (packet->user_agent_line.ptr != NULL
|
||||
&& packet->user_agent_line.len >
|
||||
NDPI_STATICSTRING_LEN
|
||||
("Mozilla/5.0 (Windows; U; Windows NT 6.1; de-DE) AppleWebKit/532.4 (KHTML, like Gecko) SecondLife/")
|
||||
&& memcmp(&packet->user_agent_line.ptr[NDPI_STATICSTRING_LEN
|
||||
("Mozilla/5.0 (Windows; U; Windows NT 6.1; de-DE) AppleWebKit/532.4 (KHTML, like Gecko) ")],
|
||||
"SecondLife/", NDPI_STATICSTRING_LEN("SecondLife/")) == 0) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_SECONDLIFE, ndpi_struct, NDPI_LOG_DEBUG,
|
||||
"Second Life TCP HTTP User Agent detected.\n");
|
||||
ndpi_int_secondlife_add_connection(ndpi_struct, flow, NDPI_CORRELATED_PROTOCOL);
|
||||
return;
|
||||
}
|
||||
if (packet->host_line.ptr != NULL && packet->host_line.len > NDPI_STATICSTRING_LEN(".agni.lindenlab.com:")) {
|
||||
u_int8_t x;
|
||||
for (x = 2; x < 6; x++) {
|
||||
if (packet->host_line.ptr[packet->host_line.len - (1 + x)] == ':') {
|
||||
if ((1 + x + NDPI_STATICSTRING_LEN(".agni.lindenlab.com")) < packet->host_line.len
|
||||
&& memcmp(&packet->host_line.ptr[packet->host_line.len -
|
||||
(1 + x + NDPI_STATICSTRING_LEN(".agni.lindenlab.com"))],
|
||||
".agni.lindenlab.com", NDPI_STATICSTRING_LEN(".agni.lindenlab.com")) == 0) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_SECONDLIFE, ndpi_struct, NDPI_LOG_DEBUG,
|
||||
"Second Life TCP HTTP Host detected.\n");
|
||||
ndpi_int_secondlife_add_connection(ndpi_struct, flow, NDPI_CORRELATED_PROTOCOL);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (packet->udp != NULL) {
|
||||
if (packet->payload_packet_len == 46
|
||||
&& memcmp(packet->payload, "\x40\x00\x00\x00\x01\x00\xff\xff\x00\x03", 10) == 0) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_SECONDLIFE, ndpi_struct, NDPI_LOG_DEBUG, "Second Life 0xffff0003 detected.\n");
|
||||
ndpi_int_secondlife_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
if (packet->payload_packet_len == 54
|
||||
&& memcmp(packet->payload, "\x40\x00\x00\x00\x01\x00\xff\xff\x00\x52", 10) == 0) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_SECONDLIFE, ndpi_struct, NDPI_LOG_DEBUG, "Second Life 0xffff0052 detected.\n");
|
||||
ndpi_int_secondlife_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
if (packet->payload_packet_len == 58
|
||||
&& memcmp(packet->payload, "\x40\x00\x00\x00\x01\x00\xff\xff\x00\xa9", 10) == 0) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_SECONDLIFE, ndpi_struct, NDPI_LOG_DEBUG, "Second Life 0xffff00a9 detected.\n");
|
||||
ndpi_int_secondlife_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
if (packet->payload_packet_len > 54 && memcmp(packet->payload, "\x40\x00\x00\x00\x01\x00\x08", 7) == 0 &&
|
||||
get_u_int32_t(packet->payload, packet->payload_packet_len - 4) == 0) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_SECONDLIFE, ndpi_struct, NDPI_LOG_DEBUG, "Second Life 0x08 detected.\n");
|
||||
ndpi_int_secondlife_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
NDPI_LOG(NDPI_PROTOCOL_SECONDLIFE, ndpi_struct, NDPI_LOG_DEBUG, "Second Life excluded.\n");
|
||||
NDPI_ADD_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, NDPI_PROTOCOL_SECONDLIFE);
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,81 +0,0 @@
|
||||
/*
|
||||
* ayiya.c
|
||||
*
|
||||
* Copyright (C) 2011-15 - ntop.org
|
||||
*
|
||||
* This file is part of nDPI, an open source deep packet inspection
|
||||
* library based on the OpenDPI and PACE technology by ipoque GmbH
|
||||
*
|
||||
* nDPI is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* nDPI is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with nDPI. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
http://en.wikipedia.org/wiki/Anything_In_Anything
|
||||
http://tools.ietf.org/html/rfc4891
|
||||
*/
|
||||
|
||||
|
||||
#include "ndpi_protocols.h"
|
||||
#ifdef NDPI_PROTOCOL_AYIYA
|
||||
|
||||
struct ayiya {
|
||||
u_int8_t flags[3];
|
||||
u_int8_t next_header;
|
||||
u_int32_t epoch;
|
||||
u_int8_t identity[16];
|
||||
u_int8_t signature[20];
|
||||
};
|
||||
|
||||
void ndpi_search_ayiya(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
{
|
||||
struct ndpi_packet_struct *packet = &flow->packet;
|
||||
|
||||
if(packet->udp && (packet->detected_protocol_stack[0] == NDPI_PROTOCOL_UNKNOWN)) {
|
||||
/* Ayiya is udp based, port 5072 */
|
||||
if ((packet->udp->source == htons(5072) || packet->udp->dest == htons(5072))
|
||||
/* check for ayiya new packet */
|
||||
&& (packet->payload_packet_len > 44)
|
||||
) {
|
||||
/* FINISH */
|
||||
struct ayiya *a = (struct ayiya*)packet->payload;
|
||||
u_int32_t epoch = ntohl(a->epoch), now;
|
||||
u_int32_t fireyears = 86400 * 365 * 5;
|
||||
|
||||
now = flow->packet.tick_timestamp;
|
||||
|
||||
if((epoch >= (now - fireyears)) && (epoch <= (now+86400 /* 1 day */)))
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_AYIYA, NDPI_PROTOCOL_UNKNOWN);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
NDPI_ADD_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, NDPI_PROTOCOL_AYIYA);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void init_ayiya_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask)
|
||||
{
|
||||
ndpi_set_bitmask_protocol_detection("Ayiya", ndpi_struct, detection_bitmask, *id,
|
||||
NDPI_PROTOCOL_AYIYA,
|
||||
ndpi_search_ayiya,
|
||||
NDPI_SELECTION_BITMASK_PROTOCOL_UDP_WITH_PAYLOAD,
|
||||
SAVE_DETECTION_BITMASK_AS_UNKNOWN,
|
||||
ADD_TO_DETECTION_BITMASK);
|
||||
|
||||
*id += 1;
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,130 +0,0 @@
|
||||
/*
|
||||
* battlefield.c
|
||||
*
|
||||
* Copyright (C) 2009-2011 by ipoque GmbH
|
||||
* Copyright (C) 2011-15 - ntop.org
|
||||
*
|
||||
* This file is part of nDPI, an open source deep packet inspection
|
||||
* library based on the OpenDPI and PACE technology by ipoque GmbH
|
||||
*
|
||||
* nDPI is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* nDPI is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with nDPI. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include "ndpi_protocols.h"
|
||||
#ifdef NDPI_PROTOCOL_BATTLEFIELD
|
||||
|
||||
|
||||
static void ndpi_int_battlefield_add_connection(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
{
|
||||
struct ndpi_packet_struct *packet = &flow->packet;
|
||||
struct ndpi_id_struct *src = flow->src;
|
||||
struct ndpi_id_struct *dst = flow->dst;
|
||||
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_BATTLEFIELD, NDPI_PROTOCOL_UNKNOWN);
|
||||
|
||||
if (src != NULL) {
|
||||
src->battlefield_ts = packet->tick_timestamp;
|
||||
}
|
||||
if (dst != NULL) {
|
||||
dst->battlefield_ts = packet->tick_timestamp;
|
||||
}
|
||||
}
|
||||
|
||||
void ndpi_search_battlefield(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
{
|
||||
struct ndpi_packet_struct *packet = &flow->packet;
|
||||
|
||||
struct ndpi_id_struct *src = flow->src;
|
||||
struct ndpi_id_struct *dst = flow->dst;
|
||||
|
||||
if (packet->detected_protocol_stack[0] == NDPI_PROTOCOL_BATTLEFIELD) {
|
||||
if (src != NULL && ((u_int32_t)
|
||||
(packet->tick_timestamp - src->battlefield_ts) < ndpi_struct->battlefield_timeout)) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_BATTLEFIELD, ndpi_struct, NDPI_LOG_DEBUG,
|
||||
"battlefield : save src connection packet detected\n");
|
||||
src->battlefield_ts = packet->tick_timestamp;
|
||||
} else if (dst != NULL && ((u_int32_t)
|
||||
(packet->tick_timestamp - dst->battlefield_ts) < ndpi_struct->battlefield_timeout)) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_BATTLEFIELD, ndpi_struct, NDPI_LOG_DEBUG,
|
||||
"battlefield : save dst connection packet detected\n");
|
||||
dst->battlefield_ts = packet->tick_timestamp;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (NDPI_SRC_OR_DST_HAS_PROTOCOL(src, dst, NDPI_PROTOCOL_BATTLEFIELD)) {
|
||||
if (flow->l4.udp.battlefield_stage == 0 || flow->l4.udp.battlefield_stage == 1 + packet->packet_direction) {
|
||||
if (packet->payload_packet_len > 8 && get_u_int16_t(packet->payload, 0) == htons(0xfefd)) {
|
||||
flow->l4.udp.battlefield_msg_id = get_u_int32_t(packet->payload, 2);
|
||||
flow->l4.udp.battlefield_stage = 1 + packet->packet_direction;
|
||||
return;
|
||||
}
|
||||
} else if (flow->l4.udp.battlefield_stage == 2 - packet->packet_direction) {
|
||||
if (packet->payload_packet_len > 8 && get_u_int32_t(packet->payload, 0) == flow->l4.udp.battlefield_msg_id) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_BATTLEFIELD, ndpi_struct,
|
||||
NDPI_LOG_DEBUG, "Battlefield message and reply detected.\n");
|
||||
ndpi_int_battlefield_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (flow->l4.udp.battlefield_stage == 0) {
|
||||
if (packet->payload_packet_len == 46 && packet->payload[2] == 0 && packet->payload[4] == 0
|
||||
&& get_u_int32_t(packet->payload, 7) == htonl(0x98001100)) {
|
||||
flow->l4.udp.battlefield_stage = 3 + packet->packet_direction;
|
||||
return;
|
||||
}
|
||||
} else if (flow->l4.udp.battlefield_stage == 4 - packet->packet_direction) {
|
||||
if (packet->payload_packet_len == 7
|
||||
&& (packet->payload[0] == 0x02 || packet->payload[packet->payload_packet_len - 1] == 0xe0)) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_BATTLEFIELD, ndpi_struct, NDPI_LOG_DEBUG,
|
||||
"Battlefield message and reply detected.\n");
|
||||
ndpi_int_battlefield_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (packet->payload_packet_len == 18 && memcmp(&packet->payload[5], "battlefield2\x00", 13) == 0) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_BATTLEFIELD, ndpi_struct, NDPI_LOG_DEBUG, "Battlefield 2 hello packet detected.\n");
|
||||
ndpi_int_battlefield_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
} else if (packet->payload_packet_len > 10 &&
|
||||
(memcmp(packet->payload, "\x11\x20\x00\x01\x00\x00\x50\xb9\x10\x11", 10) == 0
|
||||
|| memcmp(packet->payload, "\x11\x20\x00\x01\x00\x00\x30\xb9\x10\x11", 10) == 0
|
||||
|| memcmp(packet->payload, "\x11\x20\x00\x01\x00\x00\xa0\x98\x00\x11", 10) == 0)) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_BATTLEFIELD, ndpi_struct, NDPI_LOG_DEBUG, "Battlefield safe pattern detected.\n");
|
||||
ndpi_int_battlefield_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
|
||||
NDPI_ADD_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, NDPI_PROTOCOL_BATTLEFIELD);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
void init_battlefield_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask)
|
||||
{
|
||||
ndpi_set_bitmask_protocol_detection("BattleField", ndpi_struct, detection_bitmask, *id,
|
||||
NDPI_PROTOCOL_BATTLEFIELD,
|
||||
ndpi_search_battlefield,
|
||||
NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_UDP_WITH_PAYLOAD,
|
||||
SAVE_DETECTION_BITMASK_AS_UNKNOWN,
|
||||
ADD_TO_DETECTION_BITMASK);
|
||||
*id += 1;
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,70 +0,0 @@
|
||||
/*
|
||||
* bgp.c
|
||||
*
|
||||
* Copyright (C) 2009-2011 by ipoque GmbH
|
||||
* Copyright (C) 2011-15 - ntop.org
|
||||
*
|
||||
* This file is part of nDPI, an open source deep packet inspection
|
||||
* library based on the OpenDPI and PACE technology by ipoque GmbH
|
||||
*
|
||||
* nDPI is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* nDPI is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with nDPI. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include "ndpi_protocols.h"
|
||||
#ifdef NDPI_PROTOCOL_BGP
|
||||
|
||||
|
||||
static void ndpi_int_bgp_add_connection(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
{
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_BGP, NDPI_PROTOCOL_UNKNOWN);
|
||||
}
|
||||
|
||||
/* this detection also works asymmetrically */
|
||||
void ndpi_search_bgp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
{
|
||||
struct ndpi_packet_struct *packet = &flow->packet;
|
||||
|
||||
// struct ndpi_id_struct *src=ndpi_struct->src;
|
||||
// struct ndpi_id_struct *dst=ndpi_struct->dst;
|
||||
|
||||
if (packet->payload_packet_len > 18 &&
|
||||
get_u_int64_t(packet->payload, 0) == 0xffffffffffffffffULL &&
|
||||
get_u_int64_t(packet->payload, 8) == 0xffffffffffffffffULL &&
|
||||
ntohs(get_u_int16_t(packet->payload, 16)) <= packet->payload_packet_len &&
|
||||
(packet->tcp->dest == htons(179) || packet->tcp->source == htons(179))
|
||||
&& packet->payload[18] < 5) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_BGP, ndpi_struct, NDPI_LOG_DEBUG, "BGP detected.\n");
|
||||
ndpi_int_bgp_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
|
||||
NDPI_ADD_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, NDPI_PROTOCOL_BGP);
|
||||
}
|
||||
|
||||
|
||||
void init_bgp_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask)
|
||||
{
|
||||
ndpi_set_bitmask_protocol_detection("BGP", ndpi_struct, detection_bitmask, *id,
|
||||
NDPI_PROTOCOL_BGP,
|
||||
ndpi_search_bgp,
|
||||
NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP_WITH_PAYLOAD_WITHOUT_RETRANSMISSION,
|
||||
SAVE_DETECTION_BITMASK_AS_UNKNOWN,
|
||||
ADD_TO_DETECTION_BITMASK);
|
||||
*id += 1;
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
@@ -1,493 +0,0 @@
|
||||
/*
|
||||
* bittorrent.c
|
||||
*
|
||||
* Copyright (C) 2009-2011 by ipoque GmbH
|
||||
* Copyright (C) 2011-15 - ntop.org
|
||||
*
|
||||
* This file is part of nDPI, an open source deep packet inspection
|
||||
* library based on the OpenDPI and PACE technology by ipoque GmbH
|
||||
*
|
||||
* nDPI is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* nDPI is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with nDPI. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include "ndpi_protocols.h"
|
||||
#ifdef NDPI_PROTOCOL_BITTORRENT
|
||||
#define NDPI_PROTOCOL_UNSAFE_DETECTION 0
|
||||
#define NDPI_PROTOCOL_SAFE_DETECTION 1
|
||||
|
||||
#define NDPI_PROTOCOL_PLAIN_DETECTION 0
|
||||
#define NDPI_PROTOCOL_WEBSEED_DETECTION 2
|
||||
static void ndpi_add_connection_as_bittorrent(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow,
|
||||
const u_int8_t save_detection, const u_int8_t encrypted_connection/* , */
|
||||
/* ndpi_protocol_type_t protocol_type */)
|
||||
{
|
||||
ndpi_int_change_protocol(ndpi_struct, flow, NDPI_PROTOCOL_BITTORRENT, NDPI_PROTOCOL_UNKNOWN);
|
||||
}
|
||||
|
||||
static u_int8_t ndpi_int_search_bittorrent_tcp_zero(struct ndpi_detection_module_struct
|
||||
*ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
{
|
||||
struct ndpi_packet_struct *packet = &flow->packet;
|
||||
u_int16_t a = 0;
|
||||
|
||||
if (packet->payload_packet_len == 1 && packet->payload[0] == 0x13) {
|
||||
/* reset stage back to 0 so we will see the next packet here too */
|
||||
flow->bittorrent_stage = 0;
|
||||
return 0;
|
||||
}
|
||||
if (flow->packet_counter == 2 && packet->payload_packet_len > 20) {
|
||||
|
||||
if (memcmp(&packet->payload[0], "BitTorrent protocol", 19) == 0) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_BITTORRENT,
|
||||
ndpi_struct, NDPI_LOG_TRACE, "BT: plain BitTorrent protocol detected\n");
|
||||
ndpi_add_connection_as_bittorrent(ndpi_struct, flow,
|
||||
NDPI_PROTOCOL_SAFE_DETECTION, NDPI_PROTOCOL_PLAIN_DETECTION/* , */
|
||||
/* NDPI_REAL_PROTOCOL */);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (packet->payload_packet_len > 20) {
|
||||
/* test for match 0x13+"BitTorrent protocol" */
|
||||
if (packet->payload[0] == 0x13) {
|
||||
if (memcmp(&packet->payload[1], "BitTorrent protocol", 19) == 0) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_BITTORRENT,
|
||||
ndpi_struct, NDPI_LOG_TRACE, "BT: plain BitTorrent protocol detected\n");
|
||||
ndpi_add_connection_as_bittorrent(ndpi_struct, flow,
|
||||
NDPI_PROTOCOL_SAFE_DETECTION, NDPI_PROTOCOL_PLAIN_DETECTION/* , */
|
||||
/* NDPI_REAL_PROTOCOL */);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (packet->payload_packet_len > 23 && memcmp(packet->payload, "GET /webseed?info_hash=", 23) == 0) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_BITTORRENT, ndpi_struct,
|
||||
NDPI_LOG_TRACE, "BT: plain webseed BitTorrent protocol detected\n");
|
||||
ndpi_add_connection_as_bittorrent(ndpi_struct, flow,
|
||||
NDPI_PROTOCOL_SAFE_DETECTION, NDPI_PROTOCOL_WEBSEED_DETECTION/* , */
|
||||
/* NDPI_CORRELATED_PROTOCOL */);
|
||||
return 1;
|
||||
}
|
||||
/* seen Azureus as server for webseed, possibly other servers existing, to implement */
|
||||
/* is Server: hypertracker Bittorrent? */
|
||||
/* no asymmetric detection possible for answer of pattern "GET /data?fid=". */
|
||||
if (packet->payload_packet_len > 60
|
||||
&& memcmp(packet->payload, "GET /data?fid=", 14) == 0 && memcmp(&packet->payload[54], "&size=", 6) == 0) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_BITTORRENT, ndpi_struct,
|
||||
NDPI_LOG_TRACE, "BT: plain Bitcomet persistent seed protocol detected\n");
|
||||
ndpi_add_connection_as_bittorrent(ndpi_struct, flow,
|
||||
NDPI_PROTOCOL_SAFE_DETECTION, NDPI_PROTOCOL_WEBSEED_DETECTION/* , */
|
||||
/* NDPI_CORRELATED_PROTOCOL */);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
if (packet->payload_packet_len > 90 && (memcmp(packet->payload, "GET ", 4) == 0
|
||||
|| memcmp(packet->payload, "POST ", 5) == 0)) {
|
||||
const u_int8_t *ptr = &packet->payload[4];
|
||||
u_int16_t len = packet->payload_packet_len - 4;
|
||||
a = 0;
|
||||
|
||||
|
||||
/* parse complete get packet here into line structure elements */
|
||||
ndpi_parse_packet_line_info(ndpi_struct, flow);
|
||||
/* answer to this pattern is HTTP....Server: hypertracker */
|
||||
if (packet->user_agent_line.ptr != NULL
|
||||
&& ((packet->user_agent_line.len > 8 && memcmp(packet->user_agent_line.ptr, "Azureus ", 8) == 0)
|
||||
|| (packet->user_agent_line.len >= 10 && memcmp(packet->user_agent_line.ptr, "BitTorrent", 10) == 0)
|
||||
|| (packet->user_agent_line.len >= 11 && memcmp(packet->user_agent_line.ptr, "BTWebClient", 11) == 0))) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_BITTORRENT, ndpi_struct,
|
||||
NDPI_LOG_TRACE, "Azureus /Bittorrent user agent line detected\n");
|
||||
ndpi_add_connection_as_bittorrent(ndpi_struct, flow,
|
||||
NDPI_PROTOCOL_SAFE_DETECTION, NDPI_PROTOCOL_WEBSEED_DETECTION/* , */
|
||||
/* NDPI_CORRELATED_PROTOCOL */);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (packet->user_agent_line.ptr != NULL
|
||||
&& (packet->user_agent_line.len >= 9 && memcmp(packet->user_agent_line.ptr, "Shareaza ", 9) == 0)
|
||||
&& (packet->parsed_lines > 8 && packet->line[8].ptr != 0
|
||||
&& packet->line[8].len >= 9 && memcmp(packet->line[8].ptr, "X-Queue: ", 9) == 0)) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_BITTORRENT, ndpi_struct,
|
||||
NDPI_LOG_TRACE, "Bittorrent Shareaza detected.\n");
|
||||
ndpi_add_connection_as_bittorrent(ndpi_struct, flow,
|
||||
NDPI_PROTOCOL_SAFE_DETECTION, NDPI_PROTOCOL_WEBSEED_DETECTION/* , */
|
||||
/* NDPI_CORRELATED_PROTOCOL */);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* this is a self built client, not possible to catch asymmetrically */
|
||||
if ((packet->parsed_lines == 10 || (packet->parsed_lines == 11 && packet->line[11].len == 0))
|
||||
&& packet->user_agent_line.ptr != NULL
|
||||
&& packet->user_agent_line.len > 12
|
||||
&& memcmp(packet->user_agent_line.ptr, "Mozilla/4.0 ",
|
||||
12) == 0
|
||||
&& packet->host_line.ptr != NULL
|
||||
&& packet->host_line.len >= 7
|
||||
&& packet->line[2].ptr != NULL
|
||||
&& packet->line[2].len > 14
|
||||
&& memcmp(packet->line[2].ptr, "Keep-Alive: 300", 15) == 0
|
||||
&& packet->line[3].ptr != NULL
|
||||
&& packet->line[3].len > 21
|
||||
&& memcmp(packet->line[3].ptr, "Connection: Keep-alive", 22) == 0
|
||||
&& packet->line[4].ptr != NULL
|
||||
&& packet->line[4].len > 10
|
||||
&& (memcmp(packet->line[4].ptr, "Accpet: */*", 11) == 0
|
||||
|| memcmp(packet->line[4].ptr, "Accept: */*", 11) == 0)
|
||||
|
||||
&& packet->line[5].ptr != NULL
|
||||
&& packet->line[5].len > 12
|
||||
&& memcmp(packet->line[5].ptr, "Range: bytes=", 13) == 0
|
||||
&& packet->line[7].ptr != NULL
|
||||
&& packet->line[7].len > 15
|
||||
&& memcmp(packet->line[7].ptr, "Pragma: no-cache", 16) == 0
|
||||
&& packet->line[8].ptr != NULL
|
||||
&& packet->line[8].len > 22 && memcmp(packet->line[8].ptr, "Cache-Control: no-cache", 23) == 0) {
|
||||
|
||||
NDPI_LOG(NDPI_PROTOCOL_BITTORRENT, ndpi_struct, NDPI_LOG_TRACE, "Bitcomet LTS detected\n");
|
||||
ndpi_add_connection_as_bittorrent(ndpi_struct, flow,
|
||||
NDPI_PROTOCOL_UNSAFE_DETECTION, NDPI_PROTOCOL_PLAIN_DETECTION/* , */
|
||||
/* NDPI_CORRELATED_PROTOCOL */);
|
||||
return 1;
|
||||
|
||||
}
|
||||
|
||||
/* FlashGet pattern */
|
||||
if (packet->parsed_lines == 8
|
||||
&& packet->user_agent_line.ptr != NULL
|
||||
&& packet->user_agent_line.len > (sizeof("Mozilla/4.0 (compatible; MSIE 6.0;") - 1)
|
||||
&& memcmp(packet->user_agent_line.ptr, "Mozilla/4.0 (compatible; MSIE 6.0;",
|
||||
sizeof("Mozilla/4.0 (compatible; MSIE 6.0;") - 1) == 0
|
||||
&& packet->host_line.ptr != NULL
|
||||
&& packet->host_line.len >= 7
|
||||
&& packet->line[2].ptr != NULL
|
||||
&& packet->line[2].len == 11
|
||||
&& memcmp(packet->line[2].ptr, "Accept: */*", 11) == 0
|
||||
&& packet->line[3].ptr != NULL && packet->line[3].len >= (sizeof("Referer: ") - 1)
|
||||
&& memcmp(packet->line[3].ptr, "Referer: ", sizeof("Referer: ") - 1) == 0
|
||||
&& packet->line[5].ptr != NULL
|
||||
&& packet->line[5].len > 13
|
||||
&& memcmp(packet->line[5].ptr, "Range: bytes=", 13) == 0
|
||||
&& packet->line[6].ptr != NULL
|
||||
&& packet->line[6].len > 21 && memcmp(packet->line[6].ptr, "Connection: Keep-Alive", 22) == 0) {
|
||||
|
||||
NDPI_LOG(NDPI_PROTOCOL_BITTORRENT, ndpi_struct, NDPI_LOG_TRACE, "FlashGet detected\n");
|
||||
ndpi_add_connection_as_bittorrent(ndpi_struct, flow,
|
||||
NDPI_PROTOCOL_UNSAFE_DETECTION, NDPI_PROTOCOL_PLAIN_DETECTION/* , */
|
||||
/* NDPI_CORRELATED_PROTOCOL */);
|
||||
return 1;
|
||||
|
||||
}
|
||||
if (packet->parsed_lines == 7
|
||||
&& packet->user_agent_line.ptr != NULL
|
||||
&& packet->user_agent_line.len > (sizeof("Mozilla/4.0 (compatible; MSIE 6.0;") - 1)
|
||||
&& memcmp(packet->user_agent_line.ptr, "Mozilla/4.0 (compatible; MSIE 6.0;",
|
||||
sizeof("Mozilla/4.0 (compatible; MSIE 6.0;") - 1) == 0
|
||||
&& packet->host_line.ptr != NULL
|
||||
&& packet->host_line.len >= 7
|
||||
&& packet->line[2].ptr != NULL
|
||||
&& packet->line[2].len == 11
|
||||
&& memcmp(packet->line[2].ptr, "Accept: */*", 11) == 0
|
||||
&& packet->line[3].ptr != NULL && packet->line[3].len >= (sizeof("Referer: ") - 1)
|
||||
&& memcmp(packet->line[3].ptr, "Referer: ", sizeof("Referer: ") - 1) == 0
|
||||
&& packet->line[5].ptr != NULL
|
||||
&& packet->line[5].len > 21 && memcmp(packet->line[5].ptr, "Connection: Keep-Alive", 22) == 0) {
|
||||
|
||||
NDPI_LOG(NDPI_PROTOCOL_BITTORRENT, ndpi_struct, NDPI_LOG_TRACE, "FlashGet detected\n");
|
||||
ndpi_add_connection_as_bittorrent(ndpi_struct, flow,
|
||||
NDPI_PROTOCOL_UNSAFE_DETECTION, NDPI_PROTOCOL_PLAIN_DETECTION/* , */
|
||||
/* NDPI_CORRELATED_PROTOCOL */);
|
||||
return 1;
|
||||
|
||||
}
|
||||
|
||||
/* answer to this pattern is not possible to implement asymmetrically */
|
||||
while (1) {
|
||||
if (len < 50 || ptr[0] == 0x0d) {
|
||||
goto ndpi_end_bt_tracker_check;
|
||||
}
|
||||
if (memcmp(ptr, "info_hash=", 10) == 0) {
|
||||
break;
|
||||
}
|
||||
len--;
|
||||
ptr++;
|
||||
}
|
||||
|
||||
NDPI_LOG(NDPI_PROTOCOL_BITTORRENT, ndpi_struct,
|
||||
NDPI_LOG_TRACE, " BT stat: tracker info hash found\n");
|
||||
|
||||
/* len is > 50, so save operation here */
|
||||
len -= 10;
|
||||
ptr += 10;
|
||||
|
||||
/* parse bt hash */
|
||||
for (a = 0; a < 20; a++) {
|
||||
if (len < 3) {
|
||||
goto ndpi_end_bt_tracker_check;
|
||||
}
|
||||
if (*ptr == '%') {
|
||||
u_int8_t x1 = 0xFF;
|
||||
u_int8_t x2 = 0xFF;
|
||||
|
||||
|
||||
if (ptr[1] >= '0' && ptr[1] <= '9') {
|
||||
x1 = ptr[1] - '0';
|
||||
}
|
||||
if (ptr[1] >= 'a' && ptr[1] <= 'f') {
|
||||
x1 = 10 + ptr[1] - 'a';
|
||||
}
|
||||
if (ptr[1] >= 'A' && ptr[1] <= 'F') {
|
||||
x1 = 10 + ptr[1] - 'A';
|
||||
}
|
||||
|
||||
if (ptr[2] >= '0' && ptr[2] <= '9') {
|
||||
x2 = ptr[2] - '0';
|
||||
}
|
||||
if (ptr[2] >= 'a' && ptr[2] <= 'f') {
|
||||
x2 = 10 + ptr[2] - 'a';
|
||||
}
|
||||
if (ptr[2] >= 'A' && ptr[2] <= 'F') {
|
||||
x2 = 10 + ptr[2] - 'A';
|
||||
}
|
||||
|
||||
if (x1 == 0xFF || x2 == 0xFF) {
|
||||
goto ndpi_end_bt_tracker_check;
|
||||
}
|
||||
ptr += 3;
|
||||
len -= 3;
|
||||
} else if (*ptr >= 32 && *ptr < 127) {
|
||||
ptr++;
|
||||
len--;
|
||||
} else {
|
||||
goto ndpi_end_bt_tracker_check;
|
||||
}
|
||||
}
|
||||
|
||||
NDPI_LOG(NDPI_PROTOCOL_BITTORRENT, ndpi_struct,
|
||||
NDPI_LOG_TRACE, " BT stat: tracker info hash parsed\n");
|
||||
ndpi_add_connection_as_bittorrent(ndpi_struct, flow,
|
||||
NDPI_PROTOCOL_SAFE_DETECTION, NDPI_PROTOCOL_PLAIN_DETECTION/* , */
|
||||
/* NDPI_CORRELATED_PROTOCOL */);
|
||||
return 1;
|
||||
}
|
||||
|
||||
ndpi_end_bt_tracker_check:
|
||||
|
||||
if (packet->payload_packet_len == 80) {
|
||||
/* Warez 80 Bytes Packet
|
||||
* +----------------+---------------+-----------------+-----------------+
|
||||
* |20 BytesPattern | 32 Bytes Value| 12 BytesPattern | 16 Bytes Data |
|
||||
* +----------------+---------------+-----------------+-----------------+
|
||||
* 20 BytesPattern : 4c 00 00 00 ff ff ff ff 57 00 00 00 00 00 00 00 20 00 00 00
|
||||
* 12 BytesPattern : 28 23 00 00 01 00 00 00 10 00 00 00
|
||||
* */
|
||||
static const char pattern_20_bytes[20] = { 0x4c, 0x00, 0x00, 0x00, 0xff,
|
||||
0xff, 0xff, 0xff, 0x57, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00
|
||||
};
|
||||
static const char pattern_12_bytes[12] = { 0x28, 0x23, 0x00, 0x00, 0x01,
|
||||
0x00, 0x00, 0x00, 0x10, 0x00,
|
||||
0x00, 0x00
|
||||
};
|
||||
|
||||
/* did not see this pattern anywhere */
|
||||
if ((memcmp(&packet->payload[0], pattern_20_bytes, 20) == 0)
|
||||
&& (memcmp(&packet->payload[52], pattern_12_bytes, 12) == 0)) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_BITTORRENT, ndpi_struct,
|
||||
NDPI_LOG_TRACE, "BT: Warez - Plain BitTorrent protocol detected\n");
|
||||
ndpi_add_connection_as_bittorrent(ndpi_struct, flow,
|
||||
NDPI_PROTOCOL_SAFE_DETECTION, NDPI_PROTOCOL_PLAIN_DETECTION/* , */
|
||||
/* NDPI_REAL_PROTOCOL */);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
else if (packet->payload_packet_len > 50) {
|
||||
if (memcmp(packet->payload, "GET", 3) == 0) {
|
||||
|
||||
ndpi_parse_packet_line_info(ndpi_struct, flow);
|
||||
/* haven't fount this pattern anywhere */
|
||||
if (packet->host_line.ptr != NULL
|
||||
&& packet->host_line.len >= 9 && memcmp(packet->host_line.ptr, "ip2p.com:", 9) == 0) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_BITTORRENT,
|
||||
ndpi_struct, NDPI_LOG_TRACE,
|
||||
"BT: Warez - Plain BitTorrent protocol detected due to Host: ip2p.com: pattern\n");
|
||||
ndpi_add_connection_as_bittorrent(ndpi_struct, flow,
|
||||
NDPI_PROTOCOL_SAFE_DETECTION, NDPI_PROTOCOL_WEBSEED_DETECTION/* , */
|
||||
/* NDPI_CORRELATED_PROTOCOL */);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*Search for BitTorrent commands*/
|
||||
static void ndpi_int_search_bittorrent_tcp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
{
|
||||
|
||||
struct ndpi_packet_struct *packet = &flow->packet;
|
||||
|
||||
if (packet->payload_packet_len == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (flow->bittorrent_stage == 0 && packet->payload_packet_len != 0) {
|
||||
/* exclude stage 0 detection from next run */
|
||||
flow->bittorrent_stage = 1;
|
||||
if (ndpi_int_search_bittorrent_tcp_zero(ndpi_struct, flow) != 0) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_BITTORRENT, ndpi_struct, NDPI_LOG_DEBUG,
|
||||
"stage 0 has detected something, returning\n");
|
||||
return;
|
||||
}
|
||||
|
||||
NDPI_LOG(NDPI_PROTOCOL_BITTORRENT, ndpi_struct, NDPI_LOG_DEBUG,
|
||||
"stage 0 has no direct detection, fall through\n");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
void ndpi_search_bittorrent(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
{
|
||||
struct ndpi_packet_struct *packet = &flow->packet;
|
||||
int no_bittorrent = 0;
|
||||
|
||||
/* This is broadcast */
|
||||
if(packet->iph
|
||||
&& (((packet->iph->saddr == 0xFFFFFFFF) || (packet->iph->daddr == 0xFFFFFFFF))
|
||||
|| (packet->udp
|
||||
&& ((ntohs(packet->udp->source) == 3544) /* teredo.c */
|
||||
|| (ntohs(packet->udp->dest) == 3544))))) {
|
||||
NDPI_ADD_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, NDPI_PROTOCOL_BITTORRENT);
|
||||
return;
|
||||
}
|
||||
|
||||
if (packet->detected_protocol_stack[0] != NDPI_PROTOCOL_BITTORRENT) {
|
||||
/* check for tcp retransmission here */
|
||||
|
||||
if ((packet->tcp != NULL)
|
||||
&& (packet->tcp_retransmission == 0 || packet->num_retried_bytes)) {
|
||||
ndpi_int_search_bittorrent_tcp(ndpi_struct, flow);
|
||||
}
|
||||
else if(packet->udp != NULL) {
|
||||
char *bt_search = "BT-SEARCH * HTTP/1.1\r\n";
|
||||
|
||||
if((ntohs(packet->udp->source) < 1024)
|
||||
|| (ntohs(packet->udp->dest) < 1024) /* High ports only */)
|
||||
return;
|
||||
|
||||
/*
|
||||
Check for uTP http://www.bittorrent.org/beps/bep_0029.html
|
||||
|
||||
wireshark/epan/dissectors/packet-bt-utp.c
|
||||
*/
|
||||
|
||||
if(packet->payload_packet_len >= 23 /* min header size */) {
|
||||
if(strncmp((const char*)packet->payload, bt_search, strlen(bt_search)) == 0) {
|
||||
ndpi_add_connection_as_bittorrent(ndpi_struct, flow,
|
||||
NDPI_PROTOCOL_SAFE_DETECTION, NDPI_PROTOCOL_PLAIN_DETECTION/* , */
|
||||
/* NDPI_REAL_PROTOCOL */);
|
||||
return;
|
||||
} else {
|
||||
/* Check if this is protocol v0 */
|
||||
u_int8_t v0_extension = packet->payload[17];
|
||||
u_int8_t v0_flags = packet->payload[18];
|
||||
|
||||
/* Check if this is protocol v1 */
|
||||
u_int8_t v1_version = packet->payload[0];
|
||||
u_int8_t v1_extension = packet->payload[1];
|
||||
u_int32_t v1_window_size = *((u_int32_t*)&packet->payload[12]);
|
||||
|
||||
if((packet->payload[0]== 0x60)
|
||||
&& (packet->payload[1]== 0x0)
|
||||
&& (packet->payload[2]== 0x0)
|
||||
&& (packet->payload[3]== 0x0)
|
||||
&& (packet->payload[4]== 0x0)) {
|
||||
/* Heuristic */
|
||||
goto bittorrent_found;
|
||||
} else if(((v1_version & 0x0f) == 1)
|
||||
&& ((v1_version >> 4) < 5 /* ST_NUM_STATES */)
|
||||
&& (v1_extension < 3 /* EXT_NUM_EXT */)
|
||||
&& (v1_window_size < 32768 /* 32k */)
|
||||
) {
|
||||
goto bittorrent_found;
|
||||
} else if((v0_flags < 6 /* ST_NUM_STATES */)
|
||||
&& (v0_extension < 3 /* EXT_NUM_EXT */)) {
|
||||
u_int32_t ts = ntohl(*((u_int32_t*)&(packet->payload[4])));
|
||||
u_int32_t now;
|
||||
|
||||
#ifndef __KERNEL__
|
||||
now = (u_int32_t)time(NULL);
|
||||
#else
|
||||
struct timespec t;
|
||||
|
||||
getnstimeofday(&t);
|
||||
now = t.tv_sec;
|
||||
#endif
|
||||
|
||||
if((ts < (now+86400)) && (ts > (now-86400))) {
|
||||
goto bittorrent_found;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
flow->bittorrent_stage++;
|
||||
|
||||
if(flow->bittorrent_stage < 10) {
|
||||
if(packet->payload_packet_len > 19 /* min size */) {
|
||||
if(ndpi_strnstr((const char *)packet->payload, ":target20:", packet->payload_packet_len)
|
||||
|| ndpi_strnstr((const char *)packet->payload, ":find_node1:", packet->payload_packet_len)
|
||||
|| ndpi_strnstr((const char *)packet->payload, "d1:ad2:id20:", packet->payload_packet_len)
|
||||
|| ndpi_strnstr((const char *)packet->payload, ":info_hash20:", packet->payload_packet_len)
|
||||
|| ndpi_strnstr((const char *)packet->payload, ":filter64", packet->payload_packet_len)
|
||||
|| ndpi_strnstr((const char *)packet->payload, "d1:rd2:id20:", packet->payload_packet_len)
|
||||
|| ndpi_strnstr((const char *)packet->payload, "BitTorrent protocol", packet->payload_packet_len)
|
||||
) {
|
||||
bittorrent_found:
|
||||
NDPI_LOG(NDPI_PROTOCOL_BITTORRENT,
|
||||
ndpi_struct, NDPI_LOG_TRACE, "BT: plain BitTorrent protocol detected\n");
|
||||
ndpi_add_connection_as_bittorrent(ndpi_struct, flow,
|
||||
NDPI_PROTOCOL_SAFE_DETECTION, NDPI_PROTOCOL_PLAIN_DETECTION/* , */
|
||||
/* NDPI_REAL_PROTOCOL */);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
NDPI_ADD_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, NDPI_PROTOCOL_BITTORRENT);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void init_bittorrent_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask)
|
||||
{
|
||||
ndpi_set_bitmask_protocol_detection("BitTorrent", ndpi_struct, detection_bitmask, *id,
|
||||
NDPI_PROTOCOL_BITTORRENT,
|
||||
ndpi_search_bittorrent,
|
||||
NDPI_SELECTION_BITMASK_PROTOCOL_TCP_OR_UDP,
|
||||
SAVE_DETECTION_BITMASK_AS_UNKNOWN,
|
||||
ADD_TO_DETECTION_BITMASK);
|
||||
*id += 1;
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,509 +0,0 @@
|
||||
/*
|
||||
* btlib.c
|
||||
*
|
||||
* Copyright (C) 2011-15 - ntop.org
|
||||
* Contributed by Vitaly Lavrov <vel21ripn@gmail.com>
|
||||
*
|
||||
* This file is part of nDPI, an open source deep packet inspection
|
||||
* library based on the OpenDPI and PACE technology by ipoque GmbH
|
||||
*
|
||||
* nDPI is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* nDPI is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with nDPI. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef NDPI_NO_STD_INC
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <strings.h>
|
||||
|
||||
typedef unsigned char u_int8_t;
|
||||
typedef unsigned short int u_int16_t;
|
||||
typedef unsigned long long int u_int64_t;
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <arpa/inet.h>
|
||||
#endif
|
||||
|
||||
typedef signed long long int i_int64_t;
|
||||
|
||||
#include "btlib.h"
|
||||
|
||||
#ifndef __KERNEL__
|
||||
|
||||
int bt_parse_debug = 0;
|
||||
|
||||
static char *printXb(char *s,const u_int8_t *b,int l) {
|
||||
int i;
|
||||
for(i=0; i < l; i++)
|
||||
snprintf(&s[i*2],41,"%02x",b[i]);
|
||||
return s;
|
||||
}
|
||||
|
||||
static char *print20b(char *s,const u_int8_t *b) {
|
||||
snprintf(s,41,"%08x%08x%08x%08x%08x",
|
||||
htonl(*(u_int32_t*)b),
|
||||
htonl(*(u_int32_t*)(b+4)),
|
||||
htonl(*(u_int32_t*)(b+8)),
|
||||
htonl(*(u_int32_t*)(b+12)),
|
||||
htonl(*(u_int32_t*)(b+16)));
|
||||
return s;
|
||||
}
|
||||
|
||||
static char *print_id_ip_p(char *s, const struct bt_nodes_data *b) {
|
||||
u_int8_t *p = (void*)b;
|
||||
print20b(s,b->id);
|
||||
snprintf(s+40,39," %d.%d.%d.%d:%u",
|
||||
p[20], p[21], p[22], p[23], htons(b->port));
|
||||
return s;
|
||||
}
|
||||
|
||||
static char *print_ip_p(char *s, const struct bt_ipv4p *b,int np) {
|
||||
const u_int8_t *p = (const void*)b;
|
||||
snprintf(s,39,!np ? "%d.%d.%d.%d:%u":"%d.%d.%d.%d",
|
||||
p[0], p[1], p[2], p[3], htons(b->port));
|
||||
return s;
|
||||
}
|
||||
|
||||
static char *print_ip6_p(char *s, const struct bt_ipv6p *b,int np) {
|
||||
u_int16_t *p = (void*)b;
|
||||
snprintf(s,79,!np ? "%x:%x:%x:%x:%x:%x:%x:%x.%u":"%x:%x:%x:%x:%x:%x:%x:%x",
|
||||
htons(p[0]), htons(p[1]), htons(p[2]), htons(p[3]),
|
||||
htons(p[4]), htons(p[5]), htons(p[6]), htons(p[7]),
|
||||
htons(b->port));
|
||||
return s;
|
||||
}
|
||||
|
||||
static char *print_id_ip6_p(char *s,const struct bt_nodes6_data *b) {
|
||||
return print_ip6_p(s,(struct bt_ipv6p *)&b->ip,0);
|
||||
}
|
||||
|
||||
|
||||
void dump_bt_proto_struct(struct bt_parse_protocol *p) {
|
||||
char b20h[128];
|
||||
int i;
|
||||
|
||||
if(p->y_e && p->e_msg) {
|
||||
printf("Error %s/%u\n", p->e_msg, p->e_len);
|
||||
}
|
||||
if(p->y_q) {
|
||||
printf("Query ");
|
||||
if(p->q_ping) printf("ping\n");
|
||||
if(p->q_g_peers) printf("get_peers\n");
|
||||
if(p->q_f_node) printf("find_node\n");
|
||||
if(p->q_a_peer) printf("announce_peer\n");
|
||||
}
|
||||
if(p->y_r)
|
||||
printf("Reply\n");
|
||||
|
||||
if(p->t) printf("\tt\t%llx\n",p->t);
|
||||
if(p->v) printf("\tv\t%llx\n",p->v);
|
||||
if(p->ip) printf("\tIP\t%s\n",print_ip_p(b20h,p->ip,0));
|
||||
|
||||
if(p->a.port) printf("\tport\t%d\n",htons(p->a.port));
|
||||
if(p->a.id) printf("\tID\t%s\n",print20b(b20h,p->a.id));
|
||||
if(p->a.target) printf("\ttarget\t%s\n",print20b(b20h,p->a.target));
|
||||
if(p->a.token) printf("\ttoken\t%s\n",printXb(b20h,p->a.token,p->a.t_len));
|
||||
if(p->a.info_hash) printf("\ti_hash\t%s\n",print20b(b20h,p->a.info_hash));
|
||||
if(p->a.name && p->a.name_len) printf("\tname\t%.*s\n",p->a.name_len,p->a.name);
|
||||
|
||||
if(p->r.ip) printf("\tip\t%s\n",print_ip_p(b20h,p->r.ip,1));
|
||||
if(p->r.port) printf("\tport\t%d\n",htons(p->r.port));
|
||||
if(p->r.id) printf("\tID\t%s\n",print20b(b20h,p->r.id));
|
||||
if(p->r.token) printf("\ttoken\t%s\n",printXb(b20h,p->r.token,p->r.t_len));
|
||||
if(p->r.name && p->r.name_len) printf("\tname\t%.*s\n",p->r.name_len,p->r.name);
|
||||
if(p->r.values && p->r.nv) {
|
||||
struct bt_ipv4p2 *n = (struct bt_ipv4p2 *)p->r.values;
|
||||
for(i=0;i < p->r.nv; i++,n++) {
|
||||
printf("\tvalues\t%s\n", print_ip_p(b20h,&n->d,0));
|
||||
}
|
||||
}
|
||||
if(p->r.values6 && p->r.nv6) {
|
||||
struct bt_ipv6p2 *n = (struct bt_ipv6p2 *)p->r.values6;
|
||||
for(i=0;i < p->r.nv6; i++,n++) {
|
||||
printf("\tvalues6\t%s\n", print_ip6_p(b20h,&n->d,0));
|
||||
}
|
||||
}
|
||||
if(p->r.nodes && p->r.nn) {
|
||||
for(i=0;i < p->r.nn; i++) {
|
||||
printf("\tnodes\t%s\n",print_id_ip_p(b20h,p->r.nodes+i));
|
||||
}
|
||||
}
|
||||
if(p->r.nodes6 && p->r.nn6) {
|
||||
for(i=0;i < p->r.nn6; i++) {
|
||||
printf("\tnodes6\t%s\n",print_id_ip6_p(b20h,p->r.nodes6+i));
|
||||
}
|
||||
}
|
||||
|
||||
if(p->peers && p->n_peers) {
|
||||
for(i=0;i < p->n_peers; i++) {
|
||||
printf("\tpeers\t%s\n",print_ip_p(b20h,p->peers+i,0));
|
||||
}
|
||||
}
|
||||
|
||||
if(p->interval) printf("\tinterval\t%d\n",p->interval);
|
||||
if(p->min_interval) printf("\tmin interval\t%d\n",p->min_interval);
|
||||
}
|
||||
|
||||
static void _print_safe_str(char *msg,char *k,const u_int8_t *s,size_t l) {
|
||||
static const char *th="0123456789abcdef?";
|
||||
char *buf = (char*)ndpi_malloc((size_t)(l*3+2));
|
||||
|
||||
int sl = l;
|
||||
if(buf) {
|
||||
char *b = buf;
|
||||
for(;l > 0; s++,l--) {
|
||||
if(*s < ' ' || *s >= 127) {
|
||||
*b++ = '%';
|
||||
*b++ = th[(*s >> 4)&0xf];
|
||||
*b++ = th[(*s)&0xf];
|
||||
} else *b++ = *s;
|
||||
}
|
||||
*b = 0;
|
||||
|
||||
printf("%s %s %s len %d\n",msg,k,buf ? buf:"",sl);
|
||||
|
||||
ndpi_free(buf);
|
||||
}
|
||||
}
|
||||
|
||||
static void print_safe_str(char *msg,bt_parse_data_cb_t *cbd) {
|
||||
_print_safe_str(msg,cbd->buf,cbd->v.s.s,cbd->v.s.l);
|
||||
}
|
||||
#define DEBUG_TRACE(cmd) { if(bt_parse_debug) cmd; }
|
||||
#else
|
||||
#define DEBUG_TRACE(cmd,args...)
|
||||
#endif /* __KERNEL */
|
||||
|
||||
#define STREQ(a,b) !strcmp(a,b)
|
||||
|
||||
|
||||
void cb_data(bt_parse_data_cb_t *cbd,int *ret) {
|
||||
struct bt_parse_protocol *p = &(cbd->p);
|
||||
const u_int8_t *s;
|
||||
const char *ss;
|
||||
|
||||
if(cbd->t == 0) return;
|
||||
|
||||
if(cbd->t == 1) {
|
||||
|
||||
DEBUG_TRACE(printf("%s %lld\n",cbd->buf,cbd->v.i));
|
||||
|
||||
if(STREQ(cbd->buf,"a.port")) {
|
||||
p->a.port = (u_int16_t)(cbd->v.i & 0xffff);
|
||||
return;
|
||||
}
|
||||
if(
|
||||
STREQ(cbd->buf,"a.implied_port") ||
|
||||
STREQ(cbd->buf,"a.noseed") ||
|
||||
STREQ(cbd->buf,"a.scrape") ||
|
||||
STREQ(cbd->buf,"a.seed") ||
|
||||
STREQ(cbd->buf,"a.vote")
|
||||
) {
|
||||
return;
|
||||
}
|
||||
if(STREQ(cbd->buf,"r.port") || STREQ(cbd->buf,"r.p")) {
|
||||
p->r.port = (u_int16_t)(cbd->v.i & 0xffff);
|
||||
return;
|
||||
}
|
||||
if(STREQ(cbd->buf,"interval")) {
|
||||
p->interval = (u_int16_t)(cbd->v.i & 0x7fffffff);
|
||||
p->h_int = 1;
|
||||
return;
|
||||
}
|
||||
if(STREQ(cbd->buf,"min interval")) {
|
||||
p->min_interval = (u_int16_t)(cbd->v.i & 0x7fffffff);
|
||||
p->h_mint = 1;
|
||||
return;
|
||||
}
|
||||
DEBUG_TRACE(printf("UNKNOWN %s %lld\n",cbd->buf,cbd->v.i));
|
||||
return;
|
||||
}
|
||||
if(cbd->t != 2) {
|
||||
DEBUG_TRACE(printf("BUG! t=%d %s\n",cbd->t,cbd->buf));
|
||||
return;
|
||||
}
|
||||
DEBUG_TRACE(print_safe_str("",cbd));
|
||||
|
||||
s = cbd->v.s.s;
|
||||
ss = (char *)s;
|
||||
|
||||
if(STREQ(cbd->buf,"a.id")) {
|
||||
p->a.id = s;
|
||||
return;
|
||||
}
|
||||
if(STREQ(cbd->buf,"a.info_hash")) {
|
||||
p->a.info_hash = s;
|
||||
return;
|
||||
}
|
||||
if(STREQ(cbd->buf,"a.target")) {
|
||||
p->a.target = s;
|
||||
return;
|
||||
}
|
||||
if(STREQ(cbd->buf,"a.token")) {
|
||||
p->a.token = s;
|
||||
p->a.t_len = cbd->v.s.l;
|
||||
return;
|
||||
}
|
||||
if(STREQ(cbd->buf,"a.name")) {
|
||||
p->a.name = s;
|
||||
p->a.name_len = cbd->v.s.l;
|
||||
return;
|
||||
}
|
||||
if(STREQ(cbd->buf,"a.want")) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(STREQ(cbd->buf,"r.id")) {
|
||||
p->r.id = s;
|
||||
return;
|
||||
}
|
||||
if(STREQ(cbd->buf,"r.ip")) {
|
||||
if(cbd->v.s.l != 4) {
|
||||
DEBUG_TRACE(printf("BUG! r.ip with port\n"));
|
||||
return;
|
||||
}
|
||||
p->r.ip = (struct bt_ipv4p *)s;
|
||||
return;
|
||||
}
|
||||
if(STREQ(cbd->buf,"r.token")) {
|
||||
p->r.token = s;
|
||||
p->r.t_len = cbd->v.s.l;
|
||||
return;
|
||||
}
|
||||
if(STREQ(cbd->buf,"r.values")) {
|
||||
if(cbd->v.s.l == 18) {
|
||||
if(!p->r.values6) {
|
||||
p->r.values6 = s;
|
||||
p->r.nv6 = 1;
|
||||
} else {
|
||||
if(s != p->r.values6+(p->r.nv6*21)) {
|
||||
// DEBUG_TRACE(printf("BUG! r.values6 not in list! %08x %08x \n", p->r.values+(p->r.nv6*21),s));
|
||||
return;
|
||||
}
|
||||
p->r.nv6++;
|
||||
}
|
||||
return;
|
||||
}
|
||||
if(cbd->v.s.l == 6) {
|
||||
if(!p->r.values) {
|
||||
p->r.values = s;
|
||||
p->r.nv = 1;
|
||||
} else {
|
||||
if(s != p->r.values+(p->r.nv*8)) {
|
||||
// DEBUG_TRACE(printf("BUG! r.values not in list! %u \n",s-p->r.values+(p->r.nv*8)));
|
||||
return;
|
||||
}
|
||||
p->r.nv++;
|
||||
}
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if(STREQ(cbd->buf,"r.name") || STREQ(cbd->buf,"r.n")) {
|
||||
p->r.name = s;
|
||||
p->r.name_len = cbd->v.s.l;
|
||||
return;
|
||||
}
|
||||
if(STREQ(cbd->buf,"r.nodes")) {
|
||||
if(cbd->v.s.l % 26) {
|
||||
// DEBUG_TRACE(printf("BUG! r.nodes length %d not %% 26\n",cbd->v.s.l));
|
||||
return;
|
||||
}
|
||||
p->r.nodes = (struct bt_nodes_data *)s;
|
||||
p->r.nn = cbd->v.s.l / 26;
|
||||
return;
|
||||
}
|
||||
if(STREQ(cbd->buf,"r.nodes6")) {
|
||||
if(cbd->v.s.l % 38) {
|
||||
// DEBUG_TRACE(printf("BUG! r.nodes length %d not %% 38\n",cbd->v.s.l));
|
||||
return;
|
||||
}
|
||||
p->r.nodes6 = (struct bt_nodes6_data *)s;
|
||||
p->r.nn6 = cbd->v.s.l / 38;
|
||||
return;
|
||||
}
|
||||
|
||||
if(cbd->buf[0] == 'y' && !cbd->buf[1]) {
|
||||
if(cbd->v.s.l != 1) return;
|
||||
if(*ss == 'q') { p->y_q = 1; return; }
|
||||
if(*ss == 'r') { p->y_r = 1; return; }
|
||||
if(*ss == 'e') { p->y_e = 1; return; }
|
||||
return;
|
||||
}
|
||||
if(cbd->buf[0] == 'q' && !cbd->buf[1]) {
|
||||
if(!strncmp(ss,"announce_peer",13)) {
|
||||
p->q_a_peer = 1;
|
||||
return;
|
||||
}
|
||||
if(!strncmp(ss,"find_node",9)) {
|
||||
p->q_f_node = 1;
|
||||
return;
|
||||
}
|
||||
if(!strncmp(ss,"get_peers",9)) {
|
||||
p->q_g_peers = 1;
|
||||
return;
|
||||
}
|
||||
if(!strncmp(ss,"ping",4)) {
|
||||
p->q_ping = 1;
|
||||
return;
|
||||
}
|
||||
if(!strncmp(ss,"vote",4)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
if(STREQ(cbd->buf,"ip")) {
|
||||
if(cbd->v.s.l != 6) {
|
||||
// DEBUG_TRACE(printf("BUG! r.ip w/o port\n"));
|
||||
}
|
||||
p->ip = (struct bt_ipv4p *)s;
|
||||
p->h_ip = 1;
|
||||
return;
|
||||
}
|
||||
if(STREQ(cbd->buf,"peers")) {
|
||||
if(cbd->v.s.l % 6) return;
|
||||
p->peers = (struct bt_ipv4p *)s;
|
||||
p->n_peers = cbd->v.s.l / 6;
|
||||
return;
|
||||
}
|
||||
if((*cbd->buf == 't' || *cbd->buf == 'v') && !cbd->buf[1]) {
|
||||
u_int64_t d = *(u_int64_t*)s;
|
||||
switch(cbd->v.s.l) {
|
||||
case 2:
|
||||
d &= 0xffffllu; d = htons(d); break;
|
||||
case 4:
|
||||
d &= 0xffffffffllu; d = htonl(d); break;
|
||||
case 6:
|
||||
d &= 0xffffffffffffllu; d = (htonl(d & 0xffffffff) << 16) |
|
||||
(htons(d >> 32) & 0xffff);
|
||||
break;
|
||||
case 8: d = ((u_int64_t)htonl(d & 0xffffffff) << 32) |
|
||||
htonl(d >> 32);
|
||||
break;
|
||||
default: d = 0;
|
||||
}
|
||||
if(*cbd->buf == 'v') cbd->p.v = d;
|
||||
else cbd->p.t = d;
|
||||
return;
|
||||
}
|
||||
|
||||
if(cbd->buf[0] == 'e' && !cbd->buf[0]) {
|
||||
p->e_msg = s;
|
||||
p->e_len = cbd->v.s.l;
|
||||
return;
|
||||
}
|
||||
// DEBUG_TRACE(print_safe_str("UKNOWN",cbd));
|
||||
}
|
||||
|
||||
|
||||
const u_int8_t *bt_decode(const u_int8_t *b, size_t *l, int *ret, bt_parse_data_cb_t *cbd) {
|
||||
|
||||
unsigned int n=0,neg=0;
|
||||
i_int64_t d = 0;
|
||||
register u_int8_t c;
|
||||
|
||||
if(*l == 0) return NULL;
|
||||
if(cbd->level > BDEC_MAXDEPT) goto bad_data;
|
||||
c = *b++; (*l)--;
|
||||
if(c == 'i') { // integer
|
||||
while(*l) {
|
||||
c = *b++; (*l)--;
|
||||
n++;
|
||||
if(c == '-') {
|
||||
if(n != 1) goto bad_data;
|
||||
n--;
|
||||
neg=1;
|
||||
continue;
|
||||
}
|
||||
if(c >= '0' && c <= '9') {
|
||||
if(c == '0' && n > 1 && !d && *b != 'e') goto bad_data;
|
||||
d *= 10;
|
||||
d += c-'0';
|
||||
continue;
|
||||
}
|
||||
if(c != 'e') goto bad_data;
|
||||
break;
|
||||
}
|
||||
if(neg) d=-d;
|
||||
cbd->t = 1;
|
||||
cbd->v.i = neg ? -d:d;
|
||||
return b;
|
||||
}
|
||||
if(c >= '1' && c <= '9') { //string
|
||||
d=c-'0';
|
||||
while(*l) {
|
||||
c = *b++; (*l)--;
|
||||
n++;
|
||||
if(c >= '0' && c <= '9') {
|
||||
if(c == '0' && n > 1 && d == 0) goto bad_data;
|
||||
d *= 10;
|
||||
d += c-'0';
|
||||
continue;
|
||||
}
|
||||
if(c != ':') goto bad_data;
|
||||
break;
|
||||
}
|
||||
if(d > *l) goto bad_data;
|
||||
cbd->t = 2;
|
||||
cbd->v.s.s = b;
|
||||
cbd->v.s.l = d;
|
||||
b += d;
|
||||
*l -= d;
|
||||
return b;
|
||||
}
|
||||
if(c == 'l') {
|
||||
cbd->level++;
|
||||
do {
|
||||
b = bt_decode(b,l,ret,cbd);
|
||||
if(*ret < 0 || *l == 0) goto bad_data;
|
||||
cb_data(cbd,ret);
|
||||
if(*ret < 0) goto bad_data;
|
||||
cbd->t = 0;
|
||||
} while (*b != 'e' && *l != 0);
|
||||
b++; (*l)--;
|
||||
cbd->level--;
|
||||
return b;
|
||||
}
|
||||
if(c == 'd') {
|
||||
cbd->level++;
|
||||
do {
|
||||
char *ls = cbd->buf + strlen(cbd->buf);
|
||||
int l1 = ls != cbd->buf ? 1:0;
|
||||
if(!(*b >= '1' && *b <= '9')) goto bad_data;
|
||||
b = bt_decode(b,l,ret,cbd);
|
||||
if(*ret < 0 || *l == 0) goto bad_data;
|
||||
if(ls+cbd->v.s.l+l1 < &cbd->buf[sizeof(cbd->buf)-1]) {
|
||||
if(l1) ls[0]='.';
|
||||
strncpy(ls+l1,(char *)cbd->v.s.s,cbd->v.s.l);
|
||||
ls[cbd->v.s.l+l1]=0;
|
||||
}
|
||||
b = bt_decode(b,l,ret,cbd);
|
||||
if(*ret < 0 || *l == 0) goto bad_data;
|
||||
cb_data(cbd,ret);
|
||||
if(*ret < 0) goto bad_data;
|
||||
cbd->t = 0;
|
||||
*ls = 0;
|
||||
} while (*b != 'e' && l != 0);
|
||||
|
||||
b++; (*l)--;
|
||||
cbd->level--;
|
||||
return b;
|
||||
}
|
||||
bad_data:
|
||||
*ret=-1;
|
||||
return b;
|
||||
}
|
||||
@@ -1,147 +0,0 @@
|
||||
/*
|
||||
* btlib.h
|
||||
*
|
||||
* Copyright (C) 2011-15 - ntop.org
|
||||
* Contributed by Vitaly Lavrov <vel21ripn@gmail.com>
|
||||
*
|
||||
* This file is part of nDPI, an open source deep packet inspection
|
||||
* library based on the OpenDPI and PACE technology by ipoque GmbH
|
||||
*
|
||||
* nDPI is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* nDPI is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with nDPI. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#define BDEC_MAXDEPT 8
|
||||
|
||||
|
||||
typedef struct b_elem_s {
|
||||
const u_int8_t *s;
|
||||
size_t l;
|
||||
} b_elem_s_t;
|
||||
|
||||
struct __attribute__ ((__packed__)) bt_nodes_data {
|
||||
u_int8_t id[20] ;
|
||||
u_int32_t ip;
|
||||
u_int16_t port;
|
||||
};
|
||||
|
||||
struct __attribute__ ((__packed__)) bt_ipv4p {
|
||||
u_int32_t ip;
|
||||
u_int16_t port;
|
||||
};
|
||||
|
||||
struct __attribute__ ((__packed__)) bt_ipv4p2 {
|
||||
struct bt_ipv4p d;
|
||||
u_int8_t pad[2];
|
||||
};
|
||||
|
||||
struct __attribute__ ((__packed__)) bt_nodes6_data {
|
||||
u_int8_t id[20] ;
|
||||
u_int32_t ip[4];
|
||||
u_int16_t port;
|
||||
};
|
||||
|
||||
struct __attribute__ ((__packed__)) bt_ipv6p {
|
||||
u_int32_t ip[4];
|
||||
u_int16_t port;
|
||||
};
|
||||
|
||||
struct __attribute__ ((__packed__)) bt_ipv6p2 {
|
||||
struct bt_ipv6p d;
|
||||
u_int8_t pad[3];
|
||||
};
|
||||
|
||||
/*
|
||||
|
||||
a.id S r.id S
|
||||
a.info_hash S r.ip ipv4
|
||||
a.name S r.nodes x(id,ipv4,port)
|
||||
-a.noseed 0|1 r.n S name of file
|
||||
a.port N r.p port
|
||||
-a.scrape 0|1 r.token S
|
||||
-a.seed 0|1 r.values x(ipv4,port)
|
||||
a.target S
|
||||
a.token S -a.vote N
|
||||
-a.want n4|n6
|
||||
|
||||
q announce_peer q find_node
|
||||
q get_peers q ping
|
||||
-q vote
|
||||
|
||||
ip ipv4+port interval N
|
||||
min interval N peers x(ipv4,port)
|
||||
t 2/4/8b v 4/6b
|
||||
|
||||
e S y e y r y q
|
||||
|
||||
*/
|
||||
|
||||
struct bt_parse_protocol {
|
||||
u_int16_t y_e:1, y_r:1, y_q:1,
|
||||
q_a_peer:1,q_f_node:1,
|
||||
q_g_peers:1,q_ping:1,
|
||||
h_int:1,h_mint:1,h_ip:1;
|
||||
struct {
|
||||
const u_int8_t *id, // 20
|
||||
*info_hash, // 20
|
||||
*target, // 20
|
||||
*token, // 20|8
|
||||
*name; // varlen
|
||||
u_int16_t name_len;
|
||||
u_int16_t port;
|
||||
u_int16_t t_len;
|
||||
} a;
|
||||
struct {
|
||||
const u_int8_t *id, // 20
|
||||
*token, // 20|8
|
||||
*values, // (6+2)*x
|
||||
*values6, // (18_3)*x
|
||||
*name; // varlen
|
||||
struct bt_ipv4p *ip;
|
||||
struct bt_nodes_data *nodes;
|
||||
struct bt_nodes6_data *nodes6;
|
||||
u_int16_t name_len;
|
||||
u_int16_t nn; // nodes num
|
||||
u_int16_t nv; // valuse num
|
||||
u_int16_t nn6; // nodes6 num
|
||||
u_int16_t nv6; // valuse6 num
|
||||
u_int16_t port;
|
||||
u_int16_t t_len;
|
||||
} r;
|
||||
int interval,min_interval;
|
||||
struct bt_ipv4p *peers;
|
||||
int n_peers;
|
||||
struct bt_ipv4p *ip;
|
||||
const u_int8_t *e_msg;
|
||||
u_int16_t e_len;
|
||||
u_int64_t t,v;
|
||||
};
|
||||
|
||||
typedef struct bt_parse_data_cb {
|
||||
struct bt_parse_protocol p;
|
||||
char buf[64];
|
||||
int level;
|
||||
int t;
|
||||
union {
|
||||
i_int64_t i;
|
||||
b_elem_s_t s;
|
||||
} v;
|
||||
} bt_parse_data_cb_t;
|
||||
|
||||
#ifndef __KERNEL__
|
||||
extern int bt_parse_debug;
|
||||
void dump_bt_proto_struct(struct bt_parse_protocol *p);
|
||||
#endif
|
||||
const u_int8_t *bt_decode(const u_int8_t *b, size_t *l, int *ret, bt_parse_data_cb_t *cbd);
|
||||
|
||||
@@ -1,83 +0,0 @@
|
||||
/*
|
||||
* ciscovpn.c
|
||||
* Copyright (C) 2013 by Remy Mudingay <mudingay@ill.fr>
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include "ndpi_protocols.h"
|
||||
#ifdef NDPI_PROTOCOL_CISCOVPN
|
||||
|
||||
static void ndpi_int_ciscovpn_add_connection(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
{
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_CISCOVPN, NDPI_PROTOCOL_UNKNOWN);
|
||||
}
|
||||
|
||||
void ndpi_search_ciscovpn(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
{
|
||||
struct ndpi_packet_struct *packet = &flow->packet;
|
||||
u_int16_t udport = 0, usport = 0;
|
||||
u_int16_t tdport = 0, tsport = 0;
|
||||
|
||||
|
||||
NDPI_LOG(NDPI_PROTOCOL_CISCOVPN, ndpi_struct, NDPI_LOG_DEBUG, "search CISCOVPN.\n");
|
||||
|
||||
if(packet->tcp != NULL) {
|
||||
tsport = ntohs(packet->tcp->source), tdport = ntohs(packet->tcp->dest);
|
||||
NDPI_LOG(NDPI_PROTOCOL_CISCOVPN, ndpi_struct, NDPI_LOG_DEBUG, "calculated CISCOVPN over tcp ports.\n");
|
||||
}
|
||||
if(packet->udp != NULL) {
|
||||
usport = ntohs(packet->udp->source), udport = ntohs(packet->udp->dest);
|
||||
NDPI_LOG(NDPI_PROTOCOL_CISCOVPN, ndpi_struct, NDPI_LOG_DEBUG, "calculated CISCOVPN over udp ports.\n");
|
||||
}
|
||||
|
||||
if((tdport == 10000 && tsport == 10000) ||
|
||||
((tsport == 443 || tdport == 443) &&
|
||||
(packet->payload[0] == 0x17 &&
|
||||
packet->payload[1] == 0x01 &&
|
||||
packet->payload[2] == 0x00 &&
|
||||
packet->payload[3] == 0x00)
|
||||
)
|
||||
)
|
||||
|
||||
{
|
||||
/* This is a good query 17010000*/
|
||||
NDPI_LOG(NDPI_PROTOCOL_CISCOVPN, ndpi_struct, NDPI_LOG_DEBUG, "found CISCOVPN.\n");
|
||||
ndpi_int_ciscovpn_add_connection(ndpi_struct, flow);
|
||||
}
|
||||
else if(
|
||||
(
|
||||
(usport == 10000 && udport == 10000)
|
||||
&&
|
||||
(packet->payload[0] == 0xfe &&
|
||||
packet->payload[1] == 0x57 &&
|
||||
packet->payload[2] == 0x7e &&
|
||||
packet->payload[3] == 0x2b)
|
||||
)
|
||||
)
|
||||
{
|
||||
|
||||
|
||||
/* This is a good query fe577e2b */
|
||||
NDPI_LOG(NDPI_PROTOCOL_CISCOVPN, ndpi_struct, NDPI_LOG_DEBUG, "found CISCOVPN.\n");
|
||||
ndpi_int_ciscovpn_add_connection(ndpi_struct, flow);
|
||||
} else {
|
||||
NDPI_LOG(NDPI_PROTOCOL_CISCOVPN, ndpi_struct, NDPI_LOG_DEBUG, "exclude CISCOVPN.\n");
|
||||
NDPI_ADD_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, NDPI_PROTOCOL_CISCOVPN);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
void init_ciscovpn_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask)
|
||||
{
|
||||
ndpi_set_bitmask_protocol_detection("CiscoVPN", ndpi_struct, detection_bitmask, *id,
|
||||
NDPI_PROTOCOL_CISCOVPN,
|
||||
ndpi_search_ciscovpn,
|
||||
NDPI_SELECTION_BITMASK_PROTOCOL_TCP_OR_UDP_WITH_PAYLOAD,
|
||||
SAVE_DETECTION_BITMASK_AS_UNKNOWN,
|
||||
ADD_TO_DETECTION_BITMASK);
|
||||
*id += 1;
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,105 +0,0 @@
|
||||
/*
|
||||
* citrix.c
|
||||
*
|
||||
* Copyright (C) 2012-15 - ntop.org
|
||||
*
|
||||
* This file is part of nDPI, an open source deep packet inspection
|
||||
* library based on the OpenDPI and PACE technology by ipoque GmbH
|
||||
*
|
||||
* nDPI is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* nDPI is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with nDPI. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include "ndpi_api.h"
|
||||
|
||||
#ifdef NDPI_PROTOCOL_CITRIX
|
||||
|
||||
/* ************************************ */
|
||||
|
||||
static void ndpi_check_citrix(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
{
|
||||
struct ndpi_packet_struct *packet = &flow->packet;
|
||||
u_int32_t payload_len = packet->payload_packet_len;
|
||||
|
||||
#if 0
|
||||
printf("[len=%u][%02X %02X %02X %02X]\n", payload_len,
|
||||
packet->payload[0] & 0xFF,
|
||||
packet->payload[1] & 0xFF,
|
||||
packet->payload[2] & 0xFF,
|
||||
packet->payload[3] & 0xFF);
|
||||
#endif
|
||||
|
||||
if(packet->tcp != NULL) {
|
||||
flow->l4.tcp.citrix_packet_id++;
|
||||
|
||||
if((flow->l4.tcp.citrix_packet_id == 3)
|
||||
/* We have seen the 3-way handshake */
|
||||
&& flow->l4.tcp.seen_syn
|
||||
&& flow->l4.tcp.seen_syn_ack
|
||||
&& flow->l4.tcp.seen_ack) {
|
||||
if(payload_len == 6) {
|
||||
char citrix_header[] = { 0x07, 0x07, 0x49, 0x43, 0x41, 0x00 };
|
||||
|
||||
if(memcmp(packet->payload, citrix_header, sizeof(citrix_header)) == 0) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_CITRIX, ndpi_struct, NDPI_LOG_DEBUG, "Found citrix.\n");
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_CITRIX, NDPI_PROTOCOL_UNKNOWN);
|
||||
}
|
||||
|
||||
return;
|
||||
} else if(payload_len > 4) {
|
||||
char citrix_header[] = { 0x1a, 0x43, 0x47, 0x50, 0x2f, 0x30, 0x31 };
|
||||
|
||||
if((memcmp(packet->payload, citrix_header, sizeof(citrix_header)) == 0)
|
||||
|| (ndpi_strnstr((const char *)packet->payload, "Citrix.TcpProxyService", payload_len) != NULL)) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_CITRIX, ndpi_struct, NDPI_LOG_DEBUG, "Found citrix.\n");
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_CITRIX, NDPI_PROTOCOL_UNKNOWN);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
NDPI_ADD_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, NDPI_PROTOCOL_CITRIX);
|
||||
} else if(flow->l4.tcp.citrix_packet_id > 3)
|
||||
NDPI_ADD_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, NDPI_PROTOCOL_CITRIX);
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void ndpi_search_citrix(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
{
|
||||
struct ndpi_packet_struct *packet = &flow->packet;
|
||||
|
||||
NDPI_LOG(NDPI_PROTOCOL_CITRIX, ndpi_struct, NDPI_LOG_DEBUG, "citrix detection...\n");
|
||||
|
||||
/* skip marked packets */
|
||||
if(packet->detected_protocol_stack[0] != NDPI_PROTOCOL_CITRIX)
|
||||
ndpi_check_citrix(ndpi_struct, flow);
|
||||
}
|
||||
|
||||
|
||||
void init_citrix_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask)
|
||||
{
|
||||
ndpi_set_bitmask_protocol_detection("Citrix", ndpi_struct, detection_bitmask, *id,
|
||||
NDPI_PROTOCOL_CITRIX,
|
||||
ndpi_search_citrix,
|
||||
NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP_WITH_PAYLOAD_WITHOUT_RETRANSMISSION,
|
||||
SAVE_DETECTION_BITMASK_AS_UNKNOWN,
|
||||
ADD_TO_DETECTION_BITMASK);
|
||||
*id += 1;
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,54 +0,0 @@
|
||||
/*
|
||||
* collectd.c
|
||||
*
|
||||
* Copyright (C) 2014 - ntop.org
|
||||
*
|
||||
* nDPI is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* nDPI is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with nDPI. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include "ndpi_protocols.h"
|
||||
|
||||
#ifdef NDPI_PROTOCOL_COLLECTD
|
||||
|
||||
void ndpi_search_collectd(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
{
|
||||
struct ndpi_packet_struct *packet = &flow->packet;
|
||||
u_int len = 0;
|
||||
|
||||
NDPI_LOG(NDPI_PROTOCOL_COLLECTD, ndpi_struct, NDPI_LOG_DEBUG, "search collectd.\n");
|
||||
|
||||
if (packet->udp == NULL) return;
|
||||
|
||||
|
||||
while(len < packet->payload_packet_len) {
|
||||
// u_int16_t elem_type = ntohs(*((u_int16_t*)&packet->payload[len]));
|
||||
u_int16_t elem_len = ntohs(*((u_int16_t*)&packet->payload[len+2]));
|
||||
|
||||
if (elem_len == 0) break;
|
||||
|
||||
len += elem_len;
|
||||
}
|
||||
|
||||
if(len == packet->payload_packet_len) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_COLLECTD, ndpi_struct, NDPI_LOG_DEBUG, "found COLLECTD.\n");
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_COLLECTD, NDPI_PROTOCOL_UNKNOWN);
|
||||
} else {
|
||||
NDPI_LOG(NDPI_PROTOCOL_COLLECTD, ndpi_struct, NDPI_LOG_DEBUG, "exclude COLLECTD.\n");
|
||||
NDPI_ADD_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, NDPI_PROTOCOL_COLLECTD);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,60 +0,0 @@
|
||||
/*
|
||||
* corba.c
|
||||
*
|
||||
* Copyright (C) 2013 Remy Mudingay <mudingay@ill.fr>
|
||||
*
|
||||
* This module is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This module is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include "ndpi_api.h"
|
||||
|
||||
#ifdef NDPI_PROTOCOL_CORBA
|
||||
static void ndpi_int_corba_add_connection(struct ndpi_detection_module_struct
|
||||
*ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
{
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_CORBA, NDPI_PROTOCOL_UNKNOWN);
|
||||
}
|
||||
void ndpi_search_corba(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
{
|
||||
struct ndpi_packet_struct *packet = &flow->packet;
|
||||
|
||||
NDPI_LOG(NDPI_PROTOCOL_CORBA, ndpi_struct, NDPI_LOG_DEBUG, "search for CORBA.\n");
|
||||
if(packet->tcp != NULL) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_CORBA, ndpi_struct, NDPI_LOG_DEBUG, "calculating CORBA over tcp.\n");
|
||||
/* Corba General Inter-ORB Protocol -> GIOP */
|
||||
if ((packet->payload_packet_len >= 24 && packet->payload_packet_len <= 144) &&
|
||||
memcmp(packet->payload, "GIOP", 4) == 0) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_CORBA, ndpi_struct, NDPI_LOG_DEBUG, "found corba.\n");
|
||||
ndpi_int_corba_add_connection(ndpi_struct, flow);
|
||||
}
|
||||
} else {
|
||||
NDPI_LOG(NDPI_PROTOCOL_CORBA, ndpi_struct, NDPI_LOG_DEBUG, "exclude CORBA.\n");
|
||||
NDPI_ADD_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, NDPI_PROTOCOL_CORBA);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void init_corba_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask)
|
||||
{
|
||||
ndpi_set_bitmask_protocol_detection("Corba", ndpi_struct, detection_bitmask, *id,
|
||||
NDPI_PROTOCOL_CORBA,
|
||||
ndpi_search_corba,
|
||||
NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP_WITH_PAYLOAD_WITHOUT_RETRANSMISSION,
|
||||
SAVE_DETECTION_BITMASK_AS_UNKNOWN,
|
||||
ADD_TO_DETECTION_BITMASK);
|
||||
*id += 1;
|
||||
}
|
||||
#endif
|
||||
@@ -1,94 +0,0 @@
|
||||
/*
|
||||
* crossfire.c
|
||||
*
|
||||
* Copyright (C) 2012-15 - ntop.org
|
||||
*
|
||||
* This file is part of nDPI, an open source deep packet inspection
|
||||
* library based on the OpenDPI and PACE technology by ipoque GmbH
|
||||
*
|
||||
* nDPI is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* nDPI is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with nDPI. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/* include files */
|
||||
#include "ndpi_protocols.h"
|
||||
#ifdef NDPI_PROTOCOL_CROSSFIRE
|
||||
|
||||
|
||||
static void ndpi_int_crossfire_add_connection(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
struct ndpi_flow_struct *flow/* , ndpi_protocol_type_t protocol_type */)
|
||||
{
|
||||
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_CROSSFIRE, NDPI_PROTOCOL_UNKNOWN);
|
||||
}
|
||||
|
||||
void ndpi_search_crossfire_tcp_udp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
{
|
||||
struct ndpi_packet_struct *packet = &flow->packet;
|
||||
|
||||
// struct ndpi_id_struct *src=ndpi_struct->src;
|
||||
// struct ndpi_id_struct *dst=ndpi_struct->dst;
|
||||
|
||||
NDPI_LOG(NDPI_PROTOCOL_CROSSFIRE, ndpi_struct, NDPI_LOG_DEBUG, "search crossfire.\n");
|
||||
|
||||
|
||||
if (packet->udp != 0) {
|
||||
if (packet->payload_packet_len == 25 && get_u_int32_t(packet->payload, 0) == ntohl(0xc7d91999)
|
||||
&& get_u_int16_t(packet->payload, 4) == ntohs(0x0200)
|
||||
&& get_u_int16_t(packet->payload, 22) == ntohs(0x7d00)
|
||||
) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_CROSSFIRE, ndpi_struct, NDPI_LOG_DEBUG, "Crossfire: found udp packet.\n");
|
||||
ndpi_int_crossfire_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
|
||||
} else if (packet->tcp != 0) {
|
||||
|
||||
if (packet->payload_packet_len > 4 && memcmp(packet->payload, "GET /", 5) == 0) {
|
||||
ndpi_parse_packet_line_info(ndpi_struct, flow);
|
||||
if (packet->parsed_lines == 8
|
||||
&& (packet->line[0].ptr != NULL && packet->line[0].len >= 30
|
||||
&& (memcmp(&packet->payload[5], "notice/login_big", 16) == 0
|
||||
|| memcmp(&packet->payload[5], "notice/login_small", 18) == 0))
|
||||
&& memcmp(&packet->payload[packet->line[0].len - 19], "/index.asp HTTP/1.", 18) == 0
|
||||
&& (packet->host_line.ptr != NULL && packet->host_line.len >= 13
|
||||
&& (memcmp(packet->host_line.ptr, "crossfire", 9) == 0
|
||||
|| memcmp(packet->host_line.ptr, "www.crossfire", 13) == 0))
|
||||
) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_CROSSFIRE, ndpi_struct, NDPI_LOG_DEBUG, "Crossfire: found HTTP request.\n");
|
||||
ndpi_int_crossfire_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
NDPI_LOG(NDPI_PROTOCOL_CROSSFIRE, ndpi_struct, NDPI_LOG_DEBUG, "exclude crossfire.\n");
|
||||
NDPI_ADD_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, NDPI_PROTOCOL_CROSSFIRE);
|
||||
}
|
||||
|
||||
|
||||
void init_crossfire_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask)
|
||||
{
|
||||
ndpi_set_bitmask_protocol_detection("Crossfire", ndpi_struct, detection_bitmask, *id,
|
||||
NDPI_PROTOCOL_CROSSFIRE,
|
||||
ndpi_search_crossfire_tcp_udp,
|
||||
NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP_OR_UDP_WITH_PAYLOAD_WITHOUT_RETRANSMISSION,
|
||||
SAVE_DETECTION_BITMASK_AS_UNKNOWN,
|
||||
ADD_TO_DETECTION_BITMASK);
|
||||
*id += 1;
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,66 +0,0 @@
|
||||
/*
|
||||
* dcerpc.c
|
||||
*
|
||||
* Copyright (C) 2011-13 by ntop.org
|
||||
*
|
||||
* This file is part of nDPI, an open source deep packet inspection
|
||||
* library based on the OpenDPI and PACE technology by ipoque GmbH
|
||||
*
|
||||
* nDPI is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* nDPI is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with nDPI. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include "ndpi_api.h"
|
||||
|
||||
#ifdef NDPI_PROTOCOL_DCERPC
|
||||
|
||||
static void ndpi_int_dcerpc_add_connection(struct ndpi_detection_module_struct
|
||||
*ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
{
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_DCERPC, NDPI_PROTOCOL_UNKNOWN);
|
||||
}
|
||||
|
||||
void ndpi_search_dcerpc(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
{
|
||||
struct ndpi_packet_struct *packet = &flow->packet;
|
||||
|
||||
|
||||
if((packet->tcp != NULL)
|
||||
&& (packet->payload_packet_len > 64)
|
||||
&& ((ntohs(packet->tcp->source) == 135) || (ntohs(packet->tcp->dest) == 135))
|
||||
&& (packet->payload[0] == 0x05) /* version 5 */
|
||||
&& (packet->payload[2] < 16) /* Packet type */
|
||||
) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_DCERPC, ndpi_struct, NDPI_LOG_DEBUG, "DCERPC match\n");
|
||||
ndpi_int_dcerpc_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
|
||||
NDPI_ADD_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, NDPI_PROTOCOL_DCERPC);
|
||||
}
|
||||
|
||||
|
||||
void init_dcerpc_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask)
|
||||
{
|
||||
ndpi_set_bitmask_protocol_detection("DCE_RPC", ndpi_struct, detection_bitmask, *id,
|
||||
NDPI_PROTOCOL_DCERPC,
|
||||
ndpi_search_dcerpc,
|
||||
NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP_WITH_PAYLOAD_WITHOUT_RETRANSMISSION,
|
||||
SAVE_DETECTION_BITMASK_AS_UNKNOWN,
|
||||
ADD_TO_DETECTION_BITMASK);
|
||||
*id += 1;
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,73 +0,0 @@
|
||||
/*
|
||||
* dhcp.c
|
||||
*
|
||||
* Copyright (C) 2009-2011 by ipoque GmbH
|
||||
* Copyright (C) 2011-15 - ntop.org
|
||||
*
|
||||
* This file is part of nDPI, an open source deep packet inspection
|
||||
* library based on the OpenDPI and PACE technology by ipoque GmbH
|
||||
*
|
||||
* nDPI is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* nDPI is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with nDPI. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include "ndpi_protocols.h"
|
||||
|
||||
#ifdef NDPI_PROTOCOL_DHCP
|
||||
|
||||
static void ndpi_int_dhcp_add_connection(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
{
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_DHCP, NDPI_PROTOCOL_UNKNOWN);
|
||||
}
|
||||
|
||||
|
||||
void ndpi_search_dhcp_udp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
{
|
||||
struct ndpi_packet_struct *packet = &flow->packet;
|
||||
|
||||
// struct ndpi_id_struct *src=ndpi_struct->src;
|
||||
// struct ndpi_id_struct *dst=ndpi_struct->dst;
|
||||
|
||||
/* this detection also works for asymmetric dhcp traffic */
|
||||
|
||||
/*check standard DHCP 0.0.0.0:68 -> 255.255.255.255:67 */
|
||||
if (packet->payload_packet_len >= 244 && (packet->udp->source == htons(67)
|
||||
|| packet->udp->source == htons(68))
|
||||
&& (packet->udp->dest == htons(67) || packet->udp->dest == htons(68))
|
||||
&& get_u_int32_t(packet->payload, 236) == htonl(0x63825363)
|
||||
&& get_u_int16_t(packet->payload, 240) == htons(0x3501)) {
|
||||
|
||||
NDPI_LOG(NDPI_PROTOCOL_DHCP, ndpi_struct, NDPI_LOG_DEBUG, "DHCP request\n");
|
||||
|
||||
ndpi_int_dhcp_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
|
||||
NDPI_ADD_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, NDPI_PROTOCOL_DHCP);
|
||||
}
|
||||
|
||||
|
||||
void init_dhcp_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask)
|
||||
{
|
||||
ndpi_set_bitmask_protocol_detection("DHCP", ndpi_struct, detection_bitmask, *id,
|
||||
NDPI_PROTOCOL_DHCP,
|
||||
ndpi_search_dhcp_udp,
|
||||
NDPI_SELECTION_BITMASK_PROTOCOL_UDP_WITH_PAYLOAD,
|
||||
SAVE_DETECTION_BITMASK_AS_UNKNOWN,
|
||||
ADD_TO_DETECTION_BITMASK);
|
||||
*id += 1;
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,72 +0,0 @@
|
||||
/*
|
||||
* dhcpv6.c
|
||||
*
|
||||
* Copyright (C) 2009-2011 by ipoque GmbH
|
||||
* Copyright (C) 2011-15 - ntop.org
|
||||
*
|
||||
* This file is part of nDPI, an open source deep packet inspection
|
||||
* library based on the OpenDPI and PACE technology by ipoque GmbH
|
||||
*
|
||||
* nDPI is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* nDPI is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with nDPI. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/* include files */
|
||||
|
||||
#include "ndpi_protocols.h"
|
||||
#ifdef NDPI_PROTOCOL_DHCPV6
|
||||
|
||||
static void ndpi_int_dhcpv6_add_connection(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
struct ndpi_flow_struct *flow)
|
||||
{
|
||||
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_DHCPV6, NDPI_PROTOCOL_UNKNOWN);
|
||||
}
|
||||
|
||||
void ndpi_search_dhcpv6_udp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
{
|
||||
struct ndpi_packet_struct *packet = &flow->packet;
|
||||
|
||||
// struct ndpi_id_struct *src=ndpi_struct->src;
|
||||
// struct ndpi_id_struct *dst=ndpi_struct->dst;
|
||||
|
||||
if (packet->payload_packet_len >= 4 &&
|
||||
(packet->udp->source == htons(546) || packet->udp->source == htons(547)) &&
|
||||
(packet->udp->dest == htons(546) || packet->udp->dest == htons(547)) &&
|
||||
packet->payload[0] >= 1 && packet->payload[0] <= 13) {
|
||||
|
||||
NDPI_LOG(NDPI_PROTOCOL_DHCPV6, ndpi_struct, NDPI_LOG_DEBUG, "DHCPv6 detected.\n");
|
||||
ndpi_int_dhcpv6_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
|
||||
NDPI_LOG(NDPI_PROTOCOL_DHCPV6, ndpi_struct, NDPI_LOG_DEBUG, "DHCPv6 excluded.\n");
|
||||
NDPI_ADD_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, NDPI_PROTOCOL_DHCPV6);
|
||||
}
|
||||
|
||||
|
||||
void init_dhcpv6_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask)
|
||||
{
|
||||
ndpi_set_bitmask_protocol_detection("DHCPV6", ndpi_struct, detection_bitmask, *id,
|
||||
NDPI_PROTOCOL_DHCPV6,
|
||||
ndpi_search_dhcpv6_udp,
|
||||
NDPI_SELECTION_BITMASK_PROTOCOL_V6_UDP_WITH_PAYLOAD,
|
||||
SAVE_DETECTION_BITMASK_AS_UNKNOWN,
|
||||
ADD_TO_DETECTION_BITMASK);
|
||||
*id += 1;
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,487 +0,0 @@
|
||||
/*
|
||||
* directconnect.c
|
||||
*
|
||||
* Copyright (C) 2009-2011 by ipoque GmbH
|
||||
* Copyright (C) 2011-15 - ntop.org
|
||||
*
|
||||
* This file is part of nDPI, an open source deep packet inspection
|
||||
* library based on the OpenDPI and PACE technology by ipoque GmbH
|
||||
*
|
||||
* nDPI is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* nDPI is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with nDPI. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include "ndpi_protocols.h"
|
||||
#ifdef NDPI_PROTOCOL_DIRECTCONNECT
|
||||
|
||||
//#define NDPI_DEBUG_DIRECTCONNECT
|
||||
//#define NDPI_DIRECTCONNECT_PORT_DEBUG
|
||||
//#define NDPI_DEBUG_DIRECTCONNECT_CONN
|
||||
|
||||
|
||||
#define DIRECT_CONNECT_TYPE_HUB 0
|
||||
#define DIRECT_CONNECT_TYPE_PEER 1
|
||||
#define DIRECT_CONNECT_ADC_PEER 2
|
||||
|
||||
static u_int32_t skip_unknown_headers(const u_int8_t * payload, u_int32_t payload_len, u_int32_t pos)
|
||||
{
|
||||
u_int32_t i = pos;
|
||||
while (i < payload_len && payload[i] != 0x0a)
|
||||
i++;
|
||||
|
||||
i++;
|
||||
return i;
|
||||
|
||||
}
|
||||
|
||||
static u_int16_t parse_binf_message(struct ndpi_detection_module_struct
|
||||
*ndpi_struct, const u_int8_t * payload, int payload_len)
|
||||
{
|
||||
u_int32_t i = 4;
|
||||
u_int16_t bytes_read = 0;
|
||||
u_int16_t ssl_port = 0;
|
||||
while (i < payload_len) {
|
||||
i = skip_unknown_headers(payload, payload_len, i);
|
||||
if ((i + 30) < payload_len) {
|
||||
if (memcmp(&payload[i], "DCTM", 4) == 0) {
|
||||
if (memcmp(&payload[i + 15], "ADCS", 4) == 0) {
|
||||
ssl_port = ntohs_ndpi_bytestream_to_number(&payload[i + 25], 5, &bytes_read);
|
||||
NDPI_LOG(NDPI_PROTOCOL_DIRECTCONNECT, ndpi_struct,
|
||||
NDPI_LOG_DEBUG, "directconnect ssl port parsed %d", ssl_port);
|
||||
|
||||
}
|
||||
}
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
return ssl_port;
|
||||
}
|
||||
|
||||
static void ndpi_int_directconnect_add_connection(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
struct ndpi_flow_struct *flow,
|
||||
const u_int8_t connection_type)
|
||||
{
|
||||
|
||||
struct ndpi_packet_struct *packet = &flow->packet;
|
||||
|
||||
struct ndpi_id_struct *src = flow->src;
|
||||
struct ndpi_id_struct *dst = flow->dst;
|
||||
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_DIRECTCONNECT, NDPI_PROTOCOL_UNKNOWN);
|
||||
|
||||
if (src != NULL) {
|
||||
src->directconnect_last_safe_access_time = packet->tick_timestamp;
|
||||
if (connection_type == DIRECT_CONNECT_TYPE_PEER) {
|
||||
if (packet->tcp != NULL
|
||||
&& flow->setup_packet_direction != packet->packet_direction && src->detected_directconnect_port == 0) {
|
||||
src->detected_directconnect_port = packet->tcp->source;
|
||||
NDPI_LOG(NDPI_PROTOCOL_DIRECTCONNECT, ndpi_struct,
|
||||
NDPI_LOG_DEBUG, "directconnect tcp PORT %u for src\n", ntohs(src->detected_directconnect_port));
|
||||
}
|
||||
if (packet->udp != NULL && src->detected_directconnect_udp_port == 0) {
|
||||
src->detected_directconnect_udp_port = packet->udp->source;
|
||||
NDPI_LOG(NDPI_PROTOCOL_DIRECTCONNECT, ndpi_struct,
|
||||
NDPI_LOG_DEBUG, "directconnect udp PORT %u for src\n", ntohs(src->detected_directconnect_port));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
if (dst != NULL) {
|
||||
dst->directconnect_last_safe_access_time = packet->tick_timestamp;
|
||||
if (connection_type == DIRECT_CONNECT_TYPE_PEER) {
|
||||
if (packet->tcp != NULL
|
||||
&& flow->setup_packet_direction == packet->packet_direction && dst->detected_directconnect_port == 0) {
|
||||
/* DST PORT MARKING CAN LEAD TO PORT MISSDETECTIONS
|
||||
* seen at large customer http servers, where someone has send faked DC tcp packets
|
||||
* to the server
|
||||
*/
|
||||
|
||||
/*
|
||||
dst->detected_directconnect_port = packet->tcp->dest;
|
||||
NDPI_LOG (NDPI_PROTOCOL_DIRECTCONNECT, ndpi_struct,
|
||||
NDPI_LOG_DEBUG, "directconnect tcp PORT %u for dst\n",
|
||||
ntohs (dst->detected_directconnect_port));
|
||||
*/
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void ndpi_search_directconnect_tcp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
{
|
||||
struct ndpi_packet_struct *packet = &flow->packet;
|
||||
|
||||
struct ndpi_id_struct *src = flow->src;
|
||||
struct ndpi_id_struct *dst = flow->dst;
|
||||
|
||||
if (flow->detected_protocol_stack[0] == NDPI_PROTOCOL_DIRECTCONNECT) {
|
||||
if (packet->payload_packet_len >= 40 && memcmp(&packet->payload[0], "BINF", 4) == 0) {
|
||||
u_int16_t ssl_port = 0;
|
||||
ssl_port = parse_binf_message(ndpi_struct, &packet->payload[4], packet->payload_packet_len - 4);
|
||||
if (dst != NULL && ssl_port) {
|
||||
dst->detected_directconnect_ssl_port = ssl_port;
|
||||
}
|
||||
if (src != NULL && ssl_port) {
|
||||
src->detected_directconnect_ssl_port = ssl_port;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
if ((packet->payload_packet_len >= 38 && packet->payload_packet_len <= 42)
|
||||
&& memcmp(&packet->payload[0], "DCTM", 4) == 0 && memcmp(&packet->payload[15], "ADCS", 4) == 0) {
|
||||
u_int16_t bytes_read = 0;
|
||||
if (dst != NULL) {
|
||||
dst->detected_directconnect_ssl_port =
|
||||
ntohs_ndpi_bytestream_to_number(&packet->payload[25], 5, &bytes_read);
|
||||
NDPI_LOG(NDPI_PROTOCOL_DIRECTCONNECT, ndpi_struct,
|
||||
NDPI_LOG_DEBUG, "directconnect ssl port parsed %d", ntohs(dst->detected_directconnect_ssl_port));
|
||||
}
|
||||
if (src != NULL) {
|
||||
src->detected_directconnect_ssl_port =
|
||||
ntohs_ndpi_bytestream_to_number(&packet->payload[25], 5, &bytes_read);
|
||||
NDPI_LOG(NDPI_PROTOCOL_DIRECTCONNECT, ndpi_struct,
|
||||
NDPI_LOG_DEBUG, "directconnect ssl port parsed %d", ntohs(src->detected_directconnect_ssl_port));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
return;
|
||||
|
||||
}
|
||||
if (src != NULL) {
|
||||
if (src->detected_directconnect_port == packet->tcp->source) {
|
||||
if ((u_int32_t)
|
||||
(packet->tick_timestamp -
|
||||
src->directconnect_last_safe_access_time) < ndpi_struct->directconnect_connection_ip_tick_timeout) {
|
||||
ndpi_int_change_protocol(ndpi_struct, flow, NDPI_PROTOCOL_DIRECTCONNECT, NDPI_PROTOCOL_UNKNOWN);
|
||||
src->directconnect_last_safe_access_time = packet->tick_timestamp;
|
||||
NDPI_LOG(NDPI_PROTOCOL_DIRECTCONNECT, ndpi_struct,
|
||||
NDPI_LOG_DEBUG, "marking using dc port\n %d", ntohs(src->detected_directconnect_port));
|
||||
return;
|
||||
} else {
|
||||
src->detected_directconnect_port = 0;
|
||||
NDPI_LOG(NDPI_PROTOCOL_DIRECTCONNECT, ndpi_struct,
|
||||
NDPI_LOG_DEBUG, "resetting src port due to timeout");
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (src->detected_directconnect_ssl_port == packet->tcp->dest) {
|
||||
if ((u_int32_t)
|
||||
(packet->tick_timestamp -
|
||||
src->directconnect_last_safe_access_time) < ndpi_struct->directconnect_connection_ip_tick_timeout) {
|
||||
ndpi_int_change_protocol(ndpi_struct, flow, NDPI_PROTOCOL_DIRECTCONNECT, NDPI_PROTOCOL_UNKNOWN);
|
||||
src->directconnect_last_safe_access_time = packet->tick_timestamp;
|
||||
NDPI_LOG(NDPI_PROTOCOL_DIRECTCONNECT, ndpi_struct,
|
||||
NDPI_LOG_DEBUG, "marking using dc port\n %d", ntohs(src->detected_directconnect_ssl_port));
|
||||
return;
|
||||
} else {
|
||||
src->detected_directconnect_ssl_port = 0;
|
||||
NDPI_LOG(NDPI_PROTOCOL_DIRECTCONNECT, ndpi_struct,
|
||||
NDPI_LOG_DEBUG, "resetting src port due to timeout");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (dst != NULL) {
|
||||
if (dst->detected_directconnect_port == packet->tcp->dest) {
|
||||
if ((u_int32_t)
|
||||
(packet->tick_timestamp -
|
||||
dst->directconnect_last_safe_access_time) < ndpi_struct->directconnect_connection_ip_tick_timeout) {
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_DIRECTCONNECT, NDPI_PROTOCOL_UNKNOWN);
|
||||
dst->directconnect_last_safe_access_time = packet->tick_timestamp;
|
||||
NDPI_LOG(NDPI_PROTOCOL_DIRECTCONNECT, ndpi_struct,
|
||||
NDPI_LOG_DEBUG, "marking using dc port\n %d", ntohs(dst->detected_directconnect_port));
|
||||
return;
|
||||
} else {
|
||||
dst->detected_directconnect_port = 0;
|
||||
NDPI_LOG(NDPI_PROTOCOL_DIRECTCONNECT, ndpi_struct,
|
||||
NDPI_LOG_DEBUG, "resetting dst port due to timeout");
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (dst->detected_directconnect_ssl_port == packet->tcp->dest) {
|
||||
if ((u_int32_t)
|
||||
(packet->tick_timestamp -
|
||||
dst->directconnect_last_safe_access_time) < ndpi_struct->directconnect_connection_ip_tick_timeout) {
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_DIRECTCONNECT, NDPI_PROTOCOL_UNKNOWN);
|
||||
dst->directconnect_last_safe_access_time = packet->tick_timestamp;
|
||||
NDPI_LOG(NDPI_PROTOCOL_DIRECTCONNECT, ndpi_struct,
|
||||
NDPI_LOG_DEBUG, "marking using dc port\n %d", ntohs(dst->detected_directconnect_ssl_port));
|
||||
|
||||
return;
|
||||
} else {
|
||||
dst->detected_directconnect_ssl_port = 0;
|
||||
NDPI_LOG(NDPI_PROTOCOL_DIRECTCONNECT, ndpi_struct,
|
||||
NDPI_LOG_DEBUG, "resetting dst port due to timeout");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (flow->directconnect_stage == 0) {
|
||||
|
||||
if (packet->payload_packet_len > 6) {
|
||||
if (packet->payload[0] == '$'
|
||||
&& packet->payload[packet->payload_packet_len - 1] == '|'
|
||||
&& (memcmp(&packet->payload[1], "Lock ", 5) == 0)) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_DIRECTCONNECT, ndpi_struct,
|
||||
NDPI_LOG_DEBUG, "maybe first dc connect to hub detected\n");
|
||||
flow->directconnect_stage = 1;
|
||||
return;
|
||||
}
|
||||
if (packet->payload_packet_len > 7
|
||||
&& packet->payload[0] == '$'
|
||||
&& packet->payload[packet->payload_packet_len - 1] == '|'
|
||||
&& (memcmp(&packet->payload[1], "MyNick ", 7) == 0)) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_DIRECTCONNECT, ndpi_struct,
|
||||
NDPI_LOG_DEBUG, "maybe first dc connect between peers detected\n");
|
||||
flow->directconnect_stage = 2;
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
if (packet->payload_packet_len >= 11) {
|
||||
/* did not see this pattern in any trace */
|
||||
if (memcmp(&packet->payload[0], "HSUP ADBAS0", 11) == 0
|
||||
|| memcmp(&packet->payload[0], "HSUP ADBASE", 11) == 0) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_DIRECTCONNECT, ndpi_struct,
|
||||
NDPI_LOG_DEBUG, "found directconnect HSUP ADBAS0 E\n");
|
||||
ndpi_int_directconnect_add_connection(ndpi_struct, flow, DIRECT_CONNECT_TYPE_HUB);
|
||||
return;
|
||||
/* did not see this pattern in any trace */
|
||||
} else if (memcmp(&packet->payload[0], "CSUP ADBAS0", 11) == 0 ||
|
||||
memcmp(&packet->payload[0], "CSUP ADBASE", 11) == 0) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_DIRECTCONNECT, ndpi_struct,
|
||||
NDPI_LOG_DEBUG, "found directconnect CSUP ADBAS0 E\n");
|
||||
ndpi_int_directconnect_add_connection(ndpi_struct, flow, DIRECT_CONNECT_ADC_PEER);
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} else if (flow->directconnect_stage == 1) {
|
||||
if (packet->payload_packet_len >= 11) {
|
||||
/* did not see this pattern in any trace */
|
||||
if (memcmp(&packet->payload[0], "HSUP ADBAS0", 11) == 0
|
||||
|| memcmp(&packet->payload[0], "HSUP ADBASE", 11) == 0) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_DIRECTCONNECT, ndpi_struct,
|
||||
NDPI_LOG_DEBUG, "found directconnect HSUP ADBAS E in second packet\n");
|
||||
ndpi_int_directconnect_add_connection(ndpi_struct, flow, DIRECT_CONNECT_TYPE_HUB);
|
||||
|
||||
return;
|
||||
/* did not see this pattern in any trace */
|
||||
} else if (memcmp(&packet->payload[0], "CSUP ADBAS0", 11) == 0 ||
|
||||
memcmp(&packet->payload[0], "CSUP ADBASE", 11) == 0) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_DIRECTCONNECT, ndpi_struct,
|
||||
NDPI_LOG_DEBUG, "found directconnect HSUP ADBAS0 E in second packet\n");
|
||||
ndpi_int_directconnect_add_connection(ndpi_struct, flow, DIRECT_CONNECT_ADC_PEER);
|
||||
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
}
|
||||
/* get client hello answer or server message */
|
||||
if (packet->payload_packet_len > 6) {
|
||||
if ((packet->payload[0] == '$' || packet->payload[0] == '<')
|
||||
&& packet->payload[packet->payload_packet_len - 1] == '|') {
|
||||
NDPI_LOG(NDPI_PROTOCOL_DIRECTCONNECT, ndpi_struct, NDPI_LOG_DEBUG, "second dc detected\n");
|
||||
ndpi_int_directconnect_add_connection(ndpi_struct, flow, DIRECT_CONNECT_TYPE_HUB);
|
||||
|
||||
return;
|
||||
} else {
|
||||
NDPI_LOG(NDPI_PROTOCOL_DIRECTCONNECT, ndpi_struct, NDPI_LOG_DEBUG, "second dc not detected\n");
|
||||
}
|
||||
|
||||
}
|
||||
} else if (flow->directconnect_stage == 2) {
|
||||
/* get client hello answer or server message */
|
||||
if (packet->payload_packet_len > 6) {
|
||||
if (packet->payload[0] == '$' && packet->payload[packet->payload_packet_len - 1] == '|') {
|
||||
NDPI_LOG(NDPI_PROTOCOL_DIRECTCONNECT, ndpi_struct,
|
||||
NDPI_LOG_DEBUG, "second dc between peers detected\n");
|
||||
|
||||
|
||||
ndpi_int_directconnect_add_connection(ndpi_struct, flow, DIRECT_CONNECT_TYPE_PEER);
|
||||
|
||||
return;
|
||||
} else {
|
||||
NDPI_LOG(NDPI_PROTOCOL_DIRECTCONNECT, ndpi_struct,
|
||||
NDPI_LOG_DEBUG, "second dc between peers not detected\n");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
NDPI_ADD_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, NDPI_PROTOCOL_DIRECTCONNECT);
|
||||
|
||||
}
|
||||
|
||||
static void ndpi_search_directconnect_udp(struct ndpi_detection_module_struct
|
||||
*ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
{
|
||||
struct ndpi_packet_struct *packet = &flow->packet;
|
||||
|
||||
struct ndpi_id_struct *src = flow->src;
|
||||
struct ndpi_id_struct *dst = flow->dst;
|
||||
int pos, count = 0;
|
||||
|
||||
|
||||
if (dst != NULL && dst->detected_directconnect_udp_port == packet->udp->dest) {
|
||||
if ((u_int32_t)
|
||||
(packet->tick_timestamp -
|
||||
dst->directconnect_last_safe_access_time) < ndpi_struct->directconnect_connection_ip_tick_timeout) {
|
||||
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_DIRECTCONNECT, NDPI_PROTOCOL_UNKNOWN);
|
||||
dst->directconnect_last_safe_access_time = packet->tick_timestamp;
|
||||
NDPI_LOG(NDPI_PROTOCOL_DIRECTCONNECT, ndpi_struct,
|
||||
NDPI_LOG_DEBUG, "marking using dc udp port\n %d", ntohs(dst->detected_directconnect_udp_port));
|
||||
return;
|
||||
} else {
|
||||
dst->detected_directconnect_udp_port = 0;
|
||||
NDPI_LOG(NDPI_PROTOCOL_DIRECTCONNECT, ndpi_struct,
|
||||
NDPI_LOG_DEBUG, "resetting dst udp port due to timeout");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (packet->payload_packet_len > 58) {
|
||||
if (src != NULL
|
||||
&& NDPI_COMPARE_PROTOCOL_TO_BITMASK(src->detected_protocol_bitmask, NDPI_PROTOCOL_DIRECTCONNECT)) {
|
||||
if (packet->payload[0] == '$'
|
||||
&& packet->payload[packet->payload_packet_len - 1] == '|'
|
||||
&& memcmp(&packet->payload[1], "SR ", 3) == 0) {
|
||||
pos = packet->payload_packet_len - 2;
|
||||
if (packet->payload[pos] == ')') {
|
||||
while (pos > 0 && packet->payload[pos] != '(' && count < 21) {
|
||||
pos--;
|
||||
count++;
|
||||
}
|
||||
if (packet->payload[pos] == '(') {
|
||||
pos = pos - 44;
|
||||
if (pos > 2 && memcmp(&packet->payload[pos], "TTH:", 4) == 0) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_DIRECTCONNECT, ndpi_struct, NDPI_LOG_DEBUG, "dc udp detected\n");
|
||||
ndpi_int_directconnect_add_connection(ndpi_struct, flow, DIRECT_CONNECT_TYPE_PEER);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
flow->directconnect_stage++;
|
||||
|
||||
if (flow->directconnect_stage < 3) {
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
if (dst != NULL
|
||||
&& NDPI_COMPARE_PROTOCOL_TO_BITMASK(dst->detected_protocol_bitmask, NDPI_PROTOCOL_DIRECTCONNECT)) {
|
||||
if (packet->payload[0] == '$'
|
||||
&& packet->payload[packet->payload_packet_len - 1] == '|'
|
||||
&& memcmp(&packet->payload[1], "SR ", 3) == 0) {
|
||||
pos = packet->payload_packet_len - 2;
|
||||
if (packet->payload[pos] == ')') {
|
||||
while (pos > 0 && packet->payload[pos] != '(' && count < 21) {
|
||||
pos--;
|
||||
count++;
|
||||
}
|
||||
if (packet->payload[pos] == '(') {
|
||||
pos = pos - 44;
|
||||
if (pos > 2 && memcmp(&packet->payload[pos], "TTH:", 4) == 0) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_DIRECTCONNECT, ndpi_struct, NDPI_LOG_DEBUG, "dc udp detected\n");
|
||||
ndpi_int_directconnect_add_connection(ndpi_struct, flow, DIRECT_CONNECT_TYPE_PEER);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
flow->directconnect_stage++;
|
||||
if (flow->directconnect_stage < 3)
|
||||
return;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
NDPI_LOG(NDPI_PROTOCOL_DIRECTCONNECT, ndpi_struct, NDPI_LOG_DEBUG,
|
||||
"excluded at stage %d \n", flow->directconnect_stage);
|
||||
|
||||
|
||||
|
||||
NDPI_ADD_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, NDPI_PROTOCOL_DIRECTCONNECT);
|
||||
|
||||
|
||||
}
|
||||
|
||||
void ndpi_search_directconnect(struct ndpi_detection_module_struct
|
||||
*ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
{
|
||||
struct ndpi_packet_struct *packet = &flow->packet;
|
||||
struct ndpi_id_struct *src = flow->src;
|
||||
struct ndpi_id_struct *dst = flow->dst;
|
||||
|
||||
|
||||
|
||||
if (packet->detected_protocol_stack[0] == NDPI_PROTOCOL_DIRECTCONNECT) {
|
||||
if (src != NULL && ((u_int32_t)
|
||||
(packet->tick_timestamp -
|
||||
src->directconnect_last_safe_access_time) <
|
||||
ndpi_struct->directconnect_connection_ip_tick_timeout)) {
|
||||
src->directconnect_last_safe_access_time = packet->tick_timestamp;
|
||||
|
||||
} else if (dst != NULL && ((u_int32_t)
|
||||
(packet->tick_timestamp -
|
||||
dst->directconnect_last_safe_access_time) <
|
||||
ndpi_struct->directconnect_connection_ip_tick_timeout)) {
|
||||
dst->directconnect_last_safe_access_time = packet->tick_timestamp;
|
||||
} else {
|
||||
packet->detected_protocol_stack[0] = NDPI_PROTOCOL_UNKNOWN;
|
||||
NDPI_LOG(NDPI_PROTOCOL_DIRECTCONNECT, ndpi_struct,
|
||||
NDPI_LOG_DEBUG, "directconnect: skipping as unknown due to timeout\n");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (packet->tcp != NULL) {
|
||||
ndpi_search_directconnect_tcp(ndpi_struct, flow);
|
||||
} else if (packet->udp != NULL) {
|
||||
ndpi_search_directconnect_udp(ndpi_struct, flow);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void init_directconnect_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask)
|
||||
{
|
||||
ndpi_set_bitmask_protocol_detection("DirectConnect", ndpi_struct, detection_bitmask, *id,
|
||||
NDPI_PROTOCOL_DIRECTCONNECT,
|
||||
ndpi_search_directconnect,
|
||||
NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP_OR_UDP_WITH_PAYLOAD_WITHOUT_RETRANSMISSION,
|
||||
SAVE_DETECTION_BITMASK_AS_UNKNOWN,
|
||||
ADD_TO_DETECTION_BITMASK);
|
||||
|
||||
*id += 1;
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,749 +0,0 @@
|
||||
/*
|
||||
* directdownloadlink.c
|
||||
*
|
||||
* Copyright (C) 2009-2011 by ipoque GmbH
|
||||
* Copyright (C) 2011-14svn - ntop.org
|
||||
*
|
||||
* This file is part of nDPI, an open source deep packet inspection
|
||||
* library based on the OpenDPI and PACE technology by ipoque GmbH
|
||||
*
|
||||
* nDPI is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* nDPI is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with nDPI. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include "ndpi_protocols.h"
|
||||
#ifdef NDPI_PROTOCOL_DIRECT_DOWNLOAD_LINK
|
||||
|
||||
|
||||
#ifdef NDPI_DEBUG_DIRECT_DOWNLOAD_LINK
|
||||
//#define NDPI_DEBUG_DIRECT_DOWNLOAD_LINK_NOTHING_FOUND
|
||||
//#define NDPI_DEBUG_DIRECT_DOWNLOAD_LINK_PACKET_TOO_SMALL
|
||||
#define NDPI_DEBUG_DIRECT_DOWNLOAD_LINK_IP
|
||||
#endif
|
||||
|
||||
static void ndpi_int_direct_download_link_add_connection(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
struct ndpi_flow_struct *flow)
|
||||
{
|
||||
struct ndpi_packet_struct *packet = &flow->packet;
|
||||
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_DIRECT_DOWNLOAD_LINK, NDPI_PROTOCOL_UNKNOWN);
|
||||
|
||||
flow->l4.tcp.ddlink_server_direction = packet->packet_direction;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
return 0 if nothing has been detected
|
||||
return 1 if it is a megaupload packet
|
||||
*/
|
||||
u_int8_t search_ddl_domains(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
{
|
||||
struct ndpi_packet_struct *packet = &flow->packet;
|
||||
// struct ndpi_id_struct *src=ndpi_struct->src;
|
||||
// struct ndpi_id_struct *dst=ndpi_struct->dst;
|
||||
|
||||
u_int16_t filename_start = 0;
|
||||
u_int8_t i = 1;
|
||||
u_int16_t host_line_len_without_port;
|
||||
|
||||
if (packet->payload_packet_len < 100) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_DIRECT_DOWNLOAD_LINK, ndpi_struct, NDPI_LOG_DEBUG, "DDL: Packet too small.\n");
|
||||
goto end_ddl_nothing_found;
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (memcmp(packet->payload, "POST ", 5) == 0) {
|
||||
filename_start = 5; // POST
|
||||
NDPI_LOG(NDPI_PROTOCOL_DIRECT_DOWNLOAD_LINK, ndpi_struct, NDPI_LOG_DEBUG, "DDL: POST FOUND\n");
|
||||
} else if (memcmp(packet->payload, "GET ", 4) == 0) {
|
||||
filename_start = 4; // GET
|
||||
NDPI_LOG(NDPI_PROTOCOL_DIRECT_DOWNLOAD_LINK, ndpi_struct, NDPI_LOG_DEBUG, "DDL: GET FOUND\n");
|
||||
} else {
|
||||
goto end_ddl_nothing_found;
|
||||
}
|
||||
// parse packet
|
||||
ndpi_parse_packet_line_info(ndpi_struct, flow);
|
||||
|
||||
if (packet->host_line.ptr == NULL) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_DIRECT_DOWNLOAD_LINK, ndpi_struct, NDPI_LOG_DEBUG, "DDL: NO HOST FOUND\n");
|
||||
goto end_ddl_nothing_found;
|
||||
}
|
||||
|
||||
NDPI_LOG(NDPI_PROTOCOL_DIRECT_DOWNLOAD_LINK, ndpi_struct, NDPI_LOG_DEBUG, "DDL: Host: found\n");
|
||||
|
||||
if (packet->line[0].len < 9 + filename_start
|
||||
|| memcmp(&packet->line[0].ptr[packet->line[0].len - 9], " HTTP/1.", 8) != 0) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_DIRECT_DOWNLOAD_LINK, ndpi_struct,
|
||||
NDPI_LOG_DEBUG, "DDL: PACKET NOT HTTP CONFORM.\nXXX%.*sXXX\n",
|
||||
8, &packet->line[0].ptr[packet->line[0].len - 9]);
|
||||
goto end_ddl_nothing_found;
|
||||
}
|
||||
// BEGIN OF AUTOMATED CODE GENERATION
|
||||
// first see if we have ':port' at the end of the line
|
||||
host_line_len_without_port = packet->host_line.len;
|
||||
if (host_line_len_without_port >= i && packet->host_line.ptr[host_line_len_without_port - i] >= '0'
|
||||
&& packet->host_line.ptr[packet->host_line.len - i] <= '9') {
|
||||
i = 2;
|
||||
while (host_line_len_without_port >= i && packet->host_line.ptr[host_line_len_without_port - i] >= '0'
|
||||
&& packet->host_line.ptr[host_line_len_without_port - i] <= '9') {
|
||||
NDPI_LOG(NDPI_PROTOCOL_DIRECT_DOWNLOAD_LINK, ndpi_struct, NDPI_LOG_DEBUG, "DDL: number found\n");
|
||||
i++;
|
||||
}
|
||||
if (host_line_len_without_port >= i && packet->host_line.ptr[host_line_len_without_port - i] == ':') {
|
||||
NDPI_LOG(NDPI_PROTOCOL_DIRECT_DOWNLOAD_LINK, ndpi_struct, NDPI_LOG_DEBUG, "DDL: ':' found\n");
|
||||
host_line_len_without_port = host_line_len_without_port - i;
|
||||
}
|
||||
}
|
||||
// then start automated code generation
|
||||
|
||||
if (host_line_len_without_port >= 0 + 4
|
||||
&& memcmp((void *) &packet->host_line.ptr[host_line_len_without_port - 0 - 4], ".com", 4) == 0) {
|
||||
if (host_line_len_without_port >= 4 + 1 && packet->host_line.ptr[host_line_len_without_port - 4 - 1] == 'd') {
|
||||
if (host_line_len_without_port >= 5 + 6 + 1
|
||||
&& memcmp((void *) &packet->host_line.ptr[host_line_len_without_port - 5 - 6], "4share", 6) == 0
|
||||
&& (packet->host_line.ptr[host_line_len_without_port - 5 - 6 - 1] == ' '
|
||||
|| packet->host_line.ptr[host_line_len_without_port - 5 - 6 - 1] == '.')) {
|
||||
goto end_ddl_found;
|
||||
}
|
||||
if (host_line_len_without_port >= 5 + 8 + 1
|
||||
&& memcmp((void *) &packet->host_line.ptr[host_line_len_without_port - 5 - 8], "fileclou", 8) == 0
|
||||
&& (packet->host_line.ptr[host_line_len_without_port - 5 - 8 - 1] == ' '
|
||||
|| packet->host_line.ptr[host_line_len_without_port - 5 - 8 - 1] == '.')) {
|
||||
goto end_ddl_found;
|
||||
}
|
||||
if (host_line_len_without_port >= 5 + 5
|
||||
&& memcmp((void *) &packet->host_line.ptr[host_line_len_without_port - 5 - 5], "uploa", 5) == 0) {
|
||||
if (host_line_len_without_port >= 10 + 6 + 1
|
||||
&& memcmp((void *) &packet->host_line.ptr[host_line_len_without_port - 10 - 6], "files-", 6) == 0
|
||||
&& (packet->host_line.ptr[host_line_len_without_port - 10 - 6 - 1] == ' '
|
||||
|| packet->host_line.ptr[host_line_len_without_port - 10 - 6 - 1] == '.')) {
|
||||
goto end_ddl_found;
|
||||
}
|
||||
if (host_line_len_without_port >= 10 + 4 + 1
|
||||
&& memcmp((void *) &packet->host_line.ptr[host_line_len_without_port - 10 - 4], "mega", 4) == 0
|
||||
&& (packet->host_line.ptr[host_line_len_without_port - 10 - 4 - 1] == ' '
|
||||
|| packet->host_line.ptr[host_line_len_without_port - 10 - 4 - 1] == '.')) {
|
||||
goto end_ddl_found;
|
||||
}
|
||||
if (host_line_len_without_port >= 10 + 5 + 1
|
||||
&& memcmp((void *) &packet->host_line.ptr[host_line_len_without_port - 10 - 5], "rapid", 5) == 0
|
||||
&& (packet->host_line.ptr[host_line_len_without_port - 10 - 5 - 1] == ' '
|
||||
|| packet->host_line.ptr[host_line_len_without_port - 10 - 5 - 1] == '.')) {
|
||||
goto end_ddl_found;
|
||||
}
|
||||
if (host_line_len_without_port >= 10 + 5 + 1
|
||||
&& memcmp((void *) &packet->host_line.ptr[host_line_len_without_port - 10 - 5], "turbo", 5) == 0
|
||||
&& (packet->host_line.ptr[host_line_len_without_port - 10 - 5 - 1] == ' '
|
||||
|| packet->host_line.ptr[host_line_len_without_port - 10 - 5 - 1] == '.')) {
|
||||
goto end_ddl_found;
|
||||
}
|
||||
goto end_ddl_nothing_found;
|
||||
}
|
||||
goto end_ddl_nothing_found;
|
||||
}
|
||||
if (host_line_len_without_port >= 4 + 1 && packet->host_line.ptr[host_line_len_without_port - 4 - 1] == 'o') {
|
||||
if (host_line_len_without_port >= 5 + 6 + 1
|
||||
&& memcmp((void *) &packet->host_line.ptr[host_line_len_without_port - 5 - 6], "badong", 6) == 0
|
||||
&& (packet->host_line.ptr[host_line_len_without_port - 5 - 6 - 1] == ' '
|
||||
|| packet->host_line.ptr[host_line_len_without_port - 5 - 6 - 1] == '.')) {
|
||||
goto end_ddl_found;
|
||||
}
|
||||
if (host_line_len_without_port >= 5 + 5 + 1
|
||||
&& memcmp((void *) &packet->host_line.ptr[host_line_len_without_port - 5 - 5], "fileh", 5) == 0
|
||||
&& (packet->host_line.ptr[host_line_len_without_port - 5 - 5 - 1] == ' '
|
||||
|| packet->host_line.ptr[host_line_len_without_port - 5 - 5 - 1] == '.')) {
|
||||
goto end_ddl_found;
|
||||
}
|
||||
goto end_ddl_nothing_found;
|
||||
}
|
||||
if (host_line_len_without_port >= 4 + 1 && packet->host_line.ptr[host_line_len_without_port - 4 - 1] == 'g') {
|
||||
if (host_line_len_without_port >= 5 + 2
|
||||
&& memcmp((void *) &packet->host_line.ptr[host_line_len_without_port - 5 - 2], "in", 2) == 0) {
|
||||
if (host_line_len_without_port >= 7 + 4
|
||||
&& memcmp((void *) &packet->host_line.ptr[host_line_len_without_port - 7 - 4], "shar", 4) == 0) {
|
||||
if (host_line_len_without_port >= 11 + 4 + 1
|
||||
&& memcmp((void *) &packet->host_line.ptr[host_line_len_without_port - 11 - 4], "best", 4) == 0
|
||||
&& (packet->host_line.ptr[host_line_len_without_port - 11 - 4 - 1] == ' '
|
||||
|| packet->host_line.ptr[host_line_len_without_port - 11 - 4 - 1] == '.')) {
|
||||
goto end_ddl_found;
|
||||
}
|
||||
if (host_line_len_without_port >= 11 + 5 + 1
|
||||
&& memcmp((void *) &packet->host_line.ptr[host_line_len_without_port - 11 - 5], "quick", 5) == 0
|
||||
&& (packet->host_line.ptr[host_line_len_without_port - 11 - 5 - 1] == ' '
|
||||
|| packet->host_line.ptr[host_line_len_without_port - 11 - 5 - 1] == '.')) {
|
||||
goto end_ddl_found;
|
||||
}
|
||||
goto end_ddl_nothing_found;
|
||||
}
|
||||
if (host_line_len_without_port >= 7 + 6 + 1
|
||||
&& memcmp((void *) &packet->host_line.ptr[host_line_len_without_port - 7 - 6], "upload", 6) == 0
|
||||
&& (packet->host_line.ptr[host_line_len_without_port - 7 - 6 - 1] == ' '
|
||||
|| packet->host_line.ptr[host_line_len_without_port - 7 - 6 - 1] == '.')) {
|
||||
goto end_ddl_found;
|
||||
}
|
||||
goto end_ddl_nothing_found;
|
||||
}
|
||||
if (host_line_len_without_port >= 5 + 7 + 1
|
||||
&& memcmp((void *) &packet->host_line.ptr[host_line_len_without_port - 5 - 7], "sharebi", 7) == 0
|
||||
&& (packet->host_line.ptr[host_line_len_without_port - 5 - 7 - 1] == ' '
|
||||
|| packet->host_line.ptr[host_line_len_without_port - 5 - 7 - 1] == '.')) {
|
||||
goto end_ddl_found;
|
||||
}
|
||||
goto end_ddl_nothing_found;
|
||||
}
|
||||
if (host_line_len_without_port >= 4 + 8 + 1
|
||||
&& memcmp((void *) &packet->host_line.ptr[host_line_len_without_port - 4 - 8], "bigfilez", 8) == 0
|
||||
&& (packet->host_line.ptr[host_line_len_without_port - 4 - 8 - 1] == ' '
|
||||
|| packet->host_line.ptr[host_line_len_without_port - 4 - 8 - 1] == '.')) {
|
||||
goto end_ddl_found;
|
||||
}
|
||||
if (host_line_len_without_port >= 4 + 1 && packet->host_line.ptr[host_line_len_without_port - 4 - 1] == 'e') {
|
||||
if (host_line_len_without_port >= 5 + 3
|
||||
&& memcmp((void *) &packet->host_line.ptr[host_line_len_without_port - 5 - 3], "fil", 3) == 0) {
|
||||
if (host_line_len_without_port >= 8 + 2
|
||||
&& memcmp((void *) &packet->host_line.ptr[host_line_len_without_port - 8 - 2], "mo", 2) == 0) {
|
||||
if (host_line_len_without_port >= 10 + 5 + 1
|
||||
&& memcmp((void *) &packet->host_line.ptr[host_line_len_without_port - 10 - 5], "china", 5) == 0
|
||||
&& (packet->host_line.ptr[host_line_len_without_port - 10 - 5 - 1] == ' '
|
||||
|| packet->host_line.ptr[host_line_len_without_port - 10 - 5 - 1] == '.')) {
|
||||
goto end_ddl_found;
|
||||
}
|
||||
if (host_line_len_without_port >= 8 + 2 + 1
|
||||
&& (packet->host_line.ptr[host_line_len_without_port - 8 - 2 - 1] == ' '
|
||||
|| packet->host_line.ptr[host_line_len_without_port - 8 - 2 - 1] == '.')) {
|
||||
goto end_ddl_found;
|
||||
}
|
||||
}
|
||||
if (host_line_len_without_port >= 8 + 3 + 1
|
||||
&& memcmp((void *) &packet->host_line.ptr[host_line_len_without_port - 8 - 3], "hot", 3) == 0
|
||||
&& (packet->host_line.ptr[host_line_len_without_port - 8 - 3 - 1] == ' '
|
||||
|| packet->host_line.ptr[host_line_len_without_port - 8 - 3 - 1] == '.')) {
|
||||
goto end_ddl_found;
|
||||
}
|
||||
if (host_line_len_without_port >= 8 + 6 + 1
|
||||
&& memcmp((void *) &packet->host_line.ptr[host_line_len_without_port - 8 - 6], "keepmy", 6) == 0
|
||||
&& (packet->host_line.ptr[host_line_len_without_port - 8 - 6 - 1] == ' '
|
||||
|| packet->host_line.ptr[host_line_len_without_port - 8 - 6 - 1] == '.')) {
|
||||
goto end_ddl_found;
|
||||
}
|
||||
if (host_line_len_without_port >= 8 + 1
|
||||
&& packet->host_line.ptr[host_line_len_without_port - 8 - 1] == 'e') {
|
||||
if (host_line_len_without_port >= 9 + 3 + 1
|
||||
&& memcmp((void *) &packet->host_line.ptr[host_line_len_without_port - 9 - 3], "sav", 3) == 0
|
||||
&& (packet->host_line.ptr[host_line_len_without_port - 9 - 3 - 1] == ' '
|
||||
|| packet->host_line.ptr[host_line_len_without_port - 9 - 3 - 1] == '.')) {
|
||||
goto end_ddl_found;
|
||||
}
|
||||
if (host_line_len_without_port >= 9 + 5 + 1
|
||||
&& memcmp((void *) &packet->host_line.ptr[host_line_len_without_port - 9 - 5], "sendm", 5) == 0
|
||||
&& (packet->host_line.ptr[host_line_len_without_port - 9 - 5 - 1] == ' '
|
||||
|| packet->host_line.ptr[host_line_len_without_port - 9 - 5 - 1] == '.')) {
|
||||
goto end_ddl_found;
|
||||
}
|
||||
goto end_ddl_nothing_found;
|
||||
}
|
||||
if (host_line_len_without_port >= 8 + 8 + 1
|
||||
&& memcmp((void *) &packet->host_line.ptr[host_line_len_without_port - 8 - 8], "sharebig", 8) == 0
|
||||
&& (packet->host_line.ptr[host_line_len_without_port - 8 - 8 - 1] == ' '
|
||||
|| packet->host_line.ptr[host_line_len_without_port - 8 - 8 - 1] == '.')) {
|
||||
goto end_ddl_found;
|
||||
}
|
||||
if (host_line_len_without_port >= 8 + 3 + 1
|
||||
&& memcmp((void *) &packet->host_line.ptr[host_line_len_without_port - 8 - 3], "up-", 3) == 0
|
||||
&& (packet->host_line.ptr[host_line_len_without_port - 8 - 3 - 1] == ' '
|
||||
|| packet->host_line.ptr[host_line_len_without_port - 8 - 3 - 1] == '.')) {
|
||||
goto end_ddl_found;
|
||||
}
|
||||
goto end_ddl_nothing_found;
|
||||
}
|
||||
if (host_line_len_without_port >= 5 + 1 && packet->host_line.ptr[host_line_len_without_port - 5 - 1] == 'r') {
|
||||
if (host_line_len_without_port >= 6 + 3
|
||||
&& memcmp((void *) &packet->host_line.ptr[host_line_len_without_port - 6 - 3], "sha", 3) == 0) {
|
||||
if (host_line_len_without_port >= 9 + 1
|
||||
&& packet->host_line.ptr[host_line_len_without_port - 9 - 1] == '-') {
|
||||
if (host_line_len_without_port >= 10 + 4 + 1
|
||||
&& memcmp((void *) &packet->host_line.ptr[host_line_len_without_port - 10 - 4], "easy",
|
||||
4) == 0 && (packet->host_line.ptr[host_line_len_without_port - 10 - 4 - 1] == ' '
|
||||
|| packet->host_line.ptr[host_line_len_without_port - 10 - 4 - 1] ==
|
||||
'.')) {
|
||||
goto end_ddl_found;
|
||||
}
|
||||
if (host_line_len_without_port >= 10 + 4 + 1
|
||||
&& memcmp((void *) &packet->host_line.ptr[host_line_len_without_port - 10 - 4], "fast",
|
||||
4) == 0 && (packet->host_line.ptr[host_line_len_without_port - 10 - 4 - 1] == ' '
|
||||
|| packet->host_line.ptr[host_line_len_without_port - 10 - 4 - 1] ==
|
||||
'.')) {
|
||||
goto end_ddl_found;
|
||||
}
|
||||
if (host_line_len_without_port >= 10 + 4 + 1
|
||||
&& memcmp((void *) &packet->host_line.ptr[host_line_len_without_port - 10 - 4], "live",
|
||||
4) == 0 && (packet->host_line.ptr[host_line_len_without_port - 10 - 4 - 1] == ' '
|
||||
|| packet->host_line.ptr[host_line_len_without_port - 10 - 4 - 1] ==
|
||||
'.')) {
|
||||
goto end_ddl_found;
|
||||
}
|
||||
goto end_ddl_nothing_found;
|
||||
}
|
||||
if (host_line_len_without_port >= 9 + 4 + 1
|
||||
&& memcmp((void *) &packet->host_line.ptr[host_line_len_without_port - 9 - 4], "ftp2", 4) == 0
|
||||
&& (packet->host_line.ptr[host_line_len_without_port - 9 - 4 - 1] == ' '
|
||||
|| packet->host_line.ptr[host_line_len_without_port - 9 - 4 - 1] == '.')) {
|
||||
goto end_ddl_found;
|
||||
}
|
||||
if (host_line_len_without_port >= 9 + 4 + 1
|
||||
&& memcmp((void *) &packet->host_line.ptr[host_line_len_without_port - 9 - 4], "gige", 4) == 0
|
||||
&& (packet->host_line.ptr[host_line_len_without_port - 9 - 4 - 1] == ' '
|
||||
|| packet->host_line.ptr[host_line_len_without_port - 9 - 4 - 1] == '.')) {
|
||||
goto end_ddl_found;
|
||||
}
|
||||
if (host_line_len_without_port >= 9 + 4 + 1
|
||||
&& memcmp((void *) &packet->host_line.ptr[host_line_len_without_port - 9 - 4], "mega", 4) == 0
|
||||
&& (packet->host_line.ptr[host_line_len_without_port - 9 - 4 - 1] == ' '
|
||||
|| packet->host_line.ptr[host_line_len_without_port - 9 - 4 - 1] == '.')) {
|
||||
goto end_ddl_found;
|
||||
}
|
||||
if (host_line_len_without_port >= 9 + 5 + 1
|
||||
&& memcmp((void *) &packet->host_line.ptr[host_line_len_without_port - 9 - 5], "rapid", 5) == 0
|
||||
&& (packet->host_line.ptr[host_line_len_without_port - 9 - 5 - 1] == ' '
|
||||
|| packet->host_line.ptr[host_line_len_without_port - 9 - 5 - 1] == '.')) {
|
||||
goto end_ddl_found;
|
||||
}
|
||||
goto end_ddl_nothing_found;
|
||||
}
|
||||
if (host_line_len_without_port >= 6 + 7 + 1
|
||||
&& memcmp((void *) &packet->host_line.ptr[host_line_len_without_port - 6 - 7], "mediafi", 7) == 0
|
||||
&& (packet->host_line.ptr[host_line_len_without_port - 6 - 7 - 1] == ' '
|
||||
|| packet->host_line.ptr[host_line_len_without_port - 6 - 7 - 1] == '.')) {
|
||||
goto end_ddl_found;
|
||||
}
|
||||
goto end_ddl_nothing_found;
|
||||
}
|
||||
if (host_line_len_without_port >= 5 + 7 + 1
|
||||
&& memcmp((void *) &packet->host_line.ptr[host_line_len_without_port - 5 - 7], "gigasiz", 7) == 0
|
||||
&& (packet->host_line.ptr[host_line_len_without_port - 5 - 7 - 1] == ' '
|
||||
|| packet->host_line.ptr[host_line_len_without_port - 5 - 7 - 1] == '.')) {
|
||||
goto end_ddl_found;
|
||||
}
|
||||
if (host_line_len_without_port >= 5 + 8 + 1
|
||||
&& memcmp((void *) &packet->host_line.ptr[host_line_len_without_port - 5 - 8], "sendspac", 8) == 0
|
||||
&& (packet->host_line.ptr[host_line_len_without_port - 5 - 8 - 1] == ' '
|
||||
|| packet->host_line.ptr[host_line_len_without_port - 5 - 8 - 1] == '.')) {
|
||||
goto end_ddl_found;
|
||||
}
|
||||
if (host_line_len_without_port >= 5 + 7 + 1
|
||||
&& memcmp((void *) &packet->host_line.ptr[host_line_len_without_port - 5 - 7], "sharebe", 7) == 0
|
||||
&& (packet->host_line.ptr[host_line_len_without_port - 5 - 7 - 1] == ' '
|
||||
|| packet->host_line.ptr[host_line_len_without_port - 5 - 7 - 1] == '.')) {
|
||||
goto end_ddl_found;
|
||||
}
|
||||
if (host_line_len_without_port >= 5 + 11 + 1
|
||||
&& memcmp((void *) &packet->host_line.ptr[host_line_len_without_port - 5 - 11], "sharebigfli", 11) == 0
|
||||
&& (packet->host_line.ptr[host_line_len_without_port - 5 - 11 - 1] == ' '
|
||||
|| packet->host_line.ptr[host_line_len_without_port - 5 - 11 - 1] == '.')) {
|
||||
goto end_ddl_found;
|
||||
}
|
||||
if (host_line_len_without_port >= 5 + 8 + 1
|
||||
&& memcmp((void *) &packet->host_line.ptr[host_line_len_without_port - 5 - 8], "fileserv", 8) == 0
|
||||
&& (packet->host_line.ptr[host_line_len_without_port - 5 - 8 - 1] == ' '
|
||||
|| packet->host_line.ptr[host_line_len_without_port - 5 - 8 - 1] == '.')) {
|
||||
goto end_ddl_found;
|
||||
}
|
||||
goto end_ddl_nothing_found;
|
||||
}
|
||||
if (host_line_len_without_port >= 4 + 1 && packet->host_line.ptr[host_line_len_without_port - 4 - 1] == 's') {
|
||||
if (host_line_len_without_port >= 5 + 1 && packet->host_line.ptr[host_line_len_without_port - 5 - 1] == 'e') {
|
||||
if (host_line_len_without_port >= 6 + 10 + 1
|
||||
&& memcmp((void *) &packet->host_line.ptr[host_line_len_without_port - 6 - 10], "depositfil",
|
||||
10) == 0 && (packet->host_line.ptr[host_line_len_without_port - 6 - 10 - 1] == ' '
|
||||
|| packet->host_line.ptr[host_line_len_without_port - 6 - 10 - 1] == '.')) {
|
||||
goto end_ddl_found;
|
||||
}
|
||||
if (host_line_len_without_port >= 6 + 8 + 1
|
||||
&& memcmp((void *) &packet->host_line.ptr[host_line_len_without_port - 6 - 8], "megashar", 8) == 0
|
||||
&& (packet->host_line.ptr[host_line_len_without_port - 6 - 8 - 1] == ' '
|
||||
|| packet->host_line.ptr[host_line_len_without_port - 6 - 8 - 1] == '.')) {
|
||||
goto end_ddl_found;
|
||||
}
|
||||
goto end_ddl_nothing_found;
|
||||
}
|
||||
if (host_line_len_without_port >= 5 + 10 + 1
|
||||
&& memcmp((void *) &packet->host_line.ptr[host_line_len_without_port - 5 - 10], "fileupyour", 10) == 0
|
||||
&& (packet->host_line.ptr[host_line_len_without_port - 5 - 10 - 1] == ' '
|
||||
|| packet->host_line.ptr[host_line_len_without_port - 5 - 10 - 1] == '.')) {
|
||||
goto end_ddl_found;
|
||||
}
|
||||
goto end_ddl_nothing_found;
|
||||
}
|
||||
if (host_line_len_without_port >= 4 + 11 + 1
|
||||
&& memcmp((void *) &packet->host_line.ptr[host_line_len_without_port - 4 - 11], "filefactory", 11) == 0
|
||||
&& (packet->host_line.ptr[host_line_len_without_port - 4 - 11 - 1] == ' '
|
||||
|| packet->host_line.ptr[host_line_len_without_port - 4 - 11 - 1] == '.')) {
|
||||
goto end_ddl_found;
|
||||
}
|
||||
if (host_line_len_without_port >= 4 + 1 && packet->host_line.ptr[host_line_len_without_port - 4 - 1] == 't') {
|
||||
if (host_line_len_without_port >= 5 + 8 + 1
|
||||
&& memcmp((void *) &packet->host_line.ptr[host_line_len_without_port - 5 - 8], "filefron", 8) == 0
|
||||
&& (packet->host_line.ptr[host_line_len_without_port - 5 - 8 - 1] == ' '
|
||||
|| packet->host_line.ptr[host_line_len_without_port - 5 - 8 - 1] == '.')) {
|
||||
goto end_ddl_found;
|
||||
}
|
||||
if (host_line_len_without_port >= 5 + 10 + 1
|
||||
&& memcmp((void *) &packet->host_line.ptr[host_line_len_without_port - 5 - 10], "uploadingi", 10) == 0
|
||||
&& (packet->host_line.ptr[host_line_len_without_port - 5 - 10 - 1] == ' '
|
||||
|| packet->host_line.ptr[host_line_len_without_port - 5 - 10 - 1] == '.')) {
|
||||
goto end_ddl_found;
|
||||
}
|
||||
if (host_line_len_without_port >= 5 + 11 + 1
|
||||
&& memcmp((void *) &packet->host_line.ptr[host_line_len_without_port - 5 - 11], "yourfilehos", 11) == 0
|
||||
&& (packet->host_line.ptr[host_line_len_without_port - 5 - 11 - 1] == ' '
|
||||
|| packet->host_line.ptr[host_line_len_without_port - 5 - 11 - 1] == '.')) {
|
||||
goto end_ddl_found;
|
||||
}
|
||||
goto end_ddl_nothing_found;
|
||||
}
|
||||
if (host_line_len_without_port >= 4 + 1 && packet->host_line.ptr[host_line_len_without_port - 4 - 1] == 'r') {
|
||||
if (host_line_len_without_port >= 5 + 8 + 1
|
||||
&& memcmp((void *) &packet->host_line.ptr[host_line_len_without_port - 5 - 8], "mytempdi", 8) == 0
|
||||
&& (packet->host_line.ptr[host_line_len_without_port - 5 - 8 - 1] == ' '
|
||||
|| packet->host_line.ptr[host_line_len_without_port - 5 - 8 - 1] == '.')) {
|
||||
goto end_ddl_found;
|
||||
}
|
||||
if (host_line_len_without_port >= 5 + 10 + 1
|
||||
&& memcmp((void *) &packet->host_line.ptr[host_line_len_without_port - 5 - 10], "uploadpowe", 10) == 0
|
||||
&& (packet->host_line.ptr[host_line_len_without_port - 5 - 10 - 1] == ' '
|
||||
|| packet->host_line.ptr[host_line_len_without_port - 5 - 10 - 1] == '.')) {
|
||||
goto end_ddl_found;
|
||||
}
|
||||
goto end_ddl_nothing_found;
|
||||
}
|
||||
if (host_line_len_without_port >= 4 + 9 + 1
|
||||
&& memcmp((void *) &packet->host_line.ptr[host_line_len_without_port - 4 - 9], "mega.1280", 9) == 0
|
||||
&& (packet->host_line.ptr[host_line_len_without_port - 4 - 9 - 1] == ' '
|
||||
|| packet->host_line.ptr[host_line_len_without_port - 4 - 9 - 1] == '.')) {
|
||||
goto end_ddl_found;
|
||||
}
|
||||
if (host_line_len_without_port >= 4 + 9 + 1
|
||||
&& memcmp((void *) &packet->host_line.ptr[host_line_len_without_port - 4 - 9], "filesonic", 9) == 0
|
||||
&& (packet->host_line.ptr[host_line_len_without_port - 4 - 9 - 1] == ' '
|
||||
|| packet->host_line.ptr[host_line_len_without_port - 4 - 9 - 1] == '.')) {
|
||||
goto end_ddl_found;
|
||||
}
|
||||
goto end_ddl_nothing_found;
|
||||
}
|
||||
if (host_line_len_without_port >= 0 + 4
|
||||
&& memcmp((void *) &packet->host_line.ptr[host_line_len_without_port - 0 - 4], ".net", 4) == 0) {
|
||||
if (host_line_len_without_port >= 4 + 7 + 1
|
||||
&& memcmp((void *) &packet->host_line.ptr[host_line_len_without_port - 4 - 7], "badongo", 7) == 0
|
||||
&& (packet->host_line.ptr[host_line_len_without_port - 4 - 7 - 1] == ' '
|
||||
|| packet->host_line.ptr[host_line_len_without_port - 4 - 7 - 1] == '.')) {
|
||||
goto end_ddl_found;
|
||||
}
|
||||
if (host_line_len_without_port >= 4 + 1 && packet->host_line.ptr[host_line_len_without_port - 4 - 1] == 'd') {
|
||||
if (host_line_len_without_port >= 5 + 3
|
||||
&& memcmp((void *) &packet->host_line.ptr[host_line_len_without_port - 5 - 3], "loa", 3) == 0) {
|
||||
if (host_line_len_without_port >= 8 + 5 + 1
|
||||
&& memcmp((void *) &packet->host_line.ptr[host_line_len_without_port - 8 - 5], "fast-", 5) == 0
|
||||
&& (packet->host_line.ptr[host_line_len_without_port - 8 - 5 - 1] == ' '
|
||||
|| packet->host_line.ptr[host_line_len_without_port - 8 - 5 - 1] == '.')) {
|
||||
goto end_ddl_found;
|
||||
}
|
||||
if (host_line_len_without_port >= 8 + 2
|
||||
&& memcmp((void *) &packet->host_line.ptr[host_line_len_without_port - 8 - 2], "up", 2) == 0) {
|
||||
if (host_line_len_without_port >= 10 + 5 + 1
|
||||
&& memcmp((void *) &packet->host_line.ptr[host_line_len_without_port - 10 - 5], "file-", 5) == 0
|
||||
&& (packet->host_line.ptr[host_line_len_without_port - 10 - 5 - 1] == ' '
|
||||
|| packet->host_line.ptr[host_line_len_without_port - 10 - 5 - 1] == '.')) {
|
||||
goto end_ddl_found;
|
||||
}
|
||||
if (host_line_len_without_port >= 10 + 6 + 1
|
||||
&& memcmp((void *) &packet->host_line.ptr[host_line_len_without_port - 10 - 6], "simple",
|
||||
6) == 0 && (packet->host_line.ptr[host_line_len_without_port - 10 - 6 - 1] == ' '
|
||||
|| packet->host_line.ptr[host_line_len_without_port - 10 - 6 - 1] ==
|
||||
'.')) {
|
||||
goto end_ddl_found;
|
||||
}
|
||||
if (host_line_len_without_port >= 10 + 3 + 1
|
||||
&& memcmp((void *) &packet->host_line.ptr[host_line_len_without_port - 10 - 3], "wii", 3) == 0
|
||||
&& (packet->host_line.ptr[host_line_len_without_port - 10 - 3 - 1] == ' '
|
||||
|| packet->host_line.ptr[host_line_len_without_port - 10 - 3 - 1] == '.')) {
|
||||
goto end_ddl_found;
|
||||
}
|
||||
goto end_ddl_nothing_found;
|
||||
}
|
||||
goto end_ddl_nothing_found;
|
||||
}
|
||||
if (host_line_len_without_port >= 5 + 7 + 1
|
||||
&& memcmp((void *) &packet->host_line.ptr[host_line_len_without_port - 5 - 7], "filesen", 7) == 0
|
||||
&& (packet->host_line.ptr[host_line_len_without_port - 5 - 7 - 1] == ' '
|
||||
|| packet->host_line.ptr[host_line_len_without_port - 5 - 7 - 1] == '.')) {
|
||||
goto end_ddl_found;
|
||||
}
|
||||
goto end_ddl_nothing_found;
|
||||
}
|
||||
if (host_line_len_without_port >= 4 + 5 + 1
|
||||
&& memcmp((void *) &packet->host_line.ptr[host_line_len_without_port - 4 - 5], "filer", 5) == 0
|
||||
&& (packet->host_line.ptr[host_line_len_without_port - 4 - 5 - 1] == ' '
|
||||
|| packet->host_line.ptr[host_line_len_without_port - 4 - 5 - 1] == '.')) {
|
||||
goto end_ddl_found;
|
||||
}
|
||||
if (host_line_len_without_port >= 4 + 9 + 1
|
||||
&& memcmp((void *) &packet->host_line.ptr[host_line_len_without_port - 4 - 9], "livedepot", 9) == 0
|
||||
&& (packet->host_line.ptr[host_line_len_without_port - 4 - 9 - 1] == ' '
|
||||
|| packet->host_line.ptr[host_line_len_without_port - 4 - 9 - 1] == '.')) {
|
||||
goto end_ddl_found;
|
||||
}
|
||||
if (host_line_len_without_port >= 4 + 1 && packet->host_line.ptr[host_line_len_without_port - 4 - 1] == 'e') {
|
||||
if (host_line_len_without_port >= 5 + 5 + 1
|
||||
&& memcmp((void *) &packet->host_line.ptr[host_line_len_without_port - 5 - 5], "mofil", 5) == 0
|
||||
&& (packet->host_line.ptr[host_line_len_without_port - 5 - 5 - 1] == ' '
|
||||
|| packet->host_line.ptr[host_line_len_without_port - 5 - 5 - 1] == '.')) {
|
||||
goto end_ddl_found;
|
||||
}
|
||||
if (host_line_len_without_port >= 5 + 17 + 1
|
||||
&& memcmp((void *) &packet->host_line.ptr[host_line_len_without_port - 5 - 17], "odsiebie.najlepsz",
|
||||
17) == 0 && (packet->host_line.ptr[host_line_len_without_port - 5 - 17 - 1] == ' '
|
||||
|| packet->host_line.ptr[host_line_len_without_port - 5 - 17 - 1] == '.')) {
|
||||
goto end_ddl_found;
|
||||
}
|
||||
if (host_line_len_without_port >= 5 + 5 + 1
|
||||
&& memcmp((void *) &packet->host_line.ptr[host_line_len_without_port - 5 - 5], "zshar", 5) == 0
|
||||
&& (packet->host_line.ptr[host_line_len_without_port - 5 - 5 - 1] == ' '
|
||||
|| packet->host_line.ptr[host_line_len_without_port - 5 - 5 - 1] == '.')) {
|
||||
goto end_ddl_found;
|
||||
}
|
||||
goto end_ddl_nothing_found;
|
||||
}
|
||||
goto end_ddl_nothing_found;
|
||||
}
|
||||
if (host_line_len_without_port >= 0 + 1 && packet->host_line.ptr[host_line_len_without_port - 0 - 1] == 'u') {
|
||||
if (host_line_len_without_port >= 1 + 6 + 1
|
||||
&& memcmp((void *) &packet->host_line.ptr[host_line_len_without_port - 1 - 6], "data.h", 6) == 0
|
||||
&& (packet->host_line.ptr[host_line_len_without_port - 1 - 6 - 1] == ' '
|
||||
|| packet->host_line.ptr[host_line_len_without_port - 1 - 6 - 1] == '.')) {
|
||||
goto end_ddl_found;
|
||||
}
|
||||
if (host_line_len_without_port >= 1 + 2
|
||||
&& memcmp((void *) &packet->host_line.ptr[host_line_len_without_port - 1 - 2], ".r", 2) == 0) {
|
||||
if (host_line_len_without_port >= 3 + 10 + 1
|
||||
&& memcmp((void *) &packet->host_line.ptr[host_line_len_without_port - 3 - 10], "filearchiv", 10) == 0
|
||||
&& (packet->host_line.ptr[host_line_len_without_port - 3 - 10 - 1] == ' '
|
||||
|| packet->host_line.ptr[host_line_len_without_port - 3 - 10 - 1] == '.')) {
|
||||
goto end_ddl_found;
|
||||
}
|
||||
if (host_line_len_without_port >= 3 + 8 + 1
|
||||
&& memcmp((void *) &packet->host_line.ptr[host_line_len_without_port - 3 - 8], "filepost", 8) == 0
|
||||
&& (packet->host_line.ptr[host_line_len_without_port - 3 - 8 - 1] == ' '
|
||||
|| packet->host_line.ptr[host_line_len_without_port - 3 - 8 - 1] == '.')) {
|
||||
goto end_ddl_found;
|
||||
}
|
||||
if (host_line_len_without_port >= 3 + 7 + 1
|
||||
&& memcmp((void *) &packet->host_line.ptr[host_line_len_without_port - 3 - 7], "ifolder", 7) == 0
|
||||
&& (packet->host_line.ptr[host_line_len_without_port - 3 - 7 - 1] == ' '
|
||||
|| packet->host_line.ptr[host_line_len_without_port - 3 - 7 - 1] == '.')) {
|
||||
goto end_ddl_found;
|
||||
}
|
||||
goto end_ddl_nothing_found;
|
||||
}
|
||||
goto end_ddl_nothing_found;
|
||||
}
|
||||
if (host_line_len_without_port >= 0 + 11 + 1
|
||||
&& memcmp((void *) &packet->host_line.ptr[host_line_len_without_port - 0 - 11], "filehost.tv", 11) == 0
|
||||
&& (packet->host_line.ptr[host_line_len_without_port - 0 - 11 - 1] == ' '
|
||||
|| packet->host_line.ptr[host_line_len_without_port - 0 - 11 - 1] == '.')) {
|
||||
goto end_ddl_found;
|
||||
}
|
||||
if (host_line_len_without_port >= 0 + 3
|
||||
&& memcmp((void *) &packet->host_line.ptr[host_line_len_without_port - 0 - 3], ".to", 3) == 0) {
|
||||
if (host_line_len_without_port >= 3 + 1 && packet->host_line.ptr[host_line_len_without_port - 3 - 1] == 'e') {
|
||||
if (host_line_len_without_port >= 4 + 7 + 1
|
||||
&& memcmp((void *) &packet->host_line.ptr[host_line_len_without_port - 4 - 7], "filesaf", 7) == 0
|
||||
&& (packet->host_line.ptr[host_line_len_without_port - 4 - 7 - 1] == ' '
|
||||
|| packet->host_line.ptr[host_line_len_without_port - 4 - 7 - 1] == '.')) {
|
||||
goto end_ddl_found;
|
||||
}
|
||||
if (host_line_len_without_port >= 4 + 8 + 1
|
||||
&& memcmp((void *) &packet->host_line.ptr[host_line_len_without_port - 4 - 8], "sharebas", 8) == 0
|
||||
&& (packet->host_line.ptr[host_line_len_without_port - 4 - 8 - 1] == ' '
|
||||
|| packet->host_line.ptr[host_line_len_without_port - 4 - 8 - 1] == '.')) {
|
||||
goto end_ddl_found;
|
||||
}
|
||||
goto end_ddl_nothing_found;
|
||||
}
|
||||
if (host_line_len_without_port >= 3 + 5 + 1
|
||||
&& memcmp((void *) &packet->host_line.ptr[host_line_len_without_port - 3 - 5], "files", 5) == 0
|
||||
&& (packet->host_line.ptr[host_line_len_without_port - 3 - 5 - 1] == ' '
|
||||
|| packet->host_line.ptr[host_line_len_without_port - 3 - 5 - 1] == '.')) {
|
||||
goto end_ddl_found;
|
||||
}
|
||||
if (host_line_len_without_port >= 3 + 1 && packet->host_line.ptr[host_line_len_without_port - 3 - 1] == 'd') {
|
||||
if (host_line_len_without_port >= 4 + 3
|
||||
&& memcmp((void *) &packet->host_line.ptr[host_line_len_without_port - 4 - 3], "loa", 3) == 0) {
|
||||
if (host_line_len_without_port >= 7 + 7 + 1
|
||||
&& memcmp((void *) &packet->host_line.ptr[host_line_len_without_port - 7 - 7], "file-up", 7) == 0
|
||||
&& (packet->host_line.ptr[host_line_len_without_port - 7 - 7 - 1] == ' '
|
||||
|| packet->host_line.ptr[host_line_len_without_port - 7 - 7 - 1] == '.')) {
|
||||
goto end_ddl_found;
|
||||
}
|
||||
if (host_line_len_without_port >= 4 + 3 + 1
|
||||
&& (packet->host_line.ptr[host_line_len_without_port - 4 - 3 - 1] == ' '
|
||||
|| packet->host_line.ptr[host_line_len_without_port - 4 - 3 - 1] == '.')) {
|
||||
goto end_ddl_found;
|
||||
}
|
||||
}
|
||||
if (host_line_len_without_port >= 4 + 7 + 1
|
||||
&& memcmp((void *) &packet->host_line.ptr[host_line_len_without_port - 4 - 7], "uploade", 7) == 0
|
||||
&& (packet->host_line.ptr[host_line_len_without_port - 4 - 7 - 1] == ' '
|
||||
|| packet->host_line.ptr[host_line_len_without_port - 4 - 7 - 1] == '.')) {
|
||||
goto end_ddl_found;
|
||||
}
|
||||
goto end_ddl_nothing_found;
|
||||
}
|
||||
goto end_ddl_nothing_found;
|
||||
}
|
||||
if (host_line_len_without_port >= 0 + 1 && packet->host_line.ptr[host_line_len_without_port - 0 - 1] == 'z') {
|
||||
if (host_line_len_without_port >= 1 + 14 + 1
|
||||
&& memcmp((void *) &packet->host_line.ptr[host_line_len_without_port - 1 - 14], "leteckaposta.c", 14) == 0
|
||||
&& (packet->host_line.ptr[host_line_len_without_port - 1 - 14 - 1] == ' '
|
||||
|| packet->host_line.ptr[host_line_len_without_port - 1 - 14 - 1] == '.')) {
|
||||
goto end_ddl_found;
|
||||
}
|
||||
if (host_line_len_without_port >= 1 + 12 + 1
|
||||
&& memcmp((void *) &packet->host_line.ptr[host_line_len_without_port - 1 - 12], "yourfiles.bi", 12) == 0
|
||||
&& (packet->host_line.ptr[host_line_len_without_port - 1 - 12 - 1] == ' '
|
||||
|| packet->host_line.ptr[host_line_len_without_port - 1 - 12 - 1] == '.')) {
|
||||
goto end_ddl_found;
|
||||
}
|
||||
goto end_ddl_nothing_found;
|
||||
}
|
||||
if (host_line_len_without_port >= 0 + 1 && packet->host_line.ptr[host_line_len_without_port - 0 - 1] == 'n') {
|
||||
if (host_line_len_without_port >= 1 + 9 + 1
|
||||
&& memcmp((void *) &packet->host_line.ptr[host_line_len_without_port - 1 - 9], "netload.i", 9) == 0
|
||||
&& (packet->host_line.ptr[host_line_len_without_port - 1 - 9 - 1] == ' '
|
||||
|| packet->host_line.ptr[host_line_len_without_port - 1 - 9 - 1] == '.')) {
|
||||
goto end_ddl_found;
|
||||
}
|
||||
if (host_line_len_without_port >= 1 + 2
|
||||
&& memcmp((void *) &packet->host_line.ptr[host_line_len_without_port - 1 - 2], ".v", 2) == 0) {
|
||||
if (host_line_len_without_port >= 3 + 7 + 1
|
||||
&& memcmp((void *) &packet->host_line.ptr[host_line_len_without_port - 3 - 7], "4shared", 7) == 0
|
||||
&& (packet->host_line.ptr[host_line_len_without_port - 3 - 7 - 1] == ' '
|
||||
|| packet->host_line.ptr[host_line_len_without_port - 3 - 7 - 1] == '.')) {
|
||||
goto end_ddl_found;
|
||||
}
|
||||
if (host_line_len_without_port >= 3 + 9 + 1
|
||||
&& memcmp((void *) &packet->host_line.ptr[host_line_len_without_port - 3 - 9], "megashare", 9) == 0
|
||||
&& (packet->host_line.ptr[host_line_len_without_port - 3 - 9 - 1] == ' '
|
||||
|| packet->host_line.ptr[host_line_len_without_port - 3 - 9 - 1] == '.')) {
|
||||
goto end_ddl_found;
|
||||
}
|
||||
goto end_ddl_nothing_found;
|
||||
}
|
||||
goto end_ddl_nothing_found;
|
||||
}
|
||||
if (host_line_len_without_port >= 0 + 3
|
||||
&& memcmp((void *) &packet->host_line.ptr[host_line_len_without_port - 0 - 3], ".de", 3) == 0) {
|
||||
if (host_line_len_without_port >= 3 + 5
|
||||
&& memcmp((void *) &packet->host_line.ptr[host_line_len_without_port - 3 - 5], "share", 5) == 0) {
|
||||
if (host_line_len_without_port >= 8 + 5 + 1
|
||||
&& memcmp((void *) &packet->host_line.ptr[host_line_len_without_port - 8 - 5], "rapid", 5) == 0
|
||||
&& (packet->host_line.ptr[host_line_len_without_port - 8 - 5 - 1] == ' '
|
||||
|| packet->host_line.ptr[host_line_len_without_port - 8 - 5 - 1] == '.')) {
|
||||
goto end_ddl_found;
|
||||
}
|
||||
if (host_line_len_without_port >= 8 + 5 + 1
|
||||
&& memcmp((void *) &packet->host_line.ptr[host_line_len_without_port - 8 - 5], "ultra", 5) == 0
|
||||
&& (packet->host_line.ptr[host_line_len_without_port - 8 - 5 - 1] == ' '
|
||||
|| packet->host_line.ptr[host_line_len_without_port - 8 - 5 - 1] == '.')) {
|
||||
goto end_ddl_found;
|
||||
}
|
||||
goto end_ddl_nothing_found;
|
||||
}
|
||||
if (host_line_len_without_port >= 3 + 15 + 1
|
||||
&& memcmp((void *) &packet->host_line.ptr[host_line_len_without_port - 3 - 15], "uploadyourfiles", 15) == 0
|
||||
&& (packet->host_line.ptr[host_line_len_without_port - 3 - 15 - 1] == ' '
|
||||
|| packet->host_line.ptr[host_line_len_without_port - 3 - 15 - 1] == '.')) {
|
||||
goto end_ddl_found;
|
||||
}
|
||||
goto end_ddl_nothing_found;
|
||||
}
|
||||
if (host_line_len_without_port >= 0 + 14 + 1
|
||||
&& memcmp((void *) &packet->host_line.ptr[host_line_len_without_port - 0 - 14], "speedshare.org", 14) == 0
|
||||
&& (packet->host_line.ptr[host_line_len_without_port - 0 - 14 - 1] == ' '
|
||||
|| packet->host_line.ptr[host_line_len_without_port - 0 - 14 - 1] == '.')) {
|
||||
goto end_ddl_found;
|
||||
}
|
||||
// END OF AUTOMATED CODE GENERATION
|
||||
|
||||
/* This is the hard way. We do this in order to find the download of services when other
|
||||
domains are involved. This is not significant if ddl is blocked. --> then the link can not be started because
|
||||
the ads are not viewed. But when ddl is only limited then the download is the important part.
|
||||
*/
|
||||
|
||||
end_ddl_nothing_found:
|
||||
NDPI_LOG(NDPI_PROTOCOL_DIRECT_DOWNLOAD_LINK, ndpi_struct, NDPI_LOG_DEBUG,
|
||||
"Nothing Found\n");
|
||||
return 0;
|
||||
|
||||
end_ddl_found:
|
||||
NDPI_LOG(NDPI_PROTOCOL_DIRECT_DOWNLOAD_LINK, ndpi_struct, NDPI_LOG_DEBUG, "DDL: DIRECT DOWNLOAD LINK FOUND\n");
|
||||
ndpi_int_direct_download_link_add_connection(ndpi_struct, flow);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
void ndpi_search_direct_download_link_tcp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
{
|
||||
struct ndpi_packet_struct *packet = &flow->packet;
|
||||
|
||||
// struct ndpi_id_struct *src=ndpi_struct->src;
|
||||
// struct ndpi_id_struct *dst=ndpi_struct->dst;
|
||||
#if 0
|
||||
if (ndpi_struct->direct_download_link_counter_callback != NULL) {
|
||||
if (packet->detected_protocol == NDPI_PROTOCOL_DIRECT_DOWNLOAD_LINK) {
|
||||
/* skip packets not requests from the client to the server */
|
||||
if (packet->packet_direction == flow->l4.tcp.ddlink_server_direction) {
|
||||
search_ddl_domains(ndpi_struct, flow); // do the detection again in order to get the URL in keep alive streams
|
||||
} else {
|
||||
// just count the packet
|
||||
ndpi_struct->direct_download_link_counter_callback(flow->hash_id_number, packet->l3_packet_len);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
// do not detect again if it is already ddl
|
||||
if (packet->detected_protocol_stack[0] != NDPI_PROTOCOL_DIRECT_DOWNLOAD_LINK) {
|
||||
if (search_ddl_domains(ndpi_struct, flow) != 0) {
|
||||
return;
|
||||
}
|
||||
NDPI_ADD_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, NDPI_PROTOCOL_DIRECT_DOWNLOAD_LINK);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void init_directdownloadlink_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask)
|
||||
{
|
||||
ndpi_set_bitmask_protocol_detection("Direct_Download_Link", ndpi_struct, detection_bitmask, *id,
|
||||
NDPI_PROTOCOL_DIRECT_DOWNLOAD_LINK,
|
||||
ndpi_search_direct_download_link_tcp,
|
||||
NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP_WITH_PAYLOAD,
|
||||
SAVE_DETECTION_BITMASK_AS_UNKNOWN,
|
||||
ADD_TO_DETECTION_BITMASK);
|
||||
|
||||
*id += 1;
|
||||
}
|
||||
#endif
|
||||
@@ -1,315 +0,0 @@
|
||||
/*
|
||||
* dns.c
|
||||
*
|
||||
* Copyright (C) 2012-15 - ntop.org
|
||||
*
|
||||
* This file is part of nDPI, an open source deep packet inspection
|
||||
* library based on the OpenDPI and PACE technology by ipoque GmbH
|
||||
*
|
||||
* nDPI is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* nDPI is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with nDPI. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include "ndpi_protocols.h"
|
||||
|
||||
#ifdef NDPI_PROTOCOL_DNS
|
||||
|
||||
static u_int getNameLength(u_int i, const u_int8_t *payload, u_int payloadLen) {
|
||||
if(payload[i] == 0x00)
|
||||
return(1);
|
||||
else if(payload[i] == 0xC0)
|
||||
return(2);
|
||||
else {
|
||||
u_int8_t len = payload[i];
|
||||
u_int8_t off = len + 1;
|
||||
|
||||
if(off == 0) /* Bad packet */
|
||||
return(0);
|
||||
else
|
||||
return(off + getNameLength(i+off, payload, payloadLen));
|
||||
}
|
||||
}
|
||||
|
||||
/* *********************************************** */
|
||||
|
||||
static char* ndpi_intoa_v4(unsigned int addr, char* buf, u_short bufLen) {
|
||||
char *cp, *retStr;
|
||||
uint byte;
|
||||
int n;
|
||||
|
||||
cp = &buf[bufLen];
|
||||
*--cp = '\0';
|
||||
|
||||
n = 4;
|
||||
do {
|
||||
byte = addr & 0xff;
|
||||
*--cp = byte % 10 + '0';
|
||||
byte /= 10;
|
||||
if(byte > 0) {
|
||||
*--cp = byte % 10 + '0';
|
||||
byte /= 10;
|
||||
if(byte > 0)
|
||||
*--cp = byte + '0';
|
||||
}
|
||||
*--cp = '.';
|
||||
addr >>= 8;
|
||||
} while (--n > 0);
|
||||
|
||||
/* Convert the string to lowercase */
|
||||
retStr = (char*)(cp+1);
|
||||
|
||||
return(retStr);
|
||||
}
|
||||
|
||||
/* *********************************************** */
|
||||
|
||||
static u_int16_t get16(int *i, const u_int8_t *payload) {
|
||||
u_int16_t v = *(u_int16_t*)&payload[*i];
|
||||
|
||||
(*i) += 2;
|
||||
|
||||
return(ntohs(v));
|
||||
}
|
||||
|
||||
/* *********************************************** */
|
||||
|
||||
struct dns_packet_header {
|
||||
u_int16_t transaction_id, flags, num_queries, answer_rrs, authority_rrs, additional_rrs;
|
||||
} __attribute__((packed));
|
||||
|
||||
void ndpi_search_dns(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
{
|
||||
struct ndpi_packet_struct *packet = &flow->packet;
|
||||
u_int16_t dport = 0, sport = 0;
|
||||
|
||||
#define NDPI_MAX_DNS_REQUESTS 16
|
||||
|
||||
NDPI_LOG(NDPI_PROTOCOL_DNS, ndpi_struct, NDPI_LOG_DEBUG, "search DNS.\n");
|
||||
|
||||
if (packet->udp != NULL) {
|
||||
sport = ntohs(packet->udp->source), dport = ntohs(packet->udp->dest);
|
||||
NDPI_LOG(NDPI_PROTOCOL_DNS, ndpi_struct, NDPI_LOG_DEBUG, "calculated dport over UDP.\n");
|
||||
} else if(packet->tcp != NULL) {
|
||||
sport = ntohs(packet->tcp->source), dport = ntohs(packet->tcp->dest);
|
||||
NDPI_LOG(NDPI_PROTOCOL_DNS, ndpi_struct, NDPI_LOG_DEBUG, "calculated dport over tcp.\n");
|
||||
}
|
||||
|
||||
if(((dport == 53) || (sport == 53) || (dport == 5355))
|
||||
&& (packet->payload_packet_len > sizeof(struct dns_packet_header))) {
|
||||
int i = packet->tcp ? 2 : 0;
|
||||
struct dns_packet_header header, *dns = (struct dns_packet_header*)&packet->payload[i];
|
||||
u_int8_t is_query, ret_code, is_dns = 0;
|
||||
u_int32_t a_record[NDPI_MAX_DNS_REQUESTS] = { 0 }, query_offset, num_a_records = 0;
|
||||
|
||||
header.flags = ntohs(dns->flags);
|
||||
header.transaction_id = ntohs(dns->transaction_id);
|
||||
header.num_queries = ntohs(dns->num_queries);
|
||||
header.answer_rrs = ntohs(dns->answer_rrs);
|
||||
header.authority_rrs = ntohs(dns->authority_rrs);
|
||||
header.additional_rrs = ntohs(dns->additional_rrs);
|
||||
is_query = (header.flags & 0x8000) ? 0 : 1;
|
||||
ret_code = is_query ? 0 : (header.flags & 0x0F);
|
||||
i += sizeof(struct dns_packet_header);
|
||||
query_offset = i;
|
||||
|
||||
if(is_query) {
|
||||
/* DNS Request */
|
||||
if((header.num_queries > 0) && (header.num_queries <= NDPI_MAX_DNS_REQUESTS)
|
||||
&& (((header.flags & 0x2800) == 0x2800 /* Dynamic DNS Update */)
|
||||
|| ((header.answer_rrs == 0) && (header.authority_rrs == 0)))) {
|
||||
/* This is a good query */
|
||||
is_dns = 1;
|
||||
|
||||
if(header.num_queries > 0) {
|
||||
while(i < packet->payload_packet_len) {
|
||||
if(packet->payload[i] == '\0') {
|
||||
i++;
|
||||
flow->protos.dns.query_type = get16(&i, packet->payload);
|
||||
break;
|
||||
} else
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
/* DNS Reply */
|
||||
|
||||
flow->server_id = flow->dst;
|
||||
|
||||
if((header.num_queries <= NDPI_MAX_DNS_REQUESTS) /* Don't assume that num_queries must be zero */
|
||||
&& (((header.answer_rrs > 0) && (header.answer_rrs <= NDPI_MAX_DNS_REQUESTS))
|
||||
|| ((header.authority_rrs > 0) && (header.authority_rrs <= NDPI_MAX_DNS_REQUESTS))
|
||||
|| ((header.additional_rrs > 0) && (header.additional_rrs <= NDPI_MAX_DNS_REQUESTS)))
|
||||
) {
|
||||
/* This is a good reply */
|
||||
is_dns = 1;
|
||||
|
||||
i++;
|
||||
|
||||
if(packet->payload[i] != '\0') {
|
||||
while((i < packet->payload_packet_len)
|
||||
&& (packet->payload[i] != '\0')) {
|
||||
i++;
|
||||
}
|
||||
|
||||
i++;
|
||||
}
|
||||
|
||||
i += 4;
|
||||
|
||||
if(header.answer_rrs > 0) {
|
||||
u_int16_t rsp_type;
|
||||
u_int16_t num;
|
||||
|
||||
for(num = 0; num < header.answer_rrs; num++) {
|
||||
u_int16_t data_len;
|
||||
|
||||
if((i+6) >= packet->payload_packet_len) {
|
||||
break;
|
||||
}
|
||||
|
||||
if((data_len = getNameLength(i, packet->payload, packet->payload_packet_len)) == 0) {
|
||||
break;
|
||||
} else
|
||||
i += data_len;
|
||||
|
||||
rsp_type = get16(&i, packet->payload);
|
||||
|
||||
// Skip past the CLASS (2 octets) and TTL (4 octets) fields.
|
||||
i += 6;
|
||||
data_len = get16(&i, packet->payload);
|
||||
|
||||
if((data_len <= 1) || (data_len > (packet->payload_packet_len-i))) {
|
||||
break;
|
||||
}
|
||||
|
||||
flow->protos.dns.rsp_type = rsp_type;
|
||||
|
||||
if(rsp_type == 1 /* A */) {
|
||||
if(data_len == 4) {
|
||||
u_int32_t v = ntohl(*((u_int32_t*)&packet->payload[i]));
|
||||
|
||||
if(num_a_records < (NDPI_MAX_DNS_REQUESTS-1))
|
||||
a_record[num_a_records++] = v;
|
||||
else
|
||||
break; /* One record is enough */
|
||||
}
|
||||
}
|
||||
|
||||
if(data_len == 0) {
|
||||
break;
|
||||
}
|
||||
|
||||
i += data_len;
|
||||
} /* for */
|
||||
}
|
||||
}
|
||||
|
||||
if((header.num_queries <= NDPI_MAX_DNS_REQUESTS)
|
||||
&& ((header.answer_rrs == 0)
|
||||
|| (header.authority_rrs == 0)
|
||||
|| (header.additional_rrs == 0))
|
||||
&& (ret_code != 0 /* 0 == OK */)
|
||||
) {
|
||||
/* This is a good reply */
|
||||
is_dns = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if(is_dns) {
|
||||
int j = 0;
|
||||
|
||||
flow->protos.dns.num_queries = (u_int8_t)header.num_queries,
|
||||
flow->protos.dns.num_answers = (u_int8_t)(header.answer_rrs+header.authority_rrs+header.additional_rrs),
|
||||
flow->protos.dns.ret_code = ret_code;
|
||||
|
||||
i = query_offset+1;
|
||||
|
||||
while((i < packet->payload_packet_len)
|
||||
&& (j < (sizeof(flow->host_server_name)-1))
|
||||
&& (packet->payload[i] != '\0')) {
|
||||
flow->host_server_name[j] = tolower(packet->payload[i]);
|
||||
if(flow->host_server_name[j] < ' ')
|
||||
flow->host_server_name[j] = '.';
|
||||
j++, i++;
|
||||
}
|
||||
|
||||
if(a_record[0] != 0) {
|
||||
char a_buf[32];
|
||||
int i;
|
||||
|
||||
for(i=0; j < sizeof(flow->host_server_name)-1 && i < num_a_records; i++) {
|
||||
j += snprintf((char*)&flow->host_server_name[j], sizeof(flow->host_server_name)-1-j, "%s%s",
|
||||
(i == 0) ? "@" : ";",
|
||||
ndpi_intoa_v4(a_record[i], a_buf, sizeof(a_buf)));
|
||||
}
|
||||
}
|
||||
|
||||
flow->host_server_name[j] = '\0';
|
||||
|
||||
if(j > 0) {
|
||||
#ifdef DEBUG
|
||||
printf("==> %s\n", flow->host_server_name);
|
||||
#endif
|
||||
|
||||
if(ndpi_struct->match_dns_host_names)
|
||||
ndpi_match_host_subprotocol(ndpi_struct, flow,
|
||||
(char *)flow->host_server_name,
|
||||
strlen((const char*)flow->host_server_name),
|
||||
NDPI_PROTOCOL_DNS);
|
||||
}
|
||||
|
||||
i++;
|
||||
|
||||
memcpy(&flow->protos.dns.query_type, &packet->payload[i], 2);
|
||||
flow->protos.dns.query_type = ntohs(flow->protos.dns.query_type), i += 2;
|
||||
|
||||
memcpy(&flow->protos.dns.query_class, &packet->payload[i], 2);
|
||||
flow->protos.dns.query_class = ntohs(flow->protos.dns.query_class), i += 2;
|
||||
|
||||
#ifdef DEBUG
|
||||
printf("%s [type=%04X][class=%04X]\n", flow->host_server_name, flow->protos.dns.query_type, flow->protos.dns.query_class);
|
||||
#endif
|
||||
|
||||
if(packet->detected_protocol_stack[0] == NDPI_PROTOCOL_UNKNOWN) {
|
||||
/*
|
||||
Do not set the protocol with DNS if ndpi_match_host_subprotocol() has
|
||||
matched a subprotocol
|
||||
*/
|
||||
NDPI_LOG(NDPI_PROTOCOL_DNS, ndpi_struct, NDPI_LOG_DEBUG, "found DNS.\n");
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, (dport == 5355) ? NDPI_PROTOCOL_LLMNR : NDPI_PROTOCOL_DNS, NDPI_PROTOCOL_UNKNOWN);
|
||||
}
|
||||
} else {
|
||||
flow->protos.dns.bad_packet = 1;
|
||||
NDPI_LOG(NDPI_PROTOCOL_DNS, ndpi_struct, NDPI_LOG_DEBUG, "exclude DNS.\n");
|
||||
NDPI_ADD_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, NDPI_PROTOCOL_DNS);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void init_dns_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask)
|
||||
{
|
||||
ndpi_set_bitmask_protocol_detection("DNS", ndpi_struct, detection_bitmask, *id,
|
||||
NDPI_PROTOCOL_DNS,
|
||||
ndpi_search_dns,
|
||||
NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP_OR_UDP_WITH_PAYLOAD_WITHOUT_RETRANSMISSION,
|
||||
SAVE_DETECTION_BITMASK_AS_UNKNOWN,
|
||||
ADD_TO_DETECTION_BITMASK);
|
||||
|
||||
*id += 1;
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,160 +0,0 @@
|
||||
/*
|
||||
* dofus.c
|
||||
*
|
||||
* Copyright (C) 2009-2011 by ipoque GmbH
|
||||
* Copyright (C) 2011-15 - ntop.org
|
||||
*
|
||||
* This file is part of nDPI, an open source deep packet inspection
|
||||
* library based on the OpenDPI and PACE technology by ipoque GmbH
|
||||
*
|
||||
* nDPI is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* nDPI is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with nDPI. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include "ndpi_api.h"
|
||||
|
||||
#ifdef NDPI_PROTOCOL_DOFUS
|
||||
|
||||
static void ndpi_dofus_add_connection(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
{
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_DOFUS, NDPI_PROTOCOL_UNKNOWN);
|
||||
}
|
||||
|
||||
void ndpi_search_dofus(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
{
|
||||
struct ndpi_packet_struct *packet = &flow->packet;
|
||||
// struct ndpi_id_struct *src=ndpi_struct->src;
|
||||
// struct ndpi_id_struct *dst=ndpi_struct->dst;
|
||||
|
||||
|
||||
/* Dofus v 1.x.x */
|
||||
if (packet->payload_packet_len == 13 && get_u_int16_t(packet->payload, 1) == ntohs(0x0508)
|
||||
&& get_u_int16_t(packet->payload, 5) == ntohs(0x04a0)
|
||||
&& get_u_int16_t(packet->payload, packet->payload_packet_len - 2) == ntohs(0x0194)) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_DOFUS, ndpi_struct, NDPI_LOG_DEBUG, "found dofus.\n");
|
||||
ndpi_dofus_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
if (flow->l4.tcp.dofus_stage == 0 && packet->payload_packet_len == 3 && memcmp(packet->payload, "HG", 2) == 0
|
||||
&& packet->payload[packet->payload_packet_len - 1] == 0) {
|
||||
flow->l4.tcp.dofus_stage = 1;
|
||||
NDPI_LOG(NDPI_PROTOCOL_DOFUS, ndpi_struct, NDPI_LOG_DEBUG, "maybe dofus.\n");
|
||||
return;
|
||||
}
|
||||
if (flow->l4.tcp.dofus_stage == 0 && packet->payload_packet_len == 35 && memcmp(packet->payload, "HC", 2) == 0
|
||||
&& packet->payload[packet->payload_packet_len - 1] == 0) {
|
||||
flow->l4.tcp.dofus_stage = 1;
|
||||
NDPI_LOG(NDPI_PROTOCOL_DOFUS, ndpi_struct, NDPI_LOG_DEBUG, "maybe dofus.\n");
|
||||
return;
|
||||
}
|
||||
if (flow->l4.tcp.dofus_stage == 0 && packet->payload_packet_len > 2 && packet->payload[0] == 'A'
|
||||
&& (packet->payload[1] == 'x' || packet->payload[1] == 'X')
|
||||
&& packet->payload[packet->payload_packet_len - 1] == 0) {
|
||||
flow->l4.tcp.dofus_stage = 1;
|
||||
NDPI_LOG(NDPI_PROTOCOL_DOFUS, ndpi_struct, NDPI_LOG_DEBUG, "maybe dofus.\n");
|
||||
return;
|
||||
}
|
||||
if (flow->l4.tcp.dofus_stage == 0 && packet->payload_packet_len == 12 && memcmp(packet->payload, "Af", 2) == 0
|
||||
&& packet->payload[packet->payload_packet_len - 1] == 0) {
|
||||
flow->l4.tcp.dofus_stage = 1;
|
||||
NDPI_LOG(NDPI_PROTOCOL_DOFUS, ndpi_struct, NDPI_LOG_DEBUG, "maybe dofus.\n");
|
||||
return;
|
||||
}
|
||||
if (flow->l4.tcp.dofus_stage == 0 && packet->payload_packet_len > 2 && memcmp(packet->payload, "Ad", 2)
|
||||
&& packet->payload[packet->payload_packet_len - 1] == 0) {
|
||||
flow->l4.tcp.dofus_stage = 1;
|
||||
NDPI_LOG(NDPI_PROTOCOL_DOFUS, ndpi_struct, NDPI_LOG_DEBUG, "maybe dofus.\n");
|
||||
return;
|
||||
}
|
||||
if (packet->payload_packet_len == 11 && memcmp(packet->payload, "AT", 2) == 0 && packet->payload[10] == 0x00) {
|
||||
if (flow->l4.tcp.dofus_stage == 1) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_DOFUS, ndpi_struct, NDPI_LOG_DEBUG, "found dofus.\n");
|
||||
ndpi_dofus_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (flow->l4.tcp.dofus_stage == 1 && packet->payload_packet_len == 5
|
||||
&& packet->payload[0] == 'A' && packet->payload[4] == 0x00 && (packet->payload[1] == 'T'
|
||||
|| packet->payload[1] == 'k')) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_DOFUS, ndpi_struct, NDPI_LOG_DEBUG, "found dofus asym.\n");
|
||||
ndpi_dofus_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
/* end Dofus 1.x.x */
|
||||
|
||||
|
||||
/* Dofus 2.0 */
|
||||
if ((packet->payload_packet_len == 11 || packet->payload_packet_len == 13 || packet->payload_packet_len == 49)
|
||||
&& get_u_int32_t(packet->payload, 0) == ntohl(0x00050800)
|
||||
&& get_u_int16_t(packet->payload, 4) == ntohs(0x0005)
|
||||
&& get_u_int16_t(packet->payload, 8) == ntohs(0x0005)
|
||||
&& packet->payload[10] == 0x18) {
|
||||
if (packet->payload_packet_len == 13
|
||||
&& get_u_int16_t(packet->payload, packet->payload_packet_len - 2) != ntohs(0x0194)) {
|
||||
goto exclude;
|
||||
}
|
||||
if (packet->payload_packet_len == 49 && ntohs(get_u_int16_t(packet->payload, 15)) + 17 != packet->payload_packet_len) {
|
||||
goto exclude;
|
||||
}
|
||||
NDPI_LOG(NDPI_PROTOCOL_DOFUS, ndpi_struct, NDPI_LOG_DEBUG, "found dofus.\n");
|
||||
ndpi_dofus_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
if (packet->payload_packet_len >= 41 && get_u_int16_t(packet->payload, 0) == ntohs(0x01b9) && packet->payload[2] == 0x26) {
|
||||
u_int16_t len, len2;
|
||||
len = ntohs(get_u_int16_t(packet->payload, 3));
|
||||
if ((len + 5 + 2) > packet->payload_packet_len)
|
||||
goto exclude;
|
||||
len2 = ntohs(get_u_int16_t(packet->payload, 5 + len));
|
||||
if (5 + len + 2 + len2 == packet->payload_packet_len) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_DOFUS, ndpi_struct, NDPI_LOG_DEBUG, "found dofus.\n");
|
||||
ndpi_dofus_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (packet->payload_packet_len == 56
|
||||
&& memcmp(packet->payload, "\x00\x11\x35\x02\x03\x00\x93\x96\x01\x00", 10) == 0) {
|
||||
u_int16_t len, len2;
|
||||
len = ntohs(get_u_int16_t(packet->payload, 10));
|
||||
if ((len + 12 + 2) > packet->payload_packet_len)
|
||||
goto exclude;
|
||||
len2 = ntohs(get_u_int16_t(packet->payload, 12 + len));
|
||||
if ((12 + len + 2 + len2 + 1) > packet->payload_packet_len)
|
||||
goto exclude;
|
||||
if (12 + len + 2 + len2 + 1 == packet->payload_packet_len && packet->payload[12 + len + 2 + len2] == 0x01) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_DOFUS, ndpi_struct, NDPI_LOG_DEBUG, "found dofus.\n");
|
||||
ndpi_dofus_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
}
|
||||
exclude:
|
||||
NDPI_LOG(NDPI_PROTOCOL_DOFUS, ndpi_struct, NDPI_LOG_DEBUG, "exclude dofus.\n");
|
||||
NDPI_ADD_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, NDPI_PROTOCOL_DOFUS);
|
||||
}
|
||||
|
||||
|
||||
void init_dofus_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask)
|
||||
{
|
||||
ndpi_set_bitmask_protocol_detection("Dofus", ndpi_struct, detection_bitmask, *id,
|
||||
NDPI_PROTOCOL_DOFUS,
|
||||
ndpi_search_dofus,
|
||||
NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP_WITH_PAYLOAD_WITHOUT_RETRANSMISSION,
|
||||
SAVE_DETECTION_BITMASK_AS_UNKNOWN,
|
||||
ADD_TO_DETECTION_BITMASK);
|
||||
|
||||
*id += 1;
|
||||
}
|
||||
#endif
|
||||
@@ -1,89 +0,0 @@
|
||||
/*
|
||||
* dropbox.c
|
||||
*
|
||||
* Copyright (C) 2011-13 by ntop.org
|
||||
*
|
||||
* This file is part of nDPI, an open source deep packet inspection
|
||||
* library based on the OpenDPI and PACE technology by ipoque GmbH
|
||||
*
|
||||
* nDPI is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* nDPI is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with nDPI. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include "ndpi_api.h"
|
||||
|
||||
#ifdef NDPI_PROTOCOL_DROPBOX
|
||||
static void ndpi_int_dropbox_add_connection(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
struct ndpi_flow_struct *flow,
|
||||
u_int8_t due_to_correlation)
|
||||
{
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_DROPBOX, NDPI_PROTOCOL_UNKNOWN);
|
||||
}
|
||||
|
||||
|
||||
static void ndpi_check_dropbox(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
{
|
||||
struct ndpi_packet_struct *packet = &flow->packet;
|
||||
// const u_int8_t *packet_payload = packet->payload;
|
||||
u_int32_t payload_len = packet->payload_packet_len;
|
||||
|
||||
if(packet->udp != NULL) {
|
||||
u_int16_t dropbox_port = htons(17500);
|
||||
|
||||
if((packet->udp->source == dropbox_port)
|
||||
&& (packet->udp->dest == dropbox_port)) {
|
||||
if(payload_len > 2) {
|
||||
if(strncmp((const char *)packet->payload, "{\"", 2) == 0) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_DROPBOX, ndpi_struct, NDPI_LOG_DEBUG, "Found dropbox.\n");
|
||||
ndpi_int_dropbox_add_connection(ndpi_struct, flow, 0);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
NDPI_LOG(NDPI_PROTOCOL_DROPBOX, ndpi_struct, NDPI_LOG_DEBUG, "exclude dropbox.\n");
|
||||
NDPI_ADD_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, NDPI_PROTOCOL_DROPBOX);
|
||||
}
|
||||
|
||||
void ndpi_search_dropbox(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
{
|
||||
struct ndpi_packet_struct *packet = &flow->packet;
|
||||
|
||||
NDPI_LOG(NDPI_PROTOCOL_DROPBOX, ndpi_struct, NDPI_LOG_DEBUG, "dropbox detection...\n");
|
||||
|
||||
/* skip marked packets */
|
||||
if (packet->detected_protocol_stack[0] != NDPI_PROTOCOL_DROPBOX) {
|
||||
if (packet->tcp_retransmission == 0) {
|
||||
ndpi_check_dropbox(ndpi_struct, flow);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void init_dropbox_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask)
|
||||
{
|
||||
ndpi_set_bitmask_protocol_detection("DROPBOX", ndpi_struct, detection_bitmask, *id,
|
||||
NDPI_PROTOCOL_DROPBOX,
|
||||
ndpi_search_dropbox,
|
||||
NDPI_SELECTION_BITMASK_PROTOCOL_UDP_WITH_PAYLOAD,
|
||||
SAVE_DETECTION_BITMASK_AS_UNKNOWN,
|
||||
ADD_TO_DETECTION_BITMASK);
|
||||
*id += 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
@@ -1,85 +0,0 @@
|
||||
/*
|
||||
* eaq.c
|
||||
*
|
||||
* Copyright (C) 2015 - ntop.org
|
||||
*
|
||||
* This module is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This module is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
EAQ: Entitade Aferidora da Qualidade de Banda Larga
|
||||
|
||||
http://www.brasilbandalarga.com.br
|
||||
*/
|
||||
#include "ndpi_api.h"
|
||||
|
||||
#define EAQ_DEFAULT_PORT 6000
|
||||
#define EAQ_DEFAULT_SIZE 16
|
||||
|
||||
#ifdef NDPI_PROTOCOL_EAQ
|
||||
static void ndpi_int_eaq_add_connection(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
struct ndpi_flow_struct *flow) {
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_EAQ, NDPI_PROTOCOL_UNKNOWN);
|
||||
}
|
||||
|
||||
|
||||
void ndpi_search_eaq(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow) {
|
||||
struct ndpi_packet_struct *packet = &flow->packet;
|
||||
u_int16_t sport = ntohs(packet->udp->source), dport = ntohs(packet->udp->dest);
|
||||
|
||||
if((packet->payload_packet_len != EAQ_DEFAULT_SIZE)
|
||||
|| ((sport != EAQ_DEFAULT_PORT) && (dport != EAQ_DEFAULT_PORT))) {
|
||||
exclude_eaq:
|
||||
NDPI_LOG(NDPI_PROTOCOL_EAQ, ndpi_struct, NDPI_LOG_DEBUG, "Exclude eaq.\n");
|
||||
NDPI_ADD_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, NDPI_PROTOCOL_EAQ);
|
||||
return;
|
||||
}
|
||||
|
||||
if(packet->udp != NULL) {
|
||||
u_int32_t seq = (packet->payload[0] * 1000) + (packet->payload[1] * 100) + (packet->payload[2] * 10) + packet->payload[3];
|
||||
|
||||
if(flow->l4.udp.eaq_pkt_id == 0)
|
||||
flow->l4.udp.eaq_sequence = seq;
|
||||
else {
|
||||
if((flow->l4.udp.eaq_sequence == seq) || ((flow->l4.udp.eaq_sequence+1) == seq)) {
|
||||
; /* Looks good */
|
||||
} else
|
||||
goto exclude_eaq;
|
||||
}
|
||||
|
||||
if(++flow->l4.udp.eaq_pkt_id == 4) {
|
||||
/* We have collected enough packets so we assume it's EAQ */
|
||||
NDPI_LOG(NDPI_PROTOCOL_EAQ, ndpi_struct, NDPI_LOG_DEBUG, "found eaq.\n");
|
||||
ndpi_int_eaq_add_connection(ndpi_struct, flow);
|
||||
}
|
||||
} else
|
||||
goto exclude_eaq;
|
||||
}
|
||||
|
||||
|
||||
void init_eaq_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask)
|
||||
{
|
||||
ndpi_set_bitmask_protocol_detection("EAQ", ndpi_struct, detection_bitmask, *id,
|
||||
NDPI_PROTOCOL_EAQ,
|
||||
ndpi_search_eaq,
|
||||
NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_UDP_WITH_PAYLOAD,
|
||||
SAVE_DETECTION_BITMASK_AS_UNKNOWN,
|
||||
ADD_TO_DETECTION_BITMASK);
|
||||
|
||||
*id += 1;
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,224 +0,0 @@
|
||||
/*
|
||||
* edonkey.c
|
||||
*
|
||||
* Copyright (C) 2014 Tomasz Bujlow <tomasz@skatnet.dk>
|
||||
*
|
||||
* The signature is based on the Libprotoident library.
|
||||
*
|
||||
* This file is part of nDPI, an open source deep packet inspection
|
||||
* library based on the OpenDPI and PACE technology by ipoque GmbH
|
||||
*
|
||||
* nDPI is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* nDPI is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with nDPI. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include "ndpi_api.h"
|
||||
|
||||
#ifdef NDPI_PROTOCOL_EDONKEY
|
||||
static void ndpi_int_edonkey_add_connection(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow) {
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_EDONKEY, NDPI_PROTOCOL_UNKNOWN);
|
||||
}
|
||||
|
||||
static int ndpi_edonkey_payload_check(const u_int8_t *data, u_int32_t len) {
|
||||
|
||||
if ((len >= 4) && (data[0] == 0xe3) && (data[2] == 0x00) && (data[3] == 0x00))
|
||||
return 1;
|
||||
|
||||
if ((len >= 4) && (data[0] == 0xc5) && (data[2] == 0x00) && (data[3] == 0x00))
|
||||
return 1;
|
||||
|
||||
if ((len >= 2) && (data[0] == 0xe5) && (data[1] == 0x43))
|
||||
return 1;
|
||||
|
||||
if ((len >= 4) && (data[0] == 0xe5) && (data[1] == 0x08) && (data[2] == 0x78) && (data[3] == 0xda))
|
||||
return 1;
|
||||
|
||||
if ((len >= 4) && (data[0] == 0xe5) && (data[1] == 0x28) && (data[2] == 0x78) && (data[3] == 0xda))
|
||||
return 1;
|
||||
|
||||
if ((len >= 2) && (data[0] == 0xc5) && (data[1] == 0x90))
|
||||
return 1;
|
||||
|
||||
if ((len >= 2) && (data[0] == 0xc5) && (data[1] == 0x91))
|
||||
return 1;
|
||||
|
||||
if ((len == 2) && (data[0] == 0xc5) && (data[1] == 0x92))
|
||||
return 1;
|
||||
|
||||
if ((len == 2) && (data[0] == 0xc5) && (data[1] == 0x93))
|
||||
return 1;
|
||||
|
||||
if ((len >= 38 && len <= 70) && (data[0] == 0xc5) && (data[1] == 0x94))
|
||||
return 1;
|
||||
|
||||
if ((len >= 2) && (data[0] == 0xe3) && (data[1] == 0x9a))
|
||||
return 1;
|
||||
|
||||
if ((len >= 2) && (data[0] == 0xe3) && (data[1] == 0x9b))
|
||||
return 1;
|
||||
|
||||
if ((len == 6) && (data[0] == 0xe3) && (data[1] == 0x96))
|
||||
return 1;
|
||||
|
||||
if ((len <= 34 && ((len - 2) % 4 == 0)) && (data[0] == 0xe3) && (data[1] == 0x97))
|
||||
return 1;
|
||||
|
||||
if ((len >= 2) && (data[0] == 0xe3) && (data[1] == 0x92))
|
||||
return 1;
|
||||
|
||||
if ((len >= 2) && (data[0] == 0xe3) && (data[1] == 0x94))
|
||||
return 1;
|
||||
|
||||
if ((len >= 2) && (data[0] == 0xe3) && (data[1] == 0x98))
|
||||
return 1;
|
||||
|
||||
if ((len >= 2) && (data[0] == 0xe3) && (data[1] == 0x99))
|
||||
return 1;
|
||||
|
||||
if ((len == 6) && (data[0] == 0xe3) && (data[1] == 0xa2))
|
||||
return 1;
|
||||
|
||||
if ((len >= 2) && (data[0] == 0xe3) && (data[1] == 0xa3))
|
||||
return 1;
|
||||
|
||||
if ((len == 27) && (data[0] == 0xe4) && (data[1] == 0x00))
|
||||
return 1;
|
||||
|
||||
if ((len == 529) && (data[0] == 0xe4) && (data[1] == 0x08))
|
||||
return 1;
|
||||
|
||||
if ((len == 18) && (data[0] == 0xe4) && (data[1] == 0x01) && (data[2] == 0x00) && (data[3] == 0x00))
|
||||
return 1;
|
||||
|
||||
if ((len == 523) && (data[0] == 0xe4) && (data[1] == 0x09))
|
||||
return 1;
|
||||
|
||||
if ((len == 35) && (data[0] == 0xe4) && (data[1] == 0x21))
|
||||
return 1;
|
||||
|
||||
if ((len == 19) && (data[0] == 0xe4) && (data[1] == 0x4b))
|
||||
return 1;
|
||||
|
||||
if ((len >= 2) && (data[0] == 0xe4) && (data[1] == 0x11))
|
||||
return 1;
|
||||
|
||||
if ((len == 22 || len == 38 || len == 28) && (data[0] == 0xe4) && (data[1] == 0x19))
|
||||
return 1;
|
||||
|
||||
if ((len == 35) && (data[0] == 0xe4) && (data[1] == 0x20))
|
||||
return 1;
|
||||
|
||||
if ((len == 27) && (data[0] == 0xe4) && (data[1] == 0x18))
|
||||
return 1;
|
||||
|
||||
if ((len == 27) && (data[0] == 0xe4) && (data[1] == 0x10))
|
||||
return 1;
|
||||
|
||||
if ((len == 6) && (data[0] == 0xe4) && (data[1] == 0x58))
|
||||
return 1;
|
||||
|
||||
if ((len == 4) && (data[0] == 0xe4) && (data[1] == 0x50))
|
||||
return 1;
|
||||
|
||||
if ((len == 36) && (data[0] == 0xe4) && (data[1] == 0x52))
|
||||
return 1;
|
||||
|
||||
if ((len == 48) && (data[0] == 0xe4) && (data[1] == 0x40))
|
||||
return 1;
|
||||
|
||||
if ((len == 225) && (data[0] == 0xe4) && (data[1] == 0x43))
|
||||
return 1;
|
||||
|
||||
if ((len == 19) && (data[0] == 0xe4) && (data[1] == 0x48))
|
||||
return 1;
|
||||
|
||||
if ((len == 119 || len == 69 || len == 294) && (data[0] == 0xe4) && (data[1] == 0x29))
|
||||
return 1;
|
||||
|
||||
if ((len == 119 || len == 69 || len == 294 || len == 44 || len == 269) && (data[0] == 0xe4) && (data[1] == 0x28))
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void ndpi_check_edonkey(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow) {
|
||||
struct ndpi_packet_struct *packet = &flow->packet;
|
||||
u_int32_t payload_len = packet->payload_packet_len;
|
||||
|
||||
/* Break after 20 packets. */
|
||||
if (flow->packet_counter > 20) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_EDONKEY, ndpi_struct, NDPI_LOG_DEBUG, "Exclude EDONKEY.\n");
|
||||
NDPI_ADD_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, NDPI_PROTOCOL_EDONKEY);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Check if we so far detected the protocol in the request or not. */
|
||||
if (flow->edonkey_stage == 0) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_EDONKEY, ndpi_struct, NDPI_LOG_DEBUG, "EDONKEY stage 0: \n");
|
||||
|
||||
if (ndpi_edonkey_payload_check(packet->payload, payload_len)) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_EDONKEY, ndpi_struct, NDPI_LOG_DEBUG, "Possible EDONKEY request detected, we will look further for the response...\n");
|
||||
|
||||
/* Encode the direction of the packet in the stage, so we will know when we need to look for the response packet. */
|
||||
flow->edonkey_stage = packet->packet_direction + 1;
|
||||
}
|
||||
|
||||
} else {
|
||||
NDPI_LOG(NDPI_PROTOCOL_EDONKEY, ndpi_struct, NDPI_LOG_DEBUG, "EDONKEY stage %u: \n", flow->edonkey_stage);
|
||||
|
||||
/* At first check, if this is for sure a response packet (in another direction. If not, do nothing now and return. */
|
||||
if ((flow->edonkey_stage - packet->packet_direction) == 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* This is a packet in another direction. Check if we find the proper response. */
|
||||
if ((payload_len == 0) || (ndpi_edonkey_payload_check(packet->payload, payload_len))) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_EDONKEY, ndpi_struct, NDPI_LOG_DEBUG, "Found EDONKEY.\n");
|
||||
ndpi_int_edonkey_add_connection(ndpi_struct, flow);
|
||||
} else {
|
||||
NDPI_LOG(NDPI_PROTOCOL_EDONKEY, ndpi_struct, NDPI_LOG_DEBUG, "The reply did not seem to belong to EDONKEY, resetting the stage to 0...\n");
|
||||
flow->edonkey_stage = 0;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void ndpi_search_edonkey(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow) {
|
||||
struct ndpi_packet_struct *packet = &flow->packet;
|
||||
|
||||
NDPI_LOG(NDPI_PROTOCOL_EDONKEY, ndpi_struct, NDPI_LOG_DEBUG, "EDONKEY detection...\n");
|
||||
|
||||
/* skip marked packets */
|
||||
if (packet->detected_protocol_stack[0] != NDPI_PROTOCOL_EDONKEY) {
|
||||
if (packet->tcp_retransmission == 0) {
|
||||
ndpi_check_edonkey(ndpi_struct, flow);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void init_edonkey_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask)
|
||||
{
|
||||
ndpi_set_bitmask_protocol_detection("eDonkey", ndpi_struct, detection_bitmask, *id,
|
||||
NDPI_PROTOCOL_EDONKEY,
|
||||
ndpi_search_edonkey,
|
||||
NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP_OR_UDP_WITHOUT_RETRANSMISSION,
|
||||
SAVE_DETECTION_BITMASK_AS_UNKNOWN,
|
||||
ADD_TO_DETECTION_BITMASK);
|
||||
|
||||
*id += 1;
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,96 +0,0 @@
|
||||
/*
|
||||
* fasttrack.c
|
||||
*
|
||||
* Copyright (C) 2009-2011 by ipoque GmbH
|
||||
* Copyright (C) 2011-15 - ntop.org
|
||||
*
|
||||
* This file is part of nDPI, an open source deep packet inspection
|
||||
* library based on the OpenDPI and PACE technology by ipoque GmbH
|
||||
*
|
||||
* nDPI is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* nDPI is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with nDPI. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include "ndpi_protocols.h"
|
||||
|
||||
#ifdef NDPI_PROTOCOL_FASTTRACK
|
||||
|
||||
|
||||
|
||||
static void ndpi_int_fasttrack_add_connection(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
{
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_FASTTRACK, NDPI_PROTOCOL_UNKNOWN);
|
||||
}
|
||||
|
||||
|
||||
void ndpi_search_fasttrack_tcp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
{
|
||||
struct ndpi_packet_struct *packet = &flow->packet;
|
||||
|
||||
// struct ndpi_id_struct *src=ndpi_struct->src;
|
||||
// struct ndpi_id_struct *dst=ndpi_struct->dst;
|
||||
|
||||
if (packet->payload_packet_len > 6 && ntohs(get_u_int16_t(packet->payload, packet->payload_packet_len - 2)) == 0x0d0a) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_FASTTRACK, ndpi_struct, NDPI_LOG_TRACE, "detected 0d0a at the end of the packet.\n");
|
||||
|
||||
if (memcmp(packet->payload, "GIVE ", 5) == 0 && packet->payload_packet_len >= 8) {
|
||||
u_int16_t i;
|
||||
for (i = 5; i < (packet->payload_packet_len - 2); i++) {
|
||||
// make shure that the argument to GIVE is numeric
|
||||
if (!(packet->payload[i] >= '0' && packet->payload[i] <= '9')) {
|
||||
goto exclude_fasttrack;
|
||||
}
|
||||
}
|
||||
|
||||
NDPI_LOG(NDPI_PROTOCOL_FASTTRACK, ndpi_struct, NDPI_LOG_TRACE, "FASTTRACK GIVE DETECTED\n");
|
||||
ndpi_int_fasttrack_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
|
||||
if (packet->payload_packet_len > 50 && memcmp(packet->payload, "GET /", 5) == 0) {
|
||||
u_int8_t a = 0;
|
||||
NDPI_LOG(NDPI_PROTOCOL_FASTTRACK, ndpi_struct, NDPI_LOG_TRACE, "detected GET /. \n");
|
||||
ndpi_parse_packet_line_info(ndpi_struct, flow);
|
||||
for (a = 0; a < packet->parsed_lines; a++) {
|
||||
if ((packet->line[a].len > 17 && memcmp(packet->line[a].ptr, "X-Kazaa-Username: ", 18) == 0)
|
||||
|| (packet->line[a].len > 23 && memcmp(packet->line[a].ptr, "User-Agent: PeerEnabler/", 24) == 0)) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_FASTTRACK, ndpi_struct, NDPI_LOG_TRACE,
|
||||
"detected X-Kazaa-Username: || User-Agent: PeerEnabler/\n");
|
||||
ndpi_int_fasttrack_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
exclude_fasttrack:
|
||||
NDPI_LOG(NDPI_PROTOCOL_FASTTRACK, ndpi_struct, NDPI_LOG_TRACE, "fasttrack/kazaa excluded.\n");
|
||||
NDPI_ADD_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, NDPI_PROTOCOL_FASTTRACK);
|
||||
}
|
||||
|
||||
|
||||
void init_fasttrack_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask)
|
||||
{
|
||||
ndpi_set_bitmask_protocol_detection("FastTrack", ndpi_struct, detection_bitmask, *id,
|
||||
NDPI_PROTOCOL_FASTTRACK,
|
||||
ndpi_search_fasttrack_tcp,
|
||||
NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP_WITH_PAYLOAD_WITHOUT_RETRANSMISSION,
|
||||
SAVE_DETECTION_BITMASK_AS_UNKNOWN,
|
||||
ADD_TO_DETECTION_BITMASK);
|
||||
|
||||
*id += 1;
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,108 +0,0 @@
|
||||
/*
|
||||
* fiesta.c
|
||||
*
|
||||
* Copyright (C) 2009-2011 by ipoque GmbH
|
||||
* Copyright (C) 2011-15 - ntop.org
|
||||
*
|
||||
* This file is part of nDPI, an open source deep packet inspection
|
||||
* library based on the OpenDPI and PACE technology by ipoque GmbH
|
||||
*
|
||||
* nDPI is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* nDPI is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with nDPI. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
/* include files */
|
||||
#include "ndpi_protocols.h"
|
||||
#ifdef NDPI_PROTOCOL_FIESTA
|
||||
|
||||
|
||||
static void ndpi_int_fiesta_add_connection(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
{
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_FIESTA, NDPI_PROTOCOL_UNKNOWN);
|
||||
}
|
||||
|
||||
void ndpi_search_fiesta(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
{
|
||||
struct ndpi_packet_struct *packet = &flow->packet;
|
||||
|
||||
// struct ndpi_id_struct *src=ndpi_struct->src;
|
||||
// struct ndpi_id_struct *dst=ndpi_struct->dst;
|
||||
|
||||
NDPI_LOG(NDPI_PROTOCOL_FIESTA, ndpi_struct, NDPI_LOG_DEBUG, "search fiesta.\n");
|
||||
|
||||
if (flow->l4.tcp.fiesta_stage == 0 && packet->payload_packet_len == 5
|
||||
&& get_u_int16_t(packet->payload, 0) == ntohs(0x0407)
|
||||
&& (packet->payload[2] == 0x08)
|
||||
&& (packet->payload[4] == 0x00 || packet->payload[4] == 0x01)) {
|
||||
|
||||
NDPI_LOG(NDPI_PROTOCOL_FIESTA, ndpi_struct, NDPI_LOG_DEBUG, "maybe fiesta symmetric, first packet.\n");
|
||||
flow->l4.tcp.fiesta_stage = 1 + packet->packet_direction;
|
||||
goto maybe_fiesta;
|
||||
}
|
||||
if (flow->l4.tcp.fiesta_stage == (2 - packet->packet_direction)
|
||||
&& ((packet->payload_packet_len > 1 && packet->payload_packet_len - 1 == packet->payload[0])
|
||||
|| (packet->payload_packet_len > 3 && packet->payload[0] == 0
|
||||
&& get_l16(packet->payload, 1) == packet->payload_packet_len - 3))) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_FIESTA, ndpi_struct, NDPI_LOG_DEBUG, "Maybe fiesta.\n");
|
||||
goto maybe_fiesta;
|
||||
}
|
||||
if (flow->l4.tcp.fiesta_stage == (1 + packet->packet_direction)) {
|
||||
if (packet->payload_packet_len == 4 && get_u_int32_t(packet->payload, 0) == htonl(0x03050c01)) {
|
||||
goto add_fiesta;
|
||||
}
|
||||
if (packet->payload_packet_len == 5 && get_u_int32_t(packet->payload, 0) == htonl(0x04030c01)
|
||||
&& packet->payload[4] == 0) {
|
||||
goto add_fiesta;
|
||||
}
|
||||
if (packet->payload_packet_len == 6 && get_u_int32_t(packet->payload, 0) == htonl(0x050e080b)) {
|
||||
goto add_fiesta;
|
||||
}
|
||||
if (packet->payload_packet_len == 100 && packet->payload[0] == 0x63 && packet->payload[61] == 0x52
|
||||
&& packet->payload[81] == 0x5a && get_u_int16_t(packet->payload, 1) == htons(0x3810)
|
||||
&& get_u_int16_t(packet->payload, 62) == htons(0x6f75)) {
|
||||
goto add_fiesta;
|
||||
}
|
||||
if (packet->payload_packet_len > 3 && packet->payload_packet_len - 1 == packet->payload[0]
|
||||
&& get_u_int16_t(packet->payload, 1) == htons(0x140c)) {
|
||||
goto add_fiesta;
|
||||
}
|
||||
}
|
||||
|
||||
NDPI_LOG(NDPI_PROTOCOL_FIESTA, ndpi_struct, NDPI_LOG_DEBUG, "exclude fiesta.\n");
|
||||
NDPI_ADD_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, NDPI_PROTOCOL_FIESTA);
|
||||
return;
|
||||
|
||||
maybe_fiesta:
|
||||
NDPI_LOG(NDPI_PROTOCOL_FIESTA, ndpi_struct, NDPI_LOG_DEBUG, "Stage is set to %d.\n", flow->l4.tcp.fiesta_stage);
|
||||
return;
|
||||
|
||||
add_fiesta:
|
||||
NDPI_LOG(NDPI_PROTOCOL_FIESTA, ndpi_struct, NDPI_LOG_DEBUG, "detected fiesta.\n");
|
||||
ndpi_int_fiesta_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
void init_fiesta_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask)
|
||||
{
|
||||
ndpi_set_bitmask_protocol_detection("Fiesta", ndpi_struct, detection_bitmask, *id,
|
||||
NDPI_PROTOCOL_FIESTA,
|
||||
ndpi_search_fiesta,
|
||||
NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP_WITH_PAYLOAD_WITHOUT_RETRANSMISSION,
|
||||
SAVE_DETECTION_BITMASK_AS_UNKNOWN,
|
||||
ADD_TO_DETECTION_BITMASK);
|
||||
|
||||
*id += 1;
|
||||
}
|
||||
#endif
|
||||
@@ -1,95 +0,0 @@
|
||||
/*
|
||||
* filetopia.c
|
||||
*
|
||||
* Copyright (C) 2009-2011 by ipoque GmbH
|
||||
* Copyright (C) 2011-15 - ntop.org
|
||||
*
|
||||
* This file is part of nDPI, an open source deep packet inspection
|
||||
* library based on the OpenDPI and PACE technology by ipoque GmbH
|
||||
*
|
||||
* nDPI is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* nDPI is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with nDPI. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include "ndpi_protocols.h"
|
||||
#ifdef NDPI_PROTOCOL_FILETOPIA
|
||||
|
||||
|
||||
static void ndpi_int_filetopia_add_connection(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
{
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_FILETOPIA, NDPI_PROTOCOL_UNKNOWN);
|
||||
}
|
||||
|
||||
void ndpi_search_filetopia_tcp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
{
|
||||
struct ndpi_packet_struct *packet = &flow->packet;
|
||||
|
||||
// struct ndpi_id_struct *src=ndpi_struct->src;
|
||||
// struct ndpi_id_struct *dst=ndpi_struct->dst;
|
||||
|
||||
if (flow->l4.tcp.filetopia_stage == 0) {
|
||||
if (packet->payload_packet_len >= 50 && packet->payload_packet_len <= 70
|
||||
&& packet->payload[0] == 0x03 && packet->payload[1] == 0x9a
|
||||
&& packet->payload[3] == 0x22 && packet->payload[packet->payload_packet_len - 1] == 0x2b) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_FILETOPIA, ndpi_struct, NDPI_LOG_DEBUG, "Filetopia stage 1 detected\n");
|
||||
flow->l4.tcp.filetopia_stage = 1;
|
||||
return;
|
||||
}
|
||||
|
||||
} else if (flow->l4.tcp.filetopia_stage == 1) {
|
||||
if (packet->payload_packet_len >= 100 && packet->payload[0] == 0x03
|
||||
&& packet->payload[1] == 0x9a && (packet->payload[3] == 0x22 || packet->payload[3] == 0x23)) {
|
||||
|
||||
int i;
|
||||
for (i = 0; i < 10; i++) { // check 10 bytes for valid ASCII printable characters
|
||||
if (!(packet->payload[5 + i] >= 0x20 && packet->payload[5 + i] <= 0x7e)) {
|
||||
goto end_filetopia_nothing_found;
|
||||
}
|
||||
}
|
||||
|
||||
NDPI_LOG(NDPI_PROTOCOL_FILETOPIA, ndpi_struct, NDPI_LOG_DEBUG, "Filetopia stage 2 detected\n");
|
||||
flow->l4.tcp.filetopia_stage = 2;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
} else if (flow->l4.tcp.filetopia_stage == 2) {
|
||||
if (packet->payload_packet_len >= 4 && packet->payload_packet_len <= 100
|
||||
&& packet->payload[0] == 0x03 && packet->payload[1] == 0x9a
|
||||
&& (packet->payload[3] == 0x22 || packet->payload[3] == 0x23)) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_FILETOPIA, ndpi_struct, NDPI_LOG_DEBUG, "Filetopia detected\n");
|
||||
ndpi_int_filetopia_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
end_filetopia_nothing_found:
|
||||
NDPI_ADD_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, NDPI_PROTOCOL_FILETOPIA);
|
||||
}
|
||||
|
||||
|
||||
void init_filetopia_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask)
|
||||
{
|
||||
ndpi_set_bitmask_protocol_detection("Filetopia", ndpi_struct, detection_bitmask, *id,
|
||||
NDPI_PROTOCOL_FILETOPIA,
|
||||
ndpi_search_filetopia_tcp,
|
||||
NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP_WITH_PAYLOAD_WITHOUT_RETRANSMISSION,
|
||||
SAVE_DETECTION_BITMASK_AS_UNKNOWN,
|
||||
ADD_TO_DETECTION_BITMASK);
|
||||
*id += 1;
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,135 +0,0 @@
|
||||
/*
|
||||
* florensia.c
|
||||
*
|
||||
* Copyright (C) 2009-2011 by ipoque GmbH
|
||||
* Copyright (C) 2011-15 - ntop.org
|
||||
*
|
||||
* This file is part of nDPI, an open source deep packet inspection
|
||||
* library based on the OpenDPI and PACE technology by ipoque GmbH
|
||||
*
|
||||
* nDPI is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* nDPI is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with nDPI. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include "ndpi_protocols.h"
|
||||
#ifdef NDPI_PROTOCOL_FLORENSIA
|
||||
|
||||
|
||||
static void ndpi_florensia_add_connection(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
{
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_FLORENSIA, NDPI_PROTOCOL_UNKNOWN);
|
||||
}
|
||||
|
||||
void ndpi_search_florensia(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
{
|
||||
struct ndpi_packet_struct *packet = &flow->packet;
|
||||
|
||||
// struct ndpi_id_struct *src=ndpi_struct->src;
|
||||
// struct ndpi_id_struct *dst=ndpi_struct->dst;
|
||||
|
||||
|
||||
NDPI_LOG(NDPI_PROTOCOL_FLORENSIA, ndpi_struct, NDPI_LOG_DEBUG, "search florensia.\n");
|
||||
|
||||
if (packet->tcp != NULL) {
|
||||
if (packet->payload_packet_len == 5 && get_l16(packet->payload, 0) == packet->payload_packet_len
|
||||
&& packet->payload[2] == 0x65 && packet->payload[4] == 0xff) {
|
||||
if (flow->florensia_stage == 1) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_FLORENSIA, ndpi_struct, NDPI_LOG_DEBUG, "found florensia.\n");
|
||||
ndpi_florensia_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
NDPI_LOG(NDPI_PROTOCOL_FLORENSIA, ndpi_struct, NDPI_LOG_DEBUG, "maybe florensia -> stage is set to 1.\n");
|
||||
flow->florensia_stage = 1;
|
||||
return;
|
||||
}
|
||||
if (packet->payload_packet_len > 8 && get_l16(packet->payload, 0) == packet->payload_packet_len
|
||||
&& get_u_int16_t(packet->payload, 2) == htons(0x0201) && get_u_int32_t(packet->payload, 4) == htonl(0xFFFFFFFF)) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_FLORENSIA, ndpi_struct, NDPI_LOG_DEBUG, "maybe florensia -> stage is set to 1.\n");
|
||||
flow->florensia_stage = 1;
|
||||
return;
|
||||
}
|
||||
if (packet->payload_packet_len == 406 && get_l16(packet->payload, 0) == packet->payload_packet_len
|
||||
&& packet->payload[2] == 0x63) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_FLORENSIA, ndpi_struct, NDPI_LOG_DEBUG, "maybe florensia -> stage is set to 1.\n");
|
||||
flow->florensia_stage = 1;
|
||||
return;
|
||||
}
|
||||
if (packet->payload_packet_len == 12 && get_l16(packet->payload, 0) == packet->payload_packet_len
|
||||
&& get_u_int16_t(packet->payload, 2) == htons(0x0301)) {
|
||||
if (flow->florensia_stage == 1) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_FLORENSIA, ndpi_struct, NDPI_LOG_DEBUG, "found florensia.\n");
|
||||
ndpi_florensia_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
NDPI_LOG(NDPI_PROTOCOL_FLORENSIA, ndpi_struct, NDPI_LOG_DEBUG, "maybe florensia -> stage is set to 1.\n");
|
||||
flow->florensia_stage = 1;
|
||||
return;
|
||||
}
|
||||
|
||||
if (flow->florensia_stage == 1) {
|
||||
if (packet->payload_packet_len == 8 && get_l16(packet->payload, 0) == packet->payload_packet_len
|
||||
&& get_u_int16_t(packet->payload, 2) == htons(0x0302) && get_u_int32_t(packet->payload, 4) == htonl(0xFFFFFFFF)) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_FLORENSIA, ndpi_struct, NDPI_LOG_DEBUG, "found florensia asymmetrically.\n");
|
||||
ndpi_florensia_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
if (packet->payload_packet_len == 24 && get_l16(packet->payload, 0) == packet->payload_packet_len
|
||||
&& get_u_int16_t(packet->payload, 2) == htons(0x0202)
|
||||
&& get_u_int32_t(packet->payload, packet->payload_packet_len - 4) == htonl(0xFFFFFFFF)) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_FLORENSIA, ndpi_struct, NDPI_LOG_DEBUG, "found florensia.\n");
|
||||
ndpi_florensia_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
if (flow->packet_counter < 10 && get_l16(packet->payload, 0) == packet->payload_packet_len) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_FLORENSIA, ndpi_struct, NDPI_LOG_DEBUG, "maybe florensia.\n");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (packet->udp != NULL) {
|
||||
if (flow->florensia_stage == 0 && packet->payload_packet_len == 6
|
||||
&& get_u_int16_t(packet->payload, 0) == ntohs(0x0503) && get_u_int32_t(packet->payload, 2) == htonl(0xFFFF0000)) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_FLORENSIA, ndpi_struct, NDPI_LOG_DEBUG, "maybe florensia -> stage is set to 1.\n");
|
||||
flow->florensia_stage = 1;
|
||||
return;
|
||||
}
|
||||
if (flow->florensia_stage == 1 && packet->payload_packet_len == 8
|
||||
&& get_u_int16_t(packet->payload, 0) == ntohs(0x0500) && get_u_int16_t(packet->payload, 4) == htons(0x4191)) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_FLORENSIA, ndpi_struct, NDPI_LOG_DEBUG, "found florensia.\n");
|
||||
ndpi_florensia_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
NDPI_LOG(NDPI_PROTOCOL_FLORENSIA, ndpi_struct, NDPI_LOG_DEBUG, "exclude florensia.\n");
|
||||
NDPI_ADD_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, NDPI_PROTOCOL_FLORENSIA);
|
||||
}
|
||||
|
||||
|
||||
void init_florensia_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask)
|
||||
{
|
||||
ndpi_set_bitmask_protocol_detection("Florensia", ndpi_struct, detection_bitmask, *id,
|
||||
NDPI_PROTOCOL_FLORENSIA,
|
||||
ndpi_search_florensia,
|
||||
NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP_OR_UDP_WITH_PAYLOAD_WITHOUT_RETRANSMISSION,
|
||||
SAVE_DETECTION_BITMASK_AS_UNKNOWN,
|
||||
ADD_TO_DETECTION_BITMASK);
|
||||
|
||||
*id += 1;
|
||||
}
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,258 +0,0 @@
|
||||
/*
|
||||
* ftp_data.c
|
||||
*
|
||||
* Copyright (C) 2014 Tomasz Bujlow <tomasz@skatnet.dk>
|
||||
* Copyright (C) 2014 - ntop.org
|
||||
*
|
||||
* The signature is based on the Libprotoident library.
|
||||
*
|
||||
* This file is part of nDPI, an open source deep packet inspection
|
||||
* library based on the OpenDPI and PACE technology by ipoque GmbH
|
||||
*
|
||||
* nDPI is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* nDPI is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with nDPI. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "ndpi_api.h"
|
||||
|
||||
#ifdef NDPI_PROTOCOL_FTP_DATA
|
||||
static void ndpi_int_ftp_data_add_connection(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow) {
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_FTP_DATA, NDPI_PROTOCOL_UNKNOWN);
|
||||
}
|
||||
|
||||
static int ndpi_match_ftp_data_port(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow) {
|
||||
struct ndpi_packet_struct *packet = &flow->packet;
|
||||
|
||||
if(packet->tcp->dest == htons(20) || packet->tcp->source == htons(20)) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
static int ndpi_match_ftp_data_directory(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow) {
|
||||
struct ndpi_packet_struct *packet = &flow->packet;
|
||||
u_int32_t payload_len = packet->payload_packet_len;
|
||||
|
||||
if((payload_len >= 4)
|
||||
&& ((packet->payload[0] == '-') || (packet->payload[0] == 'd'))
|
||||
&& ((packet->payload[1] == '-') || (packet->payload[1] == 'r'))
|
||||
&& ((packet->payload[2] == '-') || (packet->payload[2] == 'w'))
|
||||
&& ((packet->payload[3] == '-') || (packet->payload[3] == 'x'))) {
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int ndpi_match_file_header(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow) {
|
||||
struct ndpi_packet_struct *packet = &flow->packet;
|
||||
|
||||
/* A FTP packet is pretty long so 256 is a bit consrvative but it should be OK */
|
||||
if(packet->payload_packet_len < 256)
|
||||
return 0;
|
||||
|
||||
/* RIFF is a meta-format for storing AVI and WAV files */
|
||||
if(match_first_bytes(packet->payload, "RIFF"))
|
||||
return 1;
|
||||
|
||||
/* MZ is a .exe file */
|
||||
if((packet->payload[0] == 'M') && (packet->payload[1] == 'Z') && (packet->payload[3] == 0x00))
|
||||
return 1;
|
||||
|
||||
/* Ogg files */
|
||||
if(match_first_bytes(packet->payload, "OggS"))
|
||||
return 1;
|
||||
|
||||
/* ZIP files */
|
||||
if((packet->payload[0] == 'P') && (packet->payload[1] == 'K') && (packet->payload[2] == 0x03) && (packet->payload[3] == 0x04))
|
||||
return 1;
|
||||
|
||||
/* MPEG files */
|
||||
if((packet->payload[0] == 0x00) && (packet->payload[1] == 0x00) && (packet->payload[2] == 0x01) && (packet->payload[3] == 0xba))
|
||||
return 1;
|
||||
|
||||
/* RAR files */
|
||||
if(match_first_bytes(packet->payload, "Rar!"))
|
||||
return 1;
|
||||
|
||||
/* EBML */
|
||||
if((packet->payload[0] == 0x1a) && (packet->payload[1] == 0x45) && (packet->payload[2] == 0xdf) && (packet->payload[3] == 0xa3))
|
||||
return 1;
|
||||
|
||||
/* JPG */
|
||||
if((packet->payload[0] == 0xff) && (packet->payload[1] ==0xd8))
|
||||
return 1;
|
||||
|
||||
/* GIF */
|
||||
if(match_first_bytes(packet->payload, "GIF8"))
|
||||
return 1;
|
||||
|
||||
/* PHP scripts */
|
||||
if((packet->payload[0] == 0x3c) && (packet->payload[1] == 0x3f) && (packet->payload[2] == 0x70) && (packet->payload[3] == 0x68))
|
||||
return 1;
|
||||
|
||||
/* Unix scripts */
|
||||
if((packet->payload[0] == 0x23) && (packet->payload[1] == 0x21) && (packet->payload[2] == 0x2f) && (packet->payload[3] == 0x62))
|
||||
return 1;
|
||||
|
||||
/* PDFs */
|
||||
if(match_first_bytes(packet->payload, "%PDF"))
|
||||
return 1;
|
||||
|
||||
/* PNG */
|
||||
if((packet->payload[0] == 0x89) && (packet->payload[1] == 'P') && (packet->payload[2] == 'N') && (packet->payload[3] == 'G'))
|
||||
return 1;
|
||||
|
||||
/* HTML */
|
||||
if(match_first_bytes(packet->payload, "<htm"))
|
||||
return 1;
|
||||
if((packet->payload[0] == 0x0a) && (packet->payload[1] == '<') && (packet->payload[2] == '!') && (packet->payload[3] == 'D'))
|
||||
return 1;
|
||||
|
||||
/* 7zip */
|
||||
if((packet->payload[0] == 0x37) && (packet->payload[1] == 0x7a) && (packet->payload[2] == 0xbc) && (packet->payload[3] == 0xaf))
|
||||
return 1;
|
||||
|
||||
/* gzip */
|
||||
if((packet->payload[0] == 0x1f) && (packet->payload[1] == 0x8b) && (packet->payload[2] == 0x08))
|
||||
return 1;
|
||||
|
||||
/* XML */
|
||||
if(match_first_bytes(packet->payload, "<!DO"))
|
||||
return 1;
|
||||
|
||||
/* FLAC */
|
||||
if(match_first_bytes(packet->payload, "fLaC"))
|
||||
return 1;
|
||||
|
||||
/* MP3 */
|
||||
if((packet->payload[0] == 'I') && (packet->payload[1] == 'D') && (packet->payload[2] == '3') && (packet->payload[3] == 0x03))
|
||||
return 1;
|
||||
if(match_first_bytes(packet->payload, "\xff\xfb\x90\xc0"))
|
||||
return 1;
|
||||
|
||||
/* RPM */
|
||||
if((packet->payload[0] == 0xed) && (packet->payload[1] == 0xab) && (packet->payload[2] == 0xee) && (packet->payload[3] == 0xdb))
|
||||
return 1;
|
||||
|
||||
/* Wz Patch */
|
||||
if(match_first_bytes(packet->payload, "WzPa"))
|
||||
return 1;
|
||||
|
||||
/* Flash Video */
|
||||
if((packet->payload[0] == 'F') && (packet->payload[1] == 'L') && (packet->payload[2] == 'V') && (packet->payload[3] == 0x01))
|
||||
return 1;
|
||||
|
||||
/* .BKF (Microsoft Tape Format) */
|
||||
if(match_first_bytes(packet->payload, "TAPE"))
|
||||
return 1;
|
||||
|
||||
/* MS Office Doc file - this is unpleasantly geeky */
|
||||
if((packet->payload[0] == 0xd0) && (packet->payload[1] == 0xcf) && (packet->payload[2] == 0x11) && (packet->payload[3] == 0xe0))
|
||||
return 1;
|
||||
|
||||
/* ASP */
|
||||
if((packet->payload[0] == 0x3c) && (packet->payload[1] == 0x25) && (packet->payload[2] == 0x40) && (packet->payload[3] == 0x20))
|
||||
return 1;
|
||||
|
||||
/* WMS file */
|
||||
if((packet->payload[0] == 0x3c) && (packet->payload[1] == 0x21) && (packet->payload[2] == 0x2d) && (packet->payload[3] == 0x2d))
|
||||
return 1;
|
||||
|
||||
/* ar archive, typically .deb files */
|
||||
if(match_first_bytes(packet->payload, "!<ar"))
|
||||
return 1;
|
||||
|
||||
/* Raw XML (skip jabber-like traffic as this is not FTP but unencrypted jabber) */
|
||||
if((match_first_bytes(packet->payload, "<?xm"))
|
||||
&& (ndpi_strnstr((const char *)packet->payload, "jabber", packet->payload_packet_len) == NULL))
|
||||
return 1;
|
||||
|
||||
if(match_first_bytes(packet->payload, "<iq "))
|
||||
return 1;
|
||||
|
||||
/* SPF */
|
||||
if(match_first_bytes(packet->payload, "SPFI"))
|
||||
return 1;
|
||||
|
||||
/* ABIF - Applied Biosystems */
|
||||
if(match_first_bytes(packet->payload, "ABIF"))
|
||||
return 1;
|
||||
|
||||
/* bzip2 - other digits are also possible instead of 9 */
|
||||
if((packet->payload[0] == 'B') && (packet->payload[1] == 'Z') && (packet->payload[2] == 'h') && (packet->payload[3] == '9'))
|
||||
return 1;
|
||||
|
||||
/* Some other types of files */
|
||||
|
||||
if((packet->payload[0] == '<') && (packet->payload[1] == 'c') && (packet->payload[2] == 'f'))
|
||||
return 1;
|
||||
if((packet->payload[0] == '<') && (packet->payload[1] == 'C') && (packet->payload[2] == 'F'))
|
||||
return 1;
|
||||
if(match_first_bytes(packet->payload, ".tem"))
|
||||
return 1;
|
||||
if(match_first_bytes(packet->payload, ".ite"))
|
||||
return 1;
|
||||
if(match_first_bytes(packet->payload, ".lef"))
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void ndpi_check_ftp_data(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow) {
|
||||
struct ndpi_packet_struct *packet = &flow->packet;
|
||||
|
||||
if((packet->payload_packet_len > 0)
|
||||
&& (ndpi_match_file_header(ndpi_struct, flow)
|
||||
|| ndpi_match_ftp_data_directory(ndpi_struct, flow)
|
||||
|| ndpi_match_ftp_data_port(ndpi_struct, flow)
|
||||
)
|
||||
) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_FTP_DATA, ndpi_struct, NDPI_LOG_DEBUG, "Possible FTP_DATA request detected...\n");
|
||||
ndpi_int_ftp_data_add_connection(ndpi_struct, flow);
|
||||
} else
|
||||
NDPI_ADD_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, NDPI_PROTOCOL_FTP_DATA);
|
||||
}
|
||||
|
||||
void ndpi_search_ftp_data(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow) {
|
||||
struct ndpi_packet_struct *packet = &flow->packet;
|
||||
|
||||
/* Break after 20 packets. */
|
||||
if(flow->packet_counter > 20) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_FTP_DATA, ndpi_struct, NDPI_LOG_DEBUG, "Exclude FTP_DATA.\n");
|
||||
NDPI_ADD_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, NDPI_PROTOCOL_FTP_DATA);
|
||||
return;
|
||||
}
|
||||
|
||||
NDPI_LOG(NDPI_PROTOCOL_FTP_DATA, ndpi_struct, NDPI_LOG_DEBUG, "FTP_DATA detection...\n");
|
||||
ndpi_check_ftp_data(ndpi_struct, flow);
|
||||
}
|
||||
|
||||
|
||||
void init_ftp_data_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask)
|
||||
{
|
||||
ndpi_set_bitmask_protocol_detection("FTP_DATA", ndpi_struct, detection_bitmask, *id,
|
||||
NDPI_PROTOCOL_FTP_DATA,
|
||||
ndpi_search_ftp_data,
|
||||
NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP_WITH_PAYLOAD_WITHOUT_RETRANSMISSION,
|
||||
SAVE_DETECTION_BITMASK_AS_UNKNOWN,
|
||||
ADD_TO_DETECTION_BITMASK);
|
||||
|
||||
*id += 1;
|
||||
}
|
||||
|
||||
#endif
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user