├── tests
├── .gitignore
├── bug2.pcap
├── bug3.pcap
├── bug4.pcap
├── bug5.pcap
├── bug6.pcap
├── bug7.pcap
├── bug8.pcap
├── local.pcap
├── test1.pcap
├── test2.pcap
├── test3.pcap
├── test4.pcap
├── udp.pcap
├── local2.pcap
├── simson.pcap
├── flow_test.pcap
├── test-gzip.pcap
├── test1-part1.pcap
├── test1-part2.pcap
├── test5-lines.pcap
├── test8
│ ├── image2.pcap
│ ├── building_20201108_221645.jpg
│ └── image.html
├── test1-80-50955.pcap
├── test1-one-packet.pcap
├── test7-three-flows.pcap
├── test1-out-of-order.pcap
├── test5-lines-randomized.pcap
├── test5-lines-randomized2.pcap
├── airsnort-linux-browser_page_load.pcap
├── test-pdfs.sh
├── iphtest-nitroba-100.txt
├── test-chroot.sh
├── test-iptree.sh
├── Makefile.am
├── test-subs.sh
└── test1.sh
├── doc
├── Makefile.am
├── tcpflow-logo.pdf
├── announce_1_3.txt
├── make_web.sh
├── announce_1_5.txt
├── Planning-1page.txt
├── timeline_1.4.txt
└── announce_1_4.txt
├── samplePcaps
└── jpegs.cap
├── src
├── NOTES.txt
├── wifipcap
│ ├── ether.h
│ ├── os.h
│ ├── prism.h
│ ├── util.h
│ ├── radiotap.h
│ ├── TimeVal.cpp
│ ├── types.h
│ ├── README.txt
│ ├── util.cpp
│ ├── cpack.h
│ ├── oui.h
│ ├── arp.h
│ ├── udp.h
│ ├── cpack.cpp
│ ├── sample.cpp
│ └── llc.h
├── be13_api
│ ├── dfxml
│ │ └── src
│ │ │ ├── Makefile.defs
│ │ │ └── dfxml_configure.m4
│ ├── unicode_escape.h
│ ├── Makefile.defs
│ ├── be13_configure.m4
│ ├── cppmutex.h
│ ├── utf8.h
│ ├── sbuf_stream.h
│ ├── utils.h
│ ├── beregex.h
│ ├── pcap_fake.h
│ ├── net_ethernet.h
│ └── utils.cpp
├── mime_map.h
├── inet_ntop.h
├── netviz
│ ├── net_map.h
│ ├── packetfall.h
│ ├── address_histogram.h
│ ├── net_map.cpp
│ ├── packetfall.cpp
│ ├── legend_view.h
│ ├── address_histogram_view.h
│ ├── port_histogram.h
│ ├── port_histogram_view.h
│ ├── address_histogram.cpp
│ ├── port_histogram.cpp
│ ├── time_histogram_view.h
│ └── legend_view.cpp
├── template_demo.cpp
├── scan_md5.cpp
├── intrusive_list.h
├── inet_ntop.c
├── scan_wifiviz.cpp
├── datalink_wifi.cpp
├── datalink_wifi.h
├── scan_tcpdemux.cpp
├── scan_netviz.cpp
├── stest.cpp
├── pcap_writer.h
└── Makefile.am
├── CONFIGURE_ARCH_17_8.sh
├── INSTALL
├── CONFIGURE_FEDORA_29.sh
├── gitpull.sh
├── CONFIGURE_AWS_LINUX.sh
├── CONFIGURE_UBUNTU_16_04.sh
├── CONFIGURE_FEDORA_26.sh
├── .gitmodules
├── .travis.yml
├── .make-codecov
├── etc
└── coverage_report.sh
├── AUTHORS
├── python
├── plugins
│ ├── README.md
│ └── samplePlugin.py
└── plot_wifi_aps.py
├── CMakeLists.txt
├── m4
├── ac_check_classpath.m4
├── slg_searchdirs.m4
├── slg_check_gcc_diagnostics.m4
├── ac_check_rqrd_class.m4
├── ac_prog_javah.m4
├── ac_prog_javac_works.m4
├── slg_mingw_support.m4
├── ac_java_options.m4
├── ac_try_compile_java.m4
├── ac_prog_jar.m4
├── ac_try_run_javac.m4
├── ac_prog_javadoc.m4
├── ac_prog_javac.m4
├── ac_check_junit.m4
├── ac_prog_java_cc.m4
├── ac_prog_java.m4
├── ac_prog_java_works.m4
└── slg_gcc_all_warnings.m4
├── cmake
├── FindPCAP.cmake
├── options.cmake
└── coverage.cmake
├── bootstrap.sh
├── .gitignore
├── tcpflow.spec.in
├── Makefile.am
├── CONFIGURE_CENTOS8.bash
├── .github
└── workflows
│ └── continuous-integration.yml
└── CONFIGURE_FEDORA_18.sh
/tests/.gitignore:
--------------------------------------------------------------------------------
1 | nitroba.pcap
2 | tmp*
3 |
--------------------------------------------------------------------------------
/doc/Makefile.am:
--------------------------------------------------------------------------------
1 | man_MANS = tcpflow.1
2 | CLEANFILES = tcpflow.1
3 |
--------------------------------------------------------------------------------
/tests/bug2.pcap:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/simsong/tcpflow/HEAD/tests/bug2.pcap
--------------------------------------------------------------------------------
/tests/bug3.pcap:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/simsong/tcpflow/HEAD/tests/bug3.pcap
--------------------------------------------------------------------------------
/tests/bug4.pcap:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/simsong/tcpflow/HEAD/tests/bug4.pcap
--------------------------------------------------------------------------------
/tests/bug5.pcap:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/simsong/tcpflow/HEAD/tests/bug5.pcap
--------------------------------------------------------------------------------
/tests/bug6.pcap:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/simsong/tcpflow/HEAD/tests/bug6.pcap
--------------------------------------------------------------------------------
/tests/bug7.pcap:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/simsong/tcpflow/HEAD/tests/bug7.pcap
--------------------------------------------------------------------------------
/tests/bug8.pcap:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/simsong/tcpflow/HEAD/tests/bug8.pcap
--------------------------------------------------------------------------------
/tests/local.pcap:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/simsong/tcpflow/HEAD/tests/local.pcap
--------------------------------------------------------------------------------
/tests/test1.pcap:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/simsong/tcpflow/HEAD/tests/test1.pcap
--------------------------------------------------------------------------------
/tests/test2.pcap:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/simsong/tcpflow/HEAD/tests/test2.pcap
--------------------------------------------------------------------------------
/tests/test3.pcap:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/simsong/tcpflow/HEAD/tests/test3.pcap
--------------------------------------------------------------------------------
/tests/test4.pcap:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/simsong/tcpflow/HEAD/tests/test4.pcap
--------------------------------------------------------------------------------
/tests/udp.pcap:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/simsong/tcpflow/HEAD/tests/udp.pcap
--------------------------------------------------------------------------------
/tests/local2.pcap:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/simsong/tcpflow/HEAD/tests/local2.pcap
--------------------------------------------------------------------------------
/tests/simson.pcap:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/simsong/tcpflow/HEAD/tests/simson.pcap
--------------------------------------------------------------------------------
/doc/tcpflow-logo.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/simsong/tcpflow/HEAD/doc/tcpflow-logo.pdf
--------------------------------------------------------------------------------
/samplePcaps/jpegs.cap:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/simsong/tcpflow/HEAD/samplePcaps/jpegs.cap
--------------------------------------------------------------------------------
/tests/flow_test.pcap:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/simsong/tcpflow/HEAD/tests/flow_test.pcap
--------------------------------------------------------------------------------
/tests/test-gzip.pcap:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/simsong/tcpflow/HEAD/tests/test-gzip.pcap
--------------------------------------------------------------------------------
/tests/test1-part1.pcap:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/simsong/tcpflow/HEAD/tests/test1-part1.pcap
--------------------------------------------------------------------------------
/tests/test1-part2.pcap:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/simsong/tcpflow/HEAD/tests/test1-part2.pcap
--------------------------------------------------------------------------------
/tests/test5-lines.pcap:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/simsong/tcpflow/HEAD/tests/test5-lines.pcap
--------------------------------------------------------------------------------
/tests/test8/image2.pcap:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/simsong/tcpflow/HEAD/tests/test8/image2.pcap
--------------------------------------------------------------------------------
/src/NOTES.txt:
--------------------------------------------------------------------------------
1 |
2 | to update be13_api:
3 | cd gits/tcpflow/src/be13_api
4 | git pull origin master
5 |
--------------------------------------------------------------------------------
/src/wifipcap/ether.h:
--------------------------------------------------------------------------------
1 |
2 | struct ether_hdr_t {
3 | MAC sa, da;
4 | uint16_t type;
5 | };
6 |
--------------------------------------------------------------------------------
/tests/test1-80-50955.pcap:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/simsong/tcpflow/HEAD/tests/test1-80-50955.pcap
--------------------------------------------------------------------------------
/tests/test1-one-packet.pcap:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/simsong/tcpflow/HEAD/tests/test1-one-packet.pcap
--------------------------------------------------------------------------------
/tests/test7-three-flows.pcap:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/simsong/tcpflow/HEAD/tests/test7-three-flows.pcap
--------------------------------------------------------------------------------
/tests/test1-out-of-order.pcap:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/simsong/tcpflow/HEAD/tests/test1-out-of-order.pcap
--------------------------------------------------------------------------------
/tests/test5-lines-randomized.pcap:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/simsong/tcpflow/HEAD/tests/test5-lines-randomized.pcap
--------------------------------------------------------------------------------
/tests/test5-lines-randomized2.pcap:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/simsong/tcpflow/HEAD/tests/test5-lines-randomized2.pcap
--------------------------------------------------------------------------------
/CONFIGURE_ARCH_17_8.sh:
--------------------------------------------------------------------------------
1 | sudo pacman --sync --noconfirm emacs
2 | sudo pacman --sync --noconfirm zlib openssl boost cairo libpcap
3 |
--------------------------------------------------------------------------------
/tests/test8/building_20201108_221645.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/simsong/tcpflow/HEAD/tests/test8/building_20201108_221645.jpg
--------------------------------------------------------------------------------
/INSTALL:
--------------------------------------------------------------------------------
1 | Better install instructions will go here.
2 |
3 | 1 - ./bootstrap.sh
4 | 2 - ./configure
5 | 3 - make
6 | 4 - make install
7 |
--------------------------------------------------------------------------------
/tests/airsnort-linux-browser_page_load.pcap:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/simsong/tcpflow/HEAD/tests/airsnort-linux-browser_page_load.pcap
--------------------------------------------------------------------------------
/tests/test8/image.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | My First Heading
6 |
7 | My first paragraph.
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/CONFIGURE_FEDORA_29.sh:
--------------------------------------------------------------------------------
1 | PACKAGES="emacs automake zlib zlib-static openssl-devel boost-devel cairo-devel libpcap-devel libpcap-devel cairo-devel gcc-c++ python-devel"
2 | sudo dnf -y install $PACKAGES
3 | sh bootstrap.sh
4 | ./configure --disable-dependency-tracking
5 |
--------------------------------------------------------------------------------
/gitpull.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | # http://stackoverflow.com/questions/5828324/update-git-submodule
3 | # pull root and subprojects
4 | git pull
5 | for dir in src/be13_api
6 | do
7 | pushd $dir
8 | git checkout master
9 | git pull
10 | popd
11 | done
12 |
--------------------------------------------------------------------------------
/src/be13_api/dfxml/src/Makefile.defs:
--------------------------------------------------------------------------------
1 | DFXML_WRITER = dfxml/src/dfxml_writer.cpp \
2 | dfxml/src/dfxml_writer.h \
3 | dfxml/src/hash_t.h
4 |
5 | DFXML_READER = dfxml/src/dfxml_reader.cpp \
6 | dfxml/src/dfxml_reader.h \
7 | dfxml/src/hash_t.h
8 |
--------------------------------------------------------------------------------
/CONFIGURE_AWS_LINUX.sh:
--------------------------------------------------------------------------------
1 | PACKAGES="emacs automake zlib zlib-static openssl-devel boost-devel cairo-devel libpcap-devel libpcap-devel cairo-devel gcc-c++ python-devel"
2 | sudo yum install -y install $PACKAGES
3 | sh bootstrap.sh
4 | ./configure --disable-dependency-tracking
5 |
--------------------------------------------------------------------------------
/CONFIGURE_UBUNTU_16_04.sh:
--------------------------------------------------------------------------------
1 | sudo apt-get update --fix-missing
2 | sudo apt-get install -y emacs
3 | sudo apt-get install -y git gcc g++ llvm-3.7 automake autoconf libpcap-dev libboost-dev openssl libssl-dev \
4 | zlib1g-dev libcairo2 libcairo2-dev zlibc zlib1g-dev
5 |
6 |
7 |
--------------------------------------------------------------------------------
/CONFIGURE_FEDORA_26.sh:
--------------------------------------------------------------------------------
1 | sudo dnf -y install emacs
2 | sudo dnf -y install zlib
3 | sudo dnf -y install zlib-static
4 | sudo dnf -y install openssl-devel
5 | sudo dnf -y install boost-devel
6 | sudo dnf -y install cairo-devel libpcap-devel
7 | sudo dnf -y install libpcap-devel
8 | sudo dnf -y install cairo-devel
9 |
--------------------------------------------------------------------------------
/tests/test-pdfs.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | #
3 |
4 | . $srcdir/test-subs.sh
5 |
6 | # create PDFs for all of the pcap files
7 | for i in $DMPDIR/*.pcap
8 | do
9 | echo $i
10 | cmd "$TCPFLOW -Fg -e netviz -o tmp$$ -r $i"
11 | cmd "mv tmp$$/report.pdf `basename $i .pcap`.pdf"
12 | echo ""
13 | /bin/rm -rf tmp$$ test?.pdf
14 | done
15 |
--------------------------------------------------------------------------------
/.gitmodules:
--------------------------------------------------------------------------------
1 | [submodule "src/be13_api"]
2 | path = src/be13_api
3 | url = https://github.com/simsong/be20_api.git
4 | branch = master
5 | [submodule "src/dfxml"]
6 | path = src/dfxml
7 | url = https://github.com/simsong/dfxml.git
8 | branch = master
9 | [submodule "src/http-parser"]
10 | path = src/http-parser
11 | url = https://github.com/nodejs/http-parser.git
12 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | addons:
2 | apt:
3 | packages:
4 | - automake
5 | - autoconf
6 | - g++
7 | - libboost-dev
8 | - libssl-dev
9 | - libpcap-dev
10 | - libcairo2-dev
11 | language: cpp
12 | arch:
13 | - amd64
14 | - ppc64le
15 | dist: bionic
16 | compiler: clang
17 | install:
18 | - ./bootstrap.sh && ./configure && make
19 | script:
20 | - make check
21 |
--------------------------------------------------------------------------------
/src/be13_api/unicode_escape.h:
--------------------------------------------------------------------------------
1 | /* -*- mode: C++; c-basic-offset: 4; indent-tabs-mode: nil -*- */
2 | #ifndef UNICODE_ESCAPE_H
3 | #define UNICODE_ESCAPE_H
4 |
5 | #include
6 |
7 | /** \addtogroup bulk_extractor_APIs
8 | * @{
9 | */
10 | /** \file */
11 | extern bool validateOrEscapeUTF8_validate;
12 | std::string validateOrEscapeUTF8(const std::string &input, bool escape_bad_UTF8,bool escape_backslash);
13 |
14 | #endif
15 |
--------------------------------------------------------------------------------
/doc/announce_1_3.txt:
--------------------------------------------------------------------------------
1 | I'm pleased to announce the release of tcpflow version 1.3.0.
2 |
3 | Key elements in 1.3.0 include:
4 | - Compiles with mingw32 and mingw64 for 32-bit and 64-bit windows. I am now
5 | distributing pre-compiled binaries of some releases.
6 | - Better support for DFXML (fixed some bugs)
7 |
8 | You can download version 1.3.0, both source and precompiled windows binaries,
9 | from:
10 |
11 | https://github.com/simsong/tcpflow/downloads
12 |
--------------------------------------------------------------------------------
/src/mime_map.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of tcpflow by Simson Garfinkel .
3 | * Originally by Will Glynn .
4 | *
5 | * This source code is under the GNU Public License (GPL) version 3.
6 | * See COPYING for details.
7 | *
8 | */
9 |
10 | #ifndef MIME_MAP_H
11 | #define MIME_MAP_H
12 |
13 | #include
14 |
15 | std::string get_extension_for_mime_type(const std::string& mime_type);
16 |
17 | #endif /* MIME_MAP_H */
--------------------------------------------------------------------------------
/src/wifipcap/os.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #ifdef _WIN32
4 |
5 | #define _PACKED_
6 |
7 | #include
8 |
9 | #define u_int8_t UCHAR
10 | #define u_int16_t USHORT
11 | #define u_int32_t ULONG
12 | #define u_int64_t ULONGLONG
13 |
14 | #define int8_t CHAR
15 | #define int16_t SHORT
16 | #define int32_t LONG
17 | #define int64_t LONGLONG
18 |
19 | #define u_char UCHAR
20 |
21 | #else
22 |
23 | #define _PACKED_ __attribute__((__packed__))
24 |
25 | #endif
26 |
--------------------------------------------------------------------------------
/.make-codecov:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | #
3 | # 2020-10-29 - slg - compile for codecov, run self-test, and upload results.
4 | #
5 | export CODECOV_TOKEN='d97f1a9d-88e1-4db4-b14c-5b2edef43cf6'
6 | bash bootstrap.sh
7 | ./configure CFLAGS='-g -O0 -fprofile-arcs -ftest-coverage' \
8 | CXXFLAGS='-g -O0 -fprofile-arcs -ftest-coverage' \
9 | LIBS='-lgcov'
10 | make clean \
11 | && make \
12 | && make check \
13 | && gcov-9 -n -o . *cpp \
14 | && bash <(curl -s https://codecov.io/bash)
15 | make distclean
16 |
--------------------------------------------------------------------------------
/src/inet_ntop.h:
--------------------------------------------------------------------------------
1 | #ifndef TCPFLOW_INET_NTOP_H
2 | #define TCPFLOW_INET_NTOP_H
3 |
4 | #ifdef HAVE_ARPA_INET_H
5 | # include
6 | #endif
7 |
8 | #ifndef HAVE_INET_NTOP
9 | const char *inet_ntop(int af, const void *src,char *dst, socklen_t size);
10 | #endif
11 |
12 | #if defined(__MINGW32__)
13 | // has this prototype for ws2_32 dll, but has type-conflicts with winsock2.h
14 | WINSOCK_API_LINKAGE LPCWSTR WSAAPI inet_ntop(INT Family, PVOID pAddr, LPWSTR pStringBuf, size_t StringBufSIze);
15 | #endif
16 |
17 | #endif
18 |
--------------------------------------------------------------------------------
/src/netviz/net_map.h:
--------------------------------------------------------------------------------
1 | /**
2 | * net_map.h:
3 | * Show map of network traffic by host
4 | *
5 | * This source file is public domain, as it is not based on the original tcpflow.
6 | *
7 | * Author: Michael Shick
8 | *
9 | */
10 |
11 | #ifndef NET_MAP_H
12 | #define NET_MAP_H
13 |
14 | #include "plot_view.h"
15 |
16 | class net_map {
17 | public:
18 | net_map() {}
19 |
20 | void ingest_packet(const be13::packet_info &pi);
21 | void render(cairo_t *cr, const plot_view::bounds_t &bounds);
22 | };
23 |
24 | #endif
25 |
--------------------------------------------------------------------------------
/src/netviz/packetfall.h:
--------------------------------------------------------------------------------
1 | /**
2 | * packetfall.h:
3 | * Show packets received vs port
4 | *
5 | * This source file is public domain, as it is not based on the original tcpflow.
6 | *
7 | * Author: Michael Shick
8 | *
9 | */
10 |
11 | #ifndef PACKETFALL_H
12 | #define PACKETFALL_H
13 |
14 | #include "plot_view.h"
15 |
16 | class packetfall {
17 | public:
18 | packetfall() {}
19 |
20 | void ingest_packet(const be13::packet_info &pi);
21 | void render(cairo_t *cr, const plot_view::bounds_t &bounds);
22 | };
23 |
24 | #endif
25 |
--------------------------------------------------------------------------------
/etc/coverage_report.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | #
3 | # Create a code-coverage report locally and upload one to codecov
4 | # Should be run from the root directory
5 |
6 | if [ -r coverage_report.sh ]; then
7 | echo "coverage_report.sh run in /etc directory. moving to .."
8 | cd ..
9 | fi
10 |
11 | #make distclean
12 | #CFLAGS="--coverage" CXXFLAGS="--coverage" LDFLAGS="--coverage" ./configure
13 | make check
14 | lcov --capture --directory . --output-file main_coverage.info
15 | genhtml main_coverage.info --output-directory out
16 |
17 | # Upload the coverage report
18 | bash <(curl -s https://codecov.io/bash)
19 |
20 | /bin/rm -f *.gcov *.gcda *.gcno
21 |
22 |
--------------------------------------------------------------------------------
/AUTHORS:
--------------------------------------------------------------------------------
1 | MAINTAINER
2 | ==========
3 | Simson L. Garfinkel
4 |
5 | COPYRIGHT
6 | =========
7 | Version 1.5.0 (C) Simson L. Garfinkel, Licensed under GPL 3.0
8 |
9 | ACKNOWLEDGEMENTS
10 | ================
11 | Thanks to:
12 | * Jeffrey Pang, for the radiotap implementation
13 | * Doug Madory, for the original Wifi parser
14 | * Jeremy Elson, for the original idea and initial tcp/ip implementation
15 |
16 | Additional and thanks:
17 |
18 | * Johnny Tevessen , for Linux systems still using libc5.
19 | * Ross Golder , for a spec file for generating tcpflow RPMs.
20 | * Jose M. Alcaide , patch for the -r option
21 | * olibre , for encouragmenet, lots of patches, and CMake implementation
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/python/plugins/README.md:
--------------------------------------------------------------------------------
1 | To execute customizable python plugins:
2 |
3 | 1. Check examples in directory `tcpflow/python/plugins`.
4 |
5 | 2. Create a python script with the following properties:
6 |
7 | - The script contains one or more functions for tcpflow usage.
8 | - Each intended function must take a single string parameter.
9 | This parameter will hold the contents of the application data captured by tcpflow.
10 | - If an intended function returns, it must return a string,
11 | which will then be added to the report.xml file with the "plugindata" tag.
12 |
13 | 3. Execute the `tcpflow` command line with arguments `-e python -S py_path=path -S py_module=module -S py_function=foo`.
14 |
15 | Example:
16 |
17 | tcpflow -r my.cap -o flows -e python -S py_path=python/plugins -S py_module=samplePlugin -S py_function=sampleFunction
18 |
--------------------------------------------------------------------------------
/src/template_demo.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * How do we do a template like this?
3 | */
4 |
5 | #include
6 | #include
7 | #include
8 |
9 | template
10 | class A {
11 | private:
12 | T var_;
13 | uint64_t count_;
14 | public:
15 | A(T v):var_(v),count(0){ }
16 | uint64_t count() const { return count_;}
17 | T var() const { return var_;}
18 | void inc_count();
19 | };
20 |
21 | template void A::inc_count() {
22 | count_++;
23 | };
24 |
25 | template std::ostream & operator <<(std::ostream &os, const A &e) {
26 | os << e.count() << "=" << e.var();
27 | return os;
28 | };
29 |
30 |
31 | int main(int argc,char **argv)
32 | {
33 | A a(3);
34 |
35 | a.inc_count();
36 | std::cout << a << "\n";
37 |
38 | a.inc_count();
39 | std::cout << a << "\n";
40 |
41 |
42 | }
43 |
--------------------------------------------------------------------------------
/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.1)
2 |
3 | project(tcpflow VERSION 1.4.6 LANGUAGES CXX C)
4 | # Within the above line, "C" is required for two reasons:
5 | # 1. find_package(Threads) fails using only CXX on cmake-3.3 and previous
6 | # 2. CMake files use CMAKE_C_COMPILER_ID instead of CMAKE_CXX_COMPILER_ID
7 |
8 | # The following line if for find_package(pcap) -> cmake/FindPCAP.cmake
9 | set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
10 |
11 | include(cmake/options.cmake) # Set default CMake options
12 | include(cmake/coverage.cmake) # Configure the build "Coverage"
13 | include(cmake/compilation-flags.cmake) # Compiler & Linker flags
14 | include(cmake/warning-flags.cmake) # Compiler & Linker warnings
15 |
16 | # Source code
17 | add_subdirectory(src)
18 |
19 | # Generate documentation
20 | #add_subdirectory( doc EXCLUDE_FROM_ALL )
21 |
22 |
--------------------------------------------------------------------------------
/tests/iphtest-nitroba-100.txt:
--------------------------------------------------------------------------------
1 | trim before: 4999
2 | trim after: 99
3 | nodes: 99 histogram size: 29
4 | 0.0.0.0/2 count=2950
5 | 64.0.0.0/7 count=4330
6 | 66.0.0.0/7 count=9316
7 | 68.0.0.0/8 count=354
8 | 69.16.0.0/14 count=174
9 | 69.22.167.192/28 count=3917
10 | 69.22.167.208/28 count=11753
11 | 69.22.167.224/27 count=4169
12 | 69.24.0.0/13 count=2048
13 | 69.32.0.0/11 count=748
14 | 69.64.0.0/10 count=125
15 | 69.128.0.0/9 count=87
16 | 70.0.0.0/7 count=95
17 | 72.0.0.0/7 count=3457
18 | 74.0.0.0/7 count=9695
19 | 76.0.0.0/6 count=1140
20 | 80.0.0.0/4 count=581
21 | 96.0.0.0/3 count=3
22 | 128.0.0.0/2 count=1316
23 | 192.168.1.64/26 count=12544
24 | 192.168.15.4 count=71478
25 | 192.192.0.0/10 count=22
26 | 194.0.0.0/7 count=119
27 | 196.0.0.0/6 count=4423
28 | 200.0.0.0/5 count=2773
29 | 208.0.0.0/8 count=8403
30 | 209.0.0.0/8 count=6856
31 | 212.0.0.0/6 count=59
32 | 216.0.0.0/5 count=4823
33 |
--------------------------------------------------------------------------------
/doc/make_web.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | #
3 | # Create the files for the tcpflow website
4 | CORP=/corp/
5 | DEST=/var/www/digitalcorpora/tcpflow/demo
6 | TCPFLOW=../src/tcpflow
7 | TMP=/tmp/out$$
8 |
9 | if [ ! -d $DEST ]; then mkdir -p $DEST ; fi
10 |
11 | if [ ! -x $TCPFLOW ]; then (cd .. ; make ) ; fi
12 |
13 | run()
14 | {
15 | DPDF=$DEST/$2
16 | DPNG=${DPDF%pdf}png
17 | echo DPDF=$DPDF
18 | echo DPNG=$DPNG
19 | echo $TCPFLOW -o $TMP -x tcpdemux -E netviz $1
20 | $TCPFLOW -o $TMP -x tcpdemux -E netviz $1
21 | if [ ! -r $TMP/report.pdf ]; then
22 | echo tcpflow failed
23 | exit 1
24 | fi
25 | mv $TMP/report.pdf $DPDF
26 | /bin/rm -rf $TMP
27 | convert -scale 300 $DPDF $DPNG
28 | ls -l $DPDF $DPNG
29 | }
30 |
31 | run "-r $CORP/nps/packets/2008-nitroba/nitroba.pcap" nitroba.pdf
32 | run "-l $CORP/nps/packets/2009-m57-patents/net-2009*.gz" m57-net.pdf
33 | run "-l $CORP/mitll/packets/ideval99/week?/*/outside*gz" id99-outside.pdf
34 |
35 |
--------------------------------------------------------------------------------
/m4/ac_check_classpath.m4:
--------------------------------------------------------------------------------
1 | dnl @synopsis AC_CHECK_CLASSPATH
2 | dnl
3 | dnl AC_CHECK_CLASSPATH just displays the CLASSPATH, for the edification
4 | dnl of the user.
5 | dnl
6 | dnl Note: This is part of the set of autoconf M4 macros for Java
7 | dnl programs. It is VERY IMPORTANT that you download the whole set,
8 | dnl some macros depend on other. Unfortunately, the autoconf archive
9 | dnl does not support the concept of set of macros, so I had to break it
10 | dnl for submission. The general documentation, as well as the sample
11 | dnl configure.in, is included in the AC_PROG_JAVA macro.
12 | dnl
13 | dnl @category Java
14 | dnl @author Stephane Bortzmeyer
15 | dnl @version 2000-07-19
16 | dnl @license GPLWithACException
17 |
18 | AC_DEFUN([AC_CHECK_CLASSPATH],[
19 | if test "x$CLASSPATH" = x; then
20 | echo "You have no CLASSPATH, I hope it is good"
21 | else
22 | echo "You have CLASSPATH $CLASSPATH, hope it is correct"
23 | fi
24 | ])
25 |
--------------------------------------------------------------------------------
/m4/slg_searchdirs.m4:
--------------------------------------------------------------------------------
1 | if test x"${mingw}" != "xyes" ; then
2 |
3 | case $host in
4 | *mingw*)
5 | AC_MSG_NOTICE([Compiling under mingw; will not search other directories.])
6 | ;;
7 | *)
8 | AC_MSG_NOTICE(Compiling under $host.)
9 | # Bring additional directories where things might be found into our
10 | # search path. I don't know why autoconf doesn't do this by default
11 | for spfx in /usr/local /opt/local /sw /usr/local/ssl; do
12 | AC_MSG_NOTICE([checking ${spfx}/include])
13 | if test -d ${spfx}/include; then
14 | CPPFLAGS="$CPPFLAGS -I${spfx}/include"
15 | LDFLAGS="$LDFLAGS -L${spfx}/lib"
16 | AC_MSG_NOTICE([ *** ADDING ${spfx}/include to CPPFLAGS *** ])
17 | AC_MSG_NOTICE([ *** ADDING ${spfx}/lib to LDFLAGS *** ])
18 | fi
19 | done
20 | AC_MSG_NOTICE([ CPPFLAGS = ${CPPFLAGS} ])
21 | AC_MSG_NOTICE([ LDFLAGS = ${LDFLAGS} ])
22 | ;;
23 | esac
24 | fi
25 |
26 |
27 |
--------------------------------------------------------------------------------
/tests/test-chroot.sh:
--------------------------------------------------------------------------------
1 | . $srcdir/test-subs.sh
2 |
3 | echo DMPDIR=$DMPDIR
4 | echo TCPFLOW=$TCPFLOW
5 |
6 | # check the results
7 | checkmd5()
8 | {
9 | if [ ! -r $1 ] ;
10 | then
11 | echo file $1 was not created
12 | ls -l
13 | exit 1
14 | fi
15 |
16 | md5val=`openssl md5 $1 | awk '{print $2;}'`
17 | if [ x$2 != x$md5val ];
18 | then
19 | echo failure: $1
20 | echo expected md5: $2 "(got '$md5val')"
21 | echo expected length: $3
22 | ls -l $1
23 | exit 1
24 | fi
25 | }
26 |
27 | testmd5()
28 | {
29 | md5val=`openssl md5 $1 | awk '{print $2;}'`
30 | len=`stat -r $1 | awk '{print $8;}'`
31 | echo checkmd5 \"$1\" \"$md5val\" \"$len\"
32 | }
33 |
34 | cmd()
35 | {
36 | echo $1
37 | if ! $1 ; then echo failed; exit 1; fi
38 | }
39 | NITROBA=nitroba.pcap
40 | if [ -r $NITROBA ]; then
41 | /bin/rm -rf out1
42 | cmd "$TCPFLOW -S netviz_max_histogram_size=1000 -S netviz_histogram_dump=1 -o out1 -r $NITROBA"
43 | /bin/rm -rf out1
44 | else
45 | echo $NITROBA not present.
46 | fi
47 | exit 0
48 |
49 |
--------------------------------------------------------------------------------
/tests/test-iptree.sh:
--------------------------------------------------------------------------------
1 | . $srcdir/test-subs.sh
2 |
3 | echo DMPDIR=$DMPDIR
4 | echo TCPFLOW=$TCPFLOW
5 |
6 | # check the results
7 | checkmd5()
8 | {
9 | if [ ! -r $1 ] ;
10 | then
11 | echo file $1 was not created
12 | ls -l
13 | exit 1
14 | fi
15 |
16 | md5val=`openssl md5 $1 | awk '{print $2;}'`
17 | if [ x$2 != x$md5val ];
18 | then
19 | echo failure: $1
20 | echo expected md5: $2 "(got '$md5val')"
21 | echo expected length: $3
22 | ls -l $1
23 | exit 1
24 | fi
25 | }
26 |
27 | testmd5()
28 | {
29 | md5val=`openssl md5 $1 | awk '{print $2;}'`
30 | len=`stat -r $1 | awk '{print $8;}'`
31 | echo checkmd5 \"$1\" \"$md5val\" \"$len\"
32 | }
33 |
34 | cmd()
35 | {
36 | echo $1
37 | if ! $1 ; then echo failed; exit 1; fi
38 | }
39 | NITROBA=nitroba.pcap
40 | if [ -r $NITROBA ]; then
41 | /bin/rm -rf out1
42 | cmd "$TCPFLOW -S netviz_max_histogram_size=1000 -S netviz_histogram_dump=1 -o out1 -r $NITROBA"
43 | /bin/rm -rf out1
44 | else
45 | echo $NITROBA not present.
46 | fi
47 | exit 0
48 |
49 |
--------------------------------------------------------------------------------
/m4/slg_check_gcc_diagnostics.m4:
--------------------------------------------------------------------------------
1 | AC_TRY_COMPILE([#pragma GCC diagnostic ignored "-Wshadow"],[return 0;],
2 | [AC_DEFINE(HAVE_DIAGNOSTIC_SHADOW,1,[define 1 if GCC supports -Wshadow])])
3 |
4 | AC_TRY_COMPILE([#pragma GCC diagnostic ignored "-Wundef"],[return 0;],
5 | [AC_DEFINE(HAVE_DIAGNOSTIC_UNDEF,1,[define 1 if GCC supports -Wundef])])
6 |
7 | AC_TRY_COMPILE([#pragma GCC diagnostic ignored "-Wcast-qual"],[return 0;],
8 | [AC_DEFINE(HAVE_DIAGNOSTIC_CAST_QUAL,1,[define 1 if GCC supports -Wcast-qual])])
9 |
10 | AC_TRY_COMPILE([#pragma GCC diagnostic ignored "-Weffcpp"],[return 0;],
11 | [AC_DEFINE(HAVE_DIAGNOSTIC_EFFCPP,1,[define 1 if GCC supports -Weffc++])])
12 |
13 | AC_TRY_COMPILE([#pragma GCC diagnostic ignored "-Wsuggest-attribute=noreturn"],[return 0;],
14 | [AC_DEFINE(HAVE_DIAGNOSTIC_SUGGEST_ATTRIBUTE,1,
15 | [define 1 if GCC supports -Wsuggest-attribute=noreturn])])
16 |
17 | AC_TRY_COMPILE([#pragma GCC diagnostic ignored "-Wdeprecated-register"],[return 0;],
18 | [AC_DEFINE(HAVE_DIAGNOSTIC_DEPRECATED_REGISTER,1,
19 | [define 1 if GCC supports -Wdeprecated-register])])
20 |
--------------------------------------------------------------------------------
/m4/ac_check_rqrd_class.m4:
--------------------------------------------------------------------------------
1 | dnl @synopsis AC_CHECK_RQRD_CLASS
2 | dnl
3 | dnl AC_CHECK_RQRD_CLASS tests the existence of a given Java class,
4 | dnl either in a jar or in a '.class' file and fails if it doesn't
5 | dnl exist. Its success or failure can depend on a proper setting of the
6 | dnl CLASSPATH env. variable.
7 | dnl
8 | dnl Note: This is part of the set of autoconf M4 macros for Java
9 | dnl programs. It is VERY IMPORTANT that you download the whole set,
10 | dnl some macros depend on other. Unfortunately, the autoconf archive
11 | dnl does not support the concept of set of macros, so I had to break it
12 | dnl for submission. The general documentation, as well as the sample
13 | dnl configure.in, is included in the AC_PROG_JAVA macro.
14 | dnl
15 | dnl @category Java
16 | dnl @author Stephane Bortzmeyer
17 | dnl @version 2000-07-19
18 | dnl @license GPLWithACException
19 |
20 | AC_DEFUN([AC_CHECK_RQRD_CLASS],[
21 | CLASS=`echo $1|sed 's/\./_/g'`
22 | AC_CHECK_CLASS($1)
23 | if test "$HAVE_LAST_CLASS" = "no"; then
24 | AC_MSG_ERROR([Required class $1 missing, exiting.])
25 | fi
26 | ])
27 |
--------------------------------------------------------------------------------
/tests/Makefile.am:
--------------------------------------------------------------------------------
1 | #
2 | # About the tests:
3 | #
4 | # test1.sh -
5 | # test2.sh -
6 | # test3.sh -
7 | #
8 | # About the test files:
9 | #
10 |
11 | SH_TESTS = test1.sh test-pdfs.sh test-multifile.sh test-iptree.sh test-chroot.sh
12 |
13 | EXTRA_DIST = $(SH_TESTS) test-subs.sh test1.pcap test2.pcap test3.pcap test4.pcap
14 |
15 | TESTS = $(SH_TESTS)
16 |
17 | CLEANFILES = \
18 | out/010.000.000.001.09999-010.000.000.002.36559--42 \
19 | out/010.000.000.002.36559-010.000.000.001.09999--42 \
20 | out/074.125.019.101.00080-192.168.001.102.50956 \
21 | out/074.125.019.104.00080-192.168.001.102.50955 \
22 | out/192.168.001.102.50955-074.125.019.104.00080 \
23 | out/192.168.001.102.50956-074.125.019.101.00080 \
24 | out/2001:6f8:102d::2d0:9ff:fee3:e8de.59201-2001:6f8:900:7c0::2.00080 \
25 | out/2001:6f8:900:7c0::2.00080-2001:6f8:102d::2d0:9ff:fee3:e8de.59201 \
26 | out/report.xml
27 |
28 | nitroba.pcap:
29 | wget http://downloads.digitalcorpora.org/corpora/packets/2008-nitroba/nitroba.pcap
30 |
31 | clean:
32 | @echo Erase any left over trace files
33 | /bin/rm -f *.[0-9][0-9][0-9][0-9][0-9]-[0-9][0-9][0-9].*
34 |
35 |
--------------------------------------------------------------------------------
/cmake/FindPCAP.cmake:
--------------------------------------------------------------------------------
1 | # Tries to find libpcap headers and libraries
2 | #
3 | # Usage of this module as follows:
4 | #
5 | # find_package(PCAP)
6 | #
7 | # Variables used by this module, they can change the default behaviour and need
8 | # to be set before calling find_package:
9 | #
10 | # PCAP_ROOT_DIR Set this variable to the root installation of
11 | # libpcap if the module has problems finding
12 | # the proper installation path.
13 | #
14 | # Variables defined by this module:
15 | #
16 | # PCAP_FOUND System has PCAP libs/headers
17 | # PCAP_LIBRARIES The PCAP libraries
18 | # PCAP_INCLUDE_DIR The location of PCAP headers
19 |
20 | find_path(PCAP_INCLUDE_DIR
21 | NAMES pcap.h
22 | HINTS ${PCAP_ROOT_DIR}/include)
23 |
24 | find_library(PCAP_LIBRARIES
25 | NAMES pcap
26 | HINTS ${PCAP_ROOT_DIR}/lib)
27 |
28 | include(FindPackageHandleStandardArgs)
29 | find_package_handle_standard_args(
30 | PCAP
31 | DEFAULT_MSG
32 | PCAP_LIBRARIES
33 | PCAP_INCLUDE_DIR)
34 |
35 | mark_as_advanced(
36 | PCAP_ROOT_DIR
37 | PCAP_LIBRARIES
38 | PCAP_INCLUDE_DIR)
39 |
--------------------------------------------------------------------------------
/src/netviz/address_histogram.h:
--------------------------------------------------------------------------------
1 | /**
2 | * address histogram class.
3 | *
4 | * This source file is public domain, as it is not based on the original tcpflow.
5 | *
6 | * Author: Michael Shick
7 | *
8 | */
9 |
10 | #ifndef ADDRESS_HISTOGRAM_H
11 | #define ADDRESS_HISTOGRAM_H
12 |
13 | #include "iptree.h"
14 |
15 | class address_histogram {
16 | public:
17 | address_histogram(const iptree &tree);
18 |
19 | class iptree_node_comparator {
20 | public:
21 | bool operator()(const iptree::addr_elem &a, const iptree::addr_elem &b);
22 | };
23 |
24 | static const size_t bucket_count;
25 |
26 | const iptree::addr_elem &at(size_t index) const;
27 | size_t size() const;
28 | uint64_t ingest_count() const;
29 |
30 | typedef std::vector ipt_addrs;
31 |
32 | ipt_addrs::const_iterator begin() const;
33 | ipt_addrs::const_iterator end() const;
34 | ipt_addrs::const_reverse_iterator rbegin() const;
35 | ipt_addrs::const_reverse_iterator rend() const;
36 |
37 | private:
38 | ipt_addrs buckets;
39 | uint64_t datagrams_ingested;
40 | };
41 |
42 | #endif
43 |
--------------------------------------------------------------------------------
/m4/ac_prog_javah.m4:
--------------------------------------------------------------------------------
1 | dnl @synopsis AC_PROG_JAVAH
2 | dnl
3 | dnl AC_PROG_JAVAH tests the availability of the javah header generator
4 | dnl and looks for the jni.h header file. If available, JAVAH is set to
5 | dnl the full path of javah and CPPFLAGS is updated accordingly.
6 | dnl
7 | dnl @category Java
8 | dnl @author Luc Maisonobe
9 | dnl @version 2002-03-25
10 | dnl @license AllPermissive
11 |
12 | AC_DEFUN([AC_PROG_JAVAH],[
13 | AC_REQUIRE([AC_CANONICAL_SYSTEM])dnl
14 | AC_REQUIRE([AC_PROG_CPP])dnl
15 | AC_PATH_PROG(JAVAH,javah)
16 | if test x"`eval 'echo $ac_cv_path_JAVAH'`" != x ; then
17 | AC_TRY_CPP([#include ],,[
18 | ac_save_CPPFLAGS="$CPPFLAGS"
19 | changequote(, )dnl
20 | ac_dir=`echo $ac_cv_path_JAVAH | sed 's,\(.*\)/[^/]*/[^/]*$,\1/include,'`
21 | ac_machdep=`echo $build_os | sed 's,[-0-9].*,,' | sed 's,cygwin,win32,'`
22 | changequote([, ])dnl
23 | CPPFLAGS="$ac_save_CPPFLAGS -I$ac_dir -I$ac_dir/$ac_machdep"
24 | AC_TRY_CPP([#include ],
25 | ac_save_CPPFLAGS="$CPPFLAGS",
26 | AC_MSG_WARN([unable to include ]))
27 | CPPFLAGS="$ac_save_CPPFLAGS"])
28 | fi])
29 |
--------------------------------------------------------------------------------
/bootstrap.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # Hopefully you checked out with:
3 | # $ git clone --recursive https://github.com/simsong/tcpflow.git
4 |
5 | # Make sure we have automake installed
6 | function usage() {
7 | echo tcpflow bootstrap:
8 | echo be sure to run the appropriate CONFIGURE script to install the necessary packages.
9 | exit 1
10 | }
11 |
12 | automake --help 1>/dev/null 2>&1 || usage
13 |
14 | for sub in be13_api http-parser
15 | do
16 | if [ ! -r src/$sub/.git ] ;
17 | then
18 | echo bringing in submodules
19 | echo next time check out with git clone --recursive
20 | git submodule init
21 | git submodule update
22 | fi
23 | done
24 |
25 | ## The new way:
26 | # have automake do an initial population iff necessary
27 | if [ ! -e config.guess -o ! -e config.sub -o ! -e install-sh -o ! -e missing -o ! -e test-driver ]; then
28 | /bin/rm -rf aclocal.m4
29 | autoheader -f
30 | aclocal -I m4
31 | autoconf -f
32 | automake --add-missing --copy
33 | else
34 | autoreconf -f
35 | fi
36 | echo be sure to run ./configure
37 | ## The old way:
38 |
39 | # /bin/rm -rf aclocal.m4
40 | # autoheader -f
41 | # aclocal -I m4
42 | # autoconf -f
43 | # automake --add-missing --copy
44 | # ./configure
45 |
--------------------------------------------------------------------------------
/doc/announce_1_5.txt:
--------------------------------------------------------------------------------
1 | I'm pleased to announce the release of tcpflow version 1.5.0. This
2 | version was going to be called version 1.4.7, but so much has changed
3 | that it seemed like a good time to bump the minor version number. It's
4 | more than just a bug-fix release!
5 |
6 | Changes from 1.4.6:
7 |
8 | * We now pin to simsong/http-parser rather than nodejs/http-parser, so that we have more control over http-parser's .gitignore file.
9 |
10 | * support for cmake. (May not be current, but it's there for you cmake fans!)
11 |
12 | * CONFIGURE_FEDORA_26.sh script installs all needed Fedora 26 packages.
13 |
14 | * CONFIGURE_UBUNTU_16_04.sh script installs all needed Ubuntu 16.04 packages
15 |
16 | * CONFIGURE_ARCH_17_8.sh installs all needed Arch Linux 17.8 packages! Yes, we now support Arch!
17 |
18 | * getopt_long() support. Now you can go to town and create long-versions of all your favorite, one-character tcpflow options (provided you know C++, of course. Please submit pull requests!)
19 |
20 | * tcpflow man page updated
21 |
22 | * There's a Python post-processor option as well.
23 |
24 | * chroot() and drop root, allowing better control of privledge.
25 |
26 | * Support for libcap (capability library).
27 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/src/netviz/net_map.cpp:
--------------------------------------------------------------------------------
1 | /**
2 | * net_map.cpp:
3 | * Show map of network traffic by host
4 | *
5 | * This source file is public domain, as it is not based on the original tcpflow.
6 | *
7 | * Author: Michael Shick
8 | *
9 | */
10 |
11 | #include "config.h"
12 |
13 | #ifdef HAVE_LIBCAIRO
14 | #include "tcpflow.h"
15 |
16 | #include "net_map.h"
17 |
18 | void net_map::ingest_packet(const be13::packet_info &pi)
19 | {
20 | }
21 |
22 | void net_map::render(cairo_t *cr, const plot_view::bounds_t &bounds)
23 | {
24 | cairo_set_source_rgb(cr, 0.67, 0.67, 0.67);
25 | cairo_rectangle(cr, bounds.x, bounds.y, bounds.width, bounds.height);
26 | cairo_fill(cr);
27 |
28 | double font_size = 16.0;
29 | std::string label = "pretty map";
30 | cairo_text_extents_t extents;
31 |
32 | cairo_set_font_size(cr, font_size);
33 | cairo_set_source_rgb(cr, 0.0, 0.0, 0.0);
34 |
35 | cairo_text_extents(cr, label.c_str(), &extents);
36 |
37 | double text_x = bounds.x + (bounds.width - extents.width) / 2.0;
38 | double text_y = bounds.y + (bounds.height + extents.height) / 2.0;
39 |
40 | cairo_move_to(cr, text_x, text_y);
41 | cairo_show_text(cr, label.c_str());
42 |
43 | }
44 | #endif
45 |
--------------------------------------------------------------------------------
/tests/test-subs.sh:
--------------------------------------------------------------------------------
1 | case x"$srcdir" in
2 | x)
3 | echo No srcdir specified. Assuming $0 is run locally
4 | DMPDIR=.
5 | TCPFLOW=../src/tcpflow
6 | ;;
7 | x.)
8 | echo srcdir is . Assuming $0 is run locally from make check
9 | DMPDIR=.
10 | TCPFLOW=../src/tcpflow
11 | ;;
12 | *)
13 | echo srcdir is $srcdir Assuming $0 is run from make distcheck
14 | DMPDIR=../../tests/
15 | TCPFLOW=../../_build/src/tcpflow
16 | ;;
17 | esac
18 |
19 | echo DMPDIR=$DMPDIR
20 | echo TCPFLOW=$TCPFLOW
21 |
22 | # check the results
23 | checkmd5()
24 | {
25 | if [ ! -r $1 ] ;
26 | then
27 | echo file $1 was not created
28 | ls -l
29 | exit 1
30 | fi
31 |
32 | md5val=`openssl md5 $1 | awk '{print $2;}'`
33 | if [ x$2 != x$md5val ];
34 | then
35 | echo failure: $1
36 | echo expected md5: $2 "(got '$md5val')"
37 | echo expected length: $3
38 | ls -l $1
39 | exit 1
40 | fi
41 | }
42 |
43 | testmd5()
44 | {
45 | md5val=`openssl md5 $1 | awk '{print $2;}'`
46 | len=`stat -r $1 | awk '{print $8;}'`
47 | echo checkmd5 \"$1\" \"$md5val\" \"$len\"
48 | }
49 |
50 | cmd()
51 | {
52 | echo $1
53 | if ! $1 ; then echo failed; exit 1; fi
54 | }
55 |
56 |
--------------------------------------------------------------------------------
/src/netviz/packetfall.cpp:
--------------------------------------------------------------------------------
1 | /**
2 | * packetfall.cpp:
3 | * Show packets received vs port
4 | *
5 | * This source file is public domain, as it is not based on the original tcpflow.
6 | *
7 | * Author: Michael Shick
8 | *
9 | */
10 |
11 | #include "config.h"
12 |
13 | #ifdef HAVE_LIBCAIRO
14 | #include "tcpflow.h"
15 |
16 | #include "packetfall.h"
17 |
18 | void packetfall::ingest_packet(const be13::packet_info &pi)
19 | {
20 | }
21 |
22 | void packetfall::render(cairo_t *cr, const plot_view::bounds_t &bounds)
23 | {
24 | cairo_set_source_rgb(cr, 0.67, 0.67, 0.67);
25 | cairo_rectangle(cr, bounds.x, bounds.y, bounds.width, bounds.height);
26 | cairo_fill(cr);
27 |
28 | double font_size = 16.0;
29 | std::string label = "pretty packetfall";
30 | cairo_text_extents_t extents;
31 |
32 | cairo_set_font_size(cr, font_size);
33 | cairo_set_source_rgb(cr, 0.0, 0.0, 0.0);
34 |
35 | cairo_text_extents(cr, label.c_str(), &extents);
36 |
37 | double text_x = bounds.x + (bounds.width - extents.width) / 2.0;
38 | double text_y = bounds.y + (bounds.height + extents.height) / 2.0;
39 |
40 | cairo_move_to(cr, text_x, text_y);
41 | cairo_show_text(cr, label.c_str());
42 |
43 | }
44 | #endif
45 |
--------------------------------------------------------------------------------
/src/wifipcap/prism.h:
--------------------------------------------------------------------------------
1 |
2 | #include "os.h"
3 |
4 | /*
5 | // prism header: added (from wlan-ng)
6 | #define WLAN_DEVNAMELEN_MAX 16
7 |
8 | typedef struct {
9 | uint32_t did;
10 | uint16_t status;
11 | uint16_t len;
12 | uint32_t data;
13 | } __attribute__((__packed__)) p80211item_uint32_t;
14 |
15 | typedef struct {
16 | uint32_t msgcode;
17 | uint32_t msglen;
18 | uint8_t devname[WLAN_DEVNAMELEN_MAX];
19 | p80211item_uint32_t hosttime;
20 | p80211item_uint32_t mactime;
21 | p80211item_uint32_t channel;
22 | p80211item_uint32_t rssi;
23 | p80211item_uint32_t sq;
24 | p80211item_uint32_t signal;
25 | p80211item_uint32_t noise;
26 | p80211item_uint32_t rate;
27 | p80211item_uint32_t istx;
28 | p80211item_uint32_t frmlen;
29 | } __attribute__((__packed__)) prism2_pkthdr;
30 | */
31 |
32 | #ifdef _WIN32
33 | #pragma pack(push, 1)
34 | #endif
35 | struct prism2_pkthdr {
36 | u_int32_t host_time;
37 | u_int32_t mac_time;
38 | u_int32_t channel;
39 | u_int32_t rssi;
40 | u_int32_t sq;
41 | int signal;
42 | int noise;
43 | u_int32_t rate;
44 | u_int32_t istx;
45 | u_int32_t frmlen;
46 | } _PACKED_;
47 | #ifdef _WIN32
48 | #pragma pack(pop)
49 | #endif
50 |
--------------------------------------------------------------------------------
/src/be13_api/Makefile.defs:
--------------------------------------------------------------------------------
1 | BE13_API= \
2 | be13_api/atomic_set_map.h \
3 | be13_api/aftimer.h \
4 | be13_api/beregex.cpp \
5 | be13_api/beregex.h \
6 | be13_api/bulk_extractor_i.h \
7 | be13_api/cppmutex.h \
8 | be13_api/feature_recorder.cpp \
9 | be13_api/feature_recorder.h \
10 | be13_api/feature_recorder_set.cpp \
11 | be13_api/feature_recorder_set.h \
12 | be13_api/feature_recorder_sql.cpp \
13 | be13_api/histogram.h \
14 | be13_api/histogram.cpp \
15 | be13_api/net_ethernet.h \
16 | be13_api/pcap_fake.cpp \
17 | be13_api/pcap_fake.h \
18 | be13_api/plugin.cpp \
19 | be13_api/sbuf.cpp \
20 | be13_api/sbuf.h \
21 | be13_api/sbuf_private.h \
22 | be13_api/sbuf_stream.cpp \
23 | be13_api/sbuf_stream.h \
24 | be13_api/unicode_escape.cpp \
25 | be13_api/unicode_escape.h \
26 | be13_api/utf8.h \
27 | be13_api/utf8/checked.h \
28 | be13_api/utf8/core.h \
29 | be13_api/utf8/unchecked.h \
30 | be13_api/utils.cpp \
31 | be13_api/utils.h \
32 | be13_api/word_and_context_list.cpp \
33 | be13_api/word_and_context_list.h
34 |
35 |
36 |
37 |
--------------------------------------------------------------------------------
/python/plot_wifi_aps.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python3.3
2 | #
3 | # Read a report.xml file and output a graphviz graph of the nodes
4 | #
5 | import xml.etree.ElementTree as ET
6 |
7 | if __name__=="__main__":
8 | import sys
9 | root = ET.parse(sys.argv[1])
10 | macs = set()
11 | ssids = set()
12 | print("digraph ssids {")
13 | for ssidnode in root.findall('.//ssid'):
14 | macs.add(ssidnode.attrib['mac'])
15 | ssids.add(ssidnode.attrib['ssid'])
16 | print(' "{}" -> "{}";'.format(ssidnode.attrib['mac'],ssidnode.attrib['ssid']))
17 |
18 | # Send through the attributes
19 | # Make all of the boxes
20 | for mac in macs:
21 | print(' "{}" [shape=box]'.format(mac))
22 |
23 | # color all of the SSIDs
24 | c = 1
25 | for ssid in ssids:
26 | r = (c)//3
27 | g = (c+1)//3
28 | b = (c+2)//3
29 | color = "#{:02X}{:02X}{:02X}".format(255-r*16,255-g*16,255-b*16)
30 | c += 1
31 | if c/3>4:
32 | c = 0
33 | print(' "{}" [color="{}",style=filled]'.format(ssid,color))
34 | for macnode in root.findall(".//ssid/[@ssid='{}']".format(ssid)):
35 | print(' "{}" [color="{}",style=filled]'.format(macnode.attrib['mac'],color))
36 | print("}")
37 |
38 |
--------------------------------------------------------------------------------
/src/wifipcap/util.h:
--------------------------------------------------------------------------------
1 | #ifndef __WIFIPCAP_UTIL_H_
2 | #define __WIFIPCAP_UTIL_H_
3 |
4 | #include
5 |
6 | typedef unsigned char uint8_t;
7 | typedef unsigned short uint16_t;
8 | #ifdef _WIN32
9 | typedef unsigned long long uint64_t;
10 | #endif
11 |
12 | #if 0
13 | struct MAC {
14 | uint64_t val;
15 | MAC() {}
16 | MAC(const uint8_t *stream);
17 | MAC(uint64_t val);
18 | MAC(const char *str);
19 | MAC(const MAC& o);
20 |
21 | bool operator==(const MAC& o) const {
22 | return val == o.val;
23 | }
24 | bool operator!=(const MAC& o) const {
25 | return val != o.val;
26 | }
27 | bool operator<(const MAC& o) const {
28 | return val < o.val;
29 | }
30 |
31 | enum { PRINT_FMT_COLON, PRINT_FMT_PLAIN };
32 |
33 | static MAC broadcast;
34 | static MAC null;
35 | static int print_fmt;
36 | };
37 |
38 | std::ostream& operator<<(std::ostream& out, const MAC& mac);
39 | std::ostream& operator<<(std::ostream& out, const struct in_addr& ip);
40 | #endif
41 |
42 | char *va(const char *format, ...);
43 |
44 | struct tok {
45 | int v; /* value */
46 | const char *s; /* string */
47 | };
48 |
49 | extern const char *
50 | tok2str(register const struct tok *lp, register const char *fmt,
51 | register int v);
52 |
53 | #endif
54 |
--------------------------------------------------------------------------------
/src/scan_md5.cpp:
--------------------------------------------------------------------------------
1 | /**
2 | *
3 | * scan_md5:
4 | * plug-in demonstration that shows how to write a simple plug-in scanner that calculates
5 | * the MD5 of each file..
6 | */
7 |
8 | #include "config.h"
9 | #include "bulk_extractor_i.h"
10 | #include "dfxml/src/hash_t.h"
11 |
12 | #include
13 | #include
14 |
15 |
16 | extern "C"
17 | void scan_md5(const class scanner_params &sp,const recursion_control_block &rcb)
18 | {
19 |
20 | if(sp.sp_version!=scanner_params::CURRENT_SP_VERSION){
21 | std::cerr << "scan_md5 requires sp version " << scanner_params::CURRENT_SP_VERSION << "; "
22 | << "got version " << sp.sp_version << "\n";
23 | exit(1);
24 | }
25 |
26 | if(sp.phase==scanner_params::PHASE_STARTUP){
27 | sp.info->name = "md5";
28 | sp.info->flags = scanner_info::SCANNER_DISABLED;
29 | return; /* No feature files created */
30 | }
31 |
32 | #ifdef HAVE_EVP_GET_DIGESTBYNAME
33 | if(sp.phase==scanner_params::PHASE_SCAN){
34 | static const std::string hash0("");
35 | static const std::string hash1("");
36 | if(sp.sxml){
37 | (*sp.sxml) << hash0 << md5_generator::hash_buf(sp.sbuf.buf,sp.sbuf.bufsize).hexdigest() << hash1;
38 | }
39 | return;
40 | }
41 | #endif
42 | }
43 |
--------------------------------------------------------------------------------
/m4/ac_prog_javac_works.m4:
--------------------------------------------------------------------------------
1 | dnl @synopsis AC_PROG_JAVAC_WORKS
2 | dnl
3 | dnl Internal use ONLY.
4 | dnl
5 | dnl Note: This is part of the set of autoconf M4 macros for Java
6 | dnl programs. It is VERY IMPORTANT that you download the whole set,
7 | dnl some macros depend on other. Unfortunately, the autoconf archive
8 | dnl does not support the concept of set of macros, so I had to break it
9 | dnl for submission. The general documentation, as well as the sample
10 | dnl configure.in, is included in the AC_PROG_JAVA macro.
11 | dnl
12 | dnl @category Java
13 | dnl @author Stephane Bortzmeyer
14 | dnl @version 2000-07-19
15 | dnl @license GPLWithACException
16 |
17 | AC_DEFUN([AC_PROG_JAVAC_WORKS],[
18 | AC_CACHE_CHECK([if $JAVAC works], ac_cv_prog_javac_works, [
19 | JAVA_TEST=Test.java
20 | CLASS_TEST=Test.class
21 | cat << \EOF > $JAVA_TEST
22 | /* [#]line __oline__ "configure" */
23 | public class Test {
24 | }
25 | EOF
26 | if AC_TRY_COMMAND($JAVAC $JAVACFLAGS $JAVA_TEST) >/dev/null 2>&1; then
27 | ac_cv_prog_javac_works=yes
28 | else
29 | AC_MSG_ERROR([The Java compiler $JAVAC failed (see config.log, check the CLASSPATH?)])
30 | echo "configure: failed program was:" >&AC_FD_CC
31 | cat $JAVA_TEST >&AC_FD_CC
32 | fi
33 | rm -f $JAVA_TEST $CLASS_TEST
34 | ])
35 | AC_PROVIDE([$0])dnl
36 | ])
37 |
--------------------------------------------------------------------------------
/m4/slg_mingw_support.m4:
--------------------------------------------------------------------------------
1 | ################################################################
2 | ## See if we are running on mingw
3 | # http://osdir.com/ml/gnu.mingw.devel/2003-09/msg00040.html
4 | # Note: Windows 95 WINVER=0x400
5 | # Windows 98 WINVER=0x400 _WIN32_WINDOWS=0x0410
6 | # Windows Me WINVER=0x400 _WIN32_WINDOWS=0x0490
7 | # Windows NT 4.0 WINVER=0x0400 _WIN32_WINNT=0x0400
8 | # Windows NT 4.0 SP3 WINVER=0x0400 _WIN32_WINNT=0x0403
9 | # Windows 2000 WINVER=0x500 _WIN32_WINNT=0x0500
10 | # Windows XP WINVER=0x501 _WIN32_WINNT=0x0501
11 | # Windows Server 2003 WINVER=0x502 _WIN32_WINNT=0x0502
12 | #
13 | # mingw32 includes i686-w64-mingw32 and x86_64-w64-mingw32
14 |
15 | mingw="no"
16 | case $host in
17 | *-*-*linux*-*)
18 | AC_DEFINE([__LINUX__],1,[Linux operating system functions])
19 | ;;
20 |
21 | *mingw*)
22 | LIBS="$LIBS -lpsapi -lws2_32 -lgdi32"
23 | CPPFLAGS="-DUNICODE -D_UNICODE -D__MSVCRT_VERSION__=0x0601 -DWINVER=0x0500 -D_WIN32_WINNT=0x0500 -g $CPPFLAGS"
24 | CPPFLAGS="$CPPFLAGS --static "
25 | CFLAGS="$CFLAGS --static -static-libgcc -static-libstdc++"
26 | CXXFLAGS="$CXXFLAGS -Wno-format " # compiler mingw-4.3.0 is broken on I64u formats
27 | CXXFLAGS="$CXXFLAGS --static -static-libgcc -static-libstdc++"
28 | LDFLAGS="$LDFLAGS --static"
29 | mingw="yes"
30 | ;;
31 | esac
32 |
33 |
--------------------------------------------------------------------------------
/src/wifipcap/radiotap.h:
--------------------------------------------------------------------------------
1 |
2 | #include "os.h"
3 |
4 | #ifdef _WIN32
5 | #pragma pack(push, 1)
6 | #endif
7 | struct radiotap_hdr {
8 | bool has_channel;
9 | int channel;
10 |
11 | bool has_fhss;
12 | int fhss_fhset;
13 | int fhss_fhpat;
14 |
15 | bool has_rate;
16 | int rate;
17 |
18 | bool has_signal_dbm;
19 | int signal_dbm;
20 |
21 | bool has_noise_dbm;
22 | int noise_dbm;
23 |
24 | bool has_signal_db;
25 | int signal_db;
26 |
27 | bool has_noise_db;
28 | int noise_db;
29 |
30 | bool has_quality;
31 | int quality;
32 |
33 | bool has_txattenuation;
34 | int txattenuation;
35 |
36 | bool has_txattenuation_db;
37 | int txattenuation_db;
38 |
39 | bool has_txpower_dbm;
40 | int txpower_dbm;
41 |
42 | bool has_flags;
43 | bool flags_cfp;
44 | bool flags_short_preamble;
45 | bool flags_wep;
46 | bool flags_fragmented;
47 | bool flags_badfcs;
48 |
49 | bool has_antenna;
50 | int antenna;
51 |
52 | bool has_tsft;
53 | u_int64_t tsft;
54 |
55 | bool has_rxflags;
56 | int rxflags;
57 |
58 | bool has_txflags;
59 | int txflags;
60 |
61 | bool has_rts_retries;
62 | int rts_retries;
63 |
64 | bool has_data_retries;
65 | int data_retries;
66 | } _PACKED_;
67 | #ifdef _WIN32
68 | #pragma pack(pop)
69 | #endif
70 |
--------------------------------------------------------------------------------
/m4/ac_java_options.m4:
--------------------------------------------------------------------------------
1 | dnl @synopsis AC_JAVA_OPTIONS
2 | dnl
3 | dnl AC_JAVA_OPTIONS adds configure command line options used for Java
4 | dnl m4 macros. This Macro is optional.
5 | dnl
6 | dnl Note: This is part of the set of autoconf M4 macros for Java
7 | dnl programs. It is VERY IMPORTANT that you download the whole set,
8 | dnl some macros depend on other. Unfortunately, the autoconf archive
9 | dnl does not support the concept of set of macros, so I had to break it
10 | dnl for submission. The general documentation, as well as the sample
11 | dnl configure.in, is included in the AC_PROG_JAVA macro.
12 | dnl
13 | dnl @category Java
14 | dnl @author Devin Weaver
15 | dnl @version 2000-07-19
16 | dnl @license AllPermissive
17 |
18 | AC_DEFUN([AC_JAVA_OPTIONS],[
19 | AC_ARG_WITH(java-prefix,
20 | [ --with-java-prefix=PFX prefix where Java runtime is installed (optional)])
21 | AC_ARG_WITH(javac-flags,
22 | [ --with-javac-flags=FLAGS flags to pass to the Java compiler (optional)])
23 | AC_ARG_WITH(java-flags,
24 | [ --with-java-flags=FLAGS flags to pass to the Java VM (optional)])
25 | JAVAPREFIX=$with_java_prefix
26 | JAVACFLAGS=$with_javac_flags
27 | JAVAFLAGS=$with_java_flags
28 | AC_SUBST(JAVAPREFIX)dnl
29 | AC_SUBST(JAVACFLAGS)dnl
30 | AC_SUBST(JAVAFLAGS)dnl
31 | AC_SUBST(JAVA)dnl
32 | AC_SUBST(JAVAC)dnl
33 | ])
34 |
--------------------------------------------------------------------------------
/m4/ac_try_compile_java.m4:
--------------------------------------------------------------------------------
1 | dnl @synopsis AC_TRY_COMPILE_JAVA
2 | dnl
3 | dnl AC_TRY_COMPILE_JAVA attempt to compile user given source.
4 | dnl
5 | dnl *Warning*: its success or failure can depend on a proper setting of
6 | dnl the CLASSPATH env. variable.
7 | dnl
8 | dnl Note: This is part of the set of autoconf M4 macros for Java
9 | dnl programs. It is VERY IMPORTANT that you download the whole set,
10 | dnl some macros depend on other. Unfortunately, the autoconf archive
11 | dnl does not support the concept of set of macros, so I had to break it
12 | dnl for submission. The general documentation, as well as the sample
13 | dnl configure.in, is included in the AC_PROG_JAVA macro.
14 | dnl
15 | dnl @category Java
16 | dnl @author Devin Weaver
17 | dnl @version 2000-07-19
18 | dnl @license AllPermissive
19 |
20 | AC_DEFUN([AC_TRY_COMPILE_JAVA],[
21 | AC_REQUIRE([AC_PROG_JAVAC])dnl
22 | cat << \EOF > Test.java
23 | /* [#]line __oline__ "configure" */
24 | ifelse([$1], , , [import $1;])
25 | public class Test {
26 | [$2]
27 | }
28 | EOF
29 | if AC_TRY_COMMAND($JAVAC $JAVACFLAGS Test.java) && test -s Test.class
30 | then
31 | dnl Don't remove the temporary files here, so they can be examined.
32 | ifelse([$3], , :, [$3])
33 | else
34 | echo "configure: failed program was:" >&AC_FD_CC
35 | cat Test.java >&AC_FD_CC
36 | ifelse([$4], , , [ rm -fr Test*
37 | $4
38 | ])dnl
39 | fi
40 | rm -fr Test*])
41 |
--------------------------------------------------------------------------------
/src/netviz/legend_view.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This source file is public domain, as it is not based on the original tcpflow.
3 | *
4 | * Author: Michael Shick
5 | */
6 |
7 |
8 | #ifndef LEGEND_VIEW_H
9 | #define LEGEND_VIEW_H
10 |
11 | #include "plot_view.h"
12 |
13 | class legend_view {
14 | public:
15 | // legend_view::entry to everyone else
16 | class entry_t {
17 | public:
18 | entry_t(plot_view::rgb_t color_, std::string label_, uint16_t port_) :
19 | color(color_), label(label_), port(port_) {}
20 | plot_view::rgb_t color;
21 | std::string label;
22 | uint16_t port;
23 | };
24 | typedef std::vector entries_t;
25 |
26 | legend_view(entries_t entries_) :
27 | entries(entries_) {}
28 |
29 | void render(cairo_t *cr, const plot_view::bounds_t &bounds) const;
30 |
31 | static const std::string empty_legend_label;
32 | static const double base_font_size;
33 | static const double chip_length;
34 | static const double chip_label_space;
35 | static const double inter_item_space;
36 | static const double padding;
37 | static const double border_width;
38 | static const plot_view::rgb_t border_color;
39 | private:
40 | const entries_t entries;
41 | };
42 |
43 | inline bool operator<(const legend_view::entry_t &a, const legend_view::entry_t &b)
44 | {
45 | return a.port < b.port;
46 | }
47 | #endif
48 |
--------------------------------------------------------------------------------
/src/be13_api/be13_configure.m4:
--------------------------------------------------------------------------------
1 | #
2 | # mix-ins for be13
3 | #
4 |
5 | AC_MSG_NOTICE([Including be13_configure.m4 from be13_api])
6 | AC_CHECK_HEADERS([err.h pwd.h sys/cdefs.h sys/mman.h sys/resource.h sys/utsname.h unistd.h sqlite3.h ])
7 | AC_CHECK_FUNCS([gmtime_r ishexnumber isxdigit localtime_r unistd.h mmap err errx warn warnx pread64 pread strptime _lseeki64 utimes ])
8 |
9 | AC_CHECK_LIB([sqlite3],[sqlite3_libversion])
10 | AC_CHECK_FUNCS([sqlite3_create_function_v2])
11 |
12 | AC_TRY_COMPILE([#pragma GCC diagnostic ignored "-Wredundant-decls"],[int a=3;],
13 | [AC_DEFINE(HAVE_DIAGNOSTIC_REDUNDANT_DECLS,1,[define 1 if GCC supports -Wredundant-decls])]
14 | )
15 | AC_TRY_COMPILE([#pragma GCC diagnostic ignored "-Wcast-align"],[int a=3;],
16 | [AC_DEFINE(HAVE_DIAGNOSTIC_CAST_ALIGN,1,[define 1 if GCC supports -Wcast-align])]
17 | )
18 |
19 | AC_TRY_LINK([#include ],
20 | [uint64_t ul; __sync_add_and_fetch(&ul,0);],
21 | AC_DEFINE(HAVE___SYNC_ADD_AND_FETCH,1,[define 1 if __sync_add_and_fetch works on 64-bit numbers]))
22 |
23 | #
24 | # Figure out which version of unordered_map we are going to use
25 | #
26 | AC_LANG_PUSH(C++)
27 | AC_MSG_NOTICE([checking for unordered_map])
28 | AC_MSG_NOTICE([ CXXFLAGS: $CXXFLAGS])
29 | AC_CHECK_HEADERS([unordered_map unordered_set],[],[
30 | AC_CHECK_HEADERS([tr1/unordered_map tr1/unordered_set])])
31 | AC_MSG_NOTICE([done])
32 | AC_LANG_POP()
33 |
34 |
--------------------------------------------------------------------------------
/m4/ac_prog_jar.m4:
--------------------------------------------------------------------------------
1 | dnl @synopsis AC_PROG_JAR
2 | dnl
3 | dnl AC_PROG_JAR tests for an existing jar program. It uses the
4 | dnl environment variable JAR then tests in sequence various common jar
5 | dnl programs.
6 | dnl
7 | dnl If you want to force a specific compiler:
8 | dnl
9 | dnl - at the configure.in level, set JAR=yourcompiler before calling
10 | dnl AC_PROG_JAR
11 | dnl
12 | dnl - at the configure level, setenv JAR
13 | dnl
14 | dnl You can use the JAR variable in your Makefile.in, with @JAR@.
15 | dnl
16 | dnl Note: This macro depends on the autoconf M4 macros for Java
17 | dnl programs. It is VERY IMPORTANT that you download that whole set,
18 | dnl some macros depend on other. Unfortunately, the autoconf archive
19 | dnl does not support the concept of set of macros, so I had to break it
20 | dnl for submission.
21 | dnl
22 | dnl The general documentation of those macros, as well as the sample
23 | dnl configure.in, is included in the AC_PROG_JAVA macro.
24 | dnl
25 | dnl @category Java
26 | dnl @author Egon Willighagen
27 | dnl @version 2000-07-19
28 | dnl @license AllPermissive
29 |
30 | AC_DEFUN([AC_PROG_JAR],[
31 | AC_REQUIRE([AC_EXEEXT])dnl
32 | if test "x$JAVAPREFIX" = x; then
33 | test "x$JAR" = x && AC_CHECK_PROGS(JAR, jar$EXEEXT)
34 | else
35 | test "x$JAR" = x && AC_CHECK_PROGS(JAR, jar, $JAVAPREFIX)
36 | fi
37 | test "x$JAR" = x && AC_MSG_ERROR([no acceptable jar program found in \$PATH])
38 | AC_PROVIDE([$0])dnl
39 | ])
40 |
--------------------------------------------------------------------------------
/m4/ac_try_run_javac.m4:
--------------------------------------------------------------------------------
1 | dnl @synopsis AC_TRY_RUN_JAVA
2 | dnl
3 | dnl AC_TRY_RUN_JAVA attempt to compile and run user given source.
4 | dnl
5 | dnl *Warning*: its success or failure can depend on a proper setting of
6 | dnl the CLASSPATH env. variable.
7 | dnl
8 | dnl Note: This is part of the set of autoconf M4 macros for Java
9 | dnl programs. It is VERY IMPORTANT that you download the whole set,
10 | dnl some macros depend on other. Unfortunately, the autoconf archive
11 | dnl does not support the concept of set of macros, so I had to break it
12 | dnl for submission. The general documentation, as well as the sample
13 | dnl configure.in, is included in the AC_PROG_JAVA macro.
14 | dnl
15 | dnl @category Java
16 | dnl @author Devin Weaver
17 | dnl @version 2000-07-19
18 | dnl @license AllPermissive
19 |
20 | AC_DEFUN([AC_TRY_RUN_JAVA],[
21 | AC_REQUIRE([AC_PROG_JAVAC])dnl
22 | AC_REQUIRE([AC_PROG_JAVA])dnl
23 | cat << \EOF > Test.java
24 | /* [#]line __oline__ "configure" */
25 | ifelse([$1], , , [include $1;])
26 | public class Test {
27 | [$2]
28 | }
29 | EOF
30 | if AC_TRY_COMMAND($JAVAC $JAVACFLAGS Test.java) && test -s Test.class && ($JAVA $JAVAFLAGS Test; exit) 2>/dev/null
31 | then
32 | dnl Don't remove the temporary files here, so they can be examined.
33 | ifelse([$3], , :, [$3])
34 | else
35 | echo "configure: failed program was:" >&AC_FD_CC
36 | cat Test.java >&AC_FD_CC
37 | ifelse([$4], , , [ rm -fr Test*
38 | $4
39 | ])dnl
40 | fi
41 | rm -fr Test*])
42 |
--------------------------------------------------------------------------------
/src/intrusive_list.h:
--------------------------------------------------------------------------------
1 | #ifndef INTRUSIVE_LIST_H
2 | #define INTRUSIVE_LIST_H
3 |
4 | #include
5 | #include
6 |
7 | // implement boost::intrusive::list using std::list
8 |
9 | template
10 | class intrusive_list {
11 | public:
12 | intrusive_list():li(), len(0) {}
13 |
14 | typedef typename std::list::iterator iterator;
15 |
16 | inline void push_back(T* node) {
17 | li.push_back(node);
18 | len++;
19 | node->it = --li.end();
20 | }
21 |
22 | inline void erase(T* node) {
23 | if (!is_linked(node))
24 | return;
25 | li.erase(node->it);
26 | len--;
27 | reset(node);
28 | }
29 |
30 | inline void move_to_end(T* node) {
31 | if (!is_linked(node))
32 | return;
33 | li.splice(li.end(), li, node->it);
34 | }
35 |
36 | inline void reset(T* node) {
37 | node->it = li.end();
38 | }
39 |
40 | inline bool empty() {
41 | return li.empty();
42 | }
43 |
44 | inline size_t size() {
45 | // std::list.size() is O(n) in some platform. Is there any define flag for that?
46 | //return li.size();
47 | return len;
48 | }
49 |
50 | inline iterator begin() {
51 | return li.begin();
52 | }
53 |
54 | inline iterator end() {
55 | return li.end();
56 | }
57 |
58 | private:
59 | inline bool is_linked(T* node) {
60 | return node->it != li.end();
61 | }
62 |
63 | std::list li;
64 | size_t len;
65 | };
66 |
67 | #endif // INTRUSIVE_LIST_H
68 |
--------------------------------------------------------------------------------
/m4/ac_prog_javadoc.m4:
--------------------------------------------------------------------------------
1 | dnl @synopsis AC_PROG_JAVADOC
2 | dnl
3 | dnl AC_PROG_JAVADOC tests for an existing javadoc generator. It uses
4 | dnl the environment variable JAVADOC then tests in sequence various
5 | dnl common javadoc generator.
6 | dnl
7 | dnl If you want to force a specific compiler:
8 | dnl
9 | dnl - at the configure.in level, set JAVADOC=yourgenerator before
10 | dnl calling AC_PROG_JAVADOC
11 | dnl
12 | dnl - at the configure level, setenv JAVADOC
13 | dnl
14 | dnl You can use the JAVADOC variable in your Makefile.in, with
15 | dnl @JAVADOC@.
16 | dnl
17 | dnl Note: This macro depends on the autoconf M4 macros for Java
18 | dnl programs. It is VERY IMPORTANT that you download that whole set,
19 | dnl some macros depend on other. Unfortunately, the autoconf archive
20 | dnl does not support the concept of set of macros, so I had to break it
21 | dnl for submission.
22 | dnl
23 | dnl The general documentation of those macros, as well as the sample
24 | dnl configure.in, is included in the AC_PROG_JAVA macro.
25 | dnl
26 | dnl @category Java
27 | dnl @author Egon Willighagen
28 | dnl @version 2000-07-19
29 | dnl @license AllPermissive
30 |
31 | AC_DEFUN([AC_PROG_JAVADOC],[
32 | AC_REQUIRE([AC_EXEEXT])dnl
33 | if test "x$JAVAPREFIX" = x; then
34 | test "x$JAVADOC" = x && AC_CHECK_PROGS(JAVADOC, javadoc$EXEEXT)
35 | else
36 | test "x$JAVADOC" = x && AC_CHECK_PROGS(JAVADOC, javadoc, $JAVAPREFIX)
37 | fi
38 | test "x$JAVADOC" = x && AC_MSG_ERROR([no acceptable javadoc generator found in \$PATH])
39 | AC_PROVIDE([$0])dnl
40 | ])
41 |
--------------------------------------------------------------------------------
/src/inet_ntop.c:
--------------------------------------------------------------------------------
1 | /**
2 | * private implementaiton if inet_ntop for systems that don't have it.
3 | * Functionally, correct, this version doesn't do condensing of IPv6 addresses,
4 | * and is kind of slow.
5 | *
6 | * This is included if the OS does not have inet_ntop.
7 | *
8 | * PUBLIC DOMAIN.
9 | * Simson L. Garfinkel, Jan 20, 2013
10 | */
11 |
12 | static const char *inet_ntop4(const struct in_addr *addr, char *buf, socklen_t buflen)
13 | {
14 | const uint8_t *a = (uint8_t *)addr;
15 | snprintf(buf,buflen,"%03d.%03d.%03d.%03d", a[0], a[1], a[2], a[3]);
16 | return buf;
17 | }
18 |
19 | static const char *inet_ntop6(const struct private_in6_addr *addr, char *buf, socklen_t buflen)
20 | {
21 | const char *obuf=buf;
22 | const uint8_t *a = (uint8_t *)addr;
23 | for(size_t i=0;i<16;i++){
24 | if(buflen<2) return 0; /* can't convert */
25 | snprintf(buf,buflen,"%02x",a[i]);
26 | buf+=2;
27 | buflen-=2;
28 | if(i>0 && i<15 && i%2==1){
29 | if(buflen<1) return 0;
30 | buf[0] = ':';
31 | buf++;
32 | buflen--;
33 | }
34 | }
35 | if(buflen<1) return 0;
36 | buf[0] = 0;
37 | return obuf;
38 | }
39 |
40 | const char *
41 | inet_ntop(int af, const void *addr, char *buf, socklen_t len)
42 | {
43 | switch(af){
44 | case AF_INET:
45 | return inet_ntop4((const struct in_addr *)addr, buf, len);
46 | case AF_INET6:
47 | return inet_ntop6((const struct private_in6_addr *)addr, buf, len);
48 | }
49 | return NULL;
50 | }
51 |
--------------------------------------------------------------------------------
/src/be13_api/cppmutex.h:
--------------------------------------------------------------------------------
1 | /* -*- mode: C++; c-basic-offset: 4; indent-tabs-mode: nil -*- */
2 |
3 | /**
4 | * Cppmutex is an easy-to-use mutex class.
5 | * Create a cppmutex instance for a mutex.
6 | * Create a cppmutex::lock(M) object to get a lock; delete the object to free it.
7 | *
8 | * BE SURE THAT HAVE_PTHREAD IS DEFINED BEFORE INCLUDING THIS FILE
9 | */
10 |
11 |
12 | #ifndef CPPMUTEX_H
13 | #define CPPMUTEX_H
14 |
15 | #include
16 | #include
17 | #include
18 | #include
19 |
20 | #include
21 | #include
22 |
23 | class cppmutex {
24 | // default copy construction and assignment are meaningless and not implemented
25 | cppmutex(const cppmutex &c);
26 | cppmutex &operator=(const cppmutex &cp);
27 |
28 | public:
29 | pthread_mutex_t M;
30 | public:
31 | cppmutex():M(){
32 | if(pthread_mutex_init(&M,NULL)){
33 | std::cerr << "pthread_mutex_init failed: " << strerror(errno) << "\n";
34 | exit(1);
35 | }
36 | }
37 | virtual ~cppmutex(){
38 | pthread_mutex_destroy(&M);
39 | }
40 | class lock { // get
41 | private:
42 | cppmutex &myMutex;
43 | lock(const lock &l); // copy of locks is meaningless
44 | lock &operator=(const lock &l);
45 | public:
46 | lock(cppmutex &m):myMutex(m){
47 | pthread_mutex_lock(&myMutex.M);
48 | }
49 | ~lock(){
50 | pthread_mutex_unlock(&myMutex.M);
51 | }
52 | };
53 | };
54 |
55 | #endif
56 |
--------------------------------------------------------------------------------
/src/netviz/address_histogram_view.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This source file is public domain, as it is not based on the original tcpflow.
3 | *
4 | * Author: Michael Shick
5 | */
6 |
7 |
8 | #ifndef ADDRESS_HISTOGRAM_VIEW_H
9 | #define ADDRESS_HISTOGRAM_VIEW_H
10 |
11 | #include "config.h"
12 | #ifdef HAVE_LIBCAIRO
13 |
14 | #include "plot_view.h"
15 | #include "address_histogram.h"
16 |
17 | class address_histogram_view : public plot_view {
18 | public:
19 | address_histogram_view(const address_histogram &histogram_);
20 |
21 | class bucket_view {
22 | public:
23 | bucket_view(const iptree::addr_elem &bucket_,
24 | const rgb_t &color_) :
25 | bucket(bucket_), color(color_) {}
26 |
27 | const iptree::addr_elem &bucket;
28 | const rgb_t &color;
29 |
30 | static const double label_font_size;
31 |
32 | void render(cairo_t *cr, const bounds_t &bounds);
33 | void render_label(cairo_t *cr, const bounds_t &bounds);
34 | };
35 |
36 | const address_histogram &histogram;
37 | rgb_t bar_color;
38 | rgb_t cdf_color;
39 |
40 | static const double bar_space_factor;
41 | static const size_t compressed_ip6_str_max_len;
42 | static const double cdf_line_width;
43 | static const double data_width_factor;
44 |
45 | void render(cairo_t *cr, const bounds_t &bounds);
46 | void render_data(cairo_t *cr, const bounds_t &bounds);
47 | const address_histogram &get_data() const;
48 |
49 | static std::string compressed_ip6_str(iptree::addr_elem address);
50 | };
51 |
52 | #endif
53 | #endif
54 |
--------------------------------------------------------------------------------
/src/scan_wifiviz.cpp:
--------------------------------------------------------------------------------
1 | /**
2 | * scan_wifiviz:
3 | *
4 | * Use the wifipcap and do some basic visualizations
5 | */
6 |
7 | #include "config.h"
8 | #include
9 | #include
10 |
11 | #include "bulk_extractor_i.h"
12 | #include "datalink_wifi.h"
13 |
14 | extern "C"
15 | void scan_wifiviz(const class scanner_params &sp,const recursion_control_block &rcb)
16 | {
17 | if(sp.sp_version!=scanner_params::CURRENT_SP_VERSION){
18 | std::cout << "scan_timehistogram requires sp version "
19 | << scanner_params::CURRENT_SP_VERSION << "; "
20 | << "got version " << sp.sp_version << "\n";
21 | exit(1);
22 | }
23 |
24 | if(sp.phase==scanner_params::PHASE_STARTUP){
25 | sp.info->name = "wifiviz";
26 | sp.info->flags = scanner_info::SCANNER_DISABLED;
27 | sp.info->author= "Simson Garfinkel";
28 | sp.info->packet_user = 0;
29 | sp.info->description = "Performs wifi isualization";
30 | sp.info->get_config("check_fcs",&TFCB::theTFCB.opt_check_fcs,"Require valid Frame Check Sum (FCS)");
31 | }
32 | if(sp.phase==scanner_params::PHASE_SHUTDOWN){
33 | if(sp.sxml){
34 | (*sp.sxml) << "\n";
35 | for(TFCB::mac_ssid_map_t::const_iterator it=TFCB::theTFCB.mac_to_ssid.begin();
36 | it!=TFCB::theTFCB.mac_to_ssid.end();it++){
37 | (*sp.sxml) << " \n";
39 | }
40 | (*sp.sxml) << "\n";
41 | }
42 | }
43 | }
44 |
45 |
--------------------------------------------------------------------------------
/src/netviz/port_histogram.h:
--------------------------------------------------------------------------------
1 | /**
2 | * port_histogram.h:
3 | * Show packets received vs port
4 | *
5 | * This source file is public domain, as it is not based on the original tcpflow.
6 | *
7 | * Author: Michael Shick
8 | *
9 | */
10 |
11 | #ifndef PORT_HISTOGRAM_H
12 | #define PORT_HISTOGRAM_H
13 |
14 | class port_histogram {
15 | public:
16 | port_histogram() :
17 | port_counts(), data_bytes_ingested(0), buckets(), buckets_dirty(true) {}
18 |
19 | class port_count {
20 | public:
21 | port_count(uint16_t port_, uint64_t count_) :
22 | port(port_), count(count_) {}
23 | uint16_t port;
24 | uint64_t count;
25 | };
26 | //typedef uint16_t port_t;
27 |
28 | class descending_counts {
29 | public:
30 | bool operator()(const port_count &a, const port_count &b);
31 | };
32 |
33 | void increment(uint16_t port, uint64_t delta);
34 | const port_count &at(size_t index);
35 | size_t size();
36 | uint64_t ingest_count() const;
37 |
38 | typedef std::vector port_count_vector;
39 |
40 | port_count_vector::const_iterator begin();
41 | port_count_vector::const_iterator end();
42 | port_count_vector::const_reverse_iterator rbegin();
43 | port_count_vector::const_reverse_iterator rend();
44 |
45 | static const size_t bucket_count;
46 |
47 | private:
48 | typedef std::map port_counts_t;
49 | port_counts_t port_counts;
50 | uint64_t data_bytes_ingested;
51 | std::vector buckets;
52 | bool buckets_dirty;
53 |
54 | void refresh_buckets();
55 | };
56 |
57 | #endif
58 |
--------------------------------------------------------------------------------
/src/datalink_wifi.cpp:
--------------------------------------------------------------------------------
1 | /**
2 | * wifi datalink function and callbacks to handle 802.11
3 | * In addition to calling process_packet_info() for the packets,
4 | * it maintains some 802.11 specific databases.
5 | */
6 |
7 | #include "tcpflow.h"
8 | #include "datalink_wifi.h"
9 |
10 | /**
11 | * TFCB --- TCPFLOW callbacks for wifippcap
12 | */
13 |
14 | void TFCB::Handle80211(const WifiPacket &p, u_int16_t fc, const MAC& sa, const MAC& da, const MAC& ra, const MAC& ta, const u_char *ptr, size_t len)
15 | {
16 | }
17 |
18 | void TFCB::HandleLLC(const WifiPacket &p, const struct llc_hdr_t *hdr, const u_char *rest, size_t len) {
19 | sbuf_t sb(pos0_t(),rest,len,len,0,false,false,false);
20 | struct timeval tv;
21 | be13::packet_info pi(p.header_type,p.header,p.packet,tvshift(tv,p.header->ts),rest,len);
22 | be13::plugin::process_packet(pi);
23 | }
24 |
25 | void TFCB::Handle80211MgmtBeacon(const WifiPacket &p, const mgmt_header_t *hdr, const mgmt_body_t *body)
26 | {
27 | #ifdef DEBUG_WIFI
28 | std::cerr << " " << "802.11 mgmt: " << hdr->sa << " beacon " << body->ssid.ssid << "\"";
29 | #endif
30 | mac_ssid bcn(hdr->sa,std::string(body->ssid.ssid));
31 | mac_to_ssid[bcn] += 1;
32 | }
33 |
34 |
35 | /* Entrance point */
36 | TFCB TFCB::theTFCB; // singleton
37 | static Wifipcap theWcap;
38 | void dl_ieee802_11_radio(u_char *user, const struct pcap_pkthdr *h, const u_char *p)
39 | {
40 | theWcap.handle_packet(&TFCB::theTFCB,DLT_IEEE802_11_RADIO,h,p);
41 | }
42 |
43 | void dl_prism(u_char *user, const struct pcap_pkthdr *h, const u_char *p)
44 | {
45 | #ifdef DLT_PRISM_HEADER
46 | theWcap.handle_packet(&TFCB::theTFCB,DLT_PRISM_HEADER,h,p);
47 | #endif
48 | }
49 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 |
2 | # Backup Files and autoconf nonsense
3 | # Compiled source #
4 | # Executables
5 | # Logs and databases #
6 | # OS generated files #
7 | # Packages #
8 | # git has its own built in compression methods
9 | # http://help.github.com/ignore-files/
10 | # http://stackoverflow.com/questions/3290908/which-files-generated-by-autotools-should-i-keep-in-git-repository
11 | # it's better to unpack these files and commit the raw source
12 | # plus vim backups
13 | ############
14 | ###################
15 | ######################
16 | *.7z
17 | *.a
18 | *.aff
19 | *.class
20 | *.com
21 | *.dll
22 | *.dmg
23 | *.exe
24 | *.gz
25 | *.iso
26 | *.jar
27 | *.log
28 | *.o
29 | *.obj
30 | *.pyc
31 | *.rar
32 | *.sig
33 | *.so
34 | *.sql
35 | *.sqlite
36 | *.swp
37 | *.tar
38 | *.trs
39 | *.zip
40 | *~
41 | .DS_Store
42 | .DS_Store*
43 | .deps
44 | .dirstamp
45 | .libs
46 | Icon?
47 | Makefile
48 | Makefile.in
49 | TAGS
50 | Thumbs.db
51 | a.out.dSYM
52 | aclocal.m4
53 | affconfig.h
54 | affconfig.h.in
55 | afflib-*.tar.gz
56 | afflib.lib
57 | afflib.pc
58 | afflib.spec
59 | autom4te.cache
60 | config.guess
61 | config.h
62 | config.h.in
63 | config.log
64 | config.status
65 | config.sub
66 | configure
67 | depcomp
68 | doc/tcpflow.1
69 | ehthumbs.db
70 | install-sh
71 | libtool
72 | ltmain.sh
73 | m4/libtool.m4
74 | m4/ltoptions.m4
75 | m4/ltsugar.m4
76 | m4/ltversion.m4
77 | m4/lt~obsolete.m4
78 | missing
79 | out
80 | out-*
81 | report.xml
82 | src/a.out
83 | src/config.h
84 | src/iphtest-nitroba-100.txt
85 | src/iphtest-nitroba-1000.txt
86 | src/iphtest-nitroba-10000.txt
87 | src/tcpflow
88 | stamp-h*
89 | tags
90 | tcpflow.spec
91 | test-driver
92 | tests/*.pdf
93 | tests/out
94 | tests/packet1.pcap
95 | *.d
96 | ar-lib
97 | tcpflow-1.6.1
98 |
--------------------------------------------------------------------------------
/src/be13_api/utf8.h:
--------------------------------------------------------------------------------
1 | /* -*- mode: C++; c-basic-offset: 4; indent-tabs-mode: nil -*- */
2 | // Copyright 2006 Nemanja Trifunovic
3 |
4 | /*
5 | Permission is hereby granted, free of charge, to any person or organization
6 | obtaining a copy of the software and accompanying documentation covered by
7 | this license (the "Software") to use, reproduce, display, distribute,
8 | execute, and transmit the Software, and to prepare derivative works of the
9 | Software, and to permit third-parties to whom the Software is furnished to
10 | do so, all subject to the following:
11 |
12 | The copyright notices in the Software and this entire statement, including
13 | the above license grant, this restriction and the following disclaimer,
14 | must be included in all copies of the Software, in whole or in part, and
15 | all derivative works of the Software, unless such copies or derivative
16 | works are solely in the form of machine-executable object code generated by
17 | a source language processor.
18 |
19 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
22 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
23 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
24 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25 | DEALINGS IN THE SOFTWARE.
26 | */
27 |
28 |
29 | #ifndef UTF8_FOR_CPP_2675DCD0_9480_4c0c_B92A_CC14C027B731
30 | #define UTF8_FOR_CPP_2675DCD0_9480_4c0c_B92A_CC14C027B731
31 |
32 | #include "utf8/checked.h"
33 | #include "utf8/unchecked.h"
34 |
35 | #endif // header guard
36 |
--------------------------------------------------------------------------------
/tcpflow.spec.in:
--------------------------------------------------------------------------------
1 | %global _hardened_build 1
2 |
3 | Name: tcpflow
4 | Version: @VERSION@
5 | Release: 0%{?dist}
6 | License: GPLv3
7 | Summary: Network traffic recorder
8 | URL: https://github.com/simsong/tcpflow
9 | Source0: http://digitalcorpora.org/downloads/%{name}/%{name}-%{version}.tar.gz
10 |
11 | BuildRequires: boost-devel
12 | #BuildRequires: bzip2-devel
13 | BuildRequires: cairo-devel
14 | BuildRequires: libpcap-devel
15 | BuildRequires: openssl-devel
16 | BuildRequires: zlib-devel
17 |
18 | %description
19 | tcpflow is a program that captures data transmitted as part of TCP
20 | connections (flows), and stores the data in a way that is convenient
21 | for protocol analysis or debugging. A program like 'tcpdump' shows a
22 | summary of packets seen on the wire, but usually doesn't store the
23 | data that's actually being transmitted. In contrast, tcpflow
24 | reconstructs the actual data streams and stores each flow in a
25 | separate file for later analysis.
26 |
27 | %prep
28 | %setup -q
29 |
30 | %build
31 | export CPPFLAGS="%{optflags}"
32 | export LDFLAGS="%{__global_ldflags}"
33 | %configure
34 | make %{?_smp_mflags}
35 |
36 | %install
37 | make DESTDIR=%{buildroot} INSTALL='install -p' install
38 |
39 | %check
40 | #make check
41 |
42 | %files
43 | %doc AUTHORS COPYING ChangeLog NEWS README
44 | %{_bindir}/tcpflow
45 | %{_mandir}/man1/tcpflow.1*
46 |
47 | %changelog
48 |
49 | * Sun Jun 04 2017 O. Libre - 1.4.6-0
50 | - Apply improvements from Fedora Packages repo https://src.fedoraproject.org/cgit/rpms/?q=tcpflow
51 |
52 | * Sun Feb 26 2012 Simson Garfinkel - 1.2
53 | - Rewrite for version 1.2
54 |
55 | * Thu Apr 22 1999 Ross Golder - 0.12
56 | - Wrote for version 0.12
57 |
58 |
--------------------------------------------------------------------------------
/src/datalink_wifi.h:
--------------------------------------------------------------------------------
1 | #ifndef DATALINK_WIFI_H
2 | #define DATALINK_WIFI_H
3 |
4 | #include
5 | #include