diff --git a/.bumpversion.cfg b/.bumpversion.cfg deleted file mode 100644 index cb8dd72..0000000 --- a/.bumpversion.cfg +++ /dev/null @@ -1,6 +0,0 @@ -[bumpversion] -current_version = 0.2.9 -commit = True -tag = True - -[bumpversion:file:setup.py] \ No newline at end of file diff --git a/CITATION.cff b/CITATION.cff deleted file mode 100644 index 34a5c3a..0000000 --- a/CITATION.cff +++ /dev/null @@ -1,13 +0,0 @@ -cff-version: 1.1.0 -message: "If you use this software, please cite it as below." -authors: - - family-names: Machmeier - given-names: Stefan - orcid: "https://orcid.org/0000-0002-7028-1755" - - family-names: Heuveline - given-names: Vincent - orcid: "https://orcid.org/0000-0002-2217-7558" -title: "heiFIP: A network traffic image converter" -doi: "10.5281/zenodo.8348868" -version: v1.1.1 -date-released: 2023-09-15 \ No newline at end of file diff --git a/LICENSE b/LICENSE deleted file mode 100644 index 6d8cea4..0000000 --- a/LICENSE +++ /dev/null @@ -1,190 +0,0 @@ -EUROPEAN UNION PUBLIC LICENCE v. 1.2 -EUPL © the European Union 2007, 2016 - -This European Union Public Licence (the ‘EUPL’) applies to the Work (as defined below) which is provided under the -terms of this Licence. Any use of the Work, other than as authorised under this Licence is prohibited (to the extent such -use is covered by a right of the copyright holder of the Work). -The Work is provided under the terms of this Licence when the Licensor (as defined below) has placed the following -notice immediately following the copyright notice for the Work: - Licensed under the EUPL -or has expressed by any other means his willingness to license under the EUPL. - -1.Definitions -In this Licence, the following terms have the following meaning: -— ‘The Licence’:this Licence. -— ‘The Original Work’:the work or software distributed or communicated by the Licensor under this Licence, available -as Source Code and also as Executable Code as the case may be. -— ‘Derivative Works’:the works or software that could be created by the Licensee, based upon the Original Work or -modifications thereof. This Licence does not define the extent of modification or dependence on the Original Work -required in order to classify a work as a Derivative Work; this extent is determined by copyright law applicable in -the country mentioned in Article 15. -— ‘The Work’:the Original Work or its Derivative Works. -— ‘The Source Code’:the human-readable form of the Work which is the most convenient for people to study and -modify. -— ‘The Executable Code’:any code which has generally been compiled and which is meant to be interpreted by -a computer as a program. -— ‘The Licensor’:the natural or legal person that distributes or communicates the Work under the Licence. -— ‘Contributor(s)’:any natural or legal person who modifies the Work under the Licence, or otherwise contributes to -the creation of a Derivative Work. -— ‘The Licensee’ or ‘You’:any natural or legal person who makes any usage of the Work under the terms of the -Licence. -— ‘Distribution’ or ‘Communication’:any act of selling, giving, lending, renting, distributing, communicating, -transmitting, or otherwise making available, online or offline, copies of the Work or providing access to its essential -functionalities at the disposal of any other natural or legal person. - -2.Scope of the rights granted by the Licence -The Licensor hereby grants You a worldwide, royalty-free, non-exclusive, sublicensable licence to do the following, for -the duration of copyright vested in the Original Work: -— use the Work in any circumstance and for all usage, -— reproduce the Work, -— modify the Work, and make Derivative Works based upon the Work, -— communicate to the public, including the right to make available or display the Work or copies thereof to the public -and perform publicly, as the case may be, the Work, -— distribute the Work or copies thereof, -— lend and rent the Work or copies thereof, -— sublicense rights in the Work or copies thereof. -Those rights can be exercised on any media, supports and formats, whether now known or later invented, as far as the -applicable law permits so. -In the countries where moral rights apply, the Licensor waives his right to exercise his moral right to the extent allowed -by law in order to make effective the licence of the economic rights here above listed. -The Licensor grants to the Licensee royalty-free, non-exclusive usage rights to any patents held by the Licensor, to the -extent necessary to make use of the rights granted on the Work under this Licence. - -3.Communication of the Source Code -The Licensor may provide the Work either in its Source Code form, or as Executable Code. If the Work is provided as -Executable Code, the Licensor provides in addition a machine-readable copy of the Source Code of the Work along with -each copy of the Work that the Licensor distributes or indicates, in a notice following the copyright notice attached to -the Work, a repository where the Source Code is easily and freely accessible for as long as the Licensor continues to -distribute or communicate the Work. - -4.Limitations on copyright -Nothing in this Licence is intended to deprive the Licensee of the benefits from any exception or limitation to the -exclusive rights of the rights owners in the Work, of the exhaustion of those rights or of other applicable limitations -thereto. - -5.Obligations of the Licensee -The grant of the rights mentioned above is subject to some restrictions and obligations imposed on the Licensee. Those -obligations are the following: - -Attribution right: The Licensee shall keep intact all copyright, patent or trademarks notices and all notices that refer to -the Licence and to the disclaimer of warranties. The Licensee must include a copy of such notices and a copy of the -Licence with every copy of the Work he/she distributes or communicates. The Licensee must cause any Derivative Work -to carry prominent notices stating that the Work has been modified and the date of modification. - -Copyleft clause: If the Licensee distributes or communicates copies of the Original Works or Derivative Works, this -Distribution or Communication will be done under the terms of this Licence or of a later version of this Licence unless -the Original Work is expressly distributed only under this version of the Licence — for example by communicating -‘EUPL v. 1.2 only’. The Licensee (becoming Licensor) cannot offer or impose any additional terms or conditions on the -Work or Derivative Work that alter or restrict the terms of the Licence. - -Compatibility clause: If the Licensee Distributes or Communicates Derivative Works or copies thereof based upon both -the Work and another work licensed under a Compatible Licence, this Distribution or Communication can be done -under the terms of this Compatible Licence. For the sake of this clause, ‘Compatible Licence’ refers to the licences listed -in the appendix attached to this Licence. Should the Licensee's obligations under the Compatible Licence conflict with -his/her obligations under this Licence, the obligations of the Compatible Licence shall prevail. - -Provision of Source Code: When distributing or communicating copies of the Work, the Licensee will provide -a machine-readable copy of the Source Code or indicate a repository where this Source will be easily and freely available -for as long as the Licensee continues to distribute or communicate the Work. -Legal Protection: This Licence does not grant permission to use the trade names, trademarks, service marks, or names -of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and -reproducing the content of the copyright notice. - -6.Chain of Authorship -The original Licensor warrants that the copyright in the Original Work granted hereunder is owned by him/her or -licensed to him/her and that he/she has the power and authority to grant the Licence. -Each Contributor warrants that the copyright in the modifications he/she brings to the Work are owned by him/her or -licensed to him/her and that he/she has the power and authority to grant the Licence. -Each time You accept the Licence, the original Licensor and subsequent Contributors grant You a licence to their contributions -to the Work, under the terms of this Licence. - -7.Disclaimer of Warranty -The Work is a work in progress, which is continuously improved by numerous Contributors. It is not a finished work -and may therefore contain defects or ‘bugs’ inherent to this type of development. -For the above reason, the Work is provided under the Licence on an ‘as is’ basis and without warranties of any kind -concerning the Work, including without limitation merchantability, fitness for a particular purpose, absence of defects or -errors, accuracy, non-infringement of intellectual property rights other than copyright as stated in Article 6 of this -Licence. -This disclaimer of warranty is an essential part of the Licence and a condition for the grant of any rights to the Work. - -8.Disclaimer of Liability -Except in the cases of wilful misconduct or damages directly caused to natural persons, the Licensor will in no event be -liable for any direct or indirect, material or moral, damages of any kind, arising out of the Licence or of the use of the -Work, including without limitation, damages for loss of goodwill, work stoppage, computer failure or malfunction, loss -of data or any commercial damage, even if the Licensor has been advised of the possibility of such damage. However, -the Licensor will be liable under statutory product liability laws as far such laws apply to the Work. - -9.Additional agreements -While distributing the Work, You may choose to conclude an additional agreement, defining obligations or services -consistent with this Licence. However, if accepting obligations, You may act only on your own behalf and on your sole -responsibility, not on behalf of the original Licensor or any other Contributor, and only if You agree to indemnify, -defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against such Contributor by -the fact You have accepted any warranty or additional liability. - -10.Acceptance of the Licence -The provisions of this Licence can be accepted by clicking on an icon ‘I agree’ placed under the bottom of a window -displaying the text of this Licence or by affirming consent in any other similar way, in accordance with the rules of -applicable law. Clicking on that icon indicates your clear and irrevocable acceptance of this Licence and all of its terms -and conditions. -Similarly, you irrevocably accept this Licence and all of its terms and conditions by exercising any rights granted to You -by Article 2 of this Licence, such as the use of the Work, the creation by You of a Derivative Work or the Distribution -or Communication by You of the Work or copies thereof. - -11.Information to the public -In case of any Distribution or Communication of the Work by means of electronic communication by You (for example, -by offering to download the Work from a remote location) the distribution channel or media (for example, a website) -must at least provide to the public the information requested by the applicable law regarding the Licensor, the Licence -and the way it may be accessible, concluded, stored and reproduced by the Licensee. - -12.Termination of the Licence -The Licence and the rights granted hereunder will terminate automatically upon any breach by the Licensee of the terms -of the Licence. -Such a termination will not terminate the licences of any person who has received the Work from the Licensee under -the Licence, provided such persons remain in full compliance with the Licence. - -13.Miscellaneous -Without prejudice of Article 9 above, the Licence represents the complete agreement between the Parties as to the -Work. -If any provision of the Licence is invalid or unenforceable under applicable law, this will not affect the validity or -enforceability of the Licence as a whole. Such provision will be construed or reformed so as necessary to make it valid -and enforceable. -The European Commission may publish other linguistic versions or new versions of this Licence or updated versions of -the Appendix, so far this is required and reasonable, without reducing the scope of the rights granted by the Licence. -New versions of the Licence will be published with a unique version number. -All linguistic versions of this Licence, approved by the European Commission, have identical value. Parties can take -advantage of the linguistic version of their choice. - -14.Jurisdiction -Without prejudice to specific agreement between parties, -— any litigation resulting from the interpretation of this License, arising between the European Union institutions, -bodies, offices or agencies, as a Licensor, and any Licensee, will be subject to the jurisdiction of the Court of Justice -of the European Union, as laid down in article 272 of the Treaty on the Functioning of the European Union, -— any litigation arising between other parties and resulting from the interpretation of this License, will be subject to -the exclusive jurisdiction of the competent court where the Licensor resides or conducts its primary business. - -15.Applicable Law -Without prejudice to specific agreement between parties, -— this Licence shall be governed by the law of the European Union Member State where the Licensor has his seat, -resides or has his registered office, -— this licence shall be governed by Belgian law if the Licensor has no seat, residence or registered office inside -a European Union Member State. - - - Appendix - -‘Compatible Licences’ according to Article 5 EUPL are: -— GNU General Public License (GPL) v. 2, v. 3 -— GNU Affero General Public License (AGPL) v. 3 -— Open Software License (OSL) v. 2.1, v. 3.0 -— Eclipse Public License (EPL) v. 1.0 -— CeCILL v. 2.0, v. 2.1 -— Mozilla Public Licence (MPL) v. 2 -— GNU Lesser General Public Licence (LGPL) v. 2.1, v. 3 -— Creative Commons Attribution-ShareAlike v. 3.0 Unported (CC BY-SA 3.0) for works other than software -— European Union Public Licence (EUPL) v. 1.1, v. 1.2 -— Québec Free and Open-Source Licence — Reciprocity (LiLiQ-R) or Strong Reciprocity (LiLiQ-R+). - -The European Commission may update this Appendix to later versions of the above licences without producing -a new version of the EUPL, as long as they provide the rights granted in Article 2 of this Licence and protect the -covered Source Code from exclusive appropriation. -All other changes or additions to this Appendix require the production of a new EUPL version. diff --git a/README.md b/README.md index 4d4ce4a..187f4fd 100644 --- a/README.md +++ b/README.md @@ -1,222 +1,117 @@ -![heiFIP Logo](https://raw.githubusercontent.com/stefanDeveloper/heiFIP/main/assets/heiFIP_logo.png?raw=true) - - --------------------------------------------------------------------------------- - -**heiFIP** stands for Heidelberg Flow Image Processor. -It is a tool designed to extract essential parts of packets and convert them into images for deep learning purposes. -heiFIP supports different formats and orientations. -Currently, we only support **offline** network data analysis. -However, we plan to adapt our library to support **online** network data too to enable live-probing of models. - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Live Notebook - - live notebook - -
Latest Release - - latest release - -
Supported Versions - - python3 - - - pypy3 - -
Project License - - License - -
Citation - - Citation - -
Continuous Integration - - Linux WorkFlows - - - MacOS WorkFlows - - - Windows WorkFlows - -
- -## Table of Contents - -- [**Main Features**](#main-features) -- [**Motivation**](#motivation) -- [**Examples**](#examples) -- [**Getting Started**](#getting-started) - - [**Building from source**](#building-from-source) -- [**Citation**](#citation) - - [**Credits**](#credits) - - [**Authors**](#authors) -- [**License**](#license) - -## Motivation - -The idea to create heiFIP came from working with Deep Learning approaches to classify malware traffic on images. Many papers use image representation of network traffic, but reproducing their results was quite cumbersome. As a result, we found that there is currently no official library that supports reproducible images of network traffic. For this reason, we developed heiFIP to easily create images of network traffic and reproduce ML/DL results. Researchers can use this library as a baseline for their work to enable other researchers to easily recreate their findings. - -## Main Features - -- **Different Images**: Currently, we support plain packet to byte representation, and flow to byte representation with one channel each. An image is created with same width and height for a quadratic representation. - - **Flow Images** converts a set of packets into an image. It supports the following modifications: - - **Max images dimension** allows you to specify the maximum image dimension. If the packet is larger than the specified size, it will cut the remaining pixel. - - **Min image dimesion** allows you to specify the minimum image dimension. If the packet is smaller than the specified size, it fills the remaining pixel with 0. - - **Remove duplicates** allows you to automatically remove same traffic. - - **Append** each flow to each other or write each packet to a new row. - - **Tiled** each flow is tiled into a square image representation. - - **Min packets per flow** allows you to specify the minimum number of packets per flow. If the total number of packets is too small, no image will be created. - - **Max packets per flow** allows you to specify the maximum number of packets per flow. If the total number of packets is too great, the remaining images are discarded. - - **Packet Image** converts a single packet into an image. - - **Markov Transition Matrix Image**: converts a packet or a flow into a Markov representation. -- **Header** processing allows you to customize header fields of different protocols. It aims to remove biasing fields. For more details look into [header.py](https://github.com/stefanDeveloper/heiFIP/blob/main/heifip/plugins/header.py) -- **Remove Payload** options allows you to only work on header data. -- **Fast and flexible**: We rely on [Scapy](https://github.com/secdev/scapy) for our sniffing and header processing. Image preparation is based on raw bytes. -- **Machine learning orientation**: heiFIP aims to make Deep Learning approaches using network data as images reproducible and deployable. Using heiFIP as a common framework enables researches to test and verify their models. - -## Examples - -| Image Type | Description | Example | -|------------|-------------|---------| -| Packet | Converts a single packet into a square image. Size depends on the total length | ![SMB Connection](https://raw.githubusercontent.com/stefanDeveloper/heiFIP/main/examples/packet.png?raw=true) | -| Flow | Converts a flow packet into a square image | ![SMB Connection](https://raw.githubusercontent.com/stefanDeveloper/heiFIP/main/examples/flow-tiled.png?raw=true) | -| Markov Transition Matrix Packet | Converts a packet into a Markov Transition Matrix. Size is fixed to 16x16. | ![SMB Connection](https://raw.githubusercontent.com/stefanDeveloper/heiFIP/main/examples/markov-packet.png?raw=true) | -| Markov Transition Matrix Flow | Converts a flow into a Markov Transition Matrix. It squares the image based on the number of packets | ![SMB Connection](https://raw.githubusercontent.com/stefanDeveloper/heiFIP/main/examples/markov-flow.png?raw=true) | - -## Getting Started - -Install our package using PyPi - -```sh -pip install heifip -``` -Now, you can use the integrate CLI: +# heiFIPCpp -```sh -> fip -Usage: fip [OPTIONS] COMMAND [ARGS]... +**Flow & Packet Imaging and Matrix Extraction from PCAP** -Options: - --version Show the version and exit. - -h, --help Show this message and exit. +A C++ command‑line tool to process network capture files (PCAP), generate various image representations (packet‑level, flow‑level, tiled, Markov transition matrices), and save outputs for further analysis or machine learning. -Commands: - extract -``` +--- -To extract images from PCAPs, we currently split the command into flow and packet: - -```sh -> fip extract -Starting FlowImageProcessor CLI -Usage: fip extract [OPTIONS] COMMAND [ARGS]... - -Options: - -h, --help Show this message and exit. - -Commands: - flow - packet - -# Show help information -> fip extract [flow/packet]-h -Starting FlowImageProcessor CLI -Usage: fip extract flow [OPTIONS] - -Options: - -w, --write PATH Destination file path, stores result [required] - -r, --read PATH [required] - -t, --threads INTEGER Number of parallel threads that can be used - [default: 4] - --preprocess [NONE|HEADER] Applies a preprocessing to the input data: none: - No preprocessing payload: Only payload data is - used header: Preprocesses headers - (DNS,HTTP,IP,IPv6,TCP,UDP supported) to remove - some biasing data [default: NONE] - --min_im_dim INTEGER Minimum dim ouput images need to have, 0=No - minimum dim [default: 0] - --max_im_dim INTEGER Maximum dim ouput images can have, 0=No maximum - dim [default: 0] - --remove_duplicates Within a single output folder belonging to a - single input folder no duplicate images will be - produced if two inputs lead to the same image - --min_packets INTEGER Minimum packets that a FlowImage needs to have, - 0=No minimum packets per flow [default: 0] - --max_packets INTEGER Minimum packets that a FlowImage needs to have, - 0=No minimum packets per flow [default: 0] - --append - --tiled - --width INTEGER [default: 128] - -h, --help Show this message and exit. - -> fip extract flow -r /PATH/PCAPs -w /PATH/IMAGES -``` +## Features -Import FIPExtractor to run it inside your program: +* **Packet Imaging**: Convert individual packets into grayscale images. +* **Flow Imaging**: Aggregate flows into images, with fixed or auto‑tiled layouts. +* **Markov Transition Matrices**: Compute byte‑level transition matrices at packet or flow granularity. +* **Custom Preprocessing**: Strip or transform headers before imaging. +* **Multi‑threaded**: Parallel processing across multiple CPU cores. +* **Extensible Architecture**: Add new image types or preprocessing pipelines via C++ classes. -```python -extractor = FIPExtractor() -img = extractor.create_image('./test/pcaps/dns/dns-binds.pcap') -extractor.save_image(img, './test/pcaps/dns/dns-binds.pcap') -``` +--- -### Building from source +## Requirements -Simply run: +* **C++ Compiler**: GCC ≥ 9.0, Clang ≥ 10, or MSVC 2019 with C++17 support. +* **CMake**: Version ≥ 3.15 +* **PcapPlusPlus**: Installed system‑wide or built locally. ([https://github.com/seladb/PcapPlusPlus](https://github.com/seladb/PcapPlusPlus)) +* **OpenSSL**: For MD5 hashing (libcrypto). +* **pthread**: POSIX threads (Linux/macOS). Windows users require linking against `-lws2_32` and `-lIPHLPAPI`. -``` -pip install . -``` +Optional: -### Publications that use heiFIP +* **getopt\_long**: For CLI parsing (provided by libc on Linux/macOS). Windows may need `getopt` replacement. -- [A Generalizable Approach for Network Flow Image Representation for Deep Learning] - CSNet 23 -- [Explainable artificial intelligence for improving a session-based malware traffic classification with deep learning] - SSCI 23 +--- +## Building -## Credits +```bash +# Clone this repo +git clone https://github.com/yourusername/heiFIPCpp.git +cd heiFIPCpp -[NFStream](https://github.com/nfstream/nfstream) for the inspiration of the `README.md` and workflow testing. +# Create build directory +mkdir build && cd build -### Authors +# Configure (point at PcapPlusPlus if not in default locations) +cmake .. \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_PREFIX_PATH=/opt/PcapPlusPlus -The following people contributed to heiFIP: +# Compile +make -j$(nproc) -- [Stefan Machmeier](https://github.com/stefanDeveloper): Creator -- [Manuel Trageser](https://github.com/maxi99manuel99): Header extraction and customization. +# The executable 'heiFIPCpp' will be produced in build/ +``` + +--- + +## Usage + +```bash +./heiFIPCpp \ + --input /path/to/capture.pcap \ + --output /path/to/outdir \ + --threads 4 \ + --processor HEADER \ + --mode FlowImageTiledAuto \ + --dim 16 \ + --apppend \ + --fill 0 \ + --min-dim 10 \ + --max-dim 2000 \ + --min-pkts 10 \ + --max-pkts 100 \ + --remove-dup +``` + +### Options +|-------------------- | -------------------------------------------------------------- | +| Flag | Description | +| ------------------- | -------------------------------------------------------------- | +| `-i`, `--input` | Input PCAP file path | +| `-o`, `--output` | Output directory | +| `-t`, `--threads` | Number of worker threads (default: 1) | +| `-p`, `--processor` | Preprocessing: `NONE` or `HEADER` | +| `-m`, `--mode` | Image type: `PacketImage`, `FlowImage`, `FlowImageTiledFixed`, | +| | `FlowImageTiledAuto`, `MarkovTransitionMatrixFlow`, | +| | `MarkovTransitionMatrixPacket` | +| `--dim` | Base dimension for image (e.g. width/height in pixels) | +| `--fill` | Fill or padding value (0–255) | +| `--cols` | Number of columns (for tiled/fixed or Markov flow) | +| `--auto-dim` | Enable auto‑dimension selection (bool) | +| `--append` | Enable auto‑dimension selection (bool) | +| `--min-dim` | Minimum allowed image dimension | +| `--max-dim` | Maximum allowed image dimension | +| `--min-pkts` | Minimum packets per flow (for tiled/flow modes) | +| `--max-pkts` | Maximum packets per flow | +| `--remove-dup` | Remove duplicate flows/packets by hash | +| `-h`, `--help` | Show this help message | +| ___________________ | ______________________________________________________________ | + +## Extending + +To add a new image type: + +1. Define a new `ImageArgs` struct in `extractor.cpp`. +2. Extend the `ImageType` enum. +3. Implement the conversion in `PacketProcessor::createImageFromPacket()`. +4. Update the CLI `--mode` parser to include your new type. + +--- ## License -This project is licensed under the EUPL-1.2 [**License**](license) - see the License file for details +This project is licensed under the EUPL-1.2 License - see the License file for details + +--- -[license]: https://github.com/stefanDeveloper/heiFIP/blob/main/LICENSE \ No newline at end of file +*Happy packet‑to‑image transformations!* diff --git a/assets/heiFIP.svg b/assets/heiFIP.svg deleted file mode 100644 index 49ae99d..0000000 --- a/assets/heiFIP.svg +++ /dev/null @@ -1,81 +0,0 @@ - - - - - - - - - - - heiFIP - - - - diff --git a/assets/heiFIP_logo.png b/assets/heiFIP_logo.png deleted file mode 100644 index 4b4495a..0000000 Binary files a/assets/heiFIP_logo.png and /dev/null differ diff --git a/assets/heiFIP_logo.svg b/assets/heiFIP_logo.svg deleted file mode 100644 index 2700e66..0000000 --- a/assets/heiFIP_logo.svg +++ /dev/null @@ -1,81 +0,0 @@ - - - - - - - - - - - heiFIP - - - - diff --git a/examples/flow-tiled.png b/examples/flow-tiled.png deleted file mode 100644 index 8eacaf5..0000000 Binary files a/examples/flow-tiled.png and /dev/null differ diff --git a/examples/markov-flow.png b/examples/markov-flow.png deleted file mode 100644 index f6d4667..0000000 Binary files a/examples/markov-flow.png and /dev/null differ diff --git a/examples/markov-packet.png b/examples/markov-packet.png deleted file mode 100644 index 63f6c67..0000000 Binary files a/examples/markov-packet.png and /dev/null differ diff --git a/examples/packet.png b/examples/packet.png deleted file mode 100644 index d08f7b5..0000000 Binary files a/examples/packet.png and /dev/null differ diff --git a/heiFIP/CMakeLists.txt b/heiFIP/CMakeLists.txt new file mode 100644 index 0000000..e0e6073 --- /dev/null +++ b/heiFIP/CMakeLists.txt @@ -0,0 +1,56 @@ +cmake_minimum_required(VERSION 3.10) +project(heiFIP) + +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) + +include_directories(/usr/local/include) + +set(CMAKE_BUILD_TYPE Debug) +set(CMAKE_CXX_FLAGS_DEBUG "-g") +set(CMAKE_C_FLAGS_DEBUG "-g") + +add_compile_options(-Wno-deprecated-declarations) + +if (EXISTS "/opt/homebrew") + set(HOMEBREW_PREFIX "/opt/homebrew") # Apple Silicon +else() + set(HOMEBREW_PREFIX "/usr/local") # Intel +endif() + +link_directories(${HOMEBREW_PREFIX}/lib ${OPENSSL_LIBRARIES}) +link_directories(/usr/local/lib) +include_directories(${CMAKE_SOURCE_DIR}/assets) +include_directories(${CMAKE_SOURCE_DIR}/plugins) +include_directories(${CMAKE_SOURCE_DIR}/images) +include_directories(${CMAKE_SOURCE_DIR}/layers) +include_directories( + ${HOMEBREW_PREFIX}/include + ${HOMEBREW_PREFIX}/include/pcapplusplus + ${OPENSSL_INCLUDE_DIR} +) + +set(OPENSSL_ROOT_DIR "${HOMEBREW_PREFIX}/opt/openssl") +set(OPENSSL_INCLUDE_DIR "${OPENSSL_ROOT_DIR}/include") +set(OPENSSL_LIBRARIES "${OPENSSL_ROOT_DIR}/lib") + +add_library(heiFIBPacketImage STATIC assets/heiFIBPacketImage.cpp) +target_include_directories(heiFIBPacketImage PUBLIC ${CMAKE_SOURCE_DIR}) + +find_package(OpenSSL REQUIRED) + +find_package(OpenCV REQUIRED + COMPONENTS core imgcodecs +) + +add_executable(heiFIP cli.cpp) + +target_include_directories(heiFIP PRIVATE ${OpenCV_INCLUDE_DIRS}) +target_link_libraries(heiFIP + Pcap++ + Packet++ + Common++ + pcap + ${OPENSSL_LIBRARIES} + ${OpenCV_LIBS} +) \ No newline at end of file diff --git a/heiFIP/assets/PcapHeaders.h b/heiFIP/assets/PcapHeaders.h new file mode 100644 index 0000000..be510ce --- /dev/null +++ b/heiFIP/assets/PcapHeaders.h @@ -0,0 +1,22 @@ +#pragma once + +#include + +// PCAP Global Header Structure (24 bytes) +struct PcapGlobalHeader { + uint32_t magic_number; // File format identifier + uint16_t version_major; // Major version number + uint16_t version_minor; // Minor version number + int32_t thiszone; // Time zone offset + uint32_t sigfigs; // Timestamp accuracy + uint32_t snaplen; // Max packet size + uint32_t network; // Data link type +}; + +// PCAP Packet Header Structure (16 bytes) +struct PcapPacketHeader { + uint32_t ts_sec; // Timestamp seconds + uint32_t ts_usec; // Timestamp microseconds + uint32_t caplen; // Captured packet length + uint32_t len; // Original packet length +}; \ No newline at end of file diff --git a/heiFIP/assets/heiFIBPacketImage.cpp b/heiFIP/assets/heiFIBPacketImage.cpp new file mode 100644 index 0000000..a0deb47 --- /dev/null +++ b/heiFIP/assets/heiFIBPacketImage.cpp @@ -0,0 +1,136 @@ +#pragma once + +#include +#include "PcapHeaders.h" +#include +#include +#include +#include +#include + +class heiFIBPacketImage { + public: + heiFIBPacketImage(std::vector data, uint32_t cap_length) : _data(data), _cap_length(cap_length) {} + + heiFIBPacketImage(std::vector data) : _data(data) { + PcapPacketHeader packetHeader; + _cap_length = packetHeader.caplen; + } + + heiFIBPacketImage(std::vector data, int dim, int fill, bool auto_dim) : _data(data) { + PcapPacketHeader packetHeader; + _cap_length = packetHeader.caplen; + std::pair>, std::vector>> result = heiFIBPacketImage::get_matrix_tiled(fill, dim, auto_dim); + heiFIBPacketImage::matrix = result.first; + heiFIBPacketImage::binaries = result.second; + } + + ~heiFIBPacketImage() {} + + void printHexData() const { + std::cout << std::dec << "Packet has size" << " (Size: " << get_cap_length() << " bytes):\n"; + for (size_t i = 0; i < _data.size(); i++) { + std::cout << std::hex << std::setw(2) << std::setfill('0') << static_cast(_data[i]) << " "; + } + std::cout << std::endl; + } + + std::vector getHexData() const { + std::vector hexData; + size_t packetSize = _data.size(); + for (size_t i = 0; i < packetSize; ++i) { + hexData.push_back(static_cast(_data[i])); + } + return hexData; + } + + std::vector bit_array() const { + + // Use copy of packet to avoid modification + std::vector data; + // Push each byte individually into the vector + for (uint8_t bit: _data) { + data.push_back(static_cast(bit)); + } + std::string bytes_as_bits; + for (unsigned char byte : data) { + bytes_as_bits += std::bitset<8>(byte).to_string(); + } + + std::vector transition; + for (size_t i = 0; i < bytes_as_bits.length(); i += 4) { + transition.push_back(std::stoi(bytes_as_bits.substr(i, 4), nullptr, 2)); + } + return transition; + } + + std::pair>, std::vector>> get_matrix_tiled(int fill, int dim, bool auto_dim) { + std::vector> binaries; + + std::vector hexData = (*this).getHexData(); + binaries.push_back(hexData); + + size_t length = 0; + for (const std::vector& b : binaries) { + length = std::max(length, b.size()); + } + + if (auto_dim) { + dim = static_cast(std::ceil(std::sqrt(length))); + } + + int total = dim * dim; + std::vector flat; + flat.reserve(total); + + // 1) Flatten the double-vector + for (const auto& row : binaries) { + flat.insert(flat.end(), row.begin(), row.end()); + } + + // 2) Pad with `fill` if too short + if (flat.size() < total) { + flat.insert(flat.end(), total - flat.size(), fill); + } + // 3) Or truncate if too long + else if (flat.size() > total) { + flat.resize(total); + } + + // 4) Reshape into dim × dim + std::vector> result(dim, std::vector(dim)); + for (size_t idx = 0; idx < total; ++idx) { + size_t i = idx / dim; + size_t j = idx % dim; + result[i][j] = flat[idx]; + } + + return {result, binaries}; + } + + std::vector get_data() const { + return _data; + } + + void set_data(std::vector data) { + _data = data; + } + + uint32_t get_cap_length() const { + return _cap_length; + } + + void set_cap_length(uint32_t cap_length) { + _cap_length = cap_length; + } + + std::vector>& get_matrix() { + return matrix; + } + + private: + std::vector _data; + uint32_t _cap_length; + std::vector> binaries; + std::vector> matrix; +}; \ No newline at end of file diff --git a/heiFIP/assets/packetHelper.cpp b/heiFIP/assets/packetHelper.cpp new file mode 100644 index 0000000..2ed6cb4 --- /dev/null +++ b/heiFIP/assets/packetHelper.cpp @@ -0,0 +1,32 @@ +#pragma once + +#include +#include "heiFIBPacketImage.cpp" + +std::vector> read_pcap(const std::string& filename) { + std::ifstream file(filename, std::ios::binary); + std::vector> packets; + if (!file.is_open()) { + std::cerr << "Error: Could not open file " << filename << std::endl; + return packets; + } + + PcapGlobalHeader globalHeader; + file.read(reinterpret_cast(&globalHeader), sizeof(globalHeader)); + + while (file.peek() != EOF) { + PcapPacketHeader packetHeader; + file.read(reinterpret_cast(&packetHeader), sizeof(packetHeader)); + + if (file.eof()) break; + + std::vector packet_data(packetHeader.caplen); + file.read(reinterpret_cast(packet_data.data()), packetHeader.caplen); + + + heiFIBPacketImage packet = heiFIBPacketImage(packet_data, packetHeader.caplen ); + packets.push_back(std::make_shared(packet)); + } + file.close(); + return packets; +} \ No newline at end of file diff --git a/heiFIP/cli.cpp b/heiFIP/cli.cpp new file mode 100644 index 0000000..c498a30 --- /dev/null +++ b/heiFIP/cli.cpp @@ -0,0 +1,153 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "extractor.cpp" +#include "runner.cpp" + +void print_usage(const char* progName) { + std::cout << "Usage: " << progName << " [options]\n" + << " -i, --input FILE input pcap file path\n" + << " -o, --output DIR output directory\n" + << " -t, --threads N number of threads (default 1)\n" + << " -p, --processor TYPE preprocessing type: NONE or HEADER\n" + << " -m, --mode MODE image type: FlowImage, FlowImageTiledFixed, FlowImageTiledAuto, MarkovTransitionMatrixFlow, MarkovTransitionMatrixPacket, PacketImage\n" + << " --dim N dimension (size_t)\n" + << " --fill N fill value (size_t)\n" + << " --cols N number of columns (size_t)\n" + << " --auto-dim auto-dimension flag (bool)\n" + << " --append append mode image (bool)\n" + << " --max-dim M minimum dimension (size_t)\n" + << " --max-dim N maximum dimension (size_t)\n" + << " --min-pkts N minimum packets per flow (size_t)\n" + << " --max-pkts N maximum packets per flow (size_t)\n" + << " --remove-dup remove duplicate flows/packets\n" + << " -h, --help display this help and exit\n"; +} + +int main(int argc, char* argv[]) { + std::string input_file; + std::string output_dir; + int thread_count = 1; + PacketProcessorType proc_type = PacketProcessorType::NONE; + ImageType img_type = ImageType::PacketImage; + size_t dim = 0; + size_t fill = 0; + size_t cols = 0; + bool auto_dim = false; + bool append = false; + size_t min_dim = 0; + size_t max_dim = 0; + size_t min_pkts = 0; + size_t max_pkts = 0; + bool remove_dup = false; + + static struct option long_opts[] = { + {"input", required_argument, 0, 'i'}, + {"output", required_argument, 0, 'o'}, + {"threads", required_argument, 0, 't'}, + {"processor", required_argument, 0, 'p'}, + {"mode", required_argument, 0, 'm'}, + {"dim", required_argument, 0, 0 }, + {"fill", required_argument, 0, 0 }, + {"cols", required_argument, 0, 0 }, + {"auto-dim", no_argument, 0, 0 }, + {"append", no_argument, 0, 0 }, + {"min-dim", required_argument, 0, 0 }, + {"max-dim", required_argument, 0, 0 }, + {"min-pkts", required_argument, 0, 0 }, + {"max-pkts", required_argument, 0, 0 }, + {"remove-dup", no_argument, 0, 0 }, + {"help", no_argument, 0, 'h'}, + {0,0,0,0} + }; + + int opt; + int long_index = 0; + while ((opt = getopt_long(argc, argv, "i:o:t:p:m:h", long_opts, &long_index)) != -1) { + switch (opt) { + case 'i': input_file = optarg; break; + case 'o': output_dir = optarg; break; + case 't': thread_count = std::stoi(optarg); break; + case 'p': + if (std::string(optarg) == "NONE") proc_type = PacketProcessorType::NONE; + else if (std::string(optarg) == "HEADER") proc_type = PacketProcessorType::HEADER; + else { std::cerr << "Unknown processor type\n"; return 1; } + break; + case 'm': + if (std::string(optarg) == "PacketImage") img_type = ImageType::PacketImage; + else if (std::string(optarg) == "FlowImage") img_type = ImageType::FlowImage; + else if (std::string(optarg) == "FlowImageTiledFixed") img_type = ImageType::FlowImageTiledFixed; + else if (std::string(optarg) == "FlowImageTiledAuto") img_type = ImageType::FlowImageTiledAuto; + else if (std::string(optarg) == "MarkovFlow") img_type = ImageType::MarkovTransitionMatrixFlow; + else if (std::string(optarg) == "MarkovPacket") img_type = ImageType::MarkovTransitionMatrixPacket; + else { std::cerr << "Unknown mode\n"; return 1; } + break; + case 0: + if (strcmp(long_opts[long_index].name, "dim") == 0) dim = std::stoi(optarg); + else if (strcmp(long_opts[long_index].name, "fill") == 0) fill = std::stoi(optarg); + else if (strcmp(long_opts[long_index].name, "cols") == 0) cols = std::stoi(optarg); + else if (strcmp(long_opts[long_index].name, "auto-dim") == 0) auto_dim = true; + else if (strcmp(long_opts[long_index].name, "max-dim") == 0) max_dim = std::stoi(optarg); + else if (strcmp(long_opts[long_index].name, "min-pkts") == 0) min_pkts = std::stoi(optarg); + else if (strcmp(long_opts[long_index].name, "max-pkts") == 0) max_pkts = std::stoi(optarg); + else if (strcmp(long_opts[long_index].name, "remove-dup") == 0) remove_dup = true; + break; + case 'h': print_usage(argv[0]); return 0; + default: print_usage(argv[0]); return 1; + } + } + + if (input_file.empty() || output_dir.empty()) { + print_usage(argv[0]); + return 1; + } + + std::atomic pbar{0}; + Runner runner(thread_count); + + ImageArgsVariant args; + switch (img_type) { + case ImageType::FlowImage: + args = FlowImageArgs{dim, append, fill}; + break; + case ImageType::FlowImageTiledFixed: + args = FlowImageTiledFixedArgs{dim, fill, cols}; + break; + case ImageType::FlowImageTiledAuto: + args = FlowImageTiledAutoArgs{dim, fill, auto_dim}; + break; + case ImageType::MarkovTransitionMatrixFlow: + args = MarkovTransitionMatrixFlowArgs{cols}; + break; + case ImageType::MarkovTransitionMatrixPacket: + args = MarkovTransitionMatrixPacketArgs{}; + break; + case ImageType::PacketImage: + args = PacketImageArgs{dim, auto_dim, fill}; + break; + } + + runner.create_image( + input_file, + output_dir, + args, + pbar, + proc_type, + img_type, + dim, + max_dim, + min_pkts, + max_pkts, + remove_dup + ); + + std::cout << "Progress: " << pbar.load() << std::endl; + return 0; +} diff --git a/heiFIP/extractor.cpp b/heiFIP/extractor.cpp new file mode 100644 index 0000000..7dc5db1 --- /dev/null +++ b/heiFIP/extractor.cpp @@ -0,0 +1,341 @@ +#pragma once + +#include "init.cpp" +#include "NetworkTrafficImage.hpp" +#include "flow.cpp" +#include "flow_tiled_auto.cpp" +#include "flow_tiled_fixed.cpp" +#include "markov_chain.cpp" +#include "heiFIBPacketImage.cpp" +#include +#include +#include +#include + +struct FlowImageArgs { + size_t dim; + bool append; + size_t fill; +}; + +struct FlowImageTiledFixedArgs { + size_t dim; + size_t fill; + size_t cols; +}; + +struct FlowImageTiledAutoArgs { + size_t dim; + size_t fill; + bool auto_dim; +}; + +struct PacketImageArgs { + size_t dim; + bool auto_dim; + size_t fill; +}; + +struct MarkovTransitionMatrixFlowArgs { + size_t cols; +}; + +struct MarkovTransitionMatrixPacketArgs { +}; + +using ImageArgsVariant = std::variant< + std::monostate, + FlowImageArgs, + FlowImageTiledFixedArgs, + FlowImageTiledAutoArgs, + PacketImageArgs, + MarkovTransitionMatrixFlowArgs, + MarkovTransitionMatrixPacketArgs +>; + +using UInt8Matrix = std::vector>>; +using DoubleMatrix = std::vector>>; + +using MatrixVariant = std::variant; + +enum class ImageType { + FlowImage, + FlowImageTiledFixed, + FlowImageTiledAuto, + PacketImage, + MarkovTransitionMatrixFlow, + MarkovTransitionMatrixPacket +}; + +/** + * FIPExtractor orchestrates packet processing and image generation. + */ +class FIPExtractor { + public: + /** + * Verify generated image dimensions and optional duplicate removal. + * ImgType must provide getHeight(), getWidth(), data(), dataSize(). + */ + template + bool verify(const ImgType& image, size_t minImageDim, size_t maxImageDim, bool removeDuplicates) { + size_t height = image.size(); + size_t width = image[0].size(); + if (height < minImageDim || width < minImageDim) + return false; + if (maxImageDim != 0 && (height > maxImageDim || width > maxImageDim)) + return false; + // if (removeDuplicates) { + // std::string raw(reinterpret_cast(image.data()), image.dataSize()); + // if (imagesCreatedSet.count(raw)) + // return false; + // imagesCreatedSet.insert(raw); + // } + return true; + } + public: + FIPExtractor() + : processor() {} + + MatrixVariant createImageFromFile( + const std::string& input_file, + const ImageArgsVariant& args, + PacketProcessorType preprocessing_type = PacketProcessorType::NONE, + ImageType image_type = ImageType::PacketImage, + int min_image_dim = 0, + int max_image_dim = 0, + int min_packets_per_flow = 0, + int max_packets_per_flow = 0, + bool remove_duplicates = false + ) { + if (!std::filesystem::exists(input_file)) { + throw std::runtime_error("Input file does not exist"); + } + + std::vector> processed_packets = processor.readPacketsFile(input_file, preprocessing_type); + return createMatrix( + processed_packets, + preprocessing_type, + image_type, + min_image_dim, + max_image_dim, + min_packets_per_flow, + max_packets_per_flow, + remove_duplicates, + args + ); + } + + MatrixVariant createImageFromPacket( + const std::vector>& packets, + const ImageArgsVariant& args, + PacketProcessorType preprocessing_type = PacketProcessorType::NONE, + ImageType image_type = ImageType::PacketImage, + size_t min_image_dim = 0, + size_t max_image_dim = 0, + size_t min_packets_per_flow = 0, + size_t max_packets_per_flow = 0, + bool remove_duplicates = false + ) { + + // Process packets using the PacketProcessor + std::vector> processed_packets = processor.readPacketsList(packets, preprocessing_type); + // Create images using the __create_matrix method + return createMatrix( + processed_packets, + preprocessing_type, + image_type, + min_image_dim, + max_image_dim, + min_packets_per_flow, + max_packets_per_flow, + remove_duplicates, + args + ); + } + + /** + * Create image matrices from FIPPacket flows or packets. + * Template on ImgType: one of FlowImage, FlowImageTiledFixed, FlowImageTiledAuto, + * PacketImage, MarkovTransitionMatrixFlow, MarkovTransitionMatrixPacket. + */ + // Instead of a single variadic template, provide overloads for each image type + // FlowImage: takes packets and a flow-specific parameter, e.g., time window + MatrixVariant createMatrix( + std::vector>& packets, + PacketProcessorType preprocessing_type, + ImageType image_type, + size_t min_image_dim, + size_t max_image_dim, + size_t min_packets_per_flow, + size_t max_packets_per_flow, + bool remove_duplicates, + const ImageArgsVariant& args + ) { + if (std::holds_alternative(args)) { + throw std::runtime_error("Image arguments not initialized."); + } + + if (max_packets_per_flow && packets.size() > static_cast(max_packets_per_flow)) { + packets.resize(max_packets_per_flow); + } + + std::vector packets_copy; + for (const std::unique_ptr& packet: packets) { + const uint8_t* packetData = packet->getRawPacket()->getRawData(); + size_t packetLen = packet->getRawPacket()->getRawDataLen(); + std::vector rawData; + for (size_t i = 0; i < packetLen; ++i) { + rawData.push_back(packetData[i]); // Add each element to the vector + } + packets_copy.push_back(heiFIBPacketImage(rawData)); + } + + switch (image_type) { + case ImageType::FlowImage: { + if (packets.size() < static_cast(min_packets_per_flow)) { + return {}; + } + + UInt8Matrix images; + auto actualArgs = std::get(args); + FlowImage image(packets_copy, actualArgs.dim, actualArgs.fill, actualArgs.append); + if (verify(image.get_matrix(), min_image_dim, max_image_dim, remove_duplicates)) { + images.push_back(image.get_matrix()); + } + return images; + } + + case ImageType::FlowImageTiledFixed: { + if (packets.size() < static_cast(min_packets_per_flow)) { + return {}; + } + + UInt8Matrix images; + auto actualArgs = std::get(args); + FlowImageTiledFixed image(packets_copy, actualArgs.dim, actualArgs.fill, actualArgs.cols); + + if (verify(image.get_matrix(), min_image_dim, max_image_dim, remove_duplicates)) { + images.push_back(image.get_matrix()); + } + return images; + } + + case ImageType::FlowImageTiledAuto: { + if (packets.size() < static_cast(min_packets_per_flow)) { + return {}; + } + + UInt8Matrix images; + auto actualArgs = std::get(args); + FlowImageTiledAuto image(packets_copy, actualArgs.dim, actualArgs.fill, actualArgs.auto_dim); + + if (verify(image.get_matrix(), min_image_dim, max_image_dim, remove_duplicates)) { + images.push_back(image.get_matrix()); + } + return images; + } + + case ImageType::PacketImage: { + + auto actualArgs = std::get(args); + std::vector>> images; + + for (const std::unique_ptr& pkt : packets) { + const uint8_t* packetData = pkt->getRawPacket()->getRawData(); + int packetLen = pkt->getRawPacket()->getRawDataLen(); + std::vector rawData; + + for (size_t i = 0; i < packetLen; ++i) { + rawData.push_back(packetData[i]); // Add each element to the vector + } + + heiFIBPacketImage image = heiFIBPacketImage(rawData, actualArgs.dim, actualArgs.fill, actualArgs.auto_dim); + std::vector> matrix = image.get_matrix(); + if (verify(matrix, min_image_dim, max_image_dim, remove_duplicates)) + images.push_back(matrix); + } + return images; + } + + case ImageType::MarkovTransitionMatrixFlow: { + + if (packets.size() < static_cast(min_packets_per_flow)) { + return {}; + } + + DoubleMatrix images; + auto actualArgs = std::get(args); + MarkovTransitionMatrixFlow image(packets_copy, actualArgs.cols); + + if (verify(image.get_matrix(), min_image_dim, max_image_dim, remove_duplicates)) { + images.push_back(image.get_matrix()); + } + return images; + } + + case ImageType::MarkovTransitionMatrixPacket: { + + auto actualArgs = std::get(args); + std::vector>>images; + const uint8_t* packetData; + std::vector rawData; + int packetLen; + + for (const std::unique_ptr& pkt : packets) { + packetData = pkt->getRawPacket()->getRawData(); + packetLen = pkt->getRawPacket()->getRawDataLen(); + for (size_t i = 0; i < packetLen; ++i) { + rawData.push_back(packetData[i]); // Add each element to the vector + } + heiFIBPacketImage rawImage = heiFIBPacketImage(rawData); + MarkovTransitionMatrixPacket image = MarkovTransitionMatrixPacket(rawImage); + std::vector> matrix = image.get_matrix(); + if (verify(matrix, min_image_dim, max_image_dim, remove_duplicates)) + images.push_back(matrix); + } + return images; + } + + default: + throw std::runtime_error("Wrong Parameter passed"); + } + + return {}; // Empty + } + + void save_image(const MatrixVariant& img_variant, const std::string& output_path_base) { + std::visit([&](const auto& img) { + if (img.empty() || img[0].empty() || img[0][0].empty()) { + std::cerr << "Empty image, cannot save." << std::endl; + return; + } + + // Expecting shape: [1][height][width] + const auto& grayscale_image = img[0]; // Only the first 2D slice + + int height = static_cast(grayscale_image.size()); + int width = static_cast(grayscale_image[0].size()); + + cv::Mat mat(height, width, CV_8UC1); + + for (size_t i = 0; i < height; ++i) { + uint8_t* row_ptr = mat.ptr(i); + for (size_t j = 0; j < width; ++j) { + if constexpr (std::is_same_v, UInt8Matrix>) { + row_ptr[j] = grayscale_image[i][j]; + } else { + double v = grayscale_image[i][j] * 255.0; + row_ptr[j] = static_cast(std::clamp(v, 0.0, 255.0)); + } + } + } + + std::filesystem::path outp(output_path_base + "_processed.png"); + std::filesystem::create_directories(outp.parent_path()); + cv::imwrite(outp.string(), mat); + }, img_variant); + } + + private: + PacketProcessor processor; +}; \ No newline at end of file diff --git a/tests/pcaps/rdp/rdpeudp2-handshake-success.pcap b/heiFIP/images/.DS_Store similarity index 55% rename from tests/pcaps/rdp/rdpeudp2-handshake-success.pcap rename to heiFIP/images/.DS_Store index 76bcd4a..0677ee3 100644 Binary files a/tests/pcaps/rdp/rdpeudp2-handshake-success.pcap and b/heiFIP/images/.DS_Store differ diff --git a/heiFIP/images/NetworkTrafficImage.hpp b/heiFIP/images/NetworkTrafficImage.hpp new file mode 100644 index 0000000..662413d --- /dev/null +++ b/heiFIP/images/NetworkTrafficImage.hpp @@ -0,0 +1,10 @@ +#pragma once + +class NetworkTrafficImage { + private: + int _fill; + int _dim; + + public: + NetworkTrafficImage(int fill = 0, int dim = 8) : _fill(fill), _dim(dim) {}; +}; \ No newline at end of file diff --git a/heiFIP/images/flow.cpp b/heiFIP/images/flow.cpp new file mode 100644 index 0000000..09760b9 --- /dev/null +++ b/heiFIP/images/flow.cpp @@ -0,0 +1,73 @@ +#include "NetworkTrafficImage.hpp" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "heiFIBPacketImage.cpp" +#include "packetHelper.cpp" + +class FlowImage : public NetworkTrafficImage { +public: + FlowImage(std::vector packets, int dim = 16, int fill = 0, bool append = false) + : NetworkTrafficImage(fill, dim), packets(packets), append(append) { + auto result = getMatrix(dim, append, fill, packets); + matrix = result.first; + binaries = result.second; + } + + std::vector>& get_binaries() { + return binaries; + } + + std::vector>& get_matrix() { + return matrix; + } + +private: + std::vector packets; + bool append; + std::vector> matrix; + std::vector> binaries; + + std::pair>, std::vector>> getMatrix(int dim, bool append, int fill, const std::vector& packets) { + std::vector> binaries; + + for (heiFIBPacketImage packet : packets) { + std::vector hexData = packet.getHexData(); + binaries.push_back(hexData); + } + + std::vector fh; + if (append) { + for (const auto& binary : binaries) { + fh.insert(fh.end(), binary.begin(), binary.end()); + } + int rn = fh.size() / dim + (fh.size() % dim > 0); + fh.resize(rn * dim, static_cast(0)); + std::vector> reshaped(rn, std::vector(dim)); + for (int i = 0; i < rn; ++i) { + std::copy(fh.begin() + i * dim, fh.begin() + (i + 1) * dim, reshaped[i].begin()); + } + return {reshaped, binaries}; + } else { + size_t length = 0; + for (const auto& binary : binaries) { + length = std::max(length, binary.size()); + } + std::vector> reshaped; + for (const auto& binary : binaries) { + std::vector row = binary; + row.resize(length, static_cast(fill)); + reshaped.push_back(row); + } + return {reshaped, binaries}; + } + } +}; \ No newline at end of file diff --git a/heiFIP/images/flow_tiled_auto.cpp b/heiFIP/images/flow_tiled_auto.cpp new file mode 100644 index 0000000..74f9e19 --- /dev/null +++ b/heiFIP/images/flow_tiled_auto.cpp @@ -0,0 +1,124 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "heiFIBPacketImage.cpp" +#include "packetHelper.cpp" +#include "NetworkTrafficImage.hpp" + +class FlowImageTiledAuto : public NetworkTrafficImage { + +public: + FlowImageTiledAuto(const std::vector& packets, int dim = 16, int fill = 0, bool auto_dim = false) + : NetworkTrafficImage(fill, dim), packets(packets), auto_dim(auto_dim) { + std::pair>, std::vector>> result = get_matrix_tiled(fill, dim, auto_dim, packets); + matrix = result.first; + binaries = result.second; } + + std::vector>& get_matrix() { + return matrix; + } + + std::vector>& get_binaries() { + return binaries; + } +private: + std::vector packets; + bool auto_dim; + std::vector> matrix; + std::vector> binaries; + + std::pair>, std::vector>> get_matrix_tiled(int fill, int dim, bool auto_dim, const std::vector& packets) { + std::vector> binaries; + + for (const heiFIBPacketImage& packet : packets) { + std::vector hexData = packet.getHexData(); + binaries.push_back(hexData); + } + + size_t length = 0; + for (const std::vector& b : binaries) { + length = std::max(length, b.size()); + } + + if (auto_dim) { + dim = static_cast(std::ceil(std::sqrt(length))); + } + std::vector>> result; + for (const std::vector& x : binaries) { + std::vector> reshaped(dim, std::vector(dim, fill)); + size_t k = 0; + for(int i = 0; dim > i && k < x.size(); ++i) { + for(int j = 0; dim > j && k < x.size(); ++j) { + reshaped[i][j] = x[k]; + ++k; + } + } + result.push_back(reshaped); + } + + size_t length_total = result.size(); + uint dim_total = static_cast(std::ceil(std::sqrt(length_total))); + + std::vector> fh = tile_images(result, dim_total, dim); + return {fh, binaries}; + } + + std::vector> npzero(size_t dim) { + return std::vector>(dim, std::vector(dim, 0)); + } + + std::vector> npconcatenate(const std::vector>& img1, const std::vector>& img2) { + if (img1.empty()) return img2; + if (img2.empty()) return img1; + + if (img1.size() != img2.size()) { + throw std::invalid_argument("Images must have the same number of rows to concatenate horizontally."); + } + + std::vector> result = img1; + for (size_t i = 0; i < result.size(); ++i) { + result[i].insert(result[i].end(), img2[i].begin(), img2[i].end()); + } + return result; + } + + std::vector> tile_images(const std::vector>>& images, const uint cols, const uint dim) { + + std::vector> > rows; + size_t k = 0; // Index to track current image + for (size_t i = 0; i < cols; ++i) { + std::vector> row; + for (size_t j = 0; j < cols; ++j) { + std::vector> im; + if (k < images.size()) { + im = images[k]; + } else { + im = npzero(dim); + } + + if (row.empty()) { + row = im; + } else { + row = npconcatenate(row, im); + } + ++k; + } + rows.push_back(row); + } + + std::vector> tiled = rows[0]; + + for (size_t i = 1; i < rows.size(); ++i) { + tiled.insert(tiled.end(), rows[i].begin(), rows[i].end()); + } + return tiled; + } +}; \ No newline at end of file diff --git a/heiFIP/images/flow_tiled_fixed.cpp b/heiFIP/images/flow_tiled_fixed.cpp new file mode 100644 index 0000000..c64a251 --- /dev/null +++ b/heiFIP/images/flow_tiled_fixed.cpp @@ -0,0 +1,135 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "heiFIBPacketImage.cpp" +#include "packetHelper.cpp" +#include "NetworkTrafficImage.hpp" + +class FlowImageTiledFixed : public NetworkTrafficImage { + +public: + FlowImageTiledFixed(const std::vector& packets, int dim = 16, int fill = 0, int cols = 3) + : NetworkTrafficImage(fill, dim), packets(packets), cols(cols) { + std::pair>, std::vector>> result = get_matrix_tiled(fill, dim, packets); + matrix = result.first; + binaries = result.second; } + + std::vector>& get_matrix() { + return matrix; + } + + std::vector>& get_binaries() { + return binaries; + } +private: + std::vector packets; + int cols; + std::vector> matrix; + std::vector> binaries; + + std::pair>, std::vector>> get_matrix_tiled(int fill, int dim, const std::vector& packets) { + std::vector> binaries; + + for (const heiFIBPacketImage& packet : packets) { + std::vector hexData = packet.getHexData(); + binaries.push_back(hexData); + } + + std::vector>> result; + for (const std::vector& x : binaries) { + std::vector> reshaped(dim, std::vector(dim, fill)); + size_t k = 0; + for(size_t i = 0; dim > i && k < x.size(); ++i) { + for(size_t j = 0; dim > j && k < x.size(); ++j) { + reshaped[i][j] = x[k]; + ++k; + } + } + result.push_back(reshaped); + } + + std::vector> fh = tile_images(result, cols, dim); + return {fh, binaries}; + } + + std::vector> npzero(size_t dim) { + return std::vector>(dim, std::vector(dim, 0)); + } + + std::vector> npconcatenate(const std::vector>& img1, const std::vector>& img2) { + if (img1.empty()) return img2; + if (img2.empty()) return img1; + + if (img1.size() != img2.size()) { + throw std::invalid_argument("Images must have the same number of rows to concatenate horizontally."); + } + + std::vector> result = img1; + for (size_t i = 0; i < result.size(); ++i) { + result[i].insert(result[i].end(), img2[i].begin(), img2[i].end()); + } + return result; + } + + std::vector> tile_images(const std::vector>>& images, const uint cols, const uint dim) { + + std::vector>> rows; + size_t k = 0; // Index to track current image + for (size_t i = 0; i < cols; ++i) { + std::vector> row; + for (size_t j = 0; j < cols; ++j) { + std::vector> im; + if (k < images.size()) { + im = images[k]; + } else { + im = npzero(dim); + } + + if (row.empty()) { + row = im; + } else { + row = npconcatenate(row, im); + } + ++k; + } + rows.push_back(row); + } + + std::vector> tiled = rows[0]; + + for (size_t i = 1; i < rows.size(); ++i) { + tiled.insert(tiled.end(), rows[i].begin(), rows[i].end()); + } + return tiled; + } + + std::vector hexlify(const Crafter::Packet& packet) { + + // Create a vector to store the bytes as decimal integers + std::vector hex_data; + + // Use copy of packet to avoid modification + Crafter::Packet copied_packet = packet; + + // Access the raw bytes of the crafted packet + const uint8_t* raw_bytes = copied_packet.GetRawPtr(); + size_t packet_size = copied_packet.GetSize(); + + // Push each byte individually into the vector + for (size_t i = 0; i < packet_size; ++i) { + hex_data.push_back(static_cast(raw_bytes[i])); + } + + return hex_data; + } + +}; \ No newline at end of file diff --git a/heiFIP/images/markov_chain.cpp b/heiFIP/images/markov_chain.cpp new file mode 100644 index 0000000..8b2defb --- /dev/null +++ b/heiFIP/images/markov_chain.cpp @@ -0,0 +1,136 @@ +#include +#include +#include +#include + +#include "heiFIBPacketImage.cpp" +#include "packetHelper.cpp" + +#include "NetworkTrafficImage.hpp" + +class MarkovTransitionMatrix : public NetworkTrafficImage { + +public: + MarkovTransitionMatrix(): NetworkTrafficImage(){} + + std::vector> transition_matrix(const std::vector& transitions) { + size_t n = 16; + std::vector> M(n, std::vector(n, 0)); + + for (size_t k = 0; k < transitions.size() - 1; ++k) { + size_t i = transitions[k]; + size_t j = transitions[k + 1]; + M[i][j] += 1; + } + + for (std::vector& row : M) { + double sum = 0; + for (double value : row) { + sum += value; + } + if (sum > 0) { + for (double& value : row) { + value /= sum; + } + } + } + return M; + } +}; + +class MarkovTransitionMatrixFlow : public MarkovTransitionMatrix { + public: + MarkovTransitionMatrixFlow(const std::vector& packets, uint cols = 4) : packets(packets), cols(cols) { + + std::vector>> result; + transitionMatrix = MarkovTransitionMatrix(); + + for (heiFIBPacketImage packet: packets) { + std::vector transition = packet.bit_array(); + std::vector> m = transition_matrix(transition); + result.push_back(m); + } + + matrix = tile_images(result, cols, 16); + + } + + std::vector packets; + uint cols; + MarkovTransitionMatrix transitionMatrix; + + std::vector> npzero(size_t dim) { + return std::vector>(dim, std::vector(dim, 0)); + } + + std::vector> npconcatenate(const std::vector>& img1, const std::vector>& img2) { + if (img1.empty()) return img2; + if (img2.empty()) return img1; + + if (img1.size() != img2.size()) { + throw std::invalid_argument("Images must have the same number of rows to concatenate horizontally."); + } + + std::vector> result = img1; + for (size_t i = 0; i < result.size(); ++i) { + result[i].insert(result[i].end(), img2[i].begin(), img2[i].end()); + } + return result; + } + + std::vector> tile_images(const std::vector>>& images, const uint cols, const uint dim) { + + std::vector>> rows; + size_t k = 0; // Index to track current image + for (size_t i = 0; i < cols; ++i) { + std::vector> row; + for (size_t j = 0; j < cols; ++j) { + std::vector> im; + if (k < images.size()) { + im = images[k]; + } else { + im = npzero(dim); + } + + if (row.empty()) { + row = im; + } else { + row = npconcatenate(row, im); + } + ++k; + } + rows.push_back(row); + } + + std::vector> tiled = rows[0]; + + for (size_t i = 1; i < rows.size(); ++i) { + tiled.insert(tiled.end(), rows[i].begin(), rows[i].end()); + } + return tiled; + } + + std::vector>& get_matrix() { + return matrix; + } + + private: + + std::vector> matrix; +}; + +class MarkovTransitionMatrixPacket: public MarkovTransitionMatrix { +public: + MarkovTransitionMatrixPacket(const heiFIBPacketImage packet) : packet(packet) { + std::vector transition = packet.bit_array(); + matrix = transition_matrix(transition); + } + + std::vector>& get_matrix() { + return matrix; + } + +private: + heiFIBPacketImage packet; + std::vector> matrix; +}; \ No newline at end of file diff --git a/heiFIP/layers/dns.cpp b/heiFIP/layers/dns.cpp new file mode 100644 index 0000000..b2166a5 --- /dev/null +++ b/heiFIP/layers/dns.cpp @@ -0,0 +1,134 @@ +#pragma once + +#include "transport.cpp" +#include +#include +#include + +/** + * DNSPacket wraps a raw packet into a TransportPacket and prepares + * for DNS header and resource record manipulation using custom layers. + */ +class DNSPacket : public TransportPacket { +public: + /** + * Constructor: initializes base TransportPacket with given pcap Packet, + * address mapping, and layer map. + */ + DNSPacket(const pcpp::RawPacket& packet, + std::unordered_map addressMapping = {}, + std::unordered_map layerMap = {}) + : TransportPacket(packet, addressMapping, layerMap) + { + // Base constructor handles transport-layer setup. + } + + /** + * Override this method to insert CustomDNS, CustomDNSQR, and + * CustomDNSRR layers as needed before lower-layer checks. + */ + void header_preprocessing() override { + // Locate original DNS layer + pcpp::Packet temporaryPacket = pcpp::Packet(getRawPacket().get()); + pcpp::DnsLayer* origDns = temporaryPacket.getLayerOfType(); + pcpp::dnshdr* dnsHeader = origDns->getDnsHeader(); + if (!origDns) { + TransportPacket::header_preprocessing(); + return; + } + + // Preprocess each section if present + if (origDns->getQueryCount() > 0) headerPreprocessingMessageType(origDns, "qd"); + if (origDns->getAnswerCount() > 0) headerPreprocessingMessageType(origDns, "an"); + if (origDns->getAuthorityCount() >0) headerPreprocessingMessageType(origDns, "ns"); + if (origDns->getAdditionalRecordCount() > 0) headerPreprocessingMessageType(origDns, "ar"); + + // Build new CustomDNS header + CustomDNS* customDns = new CustomDNS(); + customDns->qr = dnsHeader->queryOrResponse; + customDns->opcode = static_cast(dnsHeader->opcode); + customDns->aa = dnsHeader->authoritativeAnswer; + customDns->tc = dnsHeader->truncation; + customDns->rd = dnsHeader->recursionDesired; + customDns->ra = dnsHeader->recursionAvailable; + customDns->z = dnsHeader->zero; + customDns->ad = dnsHeader->authenticData; + customDns->cd = dnsHeader->checkingDisabled; + customDns->rcode = static_cast(dnsHeader->responseCode); + customDns->qdCount = origDns->getQueryCount(); + customDns->anCount = origDns->getAnswerCount(); + customDns->nsCount = origDns->getAuthorityCount(); + customDns->arCount = origDns->getAdditionalRecordCount(); + + // Replace original DNS layer with custom header + temporaryPacket.removeLayer(pcpp::DNS); + temporaryPacket.addLayer(customDns); + const uint8_t* modifiedData = temporaryPacket.getRawPacket()->getRawData(); + int modifiedDataLen = temporaryPacket.getRawPacket()->getRawDataLen(); + timespec ts = temporaryPacket.getRawPacket()->getPacketTimeStamp(); + pcpp::LinkLayerType linkType = temporaryPacket.getRawPacket()->getLinkLayerType(); + + uint8_t* dataCopy = new uint8_t[modifiedDataLen]; + std::memcpy(dataCopy, modifiedData, modifiedDataLen); + + setRawPacket(std::make_unique(dataCopy, modifiedDataLen, ts, false, linkType)); + // Continue up the chain + TransportPacket::header_preprocessing(); + } + private: + + void headerPreprocessingMessageType(pcpp::DnsLayer* origDns, const std::string& messageType) { + if (messageType == "qd") { + // Questions: use first and next query functions + pcpp::DnsQuery* q = origDns->getFirstQuery(); + while (q) { + CustomDNSQR* qrLayer = new CustomDNSQR(q->getName(), q->getDnsType()); + pcpp::Packet temporaryPacket = pcpp::Packet(getRawPacket().get()); + temporaryPacket.addLayer(qrLayer); + q = origDns->getNextQuery(q); + const uint8_t* modifiedData = temporaryPacket.getRawPacket()->getRawData(); + int modifiedDataLen = temporaryPacket.getRawPacket()->getRawDataLen(); + timespec ts = temporaryPacket.getRawPacket()->getPacketTimeStamp(); + pcpp::LinkLayerType linkType = temporaryPacket.getRawPacket()->getLinkLayerType(); + + uint8_t* dataCopy = new uint8_t[modifiedDataLen]; + std::memcpy(dataCopy, modifiedData, modifiedDataLen); + + // 4. Replace the RawPacket in FIPPacket + setRawPacket(std::make_unique(dataCopy, modifiedDataLen, ts, false, linkType)); + } + } + else { + // Resource records: answers, authority, additional + pcpp::DnsResource* r = nullptr; + if (messageType == "an") + r = origDns->getFirstAnswer(); + else if (messageType == "ns") + r = origDns->getFirstAuthority(); + else if (messageType == "ar") + r = origDns->getFirstAdditionalRecord(); + + while (r) { + pcpp::Packet temporaryPacket = pcpp::Packet(getRawPacket().get()); + CustomDNSRR* rrLayer = new CustomDNSRR(r->getName(), r->getDnsType(), r->getTTL()); + temporaryPacket.addLayer(rrLayer); + const uint8_t* modifiedData = temporaryPacket.getRawPacket()->getRawData(); + int modifiedDataLen = temporaryPacket.getRawPacket()->getRawDataLen(); + timespec ts = temporaryPacket.getRawPacket()->getPacketTimeStamp(); + pcpp::LinkLayerType linkType = temporaryPacket.getRawPacket()->getLinkLayerType(); + + uint8_t* dataCopy = new uint8_t[modifiedDataLen]; + std::memcpy(dataCopy, modifiedData, modifiedDataLen); + + // 4. Replace the RawPacket in FIPPacket + setRawPacket(std::make_unique(dataCopy, modifiedDataLen, ts, false, linkType)); + if (messageType == "an") + r = origDns->getNextAnswer(r); + else if (messageType == "ns") + r = origDns->getNextAuthority(r); + else // "ar" + r = origDns->getNextAdditionalRecord(r); + } + } + } +}; \ No newline at end of file diff --git a/heiFIP/layers/http.cpp b/heiFIP/layers/http.cpp new file mode 100644 index 0000000..2db409e --- /dev/null +++ b/heiFIP/layers/http.cpp @@ -0,0 +1,263 @@ +#pragma once + +#include "transport.cpp" +#include "PcapPlusPlusVersion.h" +#include "HttpLayer.h" +#include +#include +#include +#include +#include + +class HTTPPacket : public TransportPacket { +public: + HTTPPacket(const pcpp::RawPacket& packet, + std::unordered_map addressMapping = {}, + std::unordered_map layerMap = {}) + : TransportPacket(packet, addressMapping, layerMap) + { + } + + void header_preprocessing() override + { + TransportPacket::header_preprocessing(); + } +}; + +class HTTPRequestPacket : public HTTPPacket { + public: + std::string hash; + + HTTPRequestPacket(const pcpp::RawPacket& packet, + std::unordered_map addressMapping = {}, + std::unordered_map layerMap = {}) + : HTTPPacket(packet, addressMapping, layerMap) + { + generateHash(); + removeRawPayloadIfPresent(); + } + + void header_preprocessing() override { + // Extract the original HTTP request layer + pcpp::Packet temporaryPacket = pcpp::Packet(getRawPacket().get()); + pcpp::HttpRequestLayer* origLayer = temporaryPacket.getLayerOfType(); + if (origLayer) { + // Build a new CustomHTTPRequest and copy fields + CustomHTTPRequest* customReq = new CustomHTTPRequest(); + + // Copy Method and Path + std::string method = httpMethodEnumToString(origLayer->getFirstLine()->getMethod()); + std::string uri = origLayer->getFirstLine()->getUri(); + customReq->fields[0].value = method; + customReq->fields[1].value = uri; + + // Copy other headers by name & index in CustomHTTPRequest.fields + auto copyHeader = [&](const std::string& name, int idx) { + pcpp::HeaderField* fld = origLayer->getFieldByName(name); + if (fld) + customReq->fields[idx].value = fld->getFieldValue(); + }; + copyHeader("User-Agent", 2); + copyHeader("Content-Type", 3); + copyHeader("Connection", 4); + copyHeader("Accept", 5); + copyHeader("Accept-Charset", 6); + copyHeader("Accept-Encoding", 7); + copyHeader("Cookie", 8); + copyHeader("TE", 9); + + // Preserve any payload following the HTTP layer + pcpp::Layer* payload = origLayer->getNextLayer(); + + // Replace the original HTTP layer with our custom one + temporaryPacket.removeLayer(pcpp::HTTPRequest); + temporaryPacket.addLayer(customReq); + if (payload) { + temporaryPacket.addLayer(payload); + } + const uint8_t* modifiedData = temporaryPacket.getRawPacket()->getRawData(); + int modifiedDataLen = temporaryPacket.getRawPacket()->getRawDataLen(); + timespec ts = temporaryPacket.getRawPacket()->getPacketTimeStamp(); + pcpp::LinkLayerType linkType = temporaryPacket.getRawPacket()->getLinkLayerType(); + + uint8_t* dataCopy = new uint8_t[modifiedDataLen]; + std::memcpy(dataCopy, modifiedData, modifiedDataLen); + + setRawPacket(std::make_unique(dataCopy, modifiedDataLen, ts, false, linkType)); + } + + // Continue base preprocessing + HTTPPacket::header_preprocessing(); + } + + + private: + void generateHash() + { + pcpp::Packet temporaryPacket = pcpp::Packet(getRawPacket().get()); + pcpp::HttpRequestLayer* httpRequestLayer = temporaryPacket.getLayerOfType(); + if (httpRequestLayer != nullptr) + { + std::string path = httpRequestLayer->getFirstLine()->getUri(); + std::string method = httpMethodEnumToString(httpRequestLayer->getFirstLine()->getMethod()); + std::string accept = httpRequestLayer->getFieldByName("Accept") != nullptr ? httpRequestLayer->getFieldByName("Accept")->getFieldValue() : ""; + + std::string input = path + "," + method + "," + accept; + + unsigned char digest[MD5_DIGEST_LENGTH]; + MD5((unsigned char*)input.c_str(), input.size(), digest); + + std::ostringstream oss; + for (int i = 0; i < MD5_DIGEST_LENGTH; ++i) + oss << std::hex << std::setw(2) << std::setfill('0') << (int)digest[i]; + + hash = oss.str(); + } + } + + std::string httpMethodEnumToString(pcpp::HttpRequestLayer::HttpMethod method) + { + switch (method) + { + case pcpp::HttpRequestLayer::HttpMethod::HttpGET: return "GET"; + case pcpp::HttpRequestLayer::HttpMethod::HttpHEAD: return "HEAD"; + case pcpp::HttpRequestLayer::HttpMethod::HttpPOST: return "POST"; + case pcpp::HttpRequestLayer::HttpMethod::HttpPUT: return "PUT"; + case pcpp::HttpRequestLayer::HttpMethod::HttpDELETE: return "DELETE"; + case pcpp::HttpRequestLayer::HttpMethod::HttpTRACE: return "TRACE"; + case pcpp::HttpRequestLayer::HttpMethod::HttpOPTIONS: return "OPTIONS"; + case pcpp::HttpRequestLayer::HttpMethod::HttpCONNECT: return "CONNECT"; + case pcpp::HttpRequestLayer::HttpMethod::HttpPATCH: return "PATCH"; + default: return "UNKNOWN"; + } + } + + void removeRawPayloadIfPresent() + { + if (layer_map.find("Raw") != layer_map.end()) + { + pcpp::Packet temporaryPacket = pcpp::Packet(getRawPacket().get()); + pcpp::HttpRequestLayer* httpRequestLayer = temporaryPacket.getLayerOfType(); + if (httpRequestLayer != nullptr) + { + temporaryPacket.removeAllLayersAfter(httpRequestLayer); // Simplified; depends on what you mean by "remove payload" + } + } + } +}; + +class HTTPResponsePacket : public HTTPPacket { + public: + std::string hash; + + HTTPResponsePacket(const pcpp::RawPacket& packet, + std::unordered_map addressMapping = {}, + std::unordered_map layerMap = {}) + : HTTPPacket(packet, addressMapping, layerMap) { + generateHash(); + removeHttpPayloadIfPresent(); + } + + void header_preprocessing() override { + // Extract the original HTTP response layer + pcpp::Packet temporaryPacket = pcpp::Packet(getRawPacket().get()); + pcpp::HttpResponseLayer* origLayer = temporaryPacket.getLayerOfType(); + if (origLayer) { + // Instantiate CustomHTTPResponse and copy fields + CustomHTTPResponse* customResp = new CustomHTTPResponse(); + + // Copy Status_Code from the first line + auto* firstLine = origLayer->getFirstLine(); + std::string status = firstLine ? std::to_string(firstLine->getStatusCode()) : std::string(); + customResp->fields[0].value = status; + + // Copy other headers by name & index + auto copyHeader = [&](const std::string& name, int idx) { + pcpp::HeaderField* fld = origLayer->getFieldByName(name); + if (fld) + customResp->fields[idx].value = fld->getFieldValue(); + }; + copyHeader("Connection", 1); + copyHeader("Content-Encoding", 2); + copyHeader("Content-Type", 3); + copyHeader("Server", 4); + copyHeader("Set-Cookie", 5); + copyHeader("Transfer-Encoding", 6); + + // Preserve any payload following the HTTP layer + pcpp::Layer* payload = origLayer->getNextLayer(); + + // Replace the original HTTP layer with our custom one + temporaryPacket.removeLayer(pcpp::HTTPResponse); + temporaryPacket.addLayer(customResp); + if (payload) { + temporaryPacket.addLayer(payload); + } + const uint8_t* modifiedData = temporaryPacket.getRawPacket()->getRawData(); + int modifiedDataLen = temporaryPacket.getRawPacket()->getRawDataLen(); + timespec ts = temporaryPacket.getRawPacket()->getPacketTimeStamp(); + pcpp::LinkLayerType linkType = temporaryPacket.getRawPacket()->getLinkLayerType(); + + uint8_t* dataCopy = new uint8_t[modifiedDataLen]; + std::memcpy(dataCopy, modifiedData, modifiedDataLen); + + // 4. Replace the RawPacket in FIPPacket + setRawPacket(std::make_unique(dataCopy, modifiedDataLen, ts, false, linkType)); + } + + // Continue base preprocessing + HTTPPacket::header_preprocessing(); + } + + private: + void generateHash() { + // Locate the HTTP response layer + pcpp::Packet temporaryPacket = pcpp::Packet(getRawPacket().get()); + pcpp::HttpResponseLayer* respLayer = temporaryPacket.getLayerOfType(); + if (!respLayer) return; + + // Extract fields for hashing + std::string server; + if (auto* fld = respLayer->getFieldByName("Server")) + server = fld->getFieldValue(); + + // Status code from the first line + auto* firstLine = respLayer->getFirstLine(); + std::string statusCode = firstLine ? std::to_string(firstLine->getStatusCode()) : std::string(); + + std::string connection; + if (auto* fld = respLayer->getFieldByName("Connection")) + connection = fld->getFieldValue(); + + // Build input string and compute MD5 + std::string input = server + "," + statusCode + "," + connection; + unsigned char digest[MD5_DIGEST_LENGTH]; + MD5(reinterpret_cast(input.c_str()), input.size(), digest); + + std::ostringstream oss; + for (int i = 0; i < MD5_DIGEST_LENGTH; ++i) + oss << std::hex << std::setw(2) << std::setfill('0') << (int)digest[i]; + + hash = oss.str(); + } + + void removeHttpPayloadIfPresent() { + // If the Raw layer is indicated in layerMap, strip whatever payload follows the HTTP layer + if (layer_map.find("Raw") != layer_map.end()) { + pcpp::Packet temporaryPacket = pcpp::Packet(getRawPacket().get()); + pcpp::HttpResponseLayer* httpRequestLayer = temporaryPacket.getLayerOfType(); + if (httpRequestLayer != nullptr) { + temporaryPacket.removeAllLayersAfter(httpRequestLayer); // Simplified; depends on what you mean by "remove payload" + } + const uint8_t* modifiedData = temporaryPacket.getRawPacket()->getRawData(); + int modifiedDataLen = temporaryPacket.getRawPacket()->getRawDataLen(); + timespec ts = temporaryPacket.getRawPacket()->getPacketTimeStamp(); + pcpp::LinkLayerType linkType = temporaryPacket.getRawPacket()->getLinkLayerType(); + + uint8_t* dataCopy = new uint8_t[modifiedDataLen]; + std::memcpy(dataCopy, modifiedData, modifiedDataLen); + + setRawPacket(std::make_unique(dataCopy, modifiedDataLen, ts, false, linkType)); + } + } + }; \ No newline at end of file diff --git a/heiFIP/layers/init.cpp b/heiFIP/layers/init.cpp new file mode 100644 index 0000000..6917095 --- /dev/null +++ b/heiFIP/layers/init.cpp @@ -0,0 +1,202 @@ +#pragma once +#include +#include +#include +#include +#include +#include "packet.cpp" +#include "dns.cpp" +#include "http.cpp" +#include "ip.cpp" +#include "ssh.cpp" +#include "transport.cpp" +#include + + +enum class SupportedHeaderType { + IP, + IPv6, + DNS, + HTTP_REQUEST, + HTTP_RESPONSE, + TCP, + UDP +}; + +/** + * List of supported headers in processing order. + */ +static const std::vector SUPPORTED_HEADERS = { + SupportedHeaderType::IP, + SupportedHeaderType::IPv6, + SupportedHeaderType::DNS, + SupportedHeaderType::HTTP_REQUEST, + SupportedHeaderType::HTTP_RESPONSE, + SupportedHeaderType::TCP, + SupportedHeaderType::UDP +}; + +/** + * PacketProcessorType indicates whether processing is active, + * and at what level (NONE or HEADER). + */ +enum class PacketProcessorType { + NONE = 1, + HEADER = 2 +}; + +/** + * PacketProcessor orchestrates per-packet handling across supported protocols, + * accumulates packets, and can write them out to a PCAP file. + */ +class PacketProcessor { + public: + /** + * Constructor initializes internal state. + * @param fileExtension expected file extension (e.g., "pcap" or "pcapng"). + */ + PacketProcessor(const std::string& fileExtension = "pcap") + : fileExtension(fileExtension) + { + // TLS session layer is available via PcapPlusPlus's TLSSessionLayer plugin. + // No explicit runtime load is required—just link against the TLS parsing library. + } + + /** + * Add a parsed packet to the internal buffer to be written later. + */ + void addPacket(pcpp::Packet* packet) { + packets.push_back(packet); + } + + /** + * Write all buffered packets to a PCAP file. + * @param baseFilename name without extension; "_converted.pcap" will be appended. + */ + void writePackets(const std::string& baseFilename) { + std::string outName = baseFilename + "_converted.pcap"; + pcpp::PcapFileWriterDevice writer(outName, pcpp::LINKTYPE_ETHERNET); + if (!writer.open()) { + // Unable to open output file + return; + } + for (pcpp::Packet* pkt : packets) { + writer.writePacket(*(pkt->getRawPacket())); + } + writer.close(); + } + + /** + * Read packets from a PCAP file, preprocess them, and return FIPPacket pointers. + * @param filename path to the PCAP file + * @param type preprocessing type (NONE or HEADER) + * @param maxCount maximum number of packets to read (default 64) + */ + std::vector> readPacketsFile(const std::string& filename, PacketProcessorType type, size_t maxCount = 64) { + + std::vector> result; + pcpp::PcapFileReaderDevice reader(filename); + + if (!reader.open()) { + return result; + } + + pcpp::RawPacket rawPacket; + std::unique_ptr rawPacketPt; + size_t count = 0; + + while (count < maxCount && reader.getNextPacket(rawPacket)) { + rawPacketPt = std::make_unique(rawPacket); + std::unique_ptr fippkt = preprocess(rawPacketPt, type); + + if (fippkt && !fippkt->getHash().empty()) { + auto res = hashDict.insert(fippkt->getHash()); + if (res.second) { // was inserted, new + result.push_back(std::move(fippkt)); + } else { + } + } else if (fippkt) { + result.push_back(std::move(fippkt)); + } + + ++count; + } + reader.close(); + return result; + } + + std::vector> readPacketsList(const std::vector>& inputPackets, + PacketProcessorType type) { + std::vector> result; + for (const std::unique_ptr& pktPtr : inputPackets) { + std::unique_ptr fippkt = preprocess(pktPtr, type); + if (!fippkt) {continue;} + + if (!fippkt->getHash().empty()) { + auto res = hashDict.insert(fippkt->getHash()); + if (res.second) { + result.push_back(std::move(fippkt)); + } else { + } + } else { + result.push_back(std::move(fippkt)); + } + } + return result; + } + + // TODO: Add methods to process packets by type + + private: + std::string fileExtension; + std::unordered_set hashDict; + std::vector packets; // Stored packets to write out + + // TLS support is integrated via PcapPlusPlus; ensure the TLS plugin library + // is linked in your CMake configuration. + + /** + * Pre-process a raw pcpp::Packet into a FIPPacket subclass based on layers. + * Optionally invoke header preprocessing. + */ + std::unique_ptr preprocess(const std::unique_ptr& packet, PacketProcessorType type) { + // Wrap in UnknownPacket to inspect layer map + FIPPacket* packetForMaps = new FIPPacket(*packet); + std::unique_ptr fippacket; + std::unordered_map address_mapping = packetForMaps->getAdressMapping(); + std::unordered_map layer_map = packetForMaps->getLayerMap(); + delete packetForMaps; + // HTTP handling + if (layer_map.count("HTTP")) { + fippacket = std::make_unique(*packet, address_mapping, layer_map); + } + else if (layer_map.count("HTTPRequest")) { + fippacket = std::make_unique(*packet, address_mapping, layer_map); + } + else if (layer_map.count("HTTPResponse")) { + fippacket = std::make_unique(*packet, address_mapping, layer_map); + } + // DNS handling + else if (layer_map.count("DNS")) { + fippacket = std::make_unique(*packet, address_mapping, layer_map); + } + // Transport layer (TCP/UDP) + else if (layer_map.count("TCP") || layer_map.count("UDP")) { + fippacket = std::make_unique(*packet, address_mapping, layer_map); + } + // Network layer (IPv4/IPv6) + else if (layer_map.count("IP") || layer_map.count("IPv6")) { + fippacket = std::make_unique(*packet, address_mapping, layer_map); + } + // Data link layer (Ethernet) + else if (layer_map.count("Ether")) { + fippacket = std::make_unique(*packet, address_mapping, layer_map); + } + + // Header preprocessing if requested + if (type == PacketProcessorType::HEADER) { + fippacket->header_preprocessing(); + } + return fippacket; + } +}; \ No newline at end of file diff --git a/heiFIP/layers/ip.cpp b/heiFIP/layers/ip.cpp new file mode 100644 index 0000000..d357473 --- /dev/null +++ b/heiFIP/layers/ip.cpp @@ -0,0 +1,246 @@ +#pragma once + +#include "Packet.h" +#include "IPv4Layer.h" +#include "IPv6Layer.h" +#include "TcpLayer.h" +#include "UdpLayer.h" +#include "PayloadLayer.h" +#include "PcapFileDevice.h" +#include "IpAddress.h" +#include "packet.cpp" +#include "header.cpp" + +#include +#include +#include +#include +#include +#include + +class IPPacket : public EtherPacket { +public: + IPPacket(const pcpp::RawPacket& packet, + std::unordered_map addressMapping = {}, + std::unordered_map layerMap = {}) + : EtherPacket(packet, addressMapping, layerMap) + { + if (layerMap.count("IPv4")) { + filterIPv4(); + pcpp::Packet temporaryPacket = pcpp::Packet(getRawPacket().get()); + auto ipLayer = temporaryPacket.getLayerOfType(); + std::string hashInput = std::to_string(ipLayer->getIPv4Header()->ipVersion) + "," + + std::to_string(ipLayer->getIPv4Header()->fragmentOffset) + "," + + std::to_string(ipLayer->getIPv4Header()->protocol); + computeHash(hashInput); + + if (layerMap.count("TLS") && !(layerMap.count("TCP") || layerMap.count("UDP"))) + ipLayer->getLayerPayload()[0] = '\0'; // Remove payload (example) + + if (layerMap.count("Raw") && !(layerMap.count("TCP") || layerMap.count("UDP") || layerMap.count("HTTP"))) + ipLayer->getLayerPayload()[0] = '\0'; + } + else if (layerMap.count("IPv6")) { + filterIPv6(); + pcpp::Packet temporaryPacket = pcpp::Packet(getRawPacket().get()); + auto ip6Layer = temporaryPacket.getLayerOfType(); + std::string hashInput = std::to_string(ip6Layer->getIPv6Header()->ipVersion) + "," + + std::to_string(ip6Layer->getIPv6Header()->trafficClass) + "," + + std::to_string(ip6Layer->getIPv6Header()->hopLimit); + computeHash(hashInput); + + if (layerMap.count("TLS") && !(layerMap.count("TCP") || layerMap.count("UDP"))) + ip6Layer->getLayerPayload()[0] = '\0'; + + if (layerMap.count("Raw") && !(layerMap.count("TCP") || layerMap.count("UDP") || layerMap.count("HTTP"))) + ip6Layer->getLayerPayload()[0] = '\0'; + } + } + + void header_preprocessing() override { + if (layer_map.count("IPv4")) { + // 1) Find the TCP layer you want to replace + pcpp::Packet temporaryPacket = pcpp::Packet(getRawPacket().get()); + pcpp::IPv4Layer* oldIp = temporaryPacket.getLayerOfType(); + if (!oldIp) return; + + pcpp::Layer* prev = oldIp->getPrevLayer(); + + // 4) Now safely remove the old TCP layer object + temporaryPacket.detachLayer(oldIp); + + // 2) Create your replacement CustomTCPLayer* customTcp = header_preprocessing_tcp(oldTcp); + CustomIPLayer* customLayer = header_preprocessing_ipv4(oldIp); + delete oldIp; + + // 3) Insert your custom TCP layer right after whatever came before the old one + temporaryPacket.insertLayer(prev, customLayer, true); + + // 5) If your new layer changed any length/checksum fields upstream, + // recompute them on the packet + temporaryPacket.computeCalculateFields(); + const uint8_t* modifiedData = temporaryPacket.getRawPacket()->getRawData(); + int modifiedDataLen = temporaryPacket.getRawPacket()->getRawDataLen(); + timespec ts = temporaryPacket.getRawPacket()->getPacketTimeStamp(); + pcpp::LinkLayerType linkType = temporaryPacket.getRawPacket()->getLinkLayerType(); + + uint8_t* dataCopy = new uint8_t[modifiedDataLen]; + std::memcpy(dataCopy, modifiedData, modifiedDataLen); + + // 6) Replace the RawPacket in FIPPacket + setRawPacket(std::make_unique(dataCopy, modifiedDataLen, ts, false, linkType)); + } + + if (layer_map.count("IPv6")) { + // 1) Find the TCP layer you want to replace + pcpp::Packet temporaryPacket = pcpp::Packet(getRawPacket().get()); + pcpp::IPv6Layer* oldIp = temporaryPacket.getLayerOfType(); + if (!oldIp) return; + + // 2) Create your replacement CustomTCPLayer* customTcp = header_preprocessing_tcp(oldTcp); + CustomIPv6Layer* customLayer = header_preprocessing_ipv6(oldIp); + + // 3) Insert your custom TCP layer right after whatever came before the old one + pcpp::Layer* prev = oldIp->getPrevLayer(); + temporaryPacket.insertLayer(prev, customLayer); + + // 4) Now safely remove the old TCP layer object + temporaryPacket.detachLayer(oldIp); + delete oldIp; + + // 5) If your new layer changed any length/checksum fields upstream, + // recompute them on the packet + temporaryPacket.computeCalculateFields(); + const uint8_t* modifiedData = temporaryPacket.getRawPacket()->getRawData(); + int modifiedDataLen = temporaryPacket.getRawPacket()->getRawDataLen(); + timespec ts = temporaryPacket.getRawPacket()->getPacketTimeStamp(); + pcpp::LinkLayerType linkType = temporaryPacket.getRawPacket()->getLinkLayerType(); + + uint8_t* dataCopy = new uint8_t[modifiedDataLen]; + std::memcpy(dataCopy, modifiedData, modifiedDataLen); + + // 6) Replace the RawPacket in FIPPacket + setRawPacket(std::make_unique(dataCopy, modifiedDataLen, ts, false, linkType)); + } + + // Call base class preprocessing + EtherPacket::header_preprocessing(); + } + + // Functio to find the layer immediately preceding the IPv4 layer + pcpp::Layer* getLayerBeforeIPv4(const pcpp::Packet& packet) { + pcpp::Layer* previous = nullptr; + for (pcpp::Layer* layer = packet.getFirstLayer(); layer != nullptr; layer = layer->getNextLayer()) { + std::cout << "Layer: " << layer->toString(); + if (layer->getProtocol() == pcpp::IPv4) { + return previous; + } + previous = layer; + } + return nullptr; + }; + + CustomIPLayer* header_preprocessing_ipv4(pcpp::IPv4Layer* ipLayer) { + pcpp::iphdr* hdr = ipLayer->getIPv4Header(); + uint8_t version = hdr->ipVersion; + uint16_t fragOffset = ntohs(hdr->fragmentOffset); + uint8_t flags = static_cast((fragOffset >> 13) & 0x07); + return new CustomIPLayer(version, flags, hdr->typeOfService, hdr->timeToLive, hdr->protocol); + } + + // Function to find the layer immediately preceding the IPv6 layer + pcpp::Layer* getLayerBeforeIPv6(const pcpp::Packet& packet) { + pcpp::Layer* previous = nullptr; + for (pcpp::Layer* layer = packet.getFirstLayer(); layer != nullptr; layer = layer->getNextLayer()) { + if (layer->getProtocol() == pcpp::IPv6) { + return previous; + } + previous = layer; + } + return nullptr; + }; + + CustomIPv6Layer* header_preprocessing_ipv6(pcpp::IPv6Layer* ipv6Layer) { + return new CustomIPv6Layer( + ipv6Layer->getIPv6Header()->ipVersion, + ipv6Layer->getIPv6Header()->trafficClass, + ipv6Layer->getIPv6Header()->nextHeader, + ipv6Layer->getIPv6Header()->hopLimit + ); + } + + +private: + void computeHash(const std::string& input) { + unsigned char result[MD5_DIGEST_LENGTH]; + MD5(reinterpret_cast(input.c_str()), input.length(), result); + + std::ostringstream oss; + for (int i = 0; i < MD5_DIGEST_LENGTH; ++i) + oss << std::hex << std::setw(2) << std::setfill('0') << (int)result[i]; + + hash = oss.str(); + } + + void filterIPv4() { + pcpp::Packet temporaryPacket = pcpp::Packet(getRawPacket().get()); + auto ipLayer = temporaryPacket.getLayerOfType(); + std::string src = ipLayer->getSrcIPAddress().toString(); + std::string dst = ipLayer->getDstIPAddress().toString(); + + std::string newSrc = mapAddress(src); + std::string newDst = mapAddress(dst); + + ipLayer->setSrcIPv4Address(pcpp::IPv4Address(newSrc)); + ipLayer->setDstIPv4Address(pcpp::IPv4Address(newDst)); + } + + void filterIPv6() { + pcpp::Packet temporaryPacket = pcpp::Packet(getRawPacket().get()); + auto ip6Layer = temporaryPacket.getLayerOfType(); + std::string src = ip6Layer->getSrcIPAddress().toString(); + std::string dst = ip6Layer->getDstIPAddress().toString(); + + std::string newSrc = mapAddress(src, true); + std::string newDst = mapAddress(dst, true); + + ip6Layer->setSrcIPv6Address(pcpp::IPv6Address(newSrc)); + ip6Layer->setDstIPv6Address(pcpp::IPv6Address(newDst)); + } + + std::string mapAddress(const std::string& oldAddr, bool isIPv6 = false) { + if (address_mapping.count(oldAddr)) + return address_mapping[oldAddr]; + + std::string newAddr = isIPv6 ? generateRandomIPv6() : generateRandomIPv4(); + address_mapping[oldAddr] = newAddr; + return newAddr; + } + + std::string generateRandomIPv4() { + std::srand(static_cast(std::time(nullptr))); // Seed the random number generator + + std::string ip; + for (int i = 0; i < 4; ++i) { + int octet = std::rand() % 256; // Generates a number between 0 and 255 + ip += std::to_string(octet); + if (i < 3) ip += "."; + } + return ip; + } + + std::string generateRandomIPv6() { + std::srand(static_cast(std::time(nullptr))); // Seed RNG + + std::ostringstream oss; + for (int i = 0; i < 8; ++i) { + int block = std::rand() % 0x10000; // Generate a 16-bit block (0–65535) + oss << std::hex << std::setw(4) << std::setfill('0') << block; + if (i < 7) oss << ":"; + } + + return oss.str(); + } + + std::string hash; +}; \ No newline at end of file diff --git a/heiFIP/layers/packet.cpp b/heiFIP/layers/packet.cpp new file mode 100644 index 0000000..6fe72c5 --- /dev/null +++ b/heiFIP/layers/packet.cpp @@ -0,0 +1,225 @@ +#pragma once + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// Base class FIPPacket +class FIPPacket { + protected: + std::unique_ptr rawPacketPointer; + std::unordered_map address_mapping; + std::unordered_map layer_map; + std::string hash; + + std::string generate_md5() { + std::ostringstream raw_stream; + + pcpp::Packet temporaryPacket = pcpp::Packet(getRawPacket().get()); + pcpp::Layer* currentLayer = temporaryPacket.getFirstLayer(); + while (currentLayer != nullptr) { + raw_stream.write((const char*)currentLayer->getData(), currentLayer->getDataLen()); + currentLayer = currentLayer->getNextLayer(); + } + + std::string raw_data = raw_stream.str(); + unsigned char digest[MD5_DIGEST_LENGTH]; + MD5((unsigned char*)raw_data.c_str(), raw_data.length(), digest); + + std::ostringstream md5stream; + for (int i = 0; i < MD5_DIGEST_LENGTH; ++i) + md5stream << std::hex << std::setw(2) << std::setfill('0') << (int)digest[i]; + + return md5stream.str(); + } + + void extract_layers() { + layer_map.clear(); + pcpp::Packet temporaryPacket = pcpp::Packet(getRawPacket().get()); + pcpp::Layer* layer = temporaryPacket.getFirstLayer(); + while (layer != nullptr) { + std::string layerName = getProtocolTypeAsString(layer->getProtocol()); + layer_map.insert({layerName, true}); + layer = layer->getNextLayer(); + } + } + + std::string getProtocolTypeAsString(pcpp::ProtocolType protocolType) + { + switch (protocolType) + { + case pcpp::Ethernet: + return "Ethernet"; + case pcpp::IPv4: + return "IPv4"; + case pcpp::TCP: + return "TCP"; + case pcpp::HTTP: + return "HTTP"; + case pcpp::HTTPRequest: + return "HTTPRequest"; + case pcpp::HTTPResponse: + return "HTTPResponse"; + case pcpp::DNS: + return "DNS"; + default: + return "Unknown"; + } + } + + public: + // Constructor + FIPPacket(const pcpp::RawPacket& pkt, const std::unordered_map& addr_map = {}, + const std::unordered_map& lmap = {}) : address_mapping(addr_map) { + + const uint8_t* rawData = pkt.getRawData(); + int len = pkt.getRawDataLen(); + + // Deep-copy the raw data buffer + uint8_t* dataCopy = new uint8_t[len]; + std::memcpy(dataCopy, rawData, len); + timespec timeStamp = pkt.getPacketTimeStamp(); + pcpp::LinkLayerType linkerLayerType = pkt.getLinkLayerType() ; + + // Create a new RawPacket with the copied buffer + rawPacketPointer = std::make_unique( + dataCopy, + len, + timeStamp, + false, // indicate that RawPacket should free this buffer + linkerLayerType + ); + + if (lmap.empty()) { + extract_layers(); + } else { + layer_map = lmap; + } + + hash = generate_md5(); + } + + virtual ~FIPPacket() = default; + + // Virtual function for header preprocessing + virtual void header_preprocessing() { + // This is a placeholder; you can define specific header handling logic + } + + // Method to retrieve the MD5 hash + const std::string& getHash() const { return hash; } + + // Method to retrieve the layer map + const std::unordered_map& getLayerMap() const { return layer_map; } + + // Method to retrieve the layer map + const std::unordered_map& getAdressMapping() const { return address_mapping; } + + /// Returns a mutable reference to the parsed Packet. + /// Re-parses from rawPtr if you’ve mutated the bytes directly. + // In FIPPacket.h + std::unique_ptr& getRawPacket() noexcept { + return rawPacketPointer; + } + + // Const overloads; can’t mutate anything + const pcpp::RawPacket& getRawPacket() const noexcept { + return *rawPacketPointer; + } + + void setRawPacket(std::unique_ptr newRawPacket) { + rawPacketPointer = std::move(newRawPacket); + extract_layers(); // Optionally re-extract protocol layers + hash = generate_md5(); // Optionally regenerate the hash + } +}; + +// Derived class UnknownPacket +class UnknownPacket : public FIPPacket { +public: + // Constructor: Initializes FIPPacket with the same parameters + UnknownPacket(const pcpp::RawPacket& pkt, + const std::unordered_map& addr_map = {}, + const std::unordered_map& lmap = {}) + : FIPPacket(pkt, addr_map, lmap) {} + + // Override header preprocessing + void header_preprocessing() override { + // Call base class header preprocessing + FIPPacket::header_preprocessing(); + } +}; + +// Utility function to generate random MAC address +std::string generate_random_mac() { + std::stringstream mac; + mac << std::hex << std::uppercase << std::setw(2) << std::setfill('0') << (rand() % 256); + for (int i = 0; i < 5; ++i) { + mac << ":" << std::setw(2) << std::setfill('0') << (rand() % 256); + } + return mac.str(); +} + +// Derived class EtherPacket +class EtherPacket : public FIPPacket { +public: + // Constructor: Initializes FIPPacket and processes the Ethernet layer + EtherPacket(const pcpp::RawPacket& pkt, + const std::unordered_map& addr_map = {}, + const std::unordered_map& lmap = {}) + : FIPPacket(pkt, addr_map, lmap) { + + if (layer_map.find("Ethernet") != layer_map.end()) { + __filter(); + } + } + + // Function to filter and modify MAC addresses + void __filter() { + pcpp::Packet temporaryPacket = pcpp::Packet(getRawPacket().get()); + pcpp::EthLayer* ethLayer = temporaryPacket.getLayerOfType(); + if (ethLayer == nullptr) return; + + std::string previous_src = ethLayer->getSourceMac().toString(); + std::string previous_dst = ethLayer->getDestMac().toString(); + + std::string new_src, new_dst; + + // Modify source MAC + if (address_mapping.count(previous_src) > 0) { + new_src = address_mapping[previous_src]; + } else { + new_src = generate_random_mac(); + address_mapping[previous_src] = new_src; + } + + // Modify destination MAC + if (address_mapping.count(previous_dst) > 0) { + new_dst = address_mapping[previous_dst]; + } else { + new_dst = generate_random_mac(); + address_mapping[previous_dst] = new_dst; + } + + // Set new MAC addresses + ethLayer->setSourceMac(pcpp::MacAddress(new_src)); + ethLayer->setDestMac(pcpp::MacAddress(new_dst)); + } + + // Override header preprocessing + void header_preprocessing() override { + // Call base class header preprocessing + FIPPacket::header_preprocessing(); + + // Add specific preprocessing logic for EtherPacket + } +}; \ No newline at end of file diff --git a/heiFIP/layers/ssh.cpp b/heiFIP/layers/ssh.cpp new file mode 100644 index 0000000..10906fa --- /dev/null +++ b/heiFIP/layers/ssh.cpp @@ -0,0 +1,29 @@ +#pragma once + +#include "transport.cpp" + +/** + * SSHPacketProcessor is a TransportPacket subclass for SSH processing. + * It currently defers all processing to its base class. + */ +class SSHPacketProcessor : public TransportPacket { + public: + /** + * Constructor: initialize with an existing pcap Packet, address mapping, and layer map. + */ + SSHPacketProcessor(const pcpp::RawPacket& packet, + std::unordered_map addressMapping = {}, + std::unordered_map layerMap = {}) + : TransportPacket(packet, addressMapping, layerMap) {} + + /** + * Override header preprocessing to allow SSH-specific logic. + * Currently calls the base implementation. + */ + void header_preprocessing() override { + // Call upstream preprocessing (e.g., TCP reassembly, fragments) + TransportPacket::header_preprocessing(); + + // TODO: Add SSH-specific preprocessing here + } +}; \ No newline at end of file diff --git a/heiFIP/layers/transport.cpp b/heiFIP/layers/transport.cpp new file mode 100644 index 0000000..92c7031 --- /dev/null +++ b/heiFIP/layers/transport.cpp @@ -0,0 +1,243 @@ +#pragma once + +#include "Packet.h" +#include "TcpLayer.h" +#include "UdpLayer.h" +#include "PayloadLayer.h" +#include "IPv4Layer.h" +#include "HttpLayer.h" + +#include "header.cpp" +#include "ip.cpp" +#include "packet.cpp" + +#include +#include +#include + +class TransportPacket : public IPPacket { + + public: + std::string hash; + + TransportPacket(const pcpp::RawPacket& packet, + std::unordered_map addressMapping = {}, + std::unordered_map layerMap = {}) + : IPPacket(packet, addressMapping, layerMap) + { + if (layerMap["TCP"]) { + // Get the TCP layer + pcpp::Packet temporaryPacket = pcpp::Packet(getRawPacket().get()); + pcpp::TcpLayer* tcpLayer = temporaryPacket.getLayerOfType(); + if (tcpLayer != nullptr) { + // Compute hash using TCP flags and options count + pcpp::tcphdr* tcpHeader = tcpLayer->getTcpHeader(); + uint8_t flags = 0; + if (tcpHeader->synFlag) flags |= 0x02; + if (tcpHeader->ackFlag) flags |= 0x10; + if (tcpHeader->finFlag) flags |= 0x01; + if (tcpHeader->rstFlag) flags |= 0x04; + if (tcpHeader->pshFlag) flags |= 0x08; + if (tcpHeader->urgFlag) flags |= 0x20; + if (tcpHeader->eceFlag) flags |= 0x40; + if (tcpHeader->cwrFlag) flags |= 0x80; + + int optionsCount = tcpLayer->getTcpOptionCount(); + + // Create hash + std::ostringstream oss; + oss << static_cast(flags) << "," << optionsCount; + std::string hashInput = oss.str(); + + // Hash it using OpenSSL MD5 + unsigned char digest[MD5_DIGEST_LENGTH]; + MD5(reinterpret_cast(hashInput.c_str()), hashInput.length(), digest); + + std::ostringstream hashStream; + for (int i = 0; i < MD5_DIGEST_LENGTH; ++i) + hashStream << std::hex << std::setw(2) << std::setfill('0') << (int)digest[i]; + hash = hashStream.str(); + + // Remove the payload if certain layers are present + if (layerMap["TLS"] || (layerMap["Raw"] && !layerMap["HTTP"])) { + + pcpp::TcpLayer newTcpLayer = pcpp::TcpLayer(*(temporaryPacket).getLayerOfType()); + // Reconstruct the packet with the new TCP header + temporaryPacket.removeLayer(pcpp::TCP); + temporaryPacket.addLayer(&newTcpLayer); + temporaryPacket.computeCalculateFields(); + + // 3. Deep copy the modified raw data + const uint8_t* modifiedData = temporaryPacket.getRawPacket()->getRawData(); + int modifiedDataLen = temporaryPacket.getRawPacket()->getRawDataLen(); + timespec ts = temporaryPacket.getRawPacket()->getPacketTimeStamp(); + pcpp::LinkLayerType linkType = temporaryPacket.getRawPacket()->getLinkLayerType(); + + uint8_t* dataCopy = new uint8_t[modifiedDataLen]; + std::memcpy(dataCopy, modifiedData, modifiedDataLen); + + // 4. Replace the RawPacket in FIPPacket + setRawPacket(std::make_unique(dataCopy, modifiedDataLen, ts, false, linkType)); + } + } + } else if (layerMap["UDP"]) { + pcpp::Packet temporaryPacket = pcpp::Packet(getRawPacket().get()); + pcpp::UdpLayer* udpLayer = temporaryPacket.getLayerOfType(); + if (udpLayer != nullptr) { + std::string layerName = "UDP"; + hash = md5Hash(layerName); + + if (layerMap["TLS"] || (layerMap["Raw"] && !layerMap["HTTP"])) { + pcpp::UdpLayer newTcpLayer = pcpp::UdpLayer(*temporaryPacket.getLayerOfType()); + // Reconstruct the packet with the new TCP header + + temporaryPacket.removeLayer(pcpp::UDP); + temporaryPacket.addLayer(&newTcpLayer); + temporaryPacket.computeCalculateFields(); + + // 3. Deep copy the modified raw data + const uint8_t* modifiedData = temporaryPacket.getRawPacket()->getRawData(); + int modifiedDataLen = temporaryPacket.getRawPacket()->getRawDataLen(); + timespec ts = temporaryPacket.getRawPacket()->getPacketTimeStamp(); + pcpp::LinkLayerType linkType = temporaryPacket.getRawPacket()->getLinkLayerType(); + + uint8_t* dataCopy = new uint8_t[modifiedDataLen]; + std::memcpy(dataCopy, modifiedData, modifiedDataLen); + + // 4. Replace the RawPacket in FIPPacket + setRawPacket(std::make_unique(dataCopy, modifiedDataLen, ts, false, linkType)); + } + } + } + } + + pcpp::Layer* getLayerBeforeTCP(const pcpp::Packet& packet) { + pcpp::Layer* prev = nullptr; + for (pcpp::Layer* lyr = packet.getFirstLayer(); lyr; lyr = lyr->getNextLayer()) { + if (lyr->getProtocol() == pcpp::TCP) { + return prev; + } + prev = lyr; + } + return (pcpp::Layer*)nullptr; + }; + + pcpp::Layer* getLayerBeforeUDP(const pcpp::Packet& packet) { + pcpp::Layer* prev = nullptr; + for (pcpp::Layer* lyr = packet.getFirstLayer(); lyr; lyr = lyr->getNextLayer()) { + if (lyr->getProtocol() == pcpp::UDP) { + return prev; + } + prev = lyr; + } + return (pcpp::Layer*)nullptr; + }; + + + void header_preprocessing() + { + // Process the TCP layer if it exists + if (layer_map["TCP"]) { + // 1) Find the TCP layer you want to replace + pcpp::Packet temporaryPacket = pcpp::Packet(getRawPacket().get()); + pcpp::TcpLayer* oldTcp = temporaryPacket.getLayerOfType(); + if (!oldTcp) return; + + // 2) Create your replacement CustomTCPLayer* customTcp = header_preprocessing_tcp(oldTcp); + CustomTCPLayer* customLayer = header_preprocessing_tcp(oldTcp); + + // 3) Insert your custom TCP layer right after whatever came before the old one + pcpp::Layer* prev = oldTcp->getPrevLayer(); + temporaryPacket.insertLayer(prev, customLayer); + + // 4) Now safely remove the old TCP layer object + temporaryPacket.detachLayer(oldTcp); + delete oldTcp; + + + // 5) If your new layer changed any length/checksum fields upstream, + // recompute them on the packet + temporaryPacket.computeCalculateFields(); + const uint8_t* modifiedData = temporaryPacket.getRawPacket()->getRawData(); + int modifiedDataLen = temporaryPacket.getRawPacket()->getRawDataLen(); + timespec ts = temporaryPacket.getRawPacket()->getPacketTimeStamp(); + pcpp::LinkLayerType linkType = temporaryPacket.getRawPacket()->getLinkLayerType(); + + uint8_t* dataCopy = new uint8_t[modifiedDataLen]; + std::memcpy(dataCopy, modifiedData, modifiedDataLen); + + // 6) Replace the RawPacket in FIPPacket + setRawPacket(std::make_unique(dataCopy, modifiedDataLen, ts, false, linkType)); + } + + // Process the UDP layer if it exists + if (layer_map["UDP"]) { + // 1) Find the TCP layer you want to replace + pcpp::Packet temporaryPacket = pcpp::Packet(getRawPacket().get()); + pcpp::UdpLayer* oldUdp = temporaryPacket.getLayerOfType(); + if (!oldUdp) return; + + // 2) Create your replacement CustomTCPLayer* customTcp = header_preprocessing_tcp(oldTcp); + CustomUDPLayer* customLayer = header_preprocessing_udp(oldUdp); + + // 3) Insert your custom TCP layer right after whatever came before the old one + pcpp::Layer* prev = oldUdp->getPrevLayer(); + temporaryPacket.insertLayer(prev, customLayer); + + // 4) Now safely remove the old TCP layer object + temporaryPacket.detachLayer(oldUdp); + delete oldUdp; + + // 5) If your new layer changed any length/checksum fields upstream, + // recompute them on the packet + temporaryPacket.computeCalculateFields(); + const uint8_t* modifiedData = temporaryPacket.getRawPacket()->getRawData(); + int modifiedDataLen = temporaryPacket.getRawPacket()->getRawDataLen(); + timespec ts = temporaryPacket.getRawPacket()->getPacketTimeStamp(); + pcpp::LinkLayerType linkType = temporaryPacket.getRawPacket()->getLinkLayerType(); + + uint8_t* dataCopy = new uint8_t[modifiedDataLen]; + std::memcpy(dataCopy, modifiedData, modifiedDataLen); + + // 6) Replace the RawPacket in FIPPacket + setRawPacket(std::make_unique(dataCopy, modifiedDataLen, ts, false, linkType)); + } + + // Call the base class's header_preprocessing method + IPPacket::header_preprocessing(); // Assuming this is your parent class + } + + CustomTCPLayer* header_preprocessing_tcp(pcpp::TcpLayer* tcpLayer) { + auto hdr = tcpLayer->getTcpHeader(); + // Manually extract TCP flags from individual bit fields + uint16_t flags = 0; + if (hdr->finFlag) flags |= 0x01; + if (hdr->synFlag) flags |= 0x02; + if (hdr->rstFlag) flags |= 0x04; + if (hdr->pshFlag) flags |= 0x08; + if (hdr->ackFlag) flags |= 0x10; + if (hdr->urgFlag) flags |= 0x20; + if (hdr->eceFlag) flags |= 0x40; + if (hdr->cwrFlag) flags |= 0x80; + // Extract raw options bytes (if any) + size_t optLen = tcpLayer->getHeaderLen() - sizeof(*hdr); + const uint8_t* optPtr = reinterpret_cast(hdr) + sizeof(*hdr); + std::vector options(optPtr, optPtr + optLen); + return new CustomTCPLayer(flags, options); + } + + CustomUDPLayer* header_preprocessing_udp(pcpp::UdpLayer* udpLayer) { + return new CustomUDPLayer(); + } + + private: + std::string md5Hash(const std::string& input) { + unsigned char digest[MD5_DIGEST_LENGTH]; + MD5(reinterpret_cast(input.c_str()), input.length(), digest); + + std::ostringstream oss; + for (int i = 0; i < MD5_DIGEST_LENGTH; ++i) + oss << std::hex << std::setw(2) << std::setfill('0') << (int)digest[i]; + return oss.str(); + } +}; \ No newline at end of file diff --git a/heiFIP/main.cpp b/heiFIP/main.cpp new file mode 100644 index 0000000..924453a --- /dev/null +++ b/heiFIP/main.cpp @@ -0,0 +1,36 @@ +#include "runner.cpp" + +// Main function to demonstrate the usage of the Runner +int main() { + std::string input_file = "/Users/henrirebitzky/Documents/BachelorDerInformatikAnDerUniversitätHeidelberg/IFP/heiFIPCpp/tests/pcaps/ssh/reverse-ssh.pcap"; // Update with actual path + std::string output_dir = "/Users/henrirebitzky/Documents/BachelorDerInformatikAnDerUniversitätHeidelberg/IFPGit/heiFIP/build"; // Update with actual output path + + std::atomic pbar(0); + Runner runner(4); + + FlowImageArgs args{16, true, 0}; + FlowImageTiledFixedArgs args2{16, 0, 3}; + FlowImageTiledAutoArgs args3{16, 0, true}; + MarkovTransitionMatrixFlowArgs args4{3}; + MarkovTransitionMatrixPacketArgs args5{}; + PacketImageArgs args6{16, 0, true}; + + + // Simulate calling the method with appropriate parameters + runner.create_image( + input_file, + output_dir, + args3, // args placeholder + pbar, + PacketProcessorType::HEADER, // Example of using HEADER processing + ImageType::FlowImageTiledAuto, // Example: pass nullptr for NetworkTrafficImage + 3, // min_image_dim + 2000, // max_image_dim + 10, // min_packets_per_flow + 100, // max_packets_per_flow + false // remove_duplicates + ); + + // std::cout << "Process completed." << std::endl; + return 0; +} \ No newline at end of file diff --git a/heiFIP/plugins/header.cpp b/heiFIP/plugins/header.cpp new file mode 100644 index 0000000..c94103f --- /dev/null +++ b/heiFIP/plugins/header.cpp @@ -0,0 +1,625 @@ +#pragma once + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "UdpLayer.h" +#include "Packet.h" +#include +#include +#include +#include + +#pragma pack(push,1) +struct CustomIPHeader { + uint8_t version_and_flags; // high 4 bits: version, low 4 bits: flags + uint8_t tos; + uint8_t ttl; + uint8_t proto; + uint8_t reserved[4]; +}; +#pragma pack(pop) + +/** + * CustomIPLayer implements an 8-byte minimal IPv4-like header. + */ +#pragma pack(push, 1) +struct custom_ip_header { + uint8_t versionAndFlags; // high nibble = version, low nibble = flags + uint8_t typeOfService; + uint8_t timeToLive; + uint8_t protocol; +}; +#pragma pack(pop) + +class CustomIPLayer : public pcpp::Layer { +public: + CustomIPLayer(uint8_t version, + uint8_t flags, + uint8_t tos, + uint8_t ttl, + uint8_t proto) + { + m_DataLen = sizeof(custom_ip_header); + m_Data = new uint8_t[m_DataLen]; + m_DataLen = sizeof(custom_ip_header); + m_Protocol = pcpp::UnknownProtocol; // or a custom enum + auto* hdr = reinterpret_cast(m_Data); + hdr->versionAndFlags = uint8_t((version << 4) | (flags & 0x0F)); + hdr->typeOfService = tos; + hdr->timeToLive = ttl; + hdr->protocol = proto; + computeCalculateFields(); + } + + // Copy constructor + CustomIPLayer(const CustomIPLayer& other) + : Layer(other) + { + m_Data = new uint8_t[other.m_DataLen]; + m_DataLen = other.m_DataLen; + memcpy(m_Data, other.m_Data, m_DataLen); + } + + virtual ~CustomIPLayer() { /* base~ will free m_Data if owned */ } + + // Must override this to tell PcapPlusPlus how big your header is + virtual size_t getHeaderLen() const override { + return sizeof(custom_ip_header); + } + + // Called when layer is re-serialized: recalc versionAndFlags byte + virtual void computeCalculateFields() override { + auto* hdr = reinterpret_cast(m_Data); + // version and flags are already baked in, so nothing to do here + // unless you expose setters that modify version or flags + } + + // Called by PcapPlusPlus when parsing next layer—return nullptr since + // we don’t know what comes after our custom IP layer. + void parseNextLayer() override {} + + pcpp::OsiModelLayer getOsiModelLayer() const override { + return pcpp::OsiModelNetworkLayer; + } + + // Human-readable name + virtual std::string toString() const override { + return "CustomIPLayer"; + } + + // Field accessors + uint8_t getVersion() const { + return (reinterpret_cast(m_Data)->versionAndFlags) >> 4; + } + uint8_t getFlags() const { + return reinterpret_cast(m_Data)->versionAndFlags & 0x0F; + } + uint8_t getTos() const { + return reinterpret_cast(m_Data)->typeOfService; + } + uint8_t getTtl() const { + return reinterpret_cast(m_Data)->timeToLive; + } + uint8_t getProtocol() const { + return reinterpret_cast(m_Data)->protocol; + } + + // (Optional) setters that update the header and then recalc: + void setVersion(uint8_t v) { + auto* hdr = reinterpret_cast(m_Data); + hdr->versionAndFlags = uint8_t((v << 4) | (hdr->versionAndFlags & 0x0F)); + } + void setFlags(uint8_t f) { + auto* hdr = reinterpret_cast(m_Data); + hdr->versionAndFlags = uint8_t((hdr->versionAndFlags & 0xF0) | (f & 0x0F)); + } + // … similarly setTos, setTtl, setProtocol … +}; + + +#pragma pack(push, 1) +struct custom_ipv6_header { + uint8_t version; ///< high-nibble used, low-nibble zero + uint8_t trafficClass; + uint8_t nextHeader; ///< “nh” in your Scapy code + uint8_t hopLimit; ///< “hlim” +}; +#pragma pack(pop) + +class CustomIPv6Layer : public pcpp::Layer { +public: + /// Build a brand-new header + CustomIPv6Layer(uint8_t version, + uint8_t tc, + uint8_t nh, + uint8_t hlim) + { + m_DataLen = sizeof(custom_ipv6_header); + m_Data = new uint8_t[m_DataLen]; + m_Protocol = pcpp::UnknownProtocol; + auto* hdr = reinterpret_cast(m_Data); + hdr->version = version; // you can mask out lower nibble if you like + hdr->trafficClass = tc; + hdr->nextHeader = nh; + hdr->hopLimit = hlim; + computeCalculateFields(); + } + + /// Copy constructor + CustomIPv6Layer(const CustomIPv6Layer& other) + : Layer(other) + { + m_Data = new uint8_t[other.m_DataLen]; + m_DataLen = other.m_DataLen; + memcpy(m_Data, other.m_Data, m_DataLen); + } + + virtual ~CustomIPv6Layer() = default; + + /// Number of bytes in header + virtual size_t getHeaderLen() const override { + return sizeof(custom_ipv6_header); + } + + /// Called after you change fields; reserialize if needed + virtual void computeCalculateFields() override { + // nothing dynamic to recalc here; we just leave the bytes as set + } + + /// We don’t know what comes next, so stop parsing + void parseNextLayer() override {} + + /// Friendly name + virtual std::string toString() const override { + return "CustomIPv6Layer"; + } + pcpp::OsiModelLayer getOsiModelLayer() const override { + return pcpp::OsiModelNetworkLayer; + } + //— Field accessors —// + + uint8_t getVersion() const { + return reinterpret_cast(m_Data)->version; + } + uint8_t getTrafficClass() const { + return reinterpret_cast(m_Data)->trafficClass; + } + uint8_t getNextHeader() const { + return reinterpret_cast(m_Data)->nextHeader; + } + uint8_t getHopLimit() const { + return reinterpret_cast(m_Data)->hopLimit; + } + + //— Field setters —// + + void setVersion(uint8_t v) { + reinterpret_cast(m_Data)->version = v; + } + void setTrafficClass(uint8_t tc) { + reinterpret_cast(m_Data)->trafficClass = tc; + } + void setNextHeader(uint8_t nh) { + reinterpret_cast(m_Data)->nextHeader = nh; + } + void setHopLimit(uint8_t hlim) { + reinterpret_cast(m_Data)->hopLimit = hlim; + } +}; + +#pragma pack(push,1) +struct CustomTCPHeader { + uint16_t flags; // TCP flags, network byte order + // raw options follow immediately +}; +#pragma pack(pop) + +class CustomTCPLayer : public pcpp::Layer { + public: + /** + * Construct from flags and raw options bytes + */ + CustomTCPLayer(uint16_t flags, const std::vector& options) + : Layer(nullptr, 0, nullptr, 0) + { + // Prepare header buffer: flags (2 bytes) + options + uint16_t flagsNet = htons(flags); + _buffer.resize(sizeof(CustomTCPHeader)); + memcpy(_buffer.data(), &flagsNet, sizeof(flagsNet)); + _buffer.insert(_buffer.end(), options.begin(), options.end()); + + m_Data = _buffer.data(); + m_DataLen = _buffer.size(); + computeCalculateFields(); + } + + CustomTCPHeader* getCustomHeader() const { + return reinterpret_cast(const_cast(m_Data)); + } + + void parseNextLayer() override { + size_t headerLen = getHeaderLen(); + if (m_DataLen > headerLen) { + m_NextLayer = new pcpp::PayloadLayer(m_Data + headerLen, + m_DataLen - headerLen, + this, + m_Packet); + } + } + + void computeCalculateFields() override { + // No dynamic fields to compute + } + + std::string toString() const override { + return "CustomTCPLayer(len=" + std::to_string(getHeaderLen()) + ")"; + } + + pcpp::OsiModelLayer getOsiModelLayer() const override { + return pcpp::OsiModelTransportLayer; + } + + size_t getHeaderLen() const override { + return _buffer.size(); + } + + std::string getName() const { + return "TCP"; + } + + private: + std::vector _buffer; +}; + + +class CustomUDPLayer : public pcpp::Layer { + public: + CustomUDPLayer() + : Layer(nullptr, 0, nullptr, 0) + { + m_Data = nullptr; + m_DataLen = 0; + computeCalculateFields(); + } + + void parseNextLayer() override { + if (m_DataLen > getHeaderLen()) + m_NextLayer = new pcpp::PayloadLayer(m_Data + getHeaderLen(), + m_DataLen - getHeaderLen(), + this, m_Packet); + } + + void computeCalculateFields() override {} + std::string toString() const override { return "CustomUDPLayer(len=0)"; } + pcpp::OsiModelLayer getOsiModelLayer() const override { return pcpp::OsiModelTransportLayer; } + size_t getHeaderLen() const override { return 0; } + std::string getName() const { + return "UDP"; + } +}; + +class CustomHTTP : public pcpp::Layer +{ +public: + struct Field { std::string name; std::string value; }; + std::vector fields; + + CustomHTTP() + { + m_Protocol = pcpp::UnknownProtocol; + m_DataLen = 0; + m_Data = nullptr; + } + + void addField(const std::string& fieldName, const std::string& fieldValue) + { + fields.push_back({fieldName, fieldValue}); + } + + // Serialize fields into m_Data buffer + void computeCalculateFields() override + { + // Ensure stringstream is fully defined by including + std::ostringstream stream; + for (const auto& field : fields) + { + if (field.value.empty()) + continue; + if (field.name == "Method" || field.name == "Path" || field.name == "Status_Code") + stream << field.value << ' '; + else + stream << field.name << ": " << field.value << "\r\n"; + } + std::string serialized = stream.str(); + + delete[] m_Data; + m_DataLen = serialized.size(); + m_Data = new uint8_t[m_DataLen]; + std::memcpy(m_Data, serialized.data(), m_DataLen); + } + + size_t getHeaderLen() const override { return m_DataLen; } + void parseNextLayer() override { m_NextLayer = nullptr; } + std::string toString() const override { return "CustomHTTP Layer"; } + + // Required overrides + pcpp::OsiModelLayer getOsiModelLayer() const override { return pcpp::OsiModelApplicationLayer; } +}; + +class CustomHTTPRequest : public CustomHTTP { + public: + CustomHTTPRequest() + { + // Set the default fields with default values + addField("Method", "GET"); + addField("Path", "/"); + addField("User_Agent", ""); + addField("Content_Type", ""); + addField("Connection", ""); + addField("Accept", ""); + addField("Accept_Charset", ""); + addField("Accept_Encoding", ""); + addField("Cookie", ""); + addField("TE", ""); + } + + virtual std::string toString() const override + { + return "HTTP Request Layer"; + } + + std::string getName() const { + return "HTTP Request"; + } +}; + +class CustomHTTPResponse : public CustomHTTP { + public: + CustomHTTPResponse() + { + // Set the default fields with their default values + addField("Status_Code", "200"); + addField("Connection", ""); + addField("Content_Encoding", ""); + addField("Content_Type", ""); + addField("Server", ""); + addField("Set_Cookie", ""); + addField("Transfer_Encoding", ""); + } + + virtual std::string toString() const override + { + return "HTTP Response Layer"; + } + + std::string getName() const { + return "HTTP Response"; + } +}; + +class CustomDNSQR : public pcpp::Layer { + public: + std::string qname; + uint16_t qtype; + + CustomDNSQR(const std::string& name = "none", uint16_t type = 1) + : Layer(), qname(name), qtype(type) + { + m_Protocol = pcpp::UnknownProtocol; + m_DataLen = 0; + m_Data = nullptr; + } + + void setQName(const std::string& name) { qname = name; } + void setQType(uint16_t type) { qtype = type; } + + // Serialize question into m_Data in DNS wire format + void computeCalculateFields() override { + // Encode qname: labels split by '.' + std::vector labels; + std::istringstream iss(qname); + std::string label; + while (std::getline(iss, label, '.')) + labels.push_back(label); + + // Calculate total length: sum(label lengths +1) +1 null + 4 bytes for QType and QClass + size_t nameLen = 1; // final null + for (auto& lbl : labels) + nameLen += lbl.size() + 1; + m_DataLen = nameLen + 4; + + delete[] m_Data; + m_Data = new uint8_t[m_DataLen]; + + // Fill QNAME + size_t offset = 0; + for (auto& lbl : labels) { + m_Data[offset++] = static_cast(lbl.size()); + std::memcpy(m_Data + offset, lbl.data(), lbl.size()); + offset += lbl.size(); + } + m_Data[offset++] = 0; // end of QNAME + + // Fill QTYPE (network order) + uint16_t netType = htons(qtype); + std::memcpy(m_Data + offset, &netType, sizeof(netType)); + offset += sizeof(netType); + + // Fill QCLASS: 1 (IN) + uint16_t qclass = htons(1); + std::memcpy(m_Data + offset, &qclass, sizeof(qclass)); + } + + size_t getHeaderLen() const override { return m_DataLen; } + void parseNextLayer() override { m_NextLayer = nullptr; } + std::string toString() const override { return "Custom DNS Question Record"; } + + // Clone and OSI layer type + pcpp::OsiModelLayer getOsiModelLayer() const override { return pcpp::OsiModelApplicationLayer; } + + std::string getName() const { + return "DNS Question Record"; + } +}; + +class CustomDNSRR : public pcpp::Layer { + public: + std::string rrname; + uint16_t type; + uint32_t ttl; + + CustomDNSRR(const std::string& name = "", uint16_t t = 1, uint32_t timeToLive = 0) + : Layer(), rrname(name), type(t), ttl(timeToLive) + { + m_Protocol = pcpp::UnknownProtocol; + m_DataLen = 0; + m_Data = nullptr; + } + + void setRRName(const std::string& name) { rrname = name; } + void setType(uint16_t t) { type = t; } + void setTTL(uint32_t timeToLive) { ttl = timeToLive; } + + // Serialize RR into m_Data in DNS wire format (no RDATA) + void computeCalculateFields() override { + // Encode rrname + std::vector labels; + std::istringstream iss(rrname); + std::string label; + while (std::getline(iss, label, '.')) + labels.push_back(label); + + // NAME length: sum(label lengths +1) +1 null + size_t nameLen = 1; + for (auto& lbl : labels) + nameLen += lbl.size() + 1; + // Fixed 10 bytes: Type(2) + Class(2) + TTL(4) + RDLENGTH(2) + m_DataLen = nameLen + 10; + + delete[] m_Data; + m_Data = new uint8_t[m_DataLen]; + + size_t offset = 0; + // Fill NAME + for (auto& lbl : labels) { + m_Data[offset++] = static_cast(lbl.size()); + std::memcpy(m_Data + offset, lbl.data(), lbl.size()); + offset += lbl.size(); + } + m_Data[offset++] = 0; // end of NAME + + // Fill TYPE + uint16_t netType = htons(type); + std::memcpy(m_Data + offset, &netType, sizeof(netType)); + offset += sizeof(netType); + + // Fill CLASS: 1 (IN) + uint16_t qclass = htons(1); + std::memcpy(m_Data + offset, &qclass, sizeof(qclass)); + offset += sizeof(qclass); + + // Fill TTL + uint32_t netTTL = htonl(ttl); + std::memcpy(m_Data + offset, &netTTL, sizeof(netTTL)); + offset += sizeof(netTTL); + + // Fill RDLENGTH = 0 + uint16_t rdlen = htons(0); + std::memcpy(m_Data + offset, &rdlen, sizeof(rdlen)); + } + + size_t getHeaderLen() const override { return m_DataLen; } + void parseNextLayer() override { m_NextLayer = nullptr; } + std::string toString() const override { return "Custom DNS Resource Record"; } + + pcpp::OsiModelLayer getOsiModelLayer() const override { return pcpp::OsiModelApplicationLayer; } + + std::string getName() const { + return "DNS Resource Record"; + } +}; + +class CustomDNS : public pcpp::Layer { + public: + // DNS flags + bool qr = false; + uint8_t opcode = 0; + bool aa = false; + bool tc = false; + bool rd = true; + bool ra = false; + bool z = false; + bool ad = false; + bool cd = false; + uint8_t rcode = 0; + + // Section counts + uint16_t qdCount = 0; + uint16_t anCount = 0; + uint16_t nsCount = 0; + uint16_t arCount = 0; + + CustomDNS() { + m_Protocol = pcpp::UnknownProtocol; + m_DataLen = 0; + m_Data = nullptr; + } + + // Serialize DNS header into m_Data + void computeCalculateFields() override { + m_DataLen = 12; + delete[] m_Data; + m_Data = new uint8_t[m_DataLen]; + size_t offset = 0; + + // ID (set to 0) + uint16_t id = 0; + uint16_t netId = htons(id); + std::memcpy(m_Data + offset, &netId, sizeof(netId)); + offset += sizeof(netId); + + // Flags + uint16_t flags = 0; + flags |= (qr ? 1u << 15 : 0); + flags |= (opcode & 0xF) << 11; + flags |= (aa ? 1u << 10 : 0); + flags |= (tc ? 1u << 9 : 0); + flags |= (rd ? 1u << 8 : 0); + flags |= (ra ? 1u << 7 : 0); + flags |= (z ? 1u << 6 : 0); + flags |= (ad ? 1u << 5 : 0); + flags |= (cd ? 1u << 4 : 0); + flags |= (rcode & 0xF); + uint16_t netFlags = htons(flags); + std::memcpy(m_Data + offset, &netFlags, sizeof(netFlags)); + offset += sizeof(netFlags); + + // Counts + auto writeCount = [&](uint16_t val) { + uint16_t netVal = htons(val); + std::memcpy(m_Data + offset, &netVal, sizeof(netVal)); + offset += sizeof(netVal); + }; + writeCount(qdCount); + writeCount(anCount); + writeCount(nsCount); + writeCount(arCount); + } + + size_t getHeaderLen() const override { return m_DataLen; } + void parseNextLayer() override { m_NextLayer = nullptr; } + std::string toString() const override { return "Custom DNS Header"; } + + pcpp::OsiModelLayer getOsiModelLayer() const override { return pcpp::OsiModelApplicationLayer; } + + std::string getName() const { + return "DNS"; + } +}; \ No newline at end of file diff --git a/heiFIP/runner.cpp b/heiFIP/runner.cpp new file mode 100644 index 0000000..bce86c3 --- /dev/null +++ b/heiFIP/runner.cpp @@ -0,0 +1,72 @@ +#include +#include +#include +#include +#include +#include +#include +#include + +#include "extractor.cpp" + + +class Runner { +private: + int thread_number; + FIPExtractor extractor; + + size_t getMatrixCount(const MatrixVariant& mv) { + return std::visit([](auto const& mat) { + return mat.size(); + }, mv); + } + + // Function to return the element at index 'x' in the matrix + std::optional>, std::vector>>> + getVectorAtIndex(const MatrixVariant& matrix, size_t x) { + if (auto u8 = std::get_if(&matrix)) { + if (x < u8->size()) { + return (*u8)[x]; + } + } else if (auto dbl = std::get_if(&matrix)) { + if (x < dbl->size()) { + return (*dbl)[x]; + } + } + return std::nullopt; + } + +public: + Runner(int thread_number) : thread_number(thread_number), extractor() {} + + void create_image( + const std::string& input_file, + const std::string& output_dir, + const ImageArgsVariant& args, + std::atomic& pbar, + PacketProcessorType preprocessing_type = PacketProcessorType::NONE, + ImageType image_type = ImageType::PacketImage, + int min_image_dim = 0, + int max_image_dim = 0, + int min_packets_per_flow = 0, + int max_packets_per_flow = 0, + bool remove_duplicates = false + ) { + // Read and process the packets + MatrixVariant img = extractor.createImageFromFile( + input_file, + args, + preprocessing_type, + image_type, + min_image_dim, + max_image_dim, + min_packets_per_flow, + max_packets_per_flow, + remove_duplicates + ); + + // Update progress bar + pbar++; + extractor.save_image(img, output_dir + "/image_"); + } +}; \ No newline at end of file diff --git a/heifip/__init__.py b/heifip/__init__.py deleted file mode 100644 index fb8af61..0000000 --- a/heifip/__init__.py +++ /dev/null @@ -1,10 +0,0 @@ -CONTEXT_SETTINGS = dict(help_option_names=["-h", "--help"], show_default=True) - -__author__ = "Stefan Machmeier" -__copyright__ = "Copyright 2023, heiFIP" -__credits__ = ["Manuel Trageser"] -__license__ = "EUPL" -__version__ = "1.1.1" -__maintainer__ = "Stefan Machmeier" -__email__ = "stefan.machmeier@uni-heidelberg.de" -__status__ = "Production" \ No newline at end of file diff --git a/heifip/cli.py b/heifip/cli.py deleted file mode 100644 index 0d3f047..0000000 --- a/heifip/cli.py +++ /dev/null @@ -1,360 +0,0 @@ -try: - import click -except ImportError: - raise ImportError( - "Please install Python dependencies: " "click, colorama (optional)." - ) - -from heifip import CONTEXT_SETTINGS, __version__ -from heifip.images.flow import FlowImage -from heifip.images.flow_tiled_auto import FlowImageTiledAuto -from heifip.images.flow_tiled_fixed import FlowImageTiledFixed -from heifip.images.markovchain import (MarkovTransitionMatrixFlow) -from heifip.images.packet import PacketImage -from heifip.layers import PacketProcessorType -from heifip.main import Runner - - -def add_options(options): - def _add_options(func): - for option in reversed(options): - func = option(func) - return func - - return _add_options - - -@click.version_option(version=__version__) -@click.group(context_settings=CONTEXT_SETTINGS) -def cli(): - click.secho("Starting FlowImageProcessor CLI") - - -_extract_options = [ - click.option( - "-w", - "--write", - "output_dir", - type=click.Path(), - required=True, - help="Destination file path, stores result.", - ), - click.option("-r", "--read", "input_dir", required=True, type=click.Path()), - click.option( - "-t", - "--threads", - "num_threads", - type=int, - default=4, - help="Number of parallel threads that can be used.", - ), - click.option( - "--preprocess", - "preprocessing_type", - default="NONE", - type=click.Choice( - list(map(lambda x: x.name, PacketProcessorType)), case_sensitive=False - ), - help="Applies a preprocessing to the input data:\n none: No preprocessing\n payload: Only payload data is used\n header: Preprocesses headers (DNS,HTTP,IP,IPv6,TCP,UDP supported) to remove some biasing data.", - ), - click.option( - "--min-im-dim", - "min_image_dim", - type=int, - default=0, - help="Minimum dim ouput images need to have, 0=No minimum dim.", - ), - click.option( - "--max-im-dim", - "max_image_dim", - type=int, - default=0, - help="Maximum dim ouput images can have, 0=No maximum dim.", - ), - click.option( - "--remove-duplicates", - "remove_duplicates", - is_flag=True, - default=False, - help="Within a single output folder belonging to a single input folder no duplicate images will be produced if two inputs lead to the same image.", - ), -] - -_flow_options = [ - click.option( - "--min-packets", - "min_packets_per_flow", - type=int, - default=0, - help="Minimum packets that a FlowImage needs to have, 0=No minimum packets per flow.", - ), - click.option( - "--max-packets", - "max_packets_per_flow", - type=int, - default=0, - help="Minimum packets that a FlowImage needs to have, 0=No minimum packets per flow.", - ), -] - -_image_options = [ - click.option( - "--dim", - "dim", - type=int, - default=8, - help="Dimension of the image.", - ), - click.option( - "--fill", - "fill", - type=int, - default=0, - help="Fills remaining parts of the array of the image. Important: value has to be between 0-255.", - ), -] - -_auto_dim_options = [ - click.option( - "--auto-dim", - "auto_dim", - is_flag=True, - default=False, - help="Automatically adjust size of image based on the length of the packet/s.", - ), -] - - -@cli.group(name="extract", context_settings={"show_default": True}) -def extract(): - click.secho("Extract FlowImageProcessor CLI") - - -@extract.command(name="packet") -@add_options(_extract_options) -@add_options(_flow_options) -@add_options(_image_options) -@add_options(_auto_dim_options) -def extract_packet_image( - input_dir, - output_dir, - num_threads, - preprocessing_type, - min_image_dim, - max_image_dim, - min_packets_per_flow, - max_packets_per_flow, - remove_duplicates, - dim, - fill, - auto_dim, -): - """Extracts each packet from PCAP file and converts it into a single image representation.""" - runner = Runner(num_threads) - runner.run( - input_dir, - output_dir, - preprocessing_type, - PacketImage, - min_image_dim, - max_image_dim, - min_packets_per_flow, - max_packets_per_flow, - remove_duplicates, - dim, - fill, - auto_dim, - ) - - -@extract.command(name="flow") -@add_options(_extract_options) -@add_options(_flow_options) -@add_options(_image_options) -@click.option( - "--append", - "append", - is_flag=True, - default=False, - help="", -) -def extract_flow_image( - input_dir, - output_dir, - num_threads, - preprocessing_type, - min_image_dim, - max_image_dim, - min_packets_per_flow, - max_packets_per_flow, - remove_duplicates, - dim, - fill, - append, -): - """Extracts a list of packets from PCAP file and converts it into an image. You can either append each packet or write each packet into a new line.""" - runner = Runner(num_threads) - runner.run( - input_dir, - output_dir, - preprocessing_type, - FlowImage, - min_image_dim, - max_image_dim, - min_packets_per_flow, - max_packets_per_flow, - remove_duplicates, - dim, - fill, - append, - ) - - -@extract.command(name="flow-tiled-fixed") -@add_options(_extract_options) -@add_options(_flow_options) -@add_options(_image_options) -@click.option( - "--cols", - "cols", - type=int, - default=4, - help="Number of columns for quadratic representation.", -) -def extract_flow_tiled_fixed_image( - input_dir, - output_dir, - num_threads, - preprocessing_type, - min_image_dim, - max_image_dim, - min_packets_per_flow, - max_packets_per_flow, - remove_duplicates, - dim, - fill, - cols, -): - """Extracts packets from PCAP file and converts all packets into a single quadratic image based on the number of columns. If more packets are given than the total size of cols*cols, only the first n given packets are used.""" - runner = Runner(num_threads) - runner.run( - input_dir, - output_dir, - preprocessing_type, - FlowImageTiledFixed, - min_image_dim, - max_image_dim, - min_packets_per_flow, - max_packets_per_flow, - remove_duplicates, - dim, - fill, - cols, - ) - - -@extract.command(name="flow-tiled-auto") -@add_options(_extract_options) -@add_options(_flow_options) -@add_options(_image_options) -@add_options(_auto_dim_options) -def extract_flow_tiled_fixed_image( - input_dir, - output_dir, - num_threads, - preprocessing_type, - min_image_dim, - max_image_dim, - min_packets_per_flow, - max_packets_per_flow, - remove_duplicates, - dim, - fill, - cols, -): - """Extracts packets from PCAP file and converts all packets into a single quadratic image. It adjust the size based on the total amount of packets.""" - runner = Runner(num_threads) - runner.run( - input_dir, - output_dir, - preprocessing_type, - FlowImageTiledAuto, - min_image_dim, - max_image_dim, - min_packets_per_flow, - max_packets_per_flow, - remove_duplicates, - dim, - fill, - cols, - ) - - -@extract.command(name="markov-flow") -@add_options(_extract_options) -@add_options(_flow_options) -@click.option( - "--cols", - "cols", - type=int, - default=4, - help="Number of columns for quadratic representation.", -) -def extract_markov_image( - input_dir, - output_dir, - num_threads, - preprocessing_type, - min_image_dim, - max_image_dim, - min_packets_per_flow, - max_packets_per_flow, - remove_duplicates, - cols -): - """Extracts packets from PCAP file and converts it into a quadractic Markov Transition Matrix.""" - runner = Runner(num_threads) - runner.run( - input_dir, - output_dir, - preprocessing_type, - MarkovTransitionMatrixFlow, - min_image_dim, - max_image_dim, - min_packets_per_flow, - max_packets_per_flow, - remove_duplicates, - cols - ) - -@extract.command(name="markov-packet") -@add_options(_extract_options) -@add_options(_flow_options) -def extract_markov_image( - input_dir, - output_dir, - num_threads, - preprocessing_type, - min_image_dim, - max_image_dim, - min_packets_per_flow, - max_packets_per_flow, - remove_duplicates, -): - """Extracts packets from PCAP file and converts it into a quadractic Markov Transition Matrix.""" - runner = Runner(num_threads) - runner.run( - input_dir, - output_dir, - preprocessing_type, - MarkovTransitionMatrixFlow, - min_image_dim, - max_image_dim, - min_packets_per_flow, - max_packets_per_flow, - remove_duplicates, - ) - - -if __name__ == "__main__": - cli() diff --git a/heifip/exceptions/__init__.py b/heifip/exceptions/__init__.py deleted file mode 100644 index 18ea798..0000000 --- a/heifip/exceptions/__init__.py +++ /dev/null @@ -1,12 +0,0 @@ -__author__ = "Stefan Machmeier" -__copyright__ = "Copyright 2023, heiFIP" -__credits__ = ["Manuel Trageser"] -__license__ = "EUPL" -__version__ = "1.1.1" -__maintainer__ = "Stefan Machmeier" -__email__ = "stefan.machmeier@uni-heidelberg.de" -__status__ = "Production" - -class FIPWrongParameterException(Exception): - """Wrong Parameter passed""" - diff --git a/heifip/extractor.py b/heifip/extractor.py deleted file mode 100644 index 0b85b52..0000000 --- a/heifip/extractor.py +++ /dev/null @@ -1,198 +0,0 @@ -import os - -import numpy as np -from PIL import Image as PILImage -from scapy.all import Packet - -from heifip.exceptions import FIPWrongParameterException -from heifip.images import NetworkTrafficImage -from heifip.images.flow import FlowImage -from heifip.images.flow_tiled_auto import FlowImageTiledAuto -from heifip.images.flow_tiled_fixed import FlowImageTiledFixed -from heifip.images.markovchain import (MarkovTransitionMatrixFlow, - MarkovTransitionMatrixPacket) -from heifip.images.packet import PacketImage -from heifip.layers import PacketProcessor, PacketProcessorType -from heifip.layers.packet import FIPPacket - - -class FIPExtractor: - def __init__(self): - self.processor = PacketProcessor() - self.images_created = [] - - def verify(self, image, min_image_dim: int, max_image_dim: int, remove_duplicates: bool): - if image.shape[0] < min_image_dim or image.shape[1] < min_image_dim: - return False - - if max_image_dim != 0 and (max_image_dim < image.shape[0] or max_image_dim < image.shape[1]): - return False - - # if remove_duplicates: - # im_str = image.tobytes() - # if im_str in self.images_created: - # return False - # else: - # self.images_created.append(im_str) - - return True - - def create_image_from_file( - self, - input_file: str, - preprocessing_type: PacketProcessorType = PacketProcessorType.NONE, - image_type: NetworkTrafficImage = PacketImage, - min_image_dim: int = 0, - max_image_dim: int = 0, - min_packets_per_flow: int = 0, - max_packets_per_flow: int = 0, - remove_duplicates: bool = False, - *args - ): - - assert os.path.isfile(input_file) - - packets = self.processor.read_packets_file(input_file, preprocessing_type) - - images = self.__create_matrix( - packets, - preprocessing_type, - image_type, - min_image_dim, - max_image_dim, - min_packets_per_flow, - max_packets_per_flow, - remove_duplicates, - *args - ) - - return images - - def create_image_from_packet( - self, - packets: [FIPPacket], - preprocessing_type: PacketProcessorType = PacketProcessorType.NONE, - image_type: NetworkTrafficImage = PacketImage, - min_image_dim: int = 0, - max_image_dim: int = 0, - min_packets_per_flow: int = 0, - max_packets_per_flow: int = 0, - remove_duplicates: bool = False, - *args - ): - - packets = self.processor.read_packets_packet(packets, preprocessing_type) - - images = self.__create_matrix( - packets, - preprocessing_type, - image_type, - min_image_dim, - max_image_dim, - min_packets_per_flow, - max_packets_per_flow, - remove_duplicates, - *args - ) - - return images - - def __create_matrix( - self, - packets: [FIPPacket], - preprocessing_type: PacketProcessorType = PacketProcessorType.NONE, - image_type: NetworkTrafficImage = PacketImage, - min_image_dim: int = 0, - max_image_dim: int = 0, - min_packets_per_flow: int = 0, - max_packets_per_flow: int = 0, - remove_duplicates: bool = False, - *args - ): - images = [] - if image_type == FlowImage: - # when no file matches the preprocessing - if len(packets) == 0 or len(packets) < min_packets_per_flow: - return images - - # cut packets when too many are there - if max_packets_per_flow != 0 and len(packets) > max_packets_per_flow: - packets = packets[:max_packets_per_flow] - - image = FlowImage(packets, *args) - if self.verify(image.matrix, min_image_dim, max_image_dim, remove_duplicates): - images.append(image.matrix) - - elif image_type == FlowImageTiledFixed: - # when no file matches the preprocessing - if len(packets) == 0 or len(packets) < min_packets_per_flow: - return images - - # cut packets when too many are there - if max_packets_per_flow != 0 and len(packets) > max_packets_per_flow: - packets = packets[:max_packets_per_flow] - - image = FlowImageTiledFixed(packets, *args) - if self.verify(image.matrix, min_image_dim, max_image_dim, remove_duplicates): - images.append(image.matrix) - - elif image_type == FlowImageTiledAuto: - # when no file matches the preprocessing - if len(packets) == 0 or len(packets) < min_packets_per_flow: - return images - - # cut packets when too many are there - if max_packets_per_flow != 0 and len(packets) > max_packets_per_flow: - packets = packets[:max_packets_per_flow] - - image = FlowImageTiledAuto(packets, *args) - if self.verify(image.matrix, min_image_dim, max_image_dim, remove_duplicates): - images.append(image.matrix) - - elif image_type == PacketImage: - - for packet in packets: - image = PacketImage(packet, *args) - if self.verify(image.matrix, min_image_dim, max_image_dim, remove_duplicates): - images.append(image.matrix) - - elif image_type == MarkovTransitionMatrixFlow: - # when no file matches the preprocessing - if len(packets) == 0 or len(packets) < min_packets_per_flow: - return images - - # cut packets when too many are there - if max_packets_per_flow != 0 and len(packets) > max_packets_per_flow: - packets = packets[:max_packets_per_flow] - - image = MarkovTransitionMatrixFlow(packets, *args) - if self.verify(image.matrix, min_image_dim, max_image_dim, remove_duplicates): - images.append(image.matrix) - - elif image_type == MarkovTransitionMatrixPacket: - for packet in packets: - image = MarkovTransitionMatrixPacket(packet, *args) - if self.verify(image.matrix, min_image_dim, max_image_dim, remove_duplicates): - images.append(image.matrix) - else: - raise FIPWrongParameterException - - return images - - def save_image(self, img, output_dir): - pil_img = PILImage.fromarray(img) - if not os.path.exists(os.path.realpath(os.path.dirname(output_dir))): - try: - os.makedirs(os.path.realpath(os.path.dirname(output_dir))) - except: - pass - pil_img.save(f"{output_dir}_processed.png") - - def convert(self, img, target_type_min, target_type_max, target_type): - imin = img.min() - imax = img.max() - - a = (target_type_max - target_type_min) / (imax - imin) - b = target_type_max - a * imax - new_img = (a * img + b).astype(target_type) - return new_img \ No newline at end of file diff --git a/heifip/images/__init__.py b/heifip/images/__init__.py deleted file mode 100644 index 64d4f99..0000000 --- a/heifip/images/__init__.py +++ /dev/null @@ -1,16 +0,0 @@ -from abc import ABC, abstractmethod - -__author__ = "Stefan Machmeier" -__copyright__ = "Copyright 2023, heiFIP" -__credits__ = ["Manuel Trageser"] -__license__ = "EUPL" -__version__ = "1.1.1" -__maintainer__ = "Stefan Machmeier" -__email__ = "stefan.machmeier@uni-heidelberg.de" -__status__ = "Production" - - -class NetworkTrafficImage(ABC): - def __init__(self, fill=0, dim=8) -> None: - self.fill = fill - self.dim = dim diff --git a/heifip/images/flow.py b/heifip/images/flow.py deleted file mode 100644 index e795236..0000000 --- a/heifip/images/flow.py +++ /dev/null @@ -1,49 +0,0 @@ -import binascii - -import numpy as np -from scapy.all import Packet, raw - -from heifip.images import NetworkTrafficImage - - -class FlowImage(NetworkTrafficImage): - def __init__( - self, - packets, - dim=16, - fill=0, - append=False, - ) -> None: - NetworkTrafficImage.__init__(self, fill, dim) - self.packets = packets - self.append = append - self.matrix, self.binaries = self.__get_matrix(self.dim, self.append, self.fill, self.packets) - del packets - - - def __get_matrix(self, dim: int, append: bool, fill: int, packets: [Packet]): - """ - Creates a matrix of a list of Scapy Packet. - """ - binaries = [] - for packet in self.packets: - # get Hex data - hexst = binascii.hexlify(raw(packet.packet)) - # Append octet as integer - binaries.append( - [int(hexst[i : i + 2], 16) for i in range(0, len(hexst), 2)] - ) - fh = None - # Append packets after another or write each packet in a row - if append: - fh = np.concatenate([np.array(xi) for xi in binaries]) - rn = len(fh) // dim + (len(fh) % dim > 0) - fh = np.pad(fh, (0, (rn * dim) - fh.shape[0]), 'constant') - fh = fh.reshape(rn, dim) - else: - length = max(map(len, binaries)) - fh = np.array([xi + [fill] * (length - len(xi)) for xi in binaries]) - - fh = np.uint8(fh) - - return fh, binaries diff --git a/heifip/images/flow_tiled_auto.py b/heifip/images/flow_tiled_auto.py deleted file mode 100644 index 4ce37bb..0000000 --- a/heifip/images/flow_tiled_auto.py +++ /dev/null @@ -1,88 +0,0 @@ -import binascii - -import numpy as np -from scapy.all import Packet, raw - -from heifip.images import NetworkTrafficImage - - -class FlowImageTiledAuto(NetworkTrafficImage): - def __init__( - self, - packets, - dim=16, - fill=0, - auto_dim=False, - ) -> None: - NetworkTrafficImage.__init__(self, fill, dim) - self.packets = packets - self.auto_dim = auto_dim - self.matrix, self.binaries = self.__get_matrix_tiled(self.fill, self.dim, self.auto_dim, packets) - del packets - - def __get_matrix_tiled(self, fill: int, dim: int, auto_dim: bool, packets: [Packet]): - """ - Creates a matrix of a list of Scapy Packet. - Packets are tiled into a quadratic representation. - """ - binaries = [] - for packet in self.packets: - # get Hex data - hexst = binascii.hexlify(raw(packet.packet)) - # Append octet as integer - binaries.append( - [int(hexst[i : i + 2], 16) for i in range(0, len(hexst), 2)] - ) - - length = max(map(len, binaries)) - # Get dim of packet, using auto_dim uses the largest packet as dim reference - if auto_dim: - dim = int(np.ceil(np.sqrt(length))) - - result = [] - for x in binaries: - x = x[: dim * dim] - x = np.array(x + [fill] * (dim * dim - len(x))) - x = x.reshape(dim, dim) - result.append(x) - - # Get size of total image - length_total = len(result) - dim_total = int(np.ceil(np.sqrt(length_total))) - # dim_total = 4 - - # Create tiled image - fh = self.__tile_images(result, dim_total, dim) - # Convert to int - fh = np.uint8(fh) - return fh, binaries - - def __tile_images(self, images, cols: int, dim: int): - """Tile images of same size to grid with given number of columns. - - Args: - images (collection of ndarrays) - cols (int): number of colums - - Returns: - ndarray: stitched image - """ - k = 0 - rows = [] - for i in range(0, cols): - row = None - for j in range(0, cols): - if len(images) > k: - im = images[k] - else: - im = np.zeros((dim, dim)) - - if row is None: - row = im - else: - row = np.concatenate((row, im), axis=1) - k += 1 - rows.append(row) - tiled = np.concatenate(rows) - - return tiled \ No newline at end of file diff --git a/heifip/images/flow_tiled_fixed.py b/heifip/images/flow_tiled_fixed.py deleted file mode 100644 index 615af56..0000000 --- a/heifip/images/flow_tiled_fixed.py +++ /dev/null @@ -1,79 +0,0 @@ -import binascii - -import numpy as np -from scapy.all import Packet, raw - -from heifip.images import NetworkTrafficImage - - -class FlowImageTiledFixed(NetworkTrafficImage): - def __init__( - self, - packets, - dim=16, - fill=0, - cols=3, - ) -> None: - NetworkTrafficImage.__init__(self, fill, dim) - self.packets = packets - self.cols = cols - self.matrix, self.binaries = self.__get_matrix_tiled(self.fill, self.dim, self.cols, packets) - del packets - - def __get_matrix_tiled(self, fill: int, dim: int, cols: int, packets: [Packet]): - """ - Creates a matrix of a list of Scapy Packet. - Packets are tiled into a quadratic representation. - """ - binaries = [] - for packet in self.packets: - # get Hex data - hexst = binascii.hexlify(raw(packet.packet)) - # Append octet as integer - binaries.append( - [int(hexst[i : i + 2], 16) for i in range(0, len(hexst), 2)] - ) - - result = [] - for x in binaries: - x = x[: dim * dim] - x = np.array(x + [fill] * (dim * dim - len(x))) - x = x.reshape(dim, dim) - result.append(x) - - # Create tiled image - fh = self.__tile_images(result, cols, dim) - # Convert to int - fh = np.uint8(fh) - return fh, binaries - - def __tile_images(self, images, cols: int, dim: int): - """Tile images of same size to grid with given number of columns. - - Args: - images (collection of ndarrays) - cols (int): number of colums - - Returns: - ndarray: stitched image - """ - k = 0 - rows = [] - for i in range(0, cols): - row = None - for j in range(0, cols): - if len(images) > k: - im = images[k] - else: - im = np.zeros((dim, dim)) - - if row is None: - row = im - else: - row = np.concatenate((row, im), axis=1) - k += 1 - - rows.append(row) - tiled = np.concatenate(rows) - - return tiled \ No newline at end of file diff --git a/heifip/images/markovchain.py b/heifip/images/markovchain.py deleted file mode 100644 index ee83e99..0000000 --- a/heifip/images/markovchain.py +++ /dev/null @@ -1,97 +0,0 @@ -import numpy as np -from scapy.all import Packet - -from heifip.images import NetworkTrafficImage - - -class MarkovTransitionMatrix(NetworkTrafficImage): - def __init__( - self, - ) -> None: - NetworkTrafficImage.__init__(self) - - def bit_array(self, packet): - bytes_as_bits = ''.join(format(byte, '08b') for byte in bytes(packet.packet)) - transition = [] - for i in range(0, len(bytes_as_bits), 4): - transition.append(int(bytes_as_bits[i:i+4], 2)) - return transition - - def transition_matrix(self, transitions): - n = 16 - - M = [[0]*n for _ in range(n)] - - for (i,j) in zip(transitions,transitions[1:]): - M[i][j] += 1 - - #now convert to probabilities: - for row in M: - s = sum(row) - if s > 0: - row[:] = [f/s for f in row] - return M - -class MarkovTransitionMatrixFlow(MarkovTransitionMatrix): - def __init__( - self, - packets: [Packet], - cols: int = 4 - ) -> None: - MarkovTransitionMatrix.__init__(self) - - result = [] - for packet in packets: - transition = self.bit_array(packet) - m = self.transition_matrix(transition) - result.append(np.array(m)) - - # Create tiled image - fh = self.__tile_images(result, cols, 16) - - # Convert to int - self.matrix = fh - del packets - - def __tile_images(self, images, cols, dim): - """Tile images of same size to grid with given number of columns. - - Args: - images (collection of ndarrays) - cols (int): number of colums - - Returns: - ndarray: stitched image - """ - k = 0 - rows = [] - for i in range(0, cols): - row = None - for j in range(0, cols): - if len(images) > k: - im = images[k] - else: - im = np.zeros((dim, dim)) - - if row is None: - row = im - else: - row = np.concatenate((row, im), axis=1) - k += 1 - rows.append(row) - tiled = np.concatenate(rows) - - return tiled - -class MarkovTransitionMatrixPacket(MarkovTransitionMatrix): - def __init__( - self, - packet: Packet, - ) -> None: - MarkovTransitionMatrix.__init__(self) - - transition = self.bit_array(packet) - m = self.transition_matrix(transition) - self.matrix = np.array(m) - - del packet diff --git a/heifip/images/packet.py b/heifip/images/packet.py deleted file mode 100644 index 15e7069..0000000 --- a/heifip/images/packet.py +++ /dev/null @@ -1,39 +0,0 @@ -import binascii - -import numpy as np -from scapy.all import Packet, raw - -from heifip.images import NetworkTrafficImage - - -class PacketImage(NetworkTrafficImage): - def __init__( - self, - packet: Packet, - dim=8, - fill=0, - auto_dim=False - ) -> None: - NetworkTrafficImage.__init__(self, fill, dim) - self.auto_dim = auto_dim - self.matrix, self.binaries = self.__get_matrix(self.dim, self.auto_dim, self.fill, packet) - - del packet - - def __get_matrix(self, dim: int, auto_dim: int, fill: int, packet: Packet): - # get Hex data - hexst = binascii.hexlify(raw(packet.packet)) - # Append octet as integer - binaries = [int(hexst[i: i + 2], 16) for i in range(0, len(hexst), 2)] - # Get min dim - length = len(binaries) - if auto_dim: - dim = int(np.ceil(np.sqrt(length))) - - # Create array and shape it to dim - fh = np.array(binaries + [fill] * (dim * dim - len(binaries))) - fh = fh[0:dim * dim].reshape(dim, dim) - - fh = np.uint8(fh) - - return fh, binaries diff --git a/heifip/layers/__init__.py b/heifip/layers/__init__.py deleted file mode 100644 index c9a2422..0000000 --- a/heifip/layers/__init__.py +++ /dev/null @@ -1,102 +0,0 @@ -import os -from enum import Enum, unique - -from scapy.all import (Packet,load_layer, - sniff, wrpcap) -from scapy.layers.dns import DNS -from scapy.layers.http import HTTP, HTTPRequest, HTTPResponse -from scapy.layers.inet import IP, TCP, UDP, Ether -from scapy.layers.inet6 import IPv6 - -from heifip.layers.dns import DNSPacket -from heifip.layers.http import (HTTPPacket, HTTPRequestPacket, - HTTPResponsePacket) -from heifip.layers.ip import IPPacket -from heifip.layers.packet import EtherPacket, FIPPacket, UnknownPacket -from heifip.layers.transport import TransportPacket - -__author__ = "Stefan Machmeier" -__copyright__ = "Copyright 2023, heiFIP" -__credits__ = ["Manuel Trageser"] -__license__ = "EUPL" -__version__ = "1.1.1" -__maintainer__ = "Stefan Machmeier" -__email__ = "stefan.machmeier@uni-heidelberg.de" -__status__ = "Production" - -SUPPORTED_HEADERS = [IP, IPv6, DNS, HTTPRequest, HTTPResponse, TCP, UDP] - - -@unique -class PacketProcessorType(Enum): - NONE = 1 - HEADER = 2 - - -class PacketProcessor: - def __init__( - self, - file_extension="pcap", - ) -> None: - self.hash_dict = set() - load_layer("tls") - - def write_packet(self) -> None: - # Write pcap - wrpcap(f"{self.filename}_converted.pcap", self.packets, append=True) - - def read_packets_file(self, file: str, preprocessing_type: PacketProcessorType) -> [FIPPacket]: - assert os.path.isfile(file) - - # Read PCAP file with Scapy - packets = [] - # TODO Only read max number of packets - pcap = sniff(offline=file, count=64) - for pkt in pcap: - # Start preprocessing for each packet - processed_packet = self.__preprocessing(pkt, preprocessing_type) - # TODO Run extract here to reduce amount of loops in code. Atm very inefficient for computation time and memory - # In case packet returns None - if processed_packet != None: - if not processed_packet.hash in self.hash_dict: - # TODO Turn off/on hash filtering - # self.hash_dict.add(processed_packet.hash) - packets.append(processed_packet) - return packets - - - def read_packets_packet(self, packet: [Packet], preprocessing_type: PacketProcessorType) -> [FIPPacket]: - # Read PCAP file with Scapy - packets = [] - for pkt in packet: - # Start preprocessing for each packet - processed_packet = self.__preprocessing(pkt, preprocessing_type) - # In case packet returns None - if processed_packet != None: - if not processed_packet.hash in self.hash_dict: - self.hash_dict.add(processed_packet.hash) - packets.append(processed_packet) - return packets - - def __preprocessing(self, packet: Packet, preprocessing_type: PacketProcessorType) -> FIPPacket: - fippacket = UnknownPacket(packet) - if HTTP in fippacket.layer_map: - if HTTPRequest in fippacket.layer_map: - fippacket = fippacket.convert(HTTPRequestPacket, fippacket) - elif HTTPResponse in fippacket.layer_map: - fippacket = fippacket.convert(HTTPResponsePacket, fippacket) - else: - fippacket = fippacket.convert(HTTPPacket, fippacket) - elif DNS in fippacket.layer_map: - fippacket = fippacket.convert(DNSPacket, fippacket) - elif TCP in fippacket.layer_map or UDP in fippacket.layer_map: - fippacket = fippacket.convert(TransportPacket, fippacket) - elif IP in fippacket.layer_map or IPv6 in fippacket.layer_map: - fippacket = fippacket.convert(IPPacket, fippacket) - elif Ether in fippacket.layer_map: - fippacket = fippacket.convert(EtherPacket, fippacket) - - if preprocessing_type == "HEADER": - fippacket.header_preprocessing() - - return fippacket diff --git a/heifip/layers/dns.py b/heifip/layers/dns.py deleted file mode 100644 index e71f2ab..0000000 --- a/heifip/layers/dns.py +++ /dev/null @@ -1,67 +0,0 @@ -from scapy.all import Packet -from scapy.layers.dns import DNS - -from heifip.layers.transport import TransportPacket -from heifip.plugins.header import CustomDNS, CustomDNSQR, CustomDNSRR - - -class DNSPacket(TransportPacket): - def __init__(self, packet: Packet, address_mapping={}, layer_map={}) -> None: - TransportPacket.__init__(self, packet, address_mapping, layer_map) - - def header_preprocessing(self): - # TODO: Fix issue with DNS processing - if self.packet[DNS].qd: - self.__header_preprocessing_message_type(self.packet, "qd") - if self.packet[DNS].an: - self.__header_preprocessing_message_type(self.packet, "an") - if self.packet[DNS].ns: - self.__header_preprocessing_message_type(self.packet, "ns") - if self.packet[DNS].ar: - self.__header_preprocessing_message_type(self.packet, "ar") - - layer_copy = self.packet[DNS] - - new_layer = CustomDNS( - qr=layer_copy.qr, - opcode=layer_copy.opcode, - aa=layer_copy.aa, - tc=layer_copy.tc, - rd=layer_copy.rd, - ra=layer_copy.ra, - z=layer_copy.z, - ad=layer_copy.ad, - cd=layer_copy.cd, - rcode=layer_copy.rcode, - qd=layer_copy.qd, - an=layer_copy.an, - ns=layer_copy.ns, - ar=layer_copy.ar, - ) - - self.packet[DNS] /= new_layer - - super().header_preprocessing() - - - def __header_preprocessing_message_type(self, packet: Packet, message_type: str): - message = getattr(packet[DNS], message_type) - if message_type == "qd": - new_message = CustomDNSQR(qname=message.qname, qtype=message.qtype) - - while message:=message.payload: - new_message /= CustomDNSQR( - qname=message.qname, - qtype=message.qtype, - ) - else: - new_message = CustomDNSRR( - rrname=message.rrname, type=message.type - ) - - while message:=message.payload: - new_message /= CustomDNSRR( - rrname=message.rrname, type=message.type - ) - - setattr(packet[DNS], message_type, new_message) diff --git a/heifip/layers/http.py b/heifip/layers/http.py deleted file mode 100644 index 04e21cf..0000000 --- a/heifip/layers/http.py +++ /dev/null @@ -1,71 +0,0 @@ -import hashlib - -from scapy.all import Packet, Raw -from scapy.layers.http import HTTPRequest, HTTPResponse - -from heifip.layers.transport import TransportPacket -from heifip.plugins.header import (CustomHTTP_Request, - CustomHTTP_Response) - - -class HTTPPacket(TransportPacket): - def __init__(self, packet: Packet, address_mapping={}, layer_map={}): - TransportPacket.__init__(self, packet, address_mapping, layer_map) - def header_preprocessing(self): - super().header_preprocessing() - - -class HTTPRequestPacket(HTTPPacket): - def __init__(self, packet: Packet, address_mapping={}, layer_map={}): - HTTPPacket.__init__(self, packet, address_mapping, layer_map) - self.hash = hashlib.md5(f"{self.packet[HTTPRequest].Path},{self.packet[HTTPRequest].Method},{self.packet[HTTPRequest].Accept}".encode('utf-8')).hexdigest() - if Raw in self.layer_map: - self.packet[HTTPRequest].remove_payload() - - def header_preprocessing(self): - layer_copy = self.packet[HTTPRequest] - layer_copy = CustomHTTP_Request( - Method=layer_copy.Method, - Path=layer_copy.Path, - User_Agent=layer_copy.User_Agent, - Content_Type=layer_copy.Content_Type, - Connection=layer_copy.Connection, - Accept=layer_copy.Accept, - Accept_Charset=layer_copy.Accept_Charset, - Cookie=layer_copy.Cookie, - TE=layer_copy.TE, - ) - - if not self.packet[HTTPRequest].payload is None: - layer_copy.payload = self.packet[HTTPRequest].payload - - self.packet[HTTPRequest] = layer_copy - - super().header_preprocessing() - - -class HTTPResponsePacket(HTTPPacket): - def __init__(self, packet: Packet, address_mapping={}, layer_map={}): - HTTPPacket.__init__(self, packet, address_mapping, layer_map) - self.hash = hashlib.md5(f"{self.packet[HTTPResponse].Server},{self.packet[HTTPResponse].Status_Code},{self.packet[HTTPResponse].Connection}".encode('utf-8')).hexdigest() - if Raw in self.layer_map: - self.packet[HTTPResponse].remove_payload() - - def header_preprocessing(self): - layer_copy = self.packet[HTTPResponse] - layer_copy = CustomHTTP_Response( - Status_Code=layer_copy.Status_Code, - Server=layer_copy.Server, - Content_Type=layer_copy.Content_Type, - Connection=layer_copy.Connection, - Content_Encoding=layer_copy.Content_Encoding, - Set_Cookie=layer_copy.Set_Cookie, - Transfer_Encoding=layer_copy.Transfer_Encoding, - ) - - if self.packet[HTTPResponse].payload != None: - layer_copy.payload = self.packet[HTTPResponse].payload - - self.packet[HTTPResponse] = layer_copy - - super().header_preprocessing() diff --git a/heifip/layers/ip.py b/heifip/layers/ip.py deleted file mode 100644 index bac8c96..0000000 --- a/heifip/layers/ip.py +++ /dev/null @@ -1,100 +0,0 @@ -import hashlib - -from scapy.all import Packet, RandIP, RandIP6, Raw -from scapy.layers.http import HTTP -from scapy.layers.inet import IP, TCP, UDP -from scapy.layers.inet6 import IPv6 -from scapy.layers.tls.all import TLS - -from heifip.layers.packet import EtherPacket -from heifip.plugins.header import CustomIP, CustomIPv6 - - -class IPPacket(EtherPacket): - def __init__(self, packet: Packet, address_mapping={}, layer_map={}): - EtherPacket.__init__(self, packet, address_mapping, layer_map) - if IP in self.layer_map: - self.__filter_ipv4() - self.hash = hashlib.md5(f"{self.packet[IP].version},{self.packet[IP].flags},{self.packet[IP].proto}".encode('utf-8')).hexdigest() - if TLS in self.layer_map and not (TCP in self.layer_map or UDP in self.layer_map): - self.packet[IP].remove_payload() - if Raw in self.layer_map and not (TCP in self.layer_map or UDP in self.layer_map or HTTP in self.layer_map): - self.packet[IP].remove_payload() - elif IPv6 in self.layer_map: - self.__filter_ipv6() - self.hash = hashlib.md5(f"{self.packet[IPv6].version},{self.packet[IPv6].tc},{self.packet[IPv6].hlim}".encode('utf-8')).hexdigest() - if TLS in self.layer_map and not (TCP in self.layer_map or UDP in self.layer_map): - self.packet[IPv6].remove_payload() - if Raw in self.layer_map and not (TCP in self.layer_map or UDP in self.layer_map or HTTP in self.layer_map): - self.packet[IPv6].remove_payload() - - def __filter_ipv4(self): - previous_src = self.packet[IP].src - previous_dst = self.packet[IP].dst - - if previous_src in self.address_mapping: - new_src = self.address_mapping[previous_src] - else: - new_src = RandIP()._fix() - self.address_mapping[previous_src] = new_src - - if previous_dst in self.address_mapping: - new_dst = self.address_mapping[previous_dst] - else: - new_dst = RandIP()._fix() - self.address_mapping[previous_dst] = new_dst - - self.packet[IP].src = new_src - self.packet[IP].dst = new_dst - - def header_preprocessing(self): - if IP in self.layer_map: - layer_copy = self.packet[IP] - layer_copy = self.header_preprocessing_ipv4(layer_copy) - if self.packet[IP].payload != None: - layer_copy.payload = self.packet[IP].payload - self.packet[IP] = layer_copy - if IPv6 in self.layer_map: - layer_copy = self.packet[IPv6] - layer_copy = self.header_preprocessing_ipv6(layer_copy) - if self.packet[IPv6].payload != None: - layer_copy.payload = self.packet[IPv6].payload - self.packet[IPv6] = layer_copy - - super().header_preprocessing() - - def header_preprocessing_ipv4(self, layer_copy: Packet): - return CustomIP( - version=layer_copy.version, - tos=layer_copy.tos, - ttl=layer_copy.ttl, - flags=layer_copy.flags, - proto=layer_copy.proto, - ) - - def __filter_ipv6(self): - previous_src = self.packet[IPv6].src - previous_dst = self.packet[IPv6].dst - - if previous_src in self.address_mapping: - new_src = self.address_mapping[previous_src] - else: - new_src = RandIP6()._fix() - self.address_mapping[previous_src] = new_src - - if previous_dst in self.address_mapping: - new_dst = self.address_mapping[previous_dst] - else: - new_dst = RandIP6()._fix() - self.address_mapping[previous_dst] = new_dst - - self.packet[IPv6].src = new_src - self.packet[IPv6].dst = new_dst - - def header_preprocessing_ipv6(self, layer_copy: Packet): - return CustomIPv6( - version=layer_copy.version, - tc=layer_copy.tc, - nh=layer_copy.nh, - hlim=layer_copy.hlim, - ) diff --git a/heifip/layers/packet.py b/heifip/layers/packet.py deleted file mode 100644 index 7633c8f..0000000 --- a/heifip/layers/packet.py +++ /dev/null @@ -1,63 +0,0 @@ -import hashlib - -from scapy.all import RandMAC -from scapy.layers.inet import Ether - - -class FIPPacket: - def __init__(self, packet, address_mapping={}, layer_map={}): - self.address_mapping = address_mapping - self.packet = packet - self.hash = hashlib.md5().hexdigest() - - if layer_map == {}: - self.layer_map = self.__get_layers() - - def __get_layers(self): - layer_map = dict() - layers = self.packet.layers() - for layer_class in layers: - layer_map[layer_class] = 1 - return layer_map - - def convert(self, packet_type, packet): - return packet_type(packet.packet, packet.address_mapping, packet.layer_map) - - def header_preprocessing(self): - pass - -class UnknownPacket(FIPPacket): - def __init__(self, packet, address_mapping={}, layer_map={}): - FIPPacket.__init__(self, packet, address_mapping, layer_map) - - def header_preprocessing(self): - super().header_preprocessing() - -class EtherPacket(FIPPacket): - def __init__(self, packet, address_mapping={}, layer_map={}): - FIPPacket.__init__(self, packet, layer_map, address_mapping) - - if Ether in self.layer_map: - self.__filter() - - def __filter(self): - previous_src = self.packet[Ether].src - previous_dst = self.packet[Ether].dst - - if previous_src in self.address_mapping: - new_src = self.address_mapping[previous_src] - else: - new_src = RandMAC()._fix() - self.address_mapping[previous_src] = new_src - - if previous_dst in self.address_mapping: - new_dst = self.address_mapping[previous_dst] - else: - new_dst = RandMAC()._fix() - self.address_mapping[previous_dst] = new_dst - - self.packet[Ether].src = new_src - self.packet[Ether].dst = new_dst - - def header_preprocessing(self): - super().header_preprocessing() \ No newline at end of file diff --git a/heifip/layers/ssh.py b/heifip/layers/ssh.py deleted file mode 100644 index 01581e1..0000000 --- a/heifip/layers/ssh.py +++ /dev/null @@ -1,11 +0,0 @@ -from scapy.all import Packet - -from heifip.layers.transport import TransportPacket - - -class SSHPacketProcessor(TransportPacket): - def __init__(self, packet: Packet, address_mapping={}, layer_map={}): - TransportPacket.__init__(self, packet, address_mapping, layer_map) - - def header_preprocessing(self): - super().header_preprocessing() \ No newline at end of file diff --git a/heifip/layers/transport.py b/heifip/layers/transport.py deleted file mode 100644 index 0f9ecef..0000000 --- a/heifip/layers/transport.py +++ /dev/null @@ -1,50 +0,0 @@ -import hashlib - -from scapy.all import Packet, Raw -from scapy.layers.http import HTTP -from scapy.layers.inet import TCP, UDP -from scapy.layers.tls.all import TLS - -from heifip.layers.ip import IPPacket -from heifip.plugins.header import CustomTCP, CustomUDP - - -class TransportPacket(IPPacket): - def __init__(self, packet: Packet, address_mapping={}, layer_map={}): - IPPacket.__init__(self, packet, address_mapping, layer_map) - if TCP in self.layer_map: - self.hash = hashlib.md5(f"{self.packet[TCP].flags},{self.packet[TCP].options}".encode('utf-8')).hexdigest() - if TLS in self.layer_map: - self.packet[TCP].remove_payload() - if Raw in self.layer_map and not HTTP in self.layer_map: - self.packet[TCP].remove_payload() - elif UDP in self.layer_map: - self.hash = hashlib.md5(f"{self.packet[UDP].name}".encode('utf-8')).hexdigest() - if TLS in self.layer_map: - self.packet[UDP].remove_payload() - if Raw in self.layer_map and not HTTP in self.layer_map: - self.packet[UDP].remove_payload() - - - def header_preprocessing(self): - if TCP in self.layer_map: - layer_copy = self.packet[TCP] - layer_copy = self.header_preprocessing_tcp(layer_copy) - if self.packet[TCP].payload != None: - layer_copy.payload = self.packet[TCP].payload - self.packet[TCP] = layer_copy - - if UDP in self.layer_map: - layer_copy = self.packet[UDP] - layer_copy = self.header_preprocessing_udp(layer_copy) - if self.packet[UDP].payload != None: - layer_copy.payload = self.packet[UDP].payload - self.packet[UDP] = layer_copy - - super().header_preprocessing() - - def header_preprocessing_tcp(self, layer_copy: Packet): - return CustomTCP(flags=layer_copy.flags, options=layer_copy.options) - - def header_preprocessing_udp(self, layer_copy: Packet): - return CustomUDP() diff --git a/heifip/main.py b/heifip/main.py deleted file mode 100644 index 2670213..0000000 --- a/heifip/main.py +++ /dev/null @@ -1,85 +0,0 @@ -import asyncio -import fnmatch -import glob -import logging -import os -from os.path import dirname, realpath -from queue import Queue -from threading import Thread - -from PIL import Image as PILImage -from tqdm import tqdm - -from heifip.extractor import FIPExtractor -from heifip.images.flow import FlowImage - -import pickle - - -class Runner: - def __init__(self, thread_number) -> None: - self.thread_number = thread_number - self.extractor = FIPExtractor() - - def create_image( - self, - input_file: str, - output_dir: str, - pbar, - *args - ): - imgs = self.extractor.create_image_from_file(input_file, *args) - pbar.update(1) - for img in imgs: - self.extractor.save_image(img, output_dir) - - def start_process( - self, - file_queue, - pbar, - *args, - ): - while not file_queue.empty(): - input_file, output_dir = file_queue.get() - self.create_image( - input_file, - output_dir, - pbar, - *args, - ) - file_queue.task_done() - - def run( - self, - input_dir: str, - output_dir: str, - *args - ): - - # Get all executable files in input directory and add them into queue - file_queue = Queue() - total_files = 0 - for root, dirnames, filenames in os.walk(input_dir): - for filename in fnmatch.filter(filenames, "*.pcap"): - match = os.path.join(root, filename) - sub_dir = match.replace(input_dir, "") - file_queue.put((match, f"{output_dir}/{sub_dir}")) - total_files += 1 - - # Start thread - pbar = tqdm(total=total_files) - for _ in range(self.thread_number): - thread = Thread( - target=self.start_process, - args=( - file_queue, - pbar, - *args - ), - ) - thread.daemon = True - thread.start() - file_queue.join() - pbar.close() - # with open('hashes_pkt.pkl', 'wb') as f: - # pickle.dump(self.extractor.processor.hash_dict, f) diff --git a/heifip/plugins/__init__.py b/heifip/plugins/__init__.py deleted file mode 100644 index 799770e..0000000 --- a/heifip/plugins/__init__.py +++ /dev/null @@ -1,10 +0,0 @@ -from . import header - -__author__ = "Stefan Machmeier" -__copyright__ = "Copyright 2023, heiFIP" -__credits__ = ["Manuel Trageser"] -__license__ = "EUPL" -__version__ = "1.1.1" -__maintainer__ = "Stefan Machmeier" -__email__ = "stefan.machmeier@uni-heidelberg.de" -__status__ = "Production" \ No newline at end of file diff --git a/heifip/plugins/header.py b/heifip/plugins/header.py deleted file mode 100644 index e9c2297..0000000 --- a/heifip/plugins/header.py +++ /dev/null @@ -1,123 +0,0 @@ -from scapy.all import (IP_PROTOS, BitEnumField, BitField, - ByteEnumField, ByteField, DNSQRField, DNSRRField, - FlagsField, IntField, Packet, ShortEnumField, - StrField, TCPOptionsField, XByteField) -from scapy.layers.dns import DNSStrField, InheritOriginDNSStrPacket, dnstypes -from scapy.layers.inet6 import ipv6nh - - -class CustomIP(Packet): - name = "IP" - fields_desc = [ - BitField("version", 4, 4), - FlagsField("flags", 0, 4, ["R", "DF", "MF"]), # normally 3 bits last bit will always be 0 - XByteField("tos", 0), - ByteField("ttl", 64), - ByteEnumField("proto", 0, IP_PROTOS), - ] - -class CustomIPv6(Packet): - name = "IPv6" - fields_desc = [ - BitField("version", 6, 8), # normally 4 bits, last 4bits will always be 0 - BitField("tc", 0, 8), - ByteEnumField("nh", 59, ipv6nh), - ByteField("hlim", 64) - ] - -class CustomTCP(Packet): - name = "TCP" - fields_desc = [ - FlagsField("flags", 0x2, 16, "FSRPAUECN"), - TCPOptionsField("options", "") - ] - -class CustomUDP(Packet): - name = "UDP" - fields_desc = [] - -class CustomHTTP(Packet): - def self_build(self): - p = b"" - - for f in self.fields_desc: - val = self.getfieldval(f.name) - #when Value is not set - if not val: - continue - if f.name not in ['Method', 'Path', 'Status_Code']: - val = bytes((f.name).encode()) + b": " + bytes(val) - if f.name in ['Method', 'Path', 'Status_Code']: - seperator = b' ' - else: - seperator = b'\r\n' - - p = f.addfield(self, p, val + seperator) - - return p - - -class CustomHTTP_Request(CustomHTTP): - name = "HTTP Request" - fields_desc = [ - StrField("Method", "GET"), - StrField("Path", "/"), - StrField("User_Agent", None), - StrField("Content_Type", None), - StrField("Connection", None), - StrField("Accept", None), - StrField("Accept_Charset", None), - StrField("Accept_Encoding", None), - StrField("Cookie", None), - StrField("TE", None) - ] - -class CustomHTTP_Response(CustomHTTP): - name = "HTTP Response" - fields_desc = [ - StrField("Status_Code", "200"), - StrField("Connection", None), - StrField("Content_Encoding", None), - StrField("Content_Type", None), - StrField("Server", None), - StrField("Set_Cookie", None), - StrField("Transfer_Encoding", None) - ] - -class CustomDNSQR(InheritOriginDNSStrPacket): - name = "DNS Question Record" - show_indent = 0 - fields_desc = [ - DNSStrField("qname", "none"), - ShortEnumField("qtype", 1, dnstypes) - ] - -class CustomDNSRR(InheritOriginDNSStrPacket): - name = "DNS Resource Record" - show_indent = 0 - fields_desc = [ - DNSStrField("rrname", ""), - ShortEnumField("type", 1, dnstypes), - IntField("ttl", 0) - ] - -class CustomDNS(Packet): - name = "DNS" - fields_desc = [ - BitField("qr", 0, 1), - BitEnumField("opcode", 0, 4, {0: "QUERY", 1: "IQUERY", 2: "STATUS"}), - BitField("aa", 0, 1), - BitField("tc", 0, 1), - BitField("rd", 1, 1), - BitField("ra", 0, 1), - BitField("z", 0, 1), - BitField("ad", 0, 1), - BitField("cd", 0, 1), - BitEnumField("rcode", 0, 4, {0: "ok", 1: "format-error", - 2: "server-failure", 3: "name-error", - 4: "not-implemented", 5: "refused"}), - DNSQRField("qd", "", None), - DNSRRField("an", "", None), - DNSRRField("ns", "", None), - DNSRRField("ar", "", None), - ] diff --git a/heifip/protocols/__init__.py b/heifip/protocols/__init__.py deleted file mode 100644 index 815c5a3..0000000 --- a/heifip/protocols/__init__.py +++ /dev/null @@ -1,10 +0,0 @@ -__author__ = "Stefan Machmeier" -__copyright__ = "Copyright 2023, heiFIP" -__credits__ = ["Manuel Trageser"] -__license__ = "EUPL" -__version__ = "1.1.1" -__maintainer__ = "Stefan Machmeier" -__email__ = "stefan.machmeier@uni-heidelberg.de" -__status__ = "Production" - -from ssh import SSH \ No newline at end of file diff --git a/heifip/protocols/ssh.py b/heifip/protocols/ssh.py deleted file mode 100644 index 4de9f13..0000000 --- a/heifip/protocols/ssh.py +++ /dev/null @@ -1,291 +0,0 @@ - -import hashlib -import os - -from scapy.all import * -from scapy.all import TCP - - -class StrCustomTerminatorField(StrField): - __slots__ = ["remain", "terminator", "consume_terminator"] - - def __init__(self, name, default, fmt="H", remain=0, terminator="\x00\x00", consume_terminator=True): - super().__init__(name, default, fmt, remain) - - self.terminator = terminator - self.consume_terminator = consume_terminator - - def addfield(self, pkt, s, val): - return s+self.i2m(pkt, val)+self.terminator - - def getfield(self, pkt, s): - l = s.find(self.terminator) - if l < 0: - # XXX terminator not found - return "", s - if self.consume_terminator: - return s[l+len(self.terminator):], self.m2i(pkt, s[:l]) - return s[l:], self.m2i(pkt, s[:l]) - - def randval(self): - return RandTermString(RandNum(0, 1200), self.terminator) - - -class HintField(StrField): - def __init__(self, name, default, fmt="H", remain=0): - super().__init__(name, default, fmt, remain) - - def i2len(self, pkt, i): - return 0 - - def i2m(self, pkt, x): - return '' - - -class DynamicStrField(Field): - __slots__ = [ - "name", - "fmt", - "default", - "sz", - "owners", - "struct", - "remain", - "adjust" - ] - - def __init__(self, name, default, fmt="H", remain=0, adjust=lambda pkt, x: x): - - super().__init__(name, default, fmt) - - self.remain = remain - - self.adjust = adjust - - def i2len(self, pkt, i): - return len(i) - - def i2m(self, pkt, x): - if x is None: - x = "" - elif type(x) is not str: - x = str(x) - - x = self.adjust(pkt, x) - return x - - def addfield(self, pkt, s, val): - return s+self.i2m(pkt, val) - - def getfield(self, pkt, s): - if self.remain == 0: - return "", self.m2i(pkt, s) - else: - return s[-self.remain:], self.m2i(pkt, s[:-self.remain]) - - def randval(self): - return RandBin(RandNum(0, 1200)) - - -class BLenField(LenField): - __slots__ = ["adjust", "numbytes", "length_of", "count_of"] - - def __init__(self, name, default, fmt="I", adjust=lambda pkt, x: x, numbytes=None, length_of=None, count_of=None): - self.name = name - self.adjust = adjust - self.numbytes = numbytes - self.length_of = length_of - self.count_of = count_of - super().__init__(name, default, fmt) - - if fmt[0] in "@=<>!": - self.fmt = fmt - else: - self.fmt = "!"+fmt - self.default = self.any2i(None, default) - self.sz = struct.calcsize(self.fmt) if not numbytes else numbytes - self.owners = [] - - def addfield(self, pkt, s, val): - """Add an internal value to a string""" - pack = struct.pack(self.fmt, self.i2m(pkt, val)) - if self.numbytes: - pack = pack[len(pack)-self.numbytes:] - return s+pack - - def getfield(self, pkt, s): - """Extract an internal value from a string""" - upack_data = s[:self.sz] - # prepend struct.calcsize()-len(data) bytes to satisfy struct.unpack - upack_data = '\x00'*(struct.calcsize(self.fmt)-self.sz) + upack_data - - return s[self.sz:], self.m2i(pkt, struct.unpack(self.fmt, upack_data)[0]) - - def i2m(self, pkt, x): - if x is None: - if not (self.length_of or self.count_of): - x = len(pkt.payload) - x = self.adjust(pkt, x) - return x - - if self.length_of is not None: - fld, fval = pkt.getfield_and_val(self.length_of) - f = fld.i2len(pkt, fval) - else: - fld, fval = pkt.getfield_and_val(self.count_of) - f = fld.i2count(pkt, fval) - x = self.adjust(pkt, f) - return x - - -class XBLenField(BLenField): - def i2repr(self, pkt, x): - return lhex(self.i2h(pkt, x)) - - -class XLenField(LenField): - def i2repr(self, pkt, x): - return lhex(self.i2h(pkt, x)) - - -class XFieldLenField(FieldLenField): - def i2repr(self, pkt, x): - return lhex(self.i2h(pkt, x)) - - -SSH_MESSAGE_TYPES = {0x01: "disconnect", - 0x14: "kex_init", - 0x15: "new_keys", - 0xff: "unknown"} -SSH_TYPE_BOOL = {0x00: True, - 0xff: False} - -SSH_ALGO_CIPHERS = "none,aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-gcm@openssh.com,aes256-gcm@openssh.com,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour".split( - ",") -SSH_ALGO_HMACS = "none,hmac-md5-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-ripemd160-etm@openssh.com,hmac-sha1-96-etm@openssh.com,hmac-md5-96-etm@openssh.com,hmac-md5,hmac-sha1,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-ripemd160,hmac-sha1-96,hmac-md5-96".split( - ",") -SSH_ALGO_KEX = "none,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1".split( - ",") -SSH_ALGO_COMPRESSION = "none,zlib,zlib@openssh.com,none".split(",") -SSH_ALGO_HOSTKEY = "none,ecdsa-sha2-nistp521,ssh-rsa,ssh-dss".split(",") - - -def ssh_name_list(name, fmt="!I", numbytes=None, default=''): - return [XBLenField("%s_length" % name, None, length_of="%s" % name, fmt=fmt, numbytes=numbytes), - StrLenField("%s" % name, default, length_from=lambda x:getattr(x, "%s_length" % name)), ] - - -class SSHIdent(Packet): - name = "SSH Ident" - fields_desc = [ - StrField("ident", "SSH-2.0-ScapySSHLayer\r\n"), - ] - - -def ssh_calculate_mac(pkt, x): - if len(x): - return x - if not pkt.mac in ('md5', 'sha-1'): - return x - return getattr(hashlib, pkt.mac)(pkt.data).digest() - - -class SSHEncryptedPacket(Packet): - name = "SSH Encrypted Packet" - fields_desc = [ - StrField("data", None), - DynamicStrField("mac", None, adjust=ssh_calculate_mac), - HintField("encryption", None), - # HintField("mac",'md5'), - HintField("compression", None), - ] - - -class SSHMessage(Packet): - name = "SSH Message" - fields_desc = [ - XBLenField("length", None, fmt="!I", adjust=lambda pkt, - x: x+2 if pkt.lastlayer().haslayer(Raw) else x+2), - XBLenField("padding_length", None, fmt="!B", adjust=lambda pkt, x: len( - pkt.lastlayer()) if pkt.lastlayer().haslayer(Raw) else 0), - ByteEnumField("type", 0xff, SSH_MESSAGE_TYPES), - ] - - -class SSHKexInit(Packet): - name = "SSH Key Exchange Init" - fields_desc = [StrFixedLenField("cookie", os.urandom(16), 16), ] \ - + ssh_name_list("kex_algorithms", default=",".join(SSH_ALGO_KEX)) \ - + ssh_name_list("server_host_key_algorithms", default=",".join(SSH_ALGO_HOSTKEY)) \ - + ssh_name_list("encryption_algorithms_client_to_server", default=",".join(SSH_ALGO_CIPHERS)) \ - + ssh_name_list("encryption_algorithms_server_to_client", default=",".join(SSH_ALGO_CIPHERS)) \ - + ssh_name_list("mac_algorithms_client_to_server", default=",".join(SSH_ALGO_HMACS)) \ - + ssh_name_list("mac_algorithms_server_to_client", default=",".join(SSH_ALGO_HMACS)) \ - + ssh_name_list("compression_algorithms_client_to_server", default=",".join(SSH_ALGO_COMPRESSION)) \ - + ssh_name_list("compression_algorithms_server_to_client", default=",".join(SSH_ALGO_COMPRESSION)) \ - + ssh_name_list("languages_client_to_server") \ - + ssh_name_list("languages_server_to_client") \ - + [ - ByteEnumField("kex_first_packet_follows", 0x00, SSH_TYPE_BOOL), - IntField("reserved", 0x00), - ] - - -SSH_DISCONNECT_REASONS = {1: 'HOST_NOT_ALLOWED_TO_CONNECT', - 2: 'PROTOCOL_ERROR', - 3: 'KEY_EXCHANGE_FAILED', - 4: 'RESERVED', - 5: 'MAC_ERROR', - 6: 'COMPRESSION_ERROR', - 7: 'SERVICE_NOT_AVAILABLE', - 8: 'PROTOCOL_VERSION_NOT_SUPPORTED', - 9: 'HOST_KEY_NOT_VERIFIABLE', - 10: 'CONNECTION_LOST', - 11: 'BY_APPLICATION', - 12: 'TOO_MANY_CONNECTIONS', - 13: 'AUTH_CANCELLED_BY_USER', - 14: 'NO_MORE_AUTH_METHODS_AVAILABLE', - 15: 'ILLEGAL_USER_NAME', - } - - -class SSHDisconnect(Packet): - name = "SSH Disconnect" - fields_desc = [ - IntEnumField("reason", 0xff, SSH_DISCONNECT_REASONS), - StrCustomTerminatorField( - "description", "", terminator="\x00\x00\x00\x00"), - StrCustomTerminatorField( - "language", "", terminator="\x00", consume_terminator=False), - ] - - -class SSH(Packet): - name = "SSH" - - def is_ascii(s): - return all(ord(c) < 128 for c in s) - - def guess_payload_class(self, payload): - - try: - if payload.startswith("SSH-"): - return SSHIdent - - dummy = SSHMessage(payload, _internal=1) - if len(payload) <= dummy.length+4: - return SSHMessage - - except: - pass - return SSHEncryptedPacket - - -# bind magic -bind_layers(TCP, SSH, dport=22) -bind_layers(TCP, SSH, sport=22) - -bind_layers(SSH, SSHMessage) -bind_layers(SSHMessage, SSHKexInit, {'type': 0x14}) -bind_layers(SSHMessage, SSHDisconnect, {'type': 0x01}) -bind_layers(SSH, SSHEncryptedPacket) diff --git a/heifip/splitter.py b/heifip/splitter.py deleted file mode 100644 index f349ac7..0000000 --- a/heifip/splitter.py +++ /dev/null @@ -1,101 +0,0 @@ -# File from pcap-splitter project -# Copyright (C) 2019 Santiago Hernandez Ramos -# For more information about the project: https://github.com/shramos/pcap-splitter - -import subprocess - - -class PcapSplitter: - """Split a .pcap file into different files.""" - - def __init__(self, pcap_path, exefile_path="PcapSplitter"): - # Checks if the PcapSplitter executable exists in path - self._check_binary(exefile_path) - self._exefile_path = exefile_path - self._pcap_path = pcap_path - - def split_by_size(self, size_bytes, dest_path, pkts_bpf_filter=""): - """Split files by size in bytes.""" - args = (self._exefile_path, "-f", self._pcap_path, "-o", dest_path, - "-m", "file-size", "-p", str(size_bytes), "-i", pkts_bpf_filter) - # Execute the PcapSplitter binary - return self._execute(args).decode() - - def split_by_count(self, count_pkts, dest_path, pkts_bpf_filter=""): - """Split files by packet count.""" - args = (self._exefile_path, "-f", self._pcap_path, "-o", dest_path, - "-m", "packet-count", "-p", str(count_pkts), "-i", pkts_bpf_filter) - # Execute the PcapSplitter binary - return self._execute(args).decode() - - def split_by_client_ip(self, dest_path, pkts_bpf_filter=""): - """split files by client IP, meaning all connections with the same client - IP will be in the same file.""" - args = (self._exefile_path, "-f", self._pcap_path, "-o", dest_path, - "-m", "client-ip", "-i", pkts_bpf_filter) - # Execute the PcapSplitter binary - return self._execute(args).decode() - - def split_by_server_ip(self, dest_path, pkts_bpf_filter=""): - """split files by server IP, meaning all connections with the same server - IP will be in the same file.""" - args = (self._exefile_path, "-f", self._pcap_path, "-o", dest_path, - "-m", "server-ip", "-i", pkts_bpf_filter) - # Execute the PcapSplitter binary - return self._execute(args).decode() - - def split_by_server_port(self, dest_path, pkts_bpf_filter=""): - """split files by IP src and dst (2-tuple), meaning all connections with - the same IPs will be in the same file.""" - args = (self._exefile_path, "-f", self._pcap_path, "-o", dest_path, - "-m", "server-port", "-i", pkts_bpf_filter) - # Execute the PcapSplitter binary - return self._execute(args).decode() - - def split_by_ip_src_dst(self, dest_path, pkts_bpf_filter=""): - """split files by IP src and dst (2-tuple), meaning all connections with - the same IPs will be in the same file.""" - args = (self._exefile_path, "-f", self._pcap_path, "-o", dest_path, - "-m", "ip-src-dst", "-i", pkts_bpf_filter) - # Execute the PcapSplitter binary - return self._execute(args).decode() - - def split_by_session(self, dest_path, pkts_bpf_filter=""): - """split files by connection (5-tuple), meaning all packets of a - connection will be in the same file.""" - args = (self._exefile_path, "-f", self._pcap_path, "-o", dest_path, - "-m", "connection", "-i", pkts_bpf_filter) - # Execute the PcapSplitter binary - return self._execute(args).decode() - - def split_by_filter(self, bpf_filter, dest_path, pkts_bpf_filter=""): - """split file into two files: one that contains all packets matching the - given BPF filter (file #0) and one that contains the rest of the packets - (file #1).""" - args = (self._exefile_path, "-f", self._pcap_path, "-o", dest_path, - "-m", "bpf-filter", "-p", bpf_filter, "-i", pkts_bpf_filter) - # Execute the PcapSplitter binary - return self._execute(args).decode() - - def split_by_round_robin(self, n_files, dest_path, pkts_bpf_filter=""): - """split the file in a round-robin manner - each packet to a different - file.""" - args = (self._exefile_path, "-f", self._pcap_path, "-o", dest_path, - "-m", "round-robin", "-p", str(n_files), "-i", pkts_bpf_filter) - # Execute the PcapSplitter binary - return self._execute(args).decode() - - def _execute(self, args): - popen = subprocess.Popen(args, stdout=subprocess.PIPE) - popen.wait() - return popen.stdout.read() - - def _check_binary(self, exefile_path): - try: - subprocess.Popen(exefile_path, stdout=subprocess.PIPE) - except FileNotFoundError: - print("ERROR: PcapSplitter executable not found in the OS. Please \ - check that PcapPlusPlus is correctly installed and PcapSplitter \ - executable is in the path, or indicate the path of the PcapSplitter \ - executable by using the exefile_path parameter when instantiating \ - the PcapSplitter class.\n") \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml deleted file mode 100644 index 1f01c20..0000000 --- a/pyproject.toml +++ /dev/null @@ -1,74 +0,0 @@ -[build-system] -requires = [ "setuptools>=62.0.0" ] -build-backend = "setuptools.build_meta" - -[project] -name = "heifip" -version = "1.1.1" -authors = [ - { name="Stefan Machmeier", email="stefan.machmeier@uni-heidelberg.de" }, -] -description = "A tool to convert network traffic into images for ML use cases." -readme = "README.md" -license = { file="LICENSE" } -requires-python = ">=3.7" -keywords = [ "network" ] -classifiers = [ - "Programming Language :: Python :: 3", - "License :: OSI Approved :: European Union Public Licence 1.2 (EUPL 1.2)", - "Operating System :: OS Independent", - "Operating System :: OS Independent", - 'Intended Audience :: Telecommunications Industry', - 'Intended Audience :: Information Technology', - 'Intended Audience :: System Administrators', - 'Intended Audience :: Science/Research', - 'Intended Audience :: Developers', - 'Programming Language :: Python :: 3 :: Only', - 'Programming Language :: Python :: 3.7', - 'Programming Language :: Python :: 3.8', - 'Programming Language :: Python :: 3.9', - 'Programming Language :: Python :: 3.10', - 'Programming Language :: Python :: 3.11', - 'Topic :: Security', - 'Topic :: Internet :: Log Analysis', - 'Topic :: System :: Networking :: Monitoring', - 'Topic :: Scientific/Engineering :: Artificial Intelligence' -] - -[project.scripts] -fip = "heifip.cli:cli" - -[project.urls] -"Homepage" = "https://github.com/stefanDeveloper/heiFIP" -"Bug Tracker" = "https://github.com/stefanDeveloper/heiFIP/issues" - -[tool.setuptools.packages.find] -include = [ - "heifip*", -] -exclude = [ - "test*", - "assets*", -] - -[tool.poetry] -name = "heiFIP" -version = "1.1.1" -description = "A tool to convert network traffic into images for ML use cases." -license = "EUPL-1.2" -authors = ["Stefan Machmeier"] - -[tool.poetry.dependencies] -scapy = '>=2.5.0' -Pillow = '>=9.4.0' -numpy = '>=1.19.5' -click = '>=8.1.3' -tqdm = '>=4.64.1' -click-help-colors = '>=0.9.1' -pytest = '>=7.2.2' -cryptography = '>=1.0.0' - -[[tool.poetry_bumpversion.replacements]] -files = ["heifip/__init__.py", "heifip/exceptions/__init__.py", "heifip/images/__init__.py", "heifip/layers/__init__.py", "heifip/plugins/__init__.py", "heifip/protocols/__init__.py"] -search = '__version__ = "{current_version}"' -replace = '__version__ = "{new_version}"' \ No newline at end of file diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 81f0c63..0000000 --- a/requirements.txt +++ /dev/null @@ -1,10 +0,0 @@ -# pandas>=1.3.5; platform.python_implementation == 'CPython' -# pandas<=1.3.5; platform.python_implementation == 'PyPy' -scapy>=2.5.0 -Pillow>=9.4.0 -numpy>=1.19.5 -click>=8.1.3 -tqdm>=4.64.1 -click-help-colors>=0.9.1 -pytest>=7.2.2 -cryptography \ No newline at end of file diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 2f283bb..0000000 --- a/setup.cfg +++ /dev/null @@ -1,9 +0,0 @@ -[bdist_wheel] -universal = 0 - -[flake8] -exclude = docs -max-line-length = 255 - - -[aliases] \ No newline at end of file diff --git a/split.py b/split.py deleted file mode 100644 index 0c422f2..0000000 --- a/split.py +++ /dev/null @@ -1,49 +0,0 @@ -import fnmatch -import os -import re - -from heifip.splitter import PcapSplitter - -output_dir = "/home/smachmeier/data/test-data" -input_dir = "/home/smachmeier/data/test-pcaps" -orientation = { - "Cridex": "malware", - "Htbot": "malware", - "Geodo": "malware", - "Miuref": "malware", - "Neris": "malware", - "Nsis-ay": "malware", - "Shifu": "malware", - "Tinba": "malware", - "Virut": "malware", - "Weibo": "malware", - "Zeus": "malware", - "BitTorrent": "benign", - "Facetime": "benign", - "FTP": "benign", - "Gmail": "benign", - "MySQL": "benign", - "Outlook": "benign", - "Skype": "benign", - "SMB": "benign", - "WorldOfWarcraft": "benign" -} - -for root, dirnames, filenames in os.walk(input_dir): - for filename in fnmatch.filter(filenames, "*.pcap"): - match = os.path.join(root, filename) - sub_dir = match.replace(input_dir, "") - # sub_dir = re.sub("(-[0-9])?.pcap", "", sub_dir) - # sub_dir = sub_dir.replace("/", "") - # print(sub_dir.split('/')[1]) - # sub_dir = "malware" - # sub_dir = orientation[sub_dir] - if not os.path.exists(f"{output_dir}/{sub_dir}"): - try: - os.makedirs(f"{output_dir}/{sub_dir}") - except: - pass - ps = PcapSplitter(match) - # ps.split_by_count(10000, "/home/smachmeier/data/test-pcaps", pkts_bpf_filter="ip and (tcp or udp) and not (port 67 or port 68 or port 546 or port 547)") - ps.split_by_session(f"{output_dir}/{sub_dir.split('/')[1]}", pkts_bpf_filter="ip and (tcp or udp) and not (port 67 or port 68 or port 546 or port 547)") - diff --git a/tests.py b/tests.py deleted file mode 100644 index 778da16..0000000 --- a/tests.py +++ /dev/null @@ -1,170 +0,0 @@ -import fnmatch -import os - -import pytest -from scapy.all import rdpcap - -from heifip.extractor import FIPExtractor -from heifip.images.flow import FlowImage -from heifip.images.markovchain import (MarkovTransitionMatrixFlow, - MarkovTransitionMatrixPacket) -from heifip.images.packet import PacketImage -from heifip.layers import PacketProcessorType - -TEST_FOLDER = "./tests/pcaps" -OUTPUT_DIR = "./tests/images" - - -def get_files(): - assert os.path.exists(TEST_FOLDER) - packets = [] - for root, dirnames, filenames in os.walk(TEST_FOLDER): - for filename in fnmatch.filter(filenames, "*.pcap"): - match = os.path.join(root, filename) - sub_dir = match.replace(TEST_FOLDER, "") - packets.append(rdpcap(match)) - return packets[0:25] # Otherwise we break Python... - - -@pytest.mark.parametrize('packet', get_files()) -@pytest.mark.parametrize("append", [True, False]) -@pytest.mark.parametrize("fill", [0, 255]) -@pytest.mark.parametrize("dim", [4, 16]) -@pytest.mark.parametrize( - "min_packets_per_flow", [0, 4] -) -@pytest.mark.parametrize("max_image_dim", [0, 16]) -@pytest.mark.parametrize("min_image_dim", [0, 16]) -@pytest.mark.parametrize("remove_duplicates", [True, False]) -@pytest.mark.parametrize( - "preprocessing_type", [PacketProcessorType.HEADER, PacketProcessorType.NONE] -) -def test_extractor_flow( - packet, - append, - fill, - dim, - min_packets_per_flow, - max_image_dim, - min_image_dim, - remove_duplicates, - preprocessing_type, -): - extractor = FIPExtractor() - extractor.create_image_from_packet( - packet, - preprocessing_type, - FlowImage, - min_image_dim, - max_image_dim, - min_packets_per_flow, - 0, - remove_duplicates, - dim, - fill, - append, - ) - # TODO: Assert matrix... if functions worked fine - -@pytest.mark.parametrize('packet', get_files()) -@pytest.mark.parametrize( - "min_packets_per_flow", [0, 4] -) -@pytest.mark.parametrize( - "max_packets_per_flow", [0, 4] -) -@pytest.mark.parametrize("max_image_dim", [0, 16]) -@pytest.mark.parametrize("min_image_dim", [0, 16]) -@pytest.mark.parametrize("remove_duplicates", [True, False]) -@pytest.mark.parametrize( - "preprocessing_type", [PacketProcessorType.HEADER, PacketProcessorType.NONE] -) -def test_extractor_markovflow( - packet, - min_packets_per_flow, - max_packets_per_flow, - max_image_dim, - min_image_dim, - remove_duplicates, - preprocessing_type, -): - extractor = FIPExtractor() - extractor.create_image_from_packet( - packet, - preprocessing_type, - MarkovTransitionMatrixFlow, - min_image_dim, - max_image_dim, - min_packets_per_flow, - max_packets_per_flow, - remove_duplicates, - ) - # TODO: Assert matrix... if functions worked fine - -@pytest.mark.parametrize('packet', get_files()) -@pytest.mark.parametrize( - "min_packets_per_flow", [0, 4] -) -@pytest.mark.parametrize("max_image_dim", [0, 16]) -@pytest.mark.parametrize("min_image_dim", [0, 16]) -@pytest.mark.parametrize("remove_duplicates", [True, False]) -@pytest.mark.parametrize( - "preprocessing_type", [PacketProcessorType.HEADER, PacketProcessorType.NONE] -) -def test_extractor_markovpacket( - packet, - min_packets_per_flow, - max_image_dim, - min_image_dim, - remove_duplicates, - preprocessing_type, -): - extractor = FIPExtractor() - extractor.create_image_from_packet( - packet, - preprocessing_type, - MarkovTransitionMatrixPacket, - min_image_dim, - max_image_dim, - min_packets_per_flow, - 0, - remove_duplicates, - ) - # TODO: Assert matrix... if functions worked fine - -@pytest.mark.parametrize('packet', get_files()) -@pytest.mark.parametrize("fill", [0, 255]) -@pytest.mark.parametrize("dim", [4, 16]) -@pytest.mark.parametrize("max_image_dim", [0, 16]) -@pytest.mark.parametrize("min_image_dim", [0, 16]) -@pytest.mark.parametrize("remove_duplicates", [True, False]) -@pytest.mark.parametrize( - "preprocessing_type", [PacketProcessorType.HEADER, PacketProcessorType.NONE] -) -def test_extractor_packet( - packet, - fill, - dim, - max_image_dim, - min_image_dim, - remove_duplicates, - preprocessing_type, -): - extractor = FIPExtractor() - extractor.create_image_from_packet( - packet, - preprocessing_type, - PacketImage, - min_image_dim, - max_image_dim, - 0, - 0, - remove_duplicates, - dim, - fill, - False - ) - # TODO: Assert matrix... if functions worked fine - -if __name__ == "__main__": - pytest.main() diff --git a/tests/pcaps/README b/tests/pcaps/README deleted file mode 100644 index 6f8b962..0000000 --- a/tests/pcaps/README +++ /dev/null @@ -1,6 +0,0 @@ -These are the trace files that are used by the Zeek test suite. - -Note to maintainers: please take care when modifying/removing files from here. -We install these traces with the Zeek distribution and external packages might -depend on them for tests. - diff --git a/tests/pcaps/arp-leak.pcap b/tests/pcaps/arp-leak.pcap deleted file mode 100644 index a499192..0000000 Binary files a/tests/pcaps/arp-leak.pcap and /dev/null differ diff --git a/tests/pcaps/arp-who-has-radiotap.pcap b/tests/pcaps/arp-who-has-radiotap.pcap deleted file mode 100644 index 4f53210..0000000 Binary files a/tests/pcaps/arp-who-has-radiotap.pcap and /dev/null differ diff --git a/tests/pcaps/arp-who-has-wlanmon.pcap b/tests/pcaps/arp-who-has-wlanmon.pcap deleted file mode 100644 index 7d54788..0000000 Binary files a/tests/pcaps/arp-who-has-wlanmon.pcap and /dev/null differ diff --git a/tests/pcaps/arp-who-has.pcap b/tests/pcaps/arp-who-has.pcap deleted file mode 100644 index 085dddf..0000000 Binary files a/tests/pcaps/arp-who-has.pcap and /dev/null differ diff --git a/tests/pcaps/auth_change_session_keys.pcap b/tests/pcaps/auth_change_session_keys.pcap deleted file mode 100644 index 32ff0f7..0000000 Binary files a/tests/pcaps/auth_change_session_keys.pcap and /dev/null differ diff --git a/tests/pcaps/bittorrent/tracker.pcap b/tests/pcaps/bittorrent/tracker.pcap deleted file mode 100644 index a0bccfe..0000000 Binary files a/tests/pcaps/bittorrent/tracker.pcap and /dev/null differ diff --git a/tests/pcaps/chksums/ip4-bad-chksum.pcap b/tests/pcaps/chksums/ip4-bad-chksum.pcap deleted file mode 100644 index 6d8b9dd..0000000 Binary files a/tests/pcaps/chksums/ip4-bad-chksum.pcap and /dev/null differ diff --git a/tests/pcaps/chksums/ip4-icmp-bad-chksum.pcap b/tests/pcaps/chksums/ip4-icmp-bad-chksum.pcap deleted file mode 100644 index cc60d87..0000000 Binary files a/tests/pcaps/chksums/ip4-icmp-bad-chksum.pcap and /dev/null differ diff --git a/tests/pcaps/chksums/ip4-icmp-good-chksum.pcap b/tests/pcaps/chksums/ip4-icmp-good-chksum.pcap deleted file mode 100644 index 2b07326..0000000 Binary files a/tests/pcaps/chksums/ip4-icmp-good-chksum.pcap and /dev/null differ diff --git a/tests/pcaps/chksums/ip4-tcp-bad-chksum.pcap b/tests/pcaps/chksums/ip4-tcp-bad-chksum.pcap deleted file mode 100644 index b9ccd9e..0000000 Binary files a/tests/pcaps/chksums/ip4-tcp-bad-chksum.pcap and /dev/null differ diff --git a/tests/pcaps/chksums/ip4-tcp-good-chksum.pcap b/tests/pcaps/chksums/ip4-tcp-good-chksum.pcap deleted file mode 100644 index ff3f011..0000000 Binary files a/tests/pcaps/chksums/ip4-tcp-good-chksum.pcap and /dev/null differ diff --git a/tests/pcaps/chksums/ip4-udp-bad-chksum.pcap b/tests/pcaps/chksums/ip4-udp-bad-chksum.pcap deleted file mode 100644 index f3998c7..0000000 Binary files a/tests/pcaps/chksums/ip4-udp-bad-chksum.pcap and /dev/null differ diff --git a/tests/pcaps/chksums/ip4-udp-good-chksum.pcap b/tests/pcaps/chksums/ip4-udp-good-chksum.pcap deleted file mode 100644 index 3aec507..0000000 Binary files a/tests/pcaps/chksums/ip4-udp-good-chksum.pcap and /dev/null differ diff --git a/tests/pcaps/chksums/ip6-hoa-tcp-bad-chksum.pcap b/tests/pcaps/chksums/ip6-hoa-tcp-bad-chksum.pcap deleted file mode 100644 index 3aa4bd2..0000000 Binary files a/tests/pcaps/chksums/ip6-hoa-tcp-bad-chksum.pcap and /dev/null differ diff --git a/tests/pcaps/chksums/ip6-hoa-tcp-good-chksum.pcap b/tests/pcaps/chksums/ip6-hoa-tcp-good-chksum.pcap deleted file mode 100644 index a6fc9cb..0000000 Binary files a/tests/pcaps/chksums/ip6-hoa-tcp-good-chksum.pcap and /dev/null differ diff --git a/tests/pcaps/chksums/ip6-hoa-udp-bad-chksum.pcap b/tests/pcaps/chksums/ip6-hoa-udp-bad-chksum.pcap deleted file mode 100644 index d2434de..0000000 Binary files a/tests/pcaps/chksums/ip6-hoa-udp-bad-chksum.pcap and /dev/null differ diff --git a/tests/pcaps/chksums/ip6-hoa-udp-good-chksum.pcap b/tests/pcaps/chksums/ip6-hoa-udp-good-chksum.pcap deleted file mode 100644 index f3e9d63..0000000 Binary files a/tests/pcaps/chksums/ip6-hoa-udp-good-chksum.pcap and /dev/null differ diff --git a/tests/pcaps/chksums/ip6-icmp6-bad-chksum.pcap b/tests/pcaps/chksums/ip6-icmp6-bad-chksum.pcap deleted file mode 100644 index ce1dfa5..0000000 Binary files a/tests/pcaps/chksums/ip6-icmp6-bad-chksum.pcap and /dev/null differ diff --git a/tests/pcaps/chksums/ip6-icmp6-good-chksum.pcap b/tests/pcaps/chksums/ip6-icmp6-good-chksum.pcap deleted file mode 100644 index 4051fa5..0000000 Binary files a/tests/pcaps/chksums/ip6-icmp6-good-chksum.pcap and /dev/null differ diff --git a/tests/pcaps/chksums/ip6-route0-icmp6-bad-chksum.pcap b/tests/pcaps/chksums/ip6-route0-icmp6-bad-chksum.pcap deleted file mode 100644 index 15e11ed..0000000 Binary files a/tests/pcaps/chksums/ip6-route0-icmp6-bad-chksum.pcap and /dev/null differ diff --git a/tests/pcaps/chksums/ip6-route0-icmp6-good-chksum.pcap b/tests/pcaps/chksums/ip6-route0-icmp6-good-chksum.pcap deleted file mode 100644 index b7924ca..0000000 Binary files a/tests/pcaps/chksums/ip6-route0-icmp6-good-chksum.pcap and /dev/null differ diff --git a/tests/pcaps/chksums/ip6-route0-tcp-bad-chksum.pcap b/tests/pcaps/chksums/ip6-route0-tcp-bad-chksum.pcap deleted file mode 100644 index 0f5711f..0000000 Binary files a/tests/pcaps/chksums/ip6-route0-tcp-bad-chksum.pcap and /dev/null differ diff --git a/tests/pcaps/chksums/ip6-route0-tcp-good-chksum.pcap b/tests/pcaps/chksums/ip6-route0-tcp-good-chksum.pcap deleted file mode 100644 index 18f9a36..0000000 Binary files a/tests/pcaps/chksums/ip6-route0-tcp-good-chksum.pcap and /dev/null differ diff --git a/tests/pcaps/chksums/ip6-route0-udp-bad-chksum.pcap b/tests/pcaps/chksums/ip6-route0-udp-bad-chksum.pcap deleted file mode 100644 index b4eecae..0000000 Binary files a/tests/pcaps/chksums/ip6-route0-udp-bad-chksum.pcap and /dev/null differ diff --git a/tests/pcaps/chksums/ip6-route0-udp-good-chksum.pcap b/tests/pcaps/chksums/ip6-route0-udp-good-chksum.pcap deleted file mode 100644 index deb1310..0000000 Binary files a/tests/pcaps/chksums/ip6-route0-udp-good-chksum.pcap and /dev/null differ diff --git a/tests/pcaps/chksums/ip6-tcp-bad-chksum.pcap b/tests/pcaps/chksums/ip6-tcp-bad-chksum.pcap deleted file mode 100644 index 38d8abf..0000000 Binary files a/tests/pcaps/chksums/ip6-tcp-bad-chksum.pcap and /dev/null differ diff --git a/tests/pcaps/chksums/ip6-tcp-good-chksum.pcap b/tests/pcaps/chksums/ip6-tcp-good-chksum.pcap deleted file mode 100644 index 9ab19b0..0000000 Binary files a/tests/pcaps/chksums/ip6-tcp-good-chksum.pcap and /dev/null differ diff --git a/tests/pcaps/chksums/ip6-udp-bad-chksum.pcap b/tests/pcaps/chksums/ip6-udp-bad-chksum.pcap deleted file mode 100644 index 25aa3fc..0000000 Binary files a/tests/pcaps/chksums/ip6-udp-bad-chksum.pcap and /dev/null differ diff --git a/tests/pcaps/chksums/ip6-udp-good-chksum.pcap b/tests/pcaps/chksums/ip6-udp-good-chksum.pcap deleted file mode 100644 index b72b866..0000000 Binary files a/tests/pcaps/chksums/ip6-udp-good-chksum.pcap and /dev/null differ diff --git a/tests/pcaps/chksums/localhost-bad-chksum.pcap b/tests/pcaps/chksums/localhost-bad-chksum.pcap deleted file mode 100644 index 1200e9c..0000000 Binary files a/tests/pcaps/chksums/localhost-bad-chksum.pcap and /dev/null differ diff --git a/tests/pcaps/chksums/mip6-bad-mh-chksum.pcap b/tests/pcaps/chksums/mip6-bad-mh-chksum.pcap deleted file mode 100644 index 9a2437b..0000000 Binary files a/tests/pcaps/chksums/mip6-bad-mh-chksum.pcap and /dev/null differ diff --git a/tests/pcaps/chksums/mip6-good-mh-chksum.pcap b/tests/pcaps/chksums/mip6-good-mh-chksum.pcap deleted file mode 100644 index 6183fd9..0000000 Binary files a/tests/pcaps/chksums/mip6-good-mh-chksum.pcap and /dev/null differ diff --git a/tests/pcaps/cisco-fabric-path.pcap b/tests/pcaps/cisco-fabric-path.pcap deleted file mode 100644 index f238a06..0000000 Binary files a/tests/pcaps/cisco-fabric-path.pcap and /dev/null differ diff --git a/tests/pcaps/conn-size.trace b/tests/pcaps/conn-size.trace deleted file mode 100644 index 8b03d7a..0000000 Binary files a/tests/pcaps/conn-size.trace and /dev/null differ diff --git a/tests/pcaps/contentline-irc-5k-line.pcap b/tests/pcaps/contentline-irc-5k-line.pcap deleted file mode 100644 index 94c8815..0000000 Binary files a/tests/pcaps/contentline-irc-5k-line.pcap and /dev/null differ diff --git a/tests/pcaps/dce-rpc/cs_window7-join_stream092.pcap b/tests/pcaps/dce-rpc/cs_window7-join_stream092.pcap deleted file mode 100644 index c867e07..0000000 Binary files a/tests/pcaps/dce-rpc/cs_window7-join_stream092.pcap and /dev/null differ diff --git a/tests/pcaps/dce-rpc/dce_rpc_netlogon.pcap b/tests/pcaps/dce-rpc/dce_rpc_netlogon.pcap deleted file mode 100644 index 3de5d2c..0000000 Binary files a/tests/pcaps/dce-rpc/dce_rpc_netlogon.pcap and /dev/null differ diff --git a/tests/pcaps/dce-rpc/dce_rpc_ntlm.pcap b/tests/pcaps/dce-rpc/dce_rpc_ntlm.pcap deleted file mode 100644 index fc55742..0000000 Binary files a/tests/pcaps/dce-rpc/dce_rpc_ntlm.pcap and /dev/null differ diff --git a/tests/pcaps/dce-rpc/mapi.pcap b/tests/pcaps/dce-rpc/mapi.pcap deleted file mode 100644 index f5b94b8..0000000 Binary files a/tests/pcaps/dce-rpc/mapi.pcap and /dev/null differ diff --git a/tests/pcaps/dce-rpc/ntlm-empty-av-sequence.pcap b/tests/pcaps/dce-rpc/ntlm-empty-av-sequence.pcap deleted file mode 100644 index bc8253d..0000000 Binary files a/tests/pcaps/dce-rpc/ntlm-empty-av-sequence.pcap and /dev/null differ diff --git a/tests/pcaps/dce-rpc/ntlm-unterminated-av-sequence.pcap b/tests/pcaps/dce-rpc/ntlm-unterminated-av-sequence.pcap deleted file mode 100644 index 136f755..0000000 Binary files a/tests/pcaps/dce-rpc/ntlm-unterminated-av-sequence.pcap and /dev/null differ diff --git a/tests/pcaps/dhcp/dhcp.trace b/tests/pcaps/dhcp/dhcp.trace deleted file mode 100644 index aeb00a1..0000000 Binary files a/tests/pcaps/dhcp/dhcp.trace and /dev/null differ diff --git a/tests/pcaps/dhcp/dhcp_ack_subscriber_id_and_agent_remote_id.trace b/tests/pcaps/dhcp/dhcp_ack_subscriber_id_and_agent_remote_id.trace deleted file mode 100644 index b5e72d4..0000000 Binary files a/tests/pcaps/dhcp/dhcp_ack_subscriber_id_and_agent_remote_id.trace and /dev/null differ diff --git a/tests/pcaps/dhcp/dhcp_discover_param_req_and_client_id.trace b/tests/pcaps/dhcp/dhcp_discover_param_req_and_client_id.trace deleted file mode 100644 index bfdbb54..0000000 Binary files a/tests/pcaps/dhcp/dhcp_discover_param_req_and_client_id.trace and /dev/null differ diff --git a/tests/pcaps/dhcp/dhcp_flood.pcap b/tests/pcaps/dhcp/dhcp_flood.pcap deleted file mode 100644 index fef54d6..0000000 Binary files a/tests/pcaps/dhcp/dhcp_flood.pcap and /dev/null differ diff --git a/tests/pcaps/dhcp/dhcp_inform.trace b/tests/pcaps/dhcp/dhcp_inform.trace deleted file mode 100644 index 798ca84..0000000 Binary files a/tests/pcaps/dhcp/dhcp_inform.trace and /dev/null differ diff --git a/tests/pcaps/dhcp/dhcp_time_and_nameserver.trace b/tests/pcaps/dhcp/dhcp_time_and_nameserver.trace deleted file mode 100644 index 3395e48..0000000 Binary files a/tests/pcaps/dhcp/dhcp_time_and_nameserver.trace and /dev/null differ diff --git a/tests/pcaps/dhcp/hw-type0.pcap b/tests/pcaps/dhcp/hw-type0.pcap deleted file mode 100644 index c8f314f..0000000 Binary files a/tests/pcaps/dhcp/hw-type0.pcap and /dev/null differ diff --git a/tests/pcaps/dnp3/dnp3.trace b/tests/pcaps/dnp3/dnp3.trace deleted file mode 100644 index 8ee8d3e..0000000 Binary files a/tests/pcaps/dnp3/dnp3.trace and /dev/null differ diff --git a/tests/pcaps/dnp3/dnp3_del_measure.pcap b/tests/pcaps/dnp3/dnp3_del_measure.pcap deleted file mode 100644 index 888dfd3..0000000 Binary files a/tests/pcaps/dnp3/dnp3_del_measure.pcap and /dev/null differ diff --git a/tests/pcaps/dnp3/dnp3_en_spon.pcap b/tests/pcaps/dnp3/dnp3_en_spon.pcap deleted file mode 100644 index 5a0b67e..0000000 Binary files a/tests/pcaps/dnp3/dnp3_en_spon.pcap and /dev/null differ diff --git a/tests/pcaps/dnp3/dnp3_file_del.pcap b/tests/pcaps/dnp3/dnp3_file_del.pcap deleted file mode 100644 index 1703907..0000000 Binary files a/tests/pcaps/dnp3/dnp3_file_del.pcap and /dev/null differ diff --git a/tests/pcaps/dnp3/dnp3_file_read.pcap b/tests/pcaps/dnp3/dnp3_file_read.pcap deleted file mode 100644 index 450ca88..0000000 Binary files a/tests/pcaps/dnp3/dnp3_file_read.pcap and /dev/null differ diff --git a/tests/pcaps/dnp3/dnp3_file_write.pcap b/tests/pcaps/dnp3/dnp3_file_write.pcap deleted file mode 100644 index 571720b..0000000 Binary files a/tests/pcaps/dnp3/dnp3_file_write.pcap and /dev/null differ diff --git a/tests/pcaps/dnp3/dnp3_link_only.pcap b/tests/pcaps/dnp3/dnp3_link_only.pcap deleted file mode 100755 index d08bb39..0000000 Binary files a/tests/pcaps/dnp3/dnp3_link_only.pcap and /dev/null differ diff --git a/tests/pcaps/dnp3/dnp3_read.pcap b/tests/pcaps/dnp3/dnp3_read.pcap deleted file mode 100644 index 4834b2a..0000000 Binary files a/tests/pcaps/dnp3/dnp3_read.pcap and /dev/null differ diff --git a/tests/pcaps/dnp3/dnp3_read_p20001.pcap b/tests/pcaps/dnp3/dnp3_read_p20001.pcap deleted file mode 100644 index ab5cf11..0000000 Binary files a/tests/pcaps/dnp3/dnp3_read_p20001.pcap and /dev/null differ diff --git a/tests/pcaps/dnp3/dnp3_rec_time.pcap b/tests/pcaps/dnp3/dnp3_rec_time.pcap deleted file mode 100644 index 43774d6..0000000 Binary files a/tests/pcaps/dnp3/dnp3_rec_time.pcap and /dev/null differ diff --git a/tests/pcaps/dnp3/dnp3_select_operate.pcap b/tests/pcaps/dnp3/dnp3_select_operate.pcap deleted file mode 100644 index fb9052c..0000000 Binary files a/tests/pcaps/dnp3/dnp3_select_operate.pcap and /dev/null differ diff --git a/tests/pcaps/dnp3/dnp3_udp_en_spon.pcap b/tests/pcaps/dnp3/dnp3_udp_en_spon.pcap deleted file mode 100755 index f9e6078..0000000 Binary files a/tests/pcaps/dnp3/dnp3_udp_en_spon.pcap and /dev/null differ diff --git a/tests/pcaps/dnp3/dnp3_udp_read.pcap b/tests/pcaps/dnp3/dnp3_udp_read.pcap deleted file mode 100755 index f089d12..0000000 Binary files a/tests/pcaps/dnp3/dnp3_udp_read.pcap and /dev/null differ diff --git a/tests/pcaps/dnp3/dnp3_udp_select_operate.pcap b/tests/pcaps/dnp3/dnp3_udp_select_operate.pcap deleted file mode 100755 index 70b0e2c..0000000 Binary files a/tests/pcaps/dnp3/dnp3_udp_select_operate.pcap and /dev/null differ diff --git a/tests/pcaps/dnp3/dnp3_udp_write.pcap b/tests/pcaps/dnp3/dnp3_udp_write.pcap deleted file mode 100755 index dc9125f..0000000 Binary files a/tests/pcaps/dnp3/dnp3_udp_write.pcap and /dev/null differ diff --git a/tests/pcaps/dnp3/dnp3_write.pcap b/tests/pcaps/dnp3/dnp3_write.pcap deleted file mode 100644 index f1fd3ec..0000000 Binary files a/tests/pcaps/dnp3/dnp3_write.pcap and /dev/null differ diff --git a/tests/pcaps/dns-caa.pcap b/tests/pcaps/dns-caa.pcap deleted file mode 100644 index 7409c03..0000000 Binary files a/tests/pcaps/dns-caa.pcap and /dev/null differ diff --git a/tests/pcaps/dns-edns-cookie.pcap b/tests/pcaps/dns-edns-cookie.pcap deleted file mode 100644 index 07b5ab1..0000000 Binary files a/tests/pcaps/dns-edns-cookie.pcap and /dev/null differ diff --git a/tests/pcaps/dns-edns-ecs-bad.pcap b/tests/pcaps/dns-edns-ecs-bad.pcap deleted file mode 100644 index be4f7a9..0000000 Binary files a/tests/pcaps/dns-edns-ecs-bad.pcap and /dev/null differ diff --git a/tests/pcaps/dns-edns-ecs-weirds.pcap b/tests/pcaps/dns-edns-ecs-weirds.pcap deleted file mode 100644 index 6491a0b..0000000 Binary files a/tests/pcaps/dns-edns-ecs-weirds.pcap and /dev/null differ diff --git a/tests/pcaps/dns-edns-ecs.pcap b/tests/pcaps/dns-edns-ecs.pcap deleted file mode 100644 index 0357459..0000000 Binary files a/tests/pcaps/dns-edns-ecs.pcap and /dev/null differ diff --git a/tests/pcaps/dns-edns-tcp-keepalive.pcap b/tests/pcaps/dns-edns-tcp-keepalive.pcap deleted file mode 100644 index 07b5ab1..0000000 Binary files a/tests/pcaps/dns-edns-tcp-keepalive.pcap and /dev/null differ diff --git a/tests/pcaps/dns-https.pcap b/tests/pcaps/dns-https.pcap deleted file mode 100644 index b2c397e..0000000 Binary files a/tests/pcaps/dns-https.pcap and /dev/null differ diff --git a/tests/pcaps/dns-huge-ttl.pcap b/tests/pcaps/dns-huge-ttl.pcap deleted file mode 100644 index 5e9afda..0000000 Binary files a/tests/pcaps/dns-huge-ttl.pcap and /dev/null differ diff --git a/tests/pcaps/dns-inverse-query.trace b/tests/pcaps/dns-inverse-query.trace deleted file mode 100644 index 2ce7892..0000000 Binary files a/tests/pcaps/dns-inverse-query.trace and /dev/null differ diff --git a/tests/pcaps/dns-spf.pcap b/tests/pcaps/dns-spf.pcap deleted file mode 100644 index 4781bcd..0000000 Binary files a/tests/pcaps/dns-spf.pcap and /dev/null differ diff --git a/tests/pcaps/dns-svcb.pcap b/tests/pcaps/dns-svcb.pcap deleted file mode 100644 index 3060bda..0000000 Binary files a/tests/pcaps/dns-svcb.pcap and /dev/null differ diff --git a/tests/pcaps/dns-tsig.trace b/tests/pcaps/dns-tsig.trace deleted file mode 100644 index 9f377b1..0000000 Binary files a/tests/pcaps/dns-tsig.trace and /dev/null differ diff --git a/tests/pcaps/dns-two-responses.trace b/tests/pcaps/dns-two-responses.trace deleted file mode 100644 index 627b0d2..0000000 Binary files a/tests/pcaps/dns-two-responses.trace and /dev/null differ diff --git a/tests/pcaps/dns-txt-multiple.trace b/tests/pcaps/dns-txt-multiple.trace deleted file mode 100644 index ef02181..0000000 Binary files a/tests/pcaps/dns-txt-multiple.trace and /dev/null differ diff --git a/tests/pcaps/dns-zero-RRs.trace b/tests/pcaps/dns-zero-RRs.trace deleted file mode 100644 index 0f4785b..0000000 Binary files a/tests/pcaps/dns-zero-RRs.trace and /dev/null differ diff --git a/tests/pcaps/dns/dns-binds.pcap b/tests/pcaps/dns/dns-binds.pcap deleted file mode 100644 index 92ccc41..0000000 Binary files a/tests/pcaps/dns/dns-binds.pcap and /dev/null differ diff --git a/tests/pcaps/dns/dns-wks.pcap b/tests/pcaps/dns/dns-wks.pcap deleted file mode 100644 index b82f5c4..0000000 Binary files a/tests/pcaps/dns/dns-wks.pcap and /dev/null differ diff --git a/tests/pcaps/dns/hinfo.pcap b/tests/pcaps/dns/hinfo.pcap deleted file mode 100644 index 07d4cac..0000000 Binary files a/tests/pcaps/dns/hinfo.pcap and /dev/null differ diff --git a/tests/pcaps/dns/loc-29-trunc.pcap b/tests/pcaps/dns/loc-29-trunc.pcap deleted file mode 100644 index 484b9e4..0000000 Binary files a/tests/pcaps/dns/loc-29-trunc.pcap and /dev/null differ diff --git a/tests/pcaps/dns/sshfp-trunc.pcap b/tests/pcaps/dns/sshfp-trunc.pcap deleted file mode 100644 index 901654c..0000000 Binary files a/tests/pcaps/dns/sshfp-trunc.pcap and /dev/null differ diff --git a/tests/pcaps/dns53.pcap b/tests/pcaps/dns53.pcap deleted file mode 100644 index 2d97aca..0000000 Binary files a/tests/pcaps/dns53.pcap and /dev/null differ diff --git a/tests/pcaps/dns_original_case.pcap b/tests/pcaps/dns_original_case.pcap deleted file mode 100644 index b9348e0..0000000 Binary files a/tests/pcaps/dns_original_case.pcap and /dev/null differ diff --git a/tests/pcaps/dnssec/dnskey.pcap b/tests/pcaps/dnssec/dnskey.pcap deleted file mode 100644 index dba5161..0000000 Binary files a/tests/pcaps/dnssec/dnskey.pcap and /dev/null differ diff --git a/tests/pcaps/dnssec/dnskey2.pcap b/tests/pcaps/dnssec/dnskey2.pcap deleted file mode 100644 index c7a6448..0000000 Binary files a/tests/pcaps/dnssec/dnskey2.pcap and /dev/null differ diff --git a/tests/pcaps/dnssec/ds.pcap b/tests/pcaps/dnssec/ds.pcap deleted file mode 100644 index 51a269f..0000000 Binary files a/tests/pcaps/dnssec/ds.pcap and /dev/null differ diff --git a/tests/pcaps/dnssec/nsec.pcap b/tests/pcaps/dnssec/nsec.pcap deleted file mode 100644 index 355b782..0000000 Binary files a/tests/pcaps/dnssec/nsec.pcap and /dev/null differ diff --git a/tests/pcaps/dnssec/nsec3.pcap b/tests/pcaps/dnssec/nsec3.pcap deleted file mode 100644 index 8346c1f..0000000 Binary files a/tests/pcaps/dnssec/nsec3.pcap and /dev/null differ diff --git a/tests/pcaps/dnssec/nsec3param.pcap b/tests/pcaps/dnssec/nsec3param.pcap deleted file mode 100644 index f68df0c..0000000 Binary files a/tests/pcaps/dnssec/nsec3param.pcap and /dev/null differ diff --git a/tests/pcaps/dnssec/rrsig.pcap b/tests/pcaps/dnssec/rrsig.pcap deleted file mode 100644 index e9dbf73..0000000 Binary files a/tests/pcaps/dnssec/rrsig.pcap and /dev/null differ diff --git a/tests/pcaps/echo-connections.pcap.gz b/tests/pcaps/echo-connections.pcap.gz deleted file mode 100644 index 27b8f0a..0000000 Binary files a/tests/pcaps/echo-connections.pcap.gz and /dev/null differ diff --git a/tests/pcaps/empty.trace b/tests/pcaps/empty.trace deleted file mode 100644 index 3ee1117..0000000 Binary files a/tests/pcaps/empty.trace and /dev/null differ diff --git a/tests/pcaps/erspan.trace b/tests/pcaps/erspan.trace deleted file mode 100644 index 6438264..0000000 Binary files a/tests/pcaps/erspan.trace and /dev/null differ diff --git a/tests/pcaps/erspanI.pcap b/tests/pcaps/erspanI.pcap deleted file mode 100644 index f137d40..0000000 Binary files a/tests/pcaps/erspanI.pcap and /dev/null differ diff --git a/tests/pcaps/erspanII.pcap b/tests/pcaps/erspanII.pcap deleted file mode 100644 index 4ce446a..0000000 Binary files a/tests/pcaps/erspanII.pcap and /dev/null differ diff --git a/tests/pcaps/erspanIII.pcap b/tests/pcaps/erspanIII.pcap deleted file mode 100644 index 787ec64..0000000 Binary files a/tests/pcaps/erspanIII.pcap and /dev/null differ diff --git a/tests/pcaps/finger/standard.pcap b/tests/pcaps/finger/standard.pcap deleted file mode 100644 index d5288e8..0000000 Binary files a/tests/pcaps/finger/standard.pcap and /dev/null differ diff --git a/tests/pcaps/finger/verbose.pcap b/tests/pcaps/finger/verbose.pcap deleted file mode 100644 index 28c2188..0000000 Binary files a/tests/pcaps/finger/verbose.pcap and /dev/null differ diff --git a/tests/pcaps/ftp/bigtransfer.pcap b/tests/pcaps/ftp/bigtransfer.pcap deleted file mode 100644 index f08f051..0000000 Binary files a/tests/pcaps/ftp/bigtransfer.pcap and /dev/null differ diff --git a/tests/pcaps/ftp/bruteforce.pcap b/tests/pcaps/ftp/bruteforce.pcap deleted file mode 100644 index 46bdb56..0000000 Binary files a/tests/pcaps/ftp/bruteforce.pcap and /dev/null differ diff --git a/tests/pcaps/ftp/cwd-navigation.pcap b/tests/pcaps/ftp/cwd-navigation.pcap deleted file mode 100644 index 0b0990c..0000000 Binary files a/tests/pcaps/ftp/cwd-navigation.pcap and /dev/null differ diff --git a/tests/pcaps/ftp/fake-long-commands.pcap b/tests/pcaps/ftp/fake-long-commands.pcap deleted file mode 100644 index 8a31502..0000000 Binary files a/tests/pcaps/ftp/fake-long-commands.pcap and /dev/null differ diff --git a/tests/pcaps/ftp/fake-server-delays-all.pcap b/tests/pcaps/ftp/fake-server-delays-all.pcap deleted file mode 100644 index 47ba1b6..0000000 Binary files a/tests/pcaps/ftp/fake-server-delays-all.pcap and /dev/null differ diff --git a/tests/pcaps/ftp/ftp-invalid-reply-code.pcap b/tests/pcaps/ftp/ftp-invalid-reply-code.pcap deleted file mode 100644 index 09de02e..0000000 Binary files a/tests/pcaps/ftp/ftp-invalid-reply-code.pcap and /dev/null differ diff --git a/tests/pcaps/ftp/ftp-missing-reply-code.pcap b/tests/pcaps/ftp/ftp-missing-reply-code.pcap deleted file mode 100644 index 3f32d6a..0000000 Binary files a/tests/pcaps/ftp/ftp-missing-reply-code.pcap and /dev/null differ diff --git a/tests/pcaps/ftp/ftp-missing-space-after-reply-code.pcap b/tests/pcaps/ftp/ftp-missing-space-after-reply-code.pcap deleted file mode 100644 index 6c1f7c5..0000000 Binary files a/tests/pcaps/ftp/ftp-missing-space-after-reply-code.pcap and /dev/null differ diff --git a/tests/pcaps/ftp/ftp-with-numbers-in-filename.pcap b/tests/pcaps/ftp/ftp-with-numbers-in-filename.pcap deleted file mode 100644 index 02b4254..0000000 Binary files a/tests/pcaps/ftp/ftp-with-numbers-in-filename.pcap and /dev/null differ diff --git a/tests/pcaps/ftp/ipv4.trace b/tests/pcaps/ftp/ipv4.trace deleted file mode 100644 index 02cac6f..0000000 Binary files a/tests/pcaps/ftp/ipv4.trace and /dev/null differ diff --git a/tests/pcaps/ftp/ipv6-violation.trace b/tests/pcaps/ftp/ipv6-violation.trace deleted file mode 100644 index d3dcdd2..0000000 Binary files a/tests/pcaps/ftp/ipv6-violation.trace and /dev/null differ diff --git a/tests/pcaps/ftp/ipv6.trace b/tests/pcaps/ftp/ipv6.trace deleted file mode 100644 index 81313fa..0000000 Binary files a/tests/pcaps/ftp/ipv6.trace and /dev/null differ diff --git a/tests/pcaps/ftp/retr.trace b/tests/pcaps/ftp/retr.trace deleted file mode 100644 index a63ec5e..0000000 Binary files a/tests/pcaps/ftp/retr.trace and /dev/null differ diff --git a/tests/pcaps/globus-url-copy-bad-encoding.trace b/tests/pcaps/globus-url-copy-bad-encoding.trace deleted file mode 100644 index 1a6d84c..0000000 Binary files a/tests/pcaps/globus-url-copy-bad-encoding.trace and /dev/null differ diff --git a/tests/pcaps/globus-url-copy.trace b/tests/pcaps/globus-url-copy.trace deleted file mode 100644 index b42ce25..0000000 Binary files a/tests/pcaps/globus-url-copy.trace and /dev/null differ diff --git a/tests/pcaps/http/100-continue.trace b/tests/pcaps/http/100-continue.trace deleted file mode 100644 index 3ff38fa..0000000 Binary files a/tests/pcaps/http/100-continue.trace and /dev/null differ diff --git a/tests/pcaps/http/206_example_a.pcap b/tests/pcaps/http/206_example_a.pcap deleted file mode 100644 index ca134bf..0000000 Binary files a/tests/pcaps/http/206_example_a.pcap and /dev/null differ diff --git a/tests/pcaps/http/206_example_b.pcap b/tests/pcaps/http/206_example_b.pcap deleted file mode 100644 index 2752452..0000000 Binary files a/tests/pcaps/http/206_example_b.pcap and /dev/null differ diff --git a/tests/pcaps/http/206_example_c.pcap b/tests/pcaps/http/206_example_c.pcap deleted file mode 100644 index 990de43..0000000 Binary files a/tests/pcaps/http/206_example_c.pcap and /dev/null differ diff --git a/tests/pcaps/http/bro.org-filtered.pcap b/tests/pcaps/http/bro.org-filtered.pcap deleted file mode 100644 index b259050..0000000 Binary files a/tests/pcaps/http/bro.org-filtered.pcap and /dev/null differ diff --git a/tests/pcaps/http/bro.org.pcap b/tests/pcaps/http/bro.org.pcap deleted file mode 100644 index a50be12..0000000 Binary files a/tests/pcaps/http/bro.org.pcap and /dev/null differ diff --git a/tests/pcaps/http/byteranges.trace b/tests/pcaps/http/byteranges.trace deleted file mode 100644 index 7de35e0..0000000 Binary files a/tests/pcaps/http/byteranges.trace and /dev/null differ diff --git a/tests/pcaps/http/concurrent-range-requests-complete.pcap b/tests/pcaps/http/concurrent-range-requests-complete.pcap deleted file mode 100644 index f3f6655..0000000 Binary files a/tests/pcaps/http/concurrent-range-requests-complete.pcap and /dev/null differ diff --git a/tests/pcaps/http/concurrent-range-requests.pcap b/tests/pcaps/http/concurrent-range-requests.pcap deleted file mode 100644 index 49afe2e..0000000 Binary files a/tests/pcaps/http/concurrent-range-requests.pcap and /dev/null differ diff --git a/tests/pcaps/http/connect-with-header.trace b/tests/pcaps/http/connect-with-header.trace deleted file mode 100644 index 740b5ff..0000000 Binary files a/tests/pcaps/http/connect-with-header.trace and /dev/null differ diff --git a/tests/pcaps/http/connect-with-smtp.trace b/tests/pcaps/http/connect-with-smtp.trace deleted file mode 100644 index dba5e69..0000000 Binary files a/tests/pcaps/http/connect-with-smtp.trace and /dev/null differ diff --git a/tests/pcaps/http/content-range-gap-skip.trace b/tests/pcaps/http/content-range-gap-skip.trace deleted file mode 100644 index 1bb0268..0000000 Binary files a/tests/pcaps/http/content-range-gap-skip.trace and /dev/null differ diff --git a/tests/pcaps/http/content-range-gap.trace b/tests/pcaps/http/content-range-gap.trace deleted file mode 100644 index e926cee..0000000 Binary files a/tests/pcaps/http/content-range-gap.trace and /dev/null differ diff --git a/tests/pcaps/http/content-range-less-than-len.pcap b/tests/pcaps/http/content-range-less-than-len.pcap deleted file mode 100755 index 53ca520..0000000 Binary files a/tests/pcaps/http/content-range-less-than-len.pcap and /dev/null differ diff --git a/tests/pcaps/http/curl_http_09.pcap b/tests/pcaps/http/curl_http_09.pcap deleted file mode 100644 index 67c421c..0000000 Binary files a/tests/pcaps/http/curl_http_09.pcap and /dev/null differ diff --git a/tests/pcaps/http/entity_gap.trace b/tests/pcaps/http/entity_gap.trace deleted file mode 100644 index e4c5e26..0000000 Binary files a/tests/pcaps/http/entity_gap.trace and /dev/null differ diff --git a/tests/pcaps/http/entity_gap2.trace b/tests/pcaps/http/entity_gap2.trace deleted file mode 100644 index 25a9302..0000000 Binary files a/tests/pcaps/http/entity_gap2.trace and /dev/null differ diff --git a/tests/pcaps/http/fake-content-length.pcap b/tests/pcaps/http/fake-content-length.pcap deleted file mode 100755 index fc1ac91..0000000 Binary files a/tests/pcaps/http/fake-content-length.pcap and /dev/null differ diff --git a/tests/pcaps/http/flash-version.trace b/tests/pcaps/http/flash-version.trace deleted file mode 100644 index 2f67eb3..0000000 Binary files a/tests/pcaps/http/flash-version.trace and /dev/null differ diff --git a/tests/pcaps/http/get-gzip.trace b/tests/pcaps/http/get-gzip.trace deleted file mode 100644 index 8e228e4..0000000 Binary files a/tests/pcaps/http/get-gzip.trace and /dev/null differ diff --git a/tests/pcaps/http/get.trace b/tests/pcaps/http/get.trace deleted file mode 100644 index f098e04..0000000 Binary files a/tests/pcaps/http/get.trace and /dev/null differ diff --git a/tests/pcaps/http/get_nosyn.trace b/tests/pcaps/http/get_nosyn.trace deleted file mode 100644 index 9a1d08c..0000000 Binary files a/tests/pcaps/http/get_nosyn.trace and /dev/null differ diff --git a/tests/pcaps/http/http-09-content-length-confusion.pcap b/tests/pcaps/http/http-09-content-length-confusion.pcap deleted file mode 100644 index f846fe2..0000000 Binary files a/tests/pcaps/http/http-09-content-length-confusion.pcap and /dev/null differ diff --git a/tests/pcaps/http/http-11-request-then-cruft.pcap b/tests/pcaps/http/http-11-request-then-cruft.pcap deleted file mode 100644 index a9f3824..0000000 Binary files a/tests/pcaps/http/http-11-request-then-cruft.pcap and /dev/null differ diff --git a/tests/pcaps/http/http-bad-content-range-01.pcap b/tests/pcaps/http/http-bad-content-range-01.pcap deleted file mode 100644 index 9ca75e0..0000000 Binary files a/tests/pcaps/http/http-bad-content-range-01.pcap and /dev/null differ diff --git a/tests/pcaps/http/http-bad-request-with-version.trace b/tests/pcaps/http/http-bad-request-with-version.trace deleted file mode 100644 index 6503d1b..0000000 Binary files a/tests/pcaps/http/http-bad-request-with-version.trace and /dev/null differ diff --git a/tests/pcaps/http/http-filename.pcap b/tests/pcaps/http/http-filename.pcap deleted file mode 100644 index 204c6b4..0000000 Binary files a/tests/pcaps/http/http-filename.pcap and /dev/null differ diff --git a/tests/pcaps/http/http-post-large.pcap b/tests/pcaps/http/http-post-large.pcap deleted file mode 100644 index 8fd0e8d..0000000 Binary files a/tests/pcaps/http/http-post-large.pcap and /dev/null differ diff --git a/tests/pcaps/http/http_09.pcap b/tests/pcaps/http/http_09.pcap deleted file mode 100644 index 5f1907a..0000000 Binary files a/tests/pcaps/http/http_09.pcap and /dev/null differ diff --git a/tests/pcaps/http/http_large_req_8001.pcap b/tests/pcaps/http/http_large_req_8001.pcap deleted file mode 100644 index 5af299e..0000000 Binary files a/tests/pcaps/http/http_large_req_8001.pcap and /dev/null differ diff --git a/tests/pcaps/http/interleaved-http-entity.pcap b/tests/pcaps/http/interleaved-http-entity.pcap deleted file mode 100644 index 7ee49ab..0000000 Binary files a/tests/pcaps/http/interleaved-http-entity.pcap and /dev/null differ diff --git a/tests/pcaps/http/methods.trace b/tests/pcaps/http/methods.trace deleted file mode 100644 index 323e6ee..0000000 Binary files a/tests/pcaps/http/methods.trace and /dev/null differ diff --git a/tests/pcaps/http/missing-zlib-header.pcap b/tests/pcaps/http/missing-zlib-header.pcap deleted file mode 100644 index 66406a9..0000000 Binary files a/tests/pcaps/http/missing-zlib-header.pcap and /dev/null differ diff --git a/tests/pcaps/http/multipart-form-data.pcap b/tests/pcaps/http/multipart-form-data.pcap deleted file mode 100644 index 08da7f4..0000000 Binary files a/tests/pcaps/http/multipart-form-data.pcap and /dev/null differ diff --git a/tests/pcaps/http/multipart.trace b/tests/pcaps/http/multipart.trace deleted file mode 100644 index 5ce8b6e..0000000 Binary files a/tests/pcaps/http/multipart.trace and /dev/null differ diff --git a/tests/pcaps/http/no-uri.pcap b/tests/pcaps/http/no-uri.pcap deleted file mode 100644 index 47a81fb..0000000 Binary files a/tests/pcaps/http/no-uri.pcap and /dev/null differ diff --git a/tests/pcaps/http/no-version.pcap b/tests/pcaps/http/no-version.pcap deleted file mode 100644 index 90906e9..0000000 Binary files a/tests/pcaps/http/no-version.pcap and /dev/null differ diff --git a/tests/pcaps/http/no_crlf.pcap b/tests/pcaps/http/no_crlf.pcap deleted file mode 100644 index 1d9bab3..0000000 Binary files a/tests/pcaps/http/no_crlf.pcap and /dev/null differ diff --git a/tests/pcaps/http/percent-end-of-line.pcap b/tests/pcaps/http/percent-end-of-line.pcap deleted file mode 100644 index 4d38542..0000000 Binary files a/tests/pcaps/http/percent-end-of-line.pcap and /dev/null differ diff --git a/tests/pcaps/http/pipelined-requests.trace b/tests/pcaps/http/pipelined-requests.trace deleted file mode 100644 index 6d13b68..0000000 Binary files a/tests/pcaps/http/pipelined-requests.trace and /dev/null differ diff --git a/tests/pcaps/http/post.trace b/tests/pcaps/http/post.trace deleted file mode 100644 index 91a8ffc..0000000 Binary files a/tests/pcaps/http/post.trace and /dev/null differ diff --git a/tests/pcaps/http/proxy.pcap b/tests/pcaps/http/proxy.pcap deleted file mode 100644 index e0e7adf..0000000 Binary files a/tests/pcaps/http/proxy.pcap and /dev/null differ diff --git a/tests/pcaps/http/putty-upload.pcap b/tests/pcaps/http/putty-upload.pcap deleted file mode 100644 index c91721f..0000000 Binary files a/tests/pcaps/http/putty-upload.pcap and /dev/null differ diff --git a/tests/pcaps/http/version-mismatch.pcap b/tests/pcaps/http/version-mismatch.pcap deleted file mode 100644 index 179e44f..0000000 Binary files a/tests/pcaps/http/version-mismatch.pcap and /dev/null differ diff --git a/tests/pcaps/http/websocket.pcap b/tests/pcaps/http/websocket.pcap deleted file mode 100644 index 0a71c8a..0000000 Binary files a/tests/pcaps/http/websocket.pcap and /dev/null differ diff --git a/tests/pcaps/http/x-gzip.pcap b/tests/pcaps/http/x-gzip.pcap deleted file mode 100755 index 7c89026..0000000 Binary files a/tests/pcaps/http/x-gzip.pcap and /dev/null differ diff --git a/tests/pcaps/http/zero-length-bodies-with-drops.pcap b/tests/pcaps/http/zero-length-bodies-with-drops.pcap deleted file mode 100644 index 6de1f1e..0000000 Binary files a/tests/pcaps/http/zero-length-bodies-with-drops.pcap and /dev/null differ diff --git a/tests/pcaps/icmp/5-pings.pcap b/tests/pcaps/icmp/5-pings.pcap deleted file mode 100644 index 61e32c9..0000000 Binary files a/tests/pcaps/icmp/5-pings.pcap and /dev/null differ diff --git a/tests/pcaps/icmp/icmp-destunreach-ip.pcap b/tests/pcaps/icmp/icmp-destunreach-ip.pcap deleted file mode 100644 index 982f2e4..0000000 Binary files a/tests/pcaps/icmp/icmp-destunreach-ip.pcap and /dev/null differ diff --git a/tests/pcaps/icmp/icmp-destunreach-no-context.pcap b/tests/pcaps/icmp/icmp-destunreach-no-context.pcap deleted file mode 100644 index 1f904e3..0000000 Binary files a/tests/pcaps/icmp/icmp-destunreach-no-context.pcap and /dev/null differ diff --git a/tests/pcaps/icmp/icmp-destunreach-udp.pcap b/tests/pcaps/icmp/icmp-destunreach-udp.pcap deleted file mode 100644 index 60137bb..0000000 Binary files a/tests/pcaps/icmp/icmp-destunreach-udp.pcap and /dev/null differ diff --git a/tests/pcaps/icmp/icmp-ping.pcap b/tests/pcaps/icmp/icmp-ping.pcap deleted file mode 100644 index 499769b..0000000 Binary files a/tests/pcaps/icmp/icmp-ping.pcap and /dev/null differ diff --git a/tests/pcaps/icmp/icmp-timeexceeded.pcap b/tests/pcaps/icmp/icmp-timeexceeded.pcap deleted file mode 100644 index 27804b5..0000000 Binary files a/tests/pcaps/icmp/icmp-timeexceeded.pcap and /dev/null differ diff --git a/tests/pcaps/icmp/icmp6-destunreach-ip6ext-trunc.pcap b/tests/pcaps/icmp/icmp6-destunreach-ip6ext-trunc.pcap deleted file mode 100644 index bd0e0cc..0000000 Binary files a/tests/pcaps/icmp/icmp6-destunreach-ip6ext-trunc.pcap and /dev/null differ diff --git a/tests/pcaps/icmp/icmp6-destunreach-ip6ext-udp.pcap b/tests/pcaps/icmp/icmp6-destunreach-ip6ext-udp.pcap deleted file mode 100644 index 5aca9af..0000000 Binary files a/tests/pcaps/icmp/icmp6-destunreach-ip6ext-udp.pcap and /dev/null differ diff --git a/tests/pcaps/icmp/icmp6-destunreach-ip6ext.pcap b/tests/pcaps/icmp/icmp6-destunreach-ip6ext.pcap deleted file mode 100644 index 996048e..0000000 Binary files a/tests/pcaps/icmp/icmp6-destunreach-ip6ext.pcap and /dev/null differ diff --git a/tests/pcaps/icmp/icmp6-destunreach-no-context.pcap b/tests/pcaps/icmp/icmp6-destunreach-no-context.pcap deleted file mode 100644 index cf15a7c..0000000 Binary files a/tests/pcaps/icmp/icmp6-destunreach-no-context.pcap and /dev/null differ diff --git a/tests/pcaps/icmp/icmp6-nd-options.pcap b/tests/pcaps/icmp/icmp6-nd-options.pcap deleted file mode 100644 index 1103d9b..0000000 Binary files a/tests/pcaps/icmp/icmp6-nd-options.pcap and /dev/null differ diff --git a/tests/pcaps/icmp/icmp6-neighbor-advert.pcap b/tests/pcaps/icmp/icmp6-neighbor-advert.pcap deleted file mode 100644 index 0a06329..0000000 Binary files a/tests/pcaps/icmp/icmp6-neighbor-advert.pcap and /dev/null differ diff --git a/tests/pcaps/icmp/icmp6-neighbor-solicit.pcap b/tests/pcaps/icmp/icmp6-neighbor-solicit.pcap deleted file mode 100644 index 248bbae..0000000 Binary files a/tests/pcaps/icmp/icmp6-neighbor-solicit.pcap and /dev/null differ diff --git a/tests/pcaps/icmp/icmp6-paramprob.pcap b/tests/pcaps/icmp/icmp6-paramprob.pcap deleted file mode 100644 index ab2d41c..0000000 Binary files a/tests/pcaps/icmp/icmp6-paramprob.pcap and /dev/null differ diff --git a/tests/pcaps/icmp/icmp6-ping.pcap b/tests/pcaps/icmp/icmp6-ping.pcap deleted file mode 100644 index 1638ca0..0000000 Binary files a/tests/pcaps/icmp/icmp6-ping.pcap and /dev/null differ diff --git a/tests/pcaps/icmp/icmp6-redirect-hdr-opt.pcap b/tests/pcaps/icmp/icmp6-redirect-hdr-opt.pcap deleted file mode 100644 index d053519..0000000 Binary files a/tests/pcaps/icmp/icmp6-redirect-hdr-opt.pcap and /dev/null differ diff --git a/tests/pcaps/icmp/icmp6-redirect.pcap b/tests/pcaps/icmp/icmp6-redirect.pcap deleted file mode 100644 index f8ae7ed..0000000 Binary files a/tests/pcaps/icmp/icmp6-redirect.pcap and /dev/null differ diff --git a/tests/pcaps/icmp/icmp6-router-advert.pcap b/tests/pcaps/icmp/icmp6-router-advert.pcap deleted file mode 100644 index 38de434..0000000 Binary files a/tests/pcaps/icmp/icmp6-router-advert.pcap and /dev/null differ diff --git a/tests/pcaps/icmp/icmp6-router-solicit.pcap b/tests/pcaps/icmp/icmp6-router-solicit.pcap deleted file mode 100644 index b33495a..0000000 Binary files a/tests/pcaps/icmp/icmp6-router-solicit.pcap and /dev/null differ diff --git a/tests/pcaps/icmp/icmp6-timeexceeded.pcap b/tests/pcaps/icmp/icmp6-timeexceeded.pcap deleted file mode 100644 index b32fc4a..0000000 Binary files a/tests/pcaps/icmp/icmp6-timeexceeded.pcap and /dev/null differ diff --git a/tests/pcaps/icmp/icmp6-toobig.pcap b/tests/pcaps/icmp/icmp6-toobig.pcap deleted file mode 100644 index 92bf50f..0000000 Binary files a/tests/pcaps/icmp/icmp6-toobig.pcap and /dev/null differ diff --git a/tests/pcaps/icmp/icmp_sent.pcap b/tests/pcaps/icmp/icmp_sent.pcap deleted file mode 100644 index 0f0cfcb..0000000 Binary files a/tests/pcaps/icmp/icmp_sent.pcap and /dev/null differ diff --git a/tests/pcaps/icmp_dot1q.trace b/tests/pcaps/icmp_dot1q.trace deleted file mode 100644 index 7c73c62..0000000 Binary files a/tests/pcaps/icmp_dot1q.trace and /dev/null differ diff --git a/tests/pcaps/icmp_nd_dnssl.trace b/tests/pcaps/icmp_nd_dnssl.trace deleted file mode 100644 index 98cc0fe..0000000 Binary files a/tests/pcaps/icmp_nd_dnssl.trace and /dev/null differ diff --git a/tests/pcaps/ieee80211.15.4.pcap b/tests/pcaps/ieee80211.15.4.pcap deleted file mode 100644 index eb22953..0000000 Binary files a/tests/pcaps/ieee80211.15.4.pcap and /dev/null differ diff --git a/tests/pcaps/ip-bogus-header-len.pcap b/tests/pcaps/ip-bogus-header-len.pcap deleted file mode 100644 index 27f9057..0000000 Binary files a/tests/pcaps/ip-bogus-header-len.pcap and /dev/null differ diff --git a/tests/pcaps/ip6_esp.trace b/tests/pcaps/ip6_esp.trace deleted file mode 100644 index 8b3b19a..0000000 Binary files a/tests/pcaps/ip6_esp.trace and /dev/null differ diff --git a/tests/pcaps/ipv4/fragmented-1.pcap b/tests/pcaps/ipv4/fragmented-1.pcap deleted file mode 100644 index b5a8c74..0000000 Binary files a/tests/pcaps/ipv4/fragmented-1.pcap and /dev/null differ diff --git a/tests/pcaps/ipv4/fragmented-2.pcap b/tests/pcaps/ipv4/fragmented-2.pcap deleted file mode 100644 index ea10076..0000000 Binary files a/tests/pcaps/ipv4/fragmented-2.pcap and /dev/null differ diff --git a/tests/pcaps/ipv4/fragmented-3.pcap b/tests/pcaps/ipv4/fragmented-3.pcap deleted file mode 100644 index 16696c8..0000000 Binary files a/tests/pcaps/ipv4/fragmented-3.pcap and /dev/null differ diff --git a/tests/pcaps/ipv4/fragmented-4.pcap b/tests/pcaps/ipv4/fragmented-4.pcap deleted file mode 100644 index ddcef18..0000000 Binary files a/tests/pcaps/ipv4/fragmented-4.pcap and /dev/null differ diff --git a/tests/pcaps/ipv6-fragmented-dns.trace b/tests/pcaps/ipv6-fragmented-dns.trace deleted file mode 100755 index 9dda47a..0000000 Binary files a/tests/pcaps/ipv6-fragmented-dns.trace and /dev/null differ diff --git a/tests/pcaps/ipv6-hbh-routing0.trace b/tests/pcaps/ipv6-hbh-routing0.trace deleted file mode 100644 index 2a294ed..0000000 Binary files a/tests/pcaps/ipv6-hbh-routing0.trace and /dev/null differ diff --git a/tests/pcaps/ipv6-http-atomic-frag.trace b/tests/pcaps/ipv6-http-atomic-frag.trace deleted file mode 100644 index d5d9db2..0000000 Binary files a/tests/pcaps/ipv6-http-atomic-frag.trace and /dev/null differ diff --git a/tests/pcaps/ipv6-mobility-dst-opts.trace b/tests/pcaps/ipv6-mobility-dst-opts.trace deleted file mode 100755 index b660885..0000000 Binary files a/tests/pcaps/ipv6-mobility-dst-opts.trace and /dev/null differ diff --git a/tests/pcaps/ipv6_zero_len_ah.trace b/tests/pcaps/ipv6_zero_len_ah.trace deleted file mode 100644 index 7c39225..0000000 Binary files a/tests/pcaps/ipv6_zero_len_ah.trace and /dev/null differ diff --git a/tests/pcaps/irc-353.pcap b/tests/pcaps/irc-353.pcap deleted file mode 100644 index 61d12bf..0000000 Binary files a/tests/pcaps/irc-353.pcap and /dev/null differ diff --git a/tests/pcaps/irc-basic.trace b/tests/pcaps/irc-basic.trace deleted file mode 100644 index ca164f6..0000000 Binary files a/tests/pcaps/irc-basic.trace and /dev/null differ diff --git a/tests/pcaps/irc-dcc-send.trace b/tests/pcaps/irc-dcc-send.trace deleted file mode 100644 index 88735b9..0000000 Binary files a/tests/pcaps/irc-dcc-send.trace and /dev/null differ diff --git a/tests/pcaps/irc-whitespace.trace b/tests/pcaps/irc-whitespace.trace deleted file mode 100644 index a99af06..0000000 Binary files a/tests/pcaps/irc-whitespace.trace and /dev/null differ diff --git a/tests/pcaps/krb/auth.trace b/tests/pcaps/krb/auth.trace deleted file mode 100644 index e9f1ba9..0000000 Binary files a/tests/pcaps/krb/auth.trace and /dev/null differ diff --git a/tests/pcaps/krb/kerberos_tso.pcap b/tests/pcaps/krb/kerberos_tso.pcap deleted file mode 100644 index a3cc083..0000000 Binary files a/tests/pcaps/krb/kerberos_tso.pcap and /dev/null differ diff --git a/tests/pcaps/krb/kinit.trace b/tests/pcaps/krb/kinit.trace deleted file mode 100644 index a465086..0000000 Binary files a/tests/pcaps/krb/kinit.trace and /dev/null differ diff --git a/tests/pcaps/krb/optional-service-name.pcap b/tests/pcaps/krb/optional-service-name.pcap deleted file mode 100755 index 85df6b2..0000000 Binary files a/tests/pcaps/krb/optional-service-name.pcap and /dev/null differ diff --git a/tests/pcaps/krb/smb2_krb.keytab b/tests/pcaps/krb/smb2_krb.keytab deleted file mode 100644 index 0f637c1..0000000 Binary files a/tests/pcaps/krb/smb2_krb.keytab and /dev/null differ diff --git a/tests/pcaps/krb/smb2_krb.pcap b/tests/pcaps/krb/smb2_krb.pcap deleted file mode 100755 index 0f726f4..0000000 Binary files a/tests/pcaps/krb/smb2_krb.pcap and /dev/null differ diff --git a/tests/pcaps/krb/smb_gssapi.trace b/tests/pcaps/krb/smb_gssapi.trace deleted file mode 100755 index 140ce3a..0000000 Binary files a/tests/pcaps/krb/smb_gssapi.trace and /dev/null differ diff --git a/tests/pcaps/linux_dlt_sll2.pcap b/tests/pcaps/linux_dlt_sll2.pcap deleted file mode 100644 index ec9bc31..0000000 Binary files a/tests/pcaps/linux_dlt_sll2.pcap and /dev/null differ diff --git a/tests/pcaps/linuxsll-arp.pcap b/tests/pcaps/linuxsll-arp.pcap deleted file mode 100644 index 7898d55..0000000 Binary files a/tests/pcaps/linuxsll-arp.pcap and /dev/null differ diff --git a/tests/pcaps/llc.pcap b/tests/pcaps/llc.pcap deleted file mode 100644 index 6ee9dd7..0000000 Binary files a/tests/pcaps/llc.pcap and /dev/null differ diff --git a/tests/pcaps/lldp.pcap b/tests/pcaps/lldp.pcap deleted file mode 100644 index b74c247..0000000 Binary files a/tests/pcaps/lldp.pcap and /dev/null differ diff --git a/tests/pcaps/mixed-vlan-mpls.trace b/tests/pcaps/mixed-vlan-mpls.trace deleted file mode 100644 index ff9c68d..0000000 Binary files a/tests/pcaps/mixed-vlan-mpls.trace and /dev/null differ diff --git a/tests/pcaps/mmsX.pcap b/tests/pcaps/mmsX.pcap deleted file mode 100644 index 4029195..0000000 Binary files a/tests/pcaps/mmsX.pcap and /dev/null differ diff --git a/tests/pcaps/mobile-ipv6/ipv6-mobile-hoa.trace b/tests/pcaps/mobile-ipv6/ipv6-mobile-hoa.trace deleted file mode 100644 index f3e9d63..0000000 Binary files a/tests/pcaps/mobile-ipv6/ipv6-mobile-hoa.trace and /dev/null differ diff --git a/tests/pcaps/mobile-ipv6/ipv6-mobile-routing.trace b/tests/pcaps/mobile-ipv6/ipv6-mobile-routing.trace deleted file mode 100644 index 6289f26..0000000 Binary files a/tests/pcaps/mobile-ipv6/ipv6-mobile-routing.trace and /dev/null differ diff --git a/tests/pcaps/mobile-ipv6/mip6_back.trace b/tests/pcaps/mobile-ipv6/mip6_back.trace deleted file mode 100644 index 9b97186..0000000 Binary files a/tests/pcaps/mobile-ipv6/mip6_back.trace and /dev/null differ diff --git a/tests/pcaps/mobile-ipv6/mip6_be.trace b/tests/pcaps/mobile-ipv6/mip6_be.trace deleted file mode 100644 index 19862ee..0000000 Binary files a/tests/pcaps/mobile-ipv6/mip6_be.trace and /dev/null differ diff --git a/tests/pcaps/mobile-ipv6/mip6_brr.trace b/tests/pcaps/mobile-ipv6/mip6_brr.trace deleted file mode 100644 index 4020ae8..0000000 Binary files a/tests/pcaps/mobile-ipv6/mip6_brr.trace and /dev/null differ diff --git a/tests/pcaps/mobile-ipv6/mip6_bu.trace b/tests/pcaps/mobile-ipv6/mip6_bu.trace deleted file mode 100644 index 1c8c61e..0000000 Binary files a/tests/pcaps/mobile-ipv6/mip6_bu.trace and /dev/null differ diff --git a/tests/pcaps/mobile-ipv6/mip6_cot.trace b/tests/pcaps/mobile-ipv6/mip6_cot.trace deleted file mode 100644 index 2d8d215..0000000 Binary files a/tests/pcaps/mobile-ipv6/mip6_cot.trace and /dev/null differ diff --git a/tests/pcaps/mobile-ipv6/mip6_coti.trace b/tests/pcaps/mobile-ipv6/mip6_coti.trace deleted file mode 100644 index 2a5790c..0000000 Binary files a/tests/pcaps/mobile-ipv6/mip6_coti.trace and /dev/null differ diff --git a/tests/pcaps/mobile-ipv6/mip6_hot.trace b/tests/pcaps/mobile-ipv6/mip6_hot.trace deleted file mode 100644 index 0b54c97..0000000 Binary files a/tests/pcaps/mobile-ipv6/mip6_hot.trace and /dev/null differ diff --git a/tests/pcaps/mobile-ipv6/mip6_hoti.trace b/tests/pcaps/mobile-ipv6/mip6_hoti.trace deleted file mode 100644 index 3daaeb2..0000000 Binary files a/tests/pcaps/mobile-ipv6/mip6_hoti.trace and /dev/null differ diff --git a/tests/pcaps/modbus/4SICS-GeekLounge-151022-min.pcap b/tests/pcaps/modbus/4SICS-GeekLounge-151022-min.pcap deleted file mode 100755 index 71a8ae1..0000000 Binary files a/tests/pcaps/modbus/4SICS-GeekLounge-151022-min.pcap and /dev/null differ diff --git a/tests/pcaps/modbus/fuzz-1011.trace b/tests/pcaps/modbus/fuzz-1011.trace deleted file mode 100644 index b1deea7..0000000 Binary files a/tests/pcaps/modbus/fuzz-1011.trace and /dev/null differ diff --git a/tests/pcaps/modbus/fuzz-72.trace b/tests/pcaps/modbus/fuzz-72.trace deleted file mode 100644 index ef9a159..0000000 Binary files a/tests/pcaps/modbus/fuzz-72.trace and /dev/null differ diff --git a/tests/pcaps/modbus/modbus.trace b/tests/pcaps/modbus/modbus.trace deleted file mode 100644 index 418070d..0000000 Binary files a/tests/pcaps/modbus/modbus.trace and /dev/null differ diff --git a/tests/pcaps/modbus/modbusBig.pcap b/tests/pcaps/modbus/modbusBig.pcap deleted file mode 100644 index 5efe802..0000000 Binary files a/tests/pcaps/modbus/modbusBig.pcap and /dev/null differ diff --git a/tests/pcaps/modbus/modbusSmall.pcap b/tests/pcaps/modbus/modbusSmall.pcap deleted file mode 100644 index d931447..0000000 Binary files a/tests/pcaps/modbus/modbusSmall.pcap and /dev/null differ diff --git a/tests/pcaps/mount/mount_base.pcap b/tests/pcaps/mount/mount_base.pcap deleted file mode 100644 index 0d71878..0000000 Binary files a/tests/pcaps/mount/mount_base.pcap and /dev/null differ diff --git a/tests/pcaps/mpls-in-vlan.trace b/tests/pcaps/mpls-in-vlan.trace deleted file mode 100644 index 634f3fc..0000000 Binary files a/tests/pcaps/mpls-in-vlan.trace and /dev/null differ diff --git a/tests/pcaps/mqtt.pcap b/tests/pcaps/mqtt.pcap deleted file mode 100644 index 72c3311..0000000 Binary files a/tests/pcaps/mqtt.pcap and /dev/null differ diff --git a/tests/pcaps/mysql/auth.trace b/tests/pcaps/mysql/auth.trace deleted file mode 100644 index 48072e8..0000000 Binary files a/tests/pcaps/mysql/auth.trace and /dev/null differ diff --git a/tests/pcaps/mysql/encrypted.trace b/tests/pcaps/mysql/encrypted.trace deleted file mode 100644 index dcf3689..0000000 Binary files a/tests/pcaps/mysql/encrypted.trace and /dev/null differ diff --git a/tests/pcaps/mysql/mysql-show-engine-innodb-status-no-password.pcap b/tests/pcaps/mysql/mysql-show-engine-innodb-status-no-password.pcap deleted file mode 100644 index 8d9cad5..0000000 Binary files a/tests/pcaps/mysql/mysql-show-engine-innodb-status-no-password.pcap and /dev/null differ diff --git a/tests/pcaps/mysql/mysql.trace b/tests/pcaps/mysql/mysql.trace deleted file mode 100644 index 59ae364..0000000 Binary files a/tests/pcaps/mysql/mysql.trace and /dev/null differ diff --git a/tests/pcaps/mysql/plain-amazon-rds.trace b/tests/pcaps/mysql/plain-amazon-rds.trace deleted file mode 100644 index fbe1149..0000000 Binary files a/tests/pcaps/mysql/plain-amazon-rds.trace and /dev/null differ diff --git a/tests/pcaps/mysql/selects_with_new_proto.trace b/tests/pcaps/mysql/selects_with_new_proto.trace deleted file mode 100644 index 5bf8fde..0000000 Binary files a/tests/pcaps/mysql/selects_with_new_proto.trace and /dev/null differ diff --git a/tests/pcaps/mysql/tls-12-amazon-rds.trace b/tests/pcaps/mysql/tls-12-amazon-rds.trace deleted file mode 100644 index d79fc71..0000000 Binary files a/tests/pcaps/mysql/tls-12-amazon-rds.trace and /dev/null differ diff --git a/tests/pcaps/mysql/tls-13-amazon-rds.trace b/tests/pcaps/mysql/tls-13-amazon-rds.trace deleted file mode 100644 index 617a1a9..0000000 Binary files a/tests/pcaps/mysql/tls-13-amazon-rds.trace and /dev/null differ diff --git a/tests/pcaps/ncp.pcap b/tests/pcaps/ncp.pcap deleted file mode 100644 index d8c61b3..0000000 Binary files a/tests/pcaps/ncp.pcap and /dev/null differ diff --git a/tests/pcaps/negative-time.pcap b/tests/pcaps/negative-time.pcap deleted file mode 100644 index a216f1e..0000000 Binary files a/tests/pcaps/negative-time.pcap and /dev/null differ diff --git a/tests/pcaps/nflog-http.pcap b/tests/pcaps/nflog-http.pcap deleted file mode 100644 index 5feae68..0000000 Binary files a/tests/pcaps/nflog-http.pcap and /dev/null differ diff --git a/tests/pcaps/nfs/nfs_base.pcap b/tests/pcaps/nfs/nfs_base.pcap deleted file mode 100644 index 0d71878..0000000 Binary files a/tests/pcaps/nfs/nfs_base.pcap and /dev/null differ diff --git a/tests/pcaps/nmap-vsn.trace b/tests/pcaps/nmap-vsn.trace deleted file mode 100644 index b276ed3..0000000 Binary files a/tests/pcaps/nmap-vsn.trace and /dev/null differ diff --git a/tests/pcaps/ntp.pcap b/tests/pcaps/ntp.pcap deleted file mode 100644 index cc80d04..0000000 Binary files a/tests/pcaps/ntp.pcap and /dev/null differ diff --git a/tests/pcaps/ntp/NTP-digest.pcap b/tests/pcaps/ntp/NTP-digest.pcap deleted file mode 100644 index 0e8a262..0000000 Binary files a/tests/pcaps/ntp/NTP-digest.pcap and /dev/null differ diff --git a/tests/pcaps/ntp/NTP_sync.pcap b/tests/pcaps/ntp/NTP_sync.pcap deleted file mode 100644 index 997d9fb..0000000 Binary files a/tests/pcaps/ntp/NTP_sync.pcap and /dev/null differ diff --git a/tests/pcaps/ntp/ntp.pcap b/tests/pcaps/ntp/ntp.pcap deleted file mode 100644 index eaacb72..0000000 Binary files a/tests/pcaps/ntp/ntp.pcap and /dev/null differ diff --git a/tests/pcaps/ntp/ntp2.pcap b/tests/pcaps/ntp/ntp2.pcap deleted file mode 100644 index d242cc5..0000000 Binary files a/tests/pcaps/ntp/ntp2.pcap and /dev/null differ diff --git a/tests/pcaps/ntp/ntpmode67.pcap b/tests/pcaps/ntp/ntpmode67.pcap deleted file mode 100644 index ca0a8ca..0000000 Binary files a/tests/pcaps/ntp/ntpmode67.pcap and /dev/null differ diff --git a/tests/pcaps/pbb.pcap b/tests/pcaps/pbb.pcap deleted file mode 100644 index 2950902..0000000 Binary files a/tests/pcaps/pbb.pcap and /dev/null differ diff --git a/tests/pcaps/pe/pe.trace b/tests/pcaps/pe/pe.trace deleted file mode 100644 index c70c9e6..0000000 Binary files a/tests/pcaps/pe/pe.trace and /dev/null differ diff --git a/tests/pcaps/pop3-unknown-commands.pcap b/tests/pcaps/pop3-unknown-commands.pcap deleted file mode 100644 index 86c5534..0000000 Binary files a/tests/pcaps/pop3-unknown-commands.pcap and /dev/null differ diff --git a/tests/pcaps/port4242.trace b/tests/pcaps/port4242.trace deleted file mode 100644 index e999b43..0000000 Binary files a/tests/pcaps/port4242.trace and /dev/null differ diff --git a/tests/pcaps/port4243.trace b/tests/pcaps/port4243.trace deleted file mode 100644 index ddd2202..0000000 Binary files a/tests/pcaps/port4243.trace and /dev/null differ diff --git a/tests/pcaps/pppoe-over-qinq.pcap b/tests/pcaps/pppoe-over-qinq.pcap deleted file mode 100644 index 10e1429..0000000 Binary files a/tests/pcaps/pppoe-over-qinq.pcap and /dev/null differ diff --git a/tests/pcaps/pppoe.trace b/tests/pcaps/pppoe.trace deleted file mode 100644 index 4de6717..0000000 Binary files a/tests/pcaps/pppoe.trace and /dev/null differ diff --git a/tests/pcaps/q-in-q.trace b/tests/pcaps/q-in-q.trace deleted file mode 100644 index 39969c8..0000000 Binary files a/tests/pcaps/q-in-q.trace and /dev/null differ diff --git a/tests/pcaps/radiotap.pcap b/tests/pcaps/radiotap.pcap deleted file mode 100644 index 1f500f2..0000000 Binary files a/tests/pcaps/radiotap.pcap and /dev/null differ diff --git a/tests/pcaps/radius/radius.trace b/tests/pcaps/radius/radius.trace deleted file mode 100644 index d0576f7..0000000 Binary files a/tests/pcaps/radius/radius.trace and /dev/null differ diff --git a/tests/pcaps/radius/radius_localhost.pcap b/tests/pcaps/radius/radius_localhost.pcap deleted file mode 100644 index 7333fc9..0000000 Binary files a/tests/pcaps/radius/radius_localhost.pcap and /dev/null differ diff --git a/tests/pcaps/raw_layer.pcap b/tests/pcaps/raw_layer.pcap deleted file mode 100644 index 5e4ed89..0000000 Binary files a/tests/pcaps/raw_layer.pcap and /dev/null differ diff --git a/tests/pcaps/raw_packets.trace b/tests/pcaps/raw_packets.trace deleted file mode 100644 index 4fc64c4..0000000 Binary files a/tests/pcaps/raw_packets.trace and /dev/null differ diff --git a/tests/pcaps/rdp/rdp-proprietary-encryption.pcap b/tests/pcaps/rdp/rdp-proprietary-encryption.pcap deleted file mode 100644 index a26dd56..0000000 Binary files a/tests/pcaps/rdp/rdp-proprietary-encryption.pcap and /dev/null differ diff --git a/tests/pcaps/rdp/rdp-to-ssl.pcap b/tests/pcaps/rdp/rdp-to-ssl.pcap deleted file mode 100644 index e57d4b7..0000000 Binary files a/tests/pcaps/rdp/rdp-to-ssl.pcap and /dev/null differ diff --git a/tests/pcaps/rdp/rdp-unknown-keyboard.pcap b/tests/pcaps/rdp/rdp-unknown-keyboard.pcap deleted file mode 100644 index d2497f2..0000000 Binary files a/tests/pcaps/rdp/rdp-unknown-keyboard.pcap and /dev/null differ diff --git a/tests/pcaps/rdp/rdp-x509.pcap b/tests/pcaps/rdp/rdp-x509.pcap deleted file mode 100644 index 073d03e..0000000 Binary files a/tests/pcaps/rdp/rdp-x509.pcap and /dev/null differ diff --git a/tests/pcaps/rdp/rdpeudp-handshake-fail.pcap b/tests/pcaps/rdp/rdpeudp-handshake-fail.pcap deleted file mode 100644 index 253367a..0000000 Binary files a/tests/pcaps/rdp/rdpeudp-handshake-fail.pcap and /dev/null differ diff --git a/tests/pcaps/rdp/rdpeudp-handshake-success.pcap b/tests/pcaps/rdp/rdpeudp-handshake-success.pcap deleted file mode 100644 index b6a984f..0000000 Binary files a/tests/pcaps/rdp/rdpeudp-handshake-success.pcap and /dev/null differ diff --git a/tests/pcaps/rfb/vnc-mac-to-linux.pcap b/tests/pcaps/rfb/vnc-mac-to-linux.pcap deleted file mode 100644 index 3856b94..0000000 Binary files a/tests/pcaps/rfb/vnc-mac-to-linux.pcap and /dev/null differ diff --git a/tests/pcaps/rfb/vnc-scanner.pcap b/tests/pcaps/rfb/vnc-scanner.pcap deleted file mode 100644 index 9d7c186..0000000 Binary files a/tests/pcaps/rfb/vnc-scanner.pcap and /dev/null differ diff --git a/tests/pcaps/rfb/vncmac.pcap b/tests/pcaps/rfb/vncmac.pcap deleted file mode 100644 index 2970fe9..0000000 Binary files a/tests/pcaps/rfb/vncmac.pcap and /dev/null differ diff --git a/tests/pcaps/rotation.trace b/tests/pcaps/rotation.trace deleted file mode 100644 index 9954b22..0000000 Binary files a/tests/pcaps/rotation.trace and /dev/null differ diff --git a/tests/pcaps/rpc-portmap-sadmind.pcap b/tests/pcaps/rpc-portmap-sadmind.pcap deleted file mode 100644 index af94ffd..0000000 Binary files a/tests/pcaps/rpc-portmap-sadmind.pcap and /dev/null differ diff --git a/tests/pcaps/sip/sip-junk-before-request.pcap b/tests/pcaps/sip/sip-junk-before-request.pcap deleted file mode 100644 index 095cda1..0000000 Binary files a/tests/pcaps/sip/sip-junk-before-request.pcap and /dev/null differ diff --git a/tests/pcaps/sip/wireshark.trace b/tests/pcaps/sip/wireshark.trace deleted file mode 100644 index f91ab49..0000000 Binary files a/tests/pcaps/sip/wireshark.trace and /dev/null differ diff --git a/tests/pcaps/smb/SMBGhost.pcap b/tests/pcaps/smb/SMBGhost.pcap deleted file mode 100644 index 3f06d32..0000000 Binary files a/tests/pcaps/smb/SMBGhost.pcap and /dev/null differ diff --git a/tests/pcaps/smb/dssetup_DsRoleGetPrimaryDomainInformation_standalone_workstation.cap b/tests/pcaps/smb/dssetup_DsRoleGetPrimaryDomainInformation_standalone_workstation.cap deleted file mode 100644 index 0bbe41a..0000000 Binary files a/tests/pcaps/smb/dssetup_DsRoleGetPrimaryDomainInformation_standalone_workstation.cap and /dev/null differ diff --git a/tests/pcaps/smb/raw_ntlm_in_smb.pcap b/tests/pcaps/smb/raw_ntlm_in_smb.pcap deleted file mode 100644 index 8a40175..0000000 Binary files a/tests/pcaps/smb/raw_ntlm_in_smb.pcap and /dev/null differ diff --git a/tests/pcaps/smb/smb1-OSS-fuzz-54883.pcap b/tests/pcaps/smb/smb1-OSS-fuzz-54883.pcap deleted file mode 100644 index 073a363..0000000 Binary files a/tests/pcaps/smb/smb1-OSS-fuzz-54883.pcap and /dev/null differ diff --git a/tests/pcaps/smb/smb1.pcap b/tests/pcaps/smb/smb1.pcap deleted file mode 100644 index bbcf5a1..0000000 Binary files a/tests/pcaps/smb/smb1.pcap and /dev/null differ diff --git a/tests/pcaps/smb/smb1_transaction2_request.pcap b/tests/pcaps/smb/smb1_transaction2_request.pcap deleted file mode 100644 index 5645795..0000000 Binary files a/tests/pcaps/smb/smb1_transaction2_request.pcap and /dev/null differ diff --git a/tests/pcaps/smb/smb1_transaction2_secondary_request.pcap b/tests/pcaps/smb/smb1_transaction2_secondary_request.pcap deleted file mode 100644 index 923b9e0..0000000 Binary files a/tests/pcaps/smb/smb1_transaction2_secondary_request.pcap and /dev/null differ diff --git a/tests/pcaps/smb/smb1_transaction_request.pcap b/tests/pcaps/smb/smb1_transaction_request.pcap deleted file mode 100644 index e234ec4..0000000 Binary files a/tests/pcaps/smb/smb1_transaction_request.pcap and /dev/null differ diff --git a/tests/pcaps/smb/smb1_transaction_response.pcap b/tests/pcaps/smb/smb1_transaction_response.pcap deleted file mode 100644 index c28689b..0000000 Binary files a/tests/pcaps/smb/smb1_transaction_response.pcap and /dev/null differ diff --git a/tests/pcaps/smb/smb1_transaction_secondary_request.pcap b/tests/pcaps/smb/smb1_transaction_secondary_request.pcap deleted file mode 100644 index 4236b14..0000000 Binary files a/tests/pcaps/smb/smb1_transaction_secondary_request.pcap and /dev/null differ diff --git a/tests/pcaps/smb/smb2.delete-on-close-perms-delete-existing.pcap b/tests/pcaps/smb/smb2.delete-on-close-perms-delete-existing.pcap deleted file mode 100644 index f6227c7..0000000 Binary files a/tests/pcaps/smb/smb2.delete-on-close-perms-delete-existing.pcap and /dev/null differ diff --git a/tests/pcaps/smb/smb2.pcap b/tests/pcaps/smb/smb2.pcap deleted file mode 100644 index 49c7116..0000000 Binary files a/tests/pcaps/smb/smb2.pcap and /dev/null differ diff --git a/tests/pcaps/smb/smb2_fscontrol.pcap b/tests/pcaps/smb/smb2_fscontrol.pcap deleted file mode 100644 index 8cf0ec5..0000000 Binary files a/tests/pcaps/smb/smb2_fscontrol.pcap and /dev/null differ diff --git a/tests/pcaps/smb/smb2readwrite.pcap b/tests/pcaps/smb/smb2readwrite.pcap deleted file mode 100644 index 723dd58..0000000 Binary files a/tests/pcaps/smb/smb2readwrite.pcap and /dev/null differ diff --git a/tests/pcaps/smb/smb3.pcap b/tests/pcaps/smb/smb3.pcap deleted file mode 100644 index 0adc774..0000000 Binary files a/tests/pcaps/smb/smb3.pcap and /dev/null differ diff --git a/tests/pcaps/smb/smb311.pcap b/tests/pcaps/smb/smb311.pcap deleted file mode 100644 index 466924c..0000000 Binary files a/tests/pcaps/smb/smb311.pcap and /dev/null differ diff --git a/tests/pcaps/smb/smb3_multichannel.pcap b/tests/pcaps/smb/smb3_multichannel.pcap deleted file mode 100644 index 0fc9b1b..0000000 Binary files a/tests/pcaps/smb/smb3_multichannel.pcap and /dev/null differ diff --git a/tests/pcaps/smb/smb3_negotiate_context.pcap b/tests/pcaps/smb/smb3_negotiate_context.pcap deleted file mode 100644 index d705500..0000000 Binary files a/tests/pcaps/smb/smb3_negotiate_context.pcap and /dev/null differ diff --git a/tests/pcaps/smtp-attachment-msg.pcap b/tests/pcaps/smtp-attachment-msg.pcap deleted file mode 100644 index 29e8fb7..0000000 Binary files a/tests/pcaps/smtp-attachment-msg.pcap and /dev/null differ diff --git a/tests/pcaps/smtp-multi-addr.pcap b/tests/pcaps/smtp-multi-addr.pcap deleted file mode 100644 index 0029d98..0000000 Binary files a/tests/pcaps/smtp-multi-addr.pcap and /dev/null differ diff --git a/tests/pcaps/smtp-one-side-only.trace b/tests/pcaps/smtp-one-side-only.trace deleted file mode 100644 index 1ac9578..0000000 Binary files a/tests/pcaps/smtp-one-side-only.trace and /dev/null differ diff --git a/tests/pcaps/smtp.trace b/tests/pcaps/smtp.trace deleted file mode 100644 index 25b09e5..0000000 Binary files a/tests/pcaps/smtp.trace and /dev/null differ diff --git a/tests/pcaps/snmp/leak_test.pcap b/tests/pcaps/snmp/leak_test.pcap deleted file mode 100644 index 0abdc0a..0000000 Binary files a/tests/pcaps/snmp/leak_test.pcap and /dev/null differ diff --git a/tests/pcaps/snmp/snmpv1_get.pcap b/tests/pcaps/snmp/snmpv1_get.pcap deleted file mode 100644 index de8505b..0000000 Binary files a/tests/pcaps/snmp/snmpv1_get.pcap and /dev/null differ diff --git a/tests/pcaps/snmp/snmpv1_get_short.pcap b/tests/pcaps/snmp/snmpv1_get_short.pcap deleted file mode 100644 index a765af6..0000000 Binary files a/tests/pcaps/snmp/snmpv1_get_short.pcap and /dev/null differ diff --git a/tests/pcaps/snmp/snmpv1_set.pcap b/tests/pcaps/snmp/snmpv1_set.pcap deleted file mode 100644 index dc07014..0000000 Binary files a/tests/pcaps/snmp/snmpv1_set.pcap and /dev/null differ diff --git a/tests/pcaps/snmp/snmpv1_trap.pcap b/tests/pcaps/snmp/snmpv1_trap.pcap deleted file mode 100644 index e77219e..0000000 Binary files a/tests/pcaps/snmp/snmpv1_trap.pcap and /dev/null differ diff --git a/tests/pcaps/snmp/snmpv2_get.pcap b/tests/pcaps/snmp/snmpv2_get.pcap deleted file mode 100644 index 705af97..0000000 Binary files a/tests/pcaps/snmp/snmpv2_get.pcap and /dev/null differ diff --git a/tests/pcaps/snmp/snmpv2_get_bulk.pcap b/tests/pcaps/snmp/snmpv2_get_bulk.pcap deleted file mode 100644 index 5099c7a..0000000 Binary files a/tests/pcaps/snmp/snmpv2_get_bulk.pcap and /dev/null differ diff --git a/tests/pcaps/snmp/snmpv2_get_next.pcap b/tests/pcaps/snmp/snmpv2_get_next.pcap deleted file mode 100644 index d3c6c2b..0000000 Binary files a/tests/pcaps/snmp/snmpv2_get_next.pcap and /dev/null differ diff --git a/tests/pcaps/snmp/snmpv3_get_next.pcap b/tests/pcaps/snmp/snmpv3_get_next.pcap deleted file mode 100644 index 13ed2e7..0000000 Binary files a/tests/pcaps/snmp/snmpv3_get_next.pcap and /dev/null differ diff --git a/tests/pcaps/snmp/snmpwalk-short.pcap b/tests/pcaps/snmp/snmpwalk-short.pcap deleted file mode 100644 index 90f2a47..0000000 Binary files a/tests/pcaps/snmp/snmpwalk-short.pcap and /dev/null differ diff --git a/tests/pcaps/socks-auth.pcap b/tests/pcaps/socks-auth.pcap deleted file mode 100644 index 1570e22..0000000 Binary files a/tests/pcaps/socks-auth.pcap and /dev/null differ diff --git a/tests/pcaps/socks-with-ssl.trace b/tests/pcaps/socks-with-ssl.trace deleted file mode 100644 index da27cc8..0000000 Binary files a/tests/pcaps/socks-with-ssl.trace and /dev/null differ diff --git a/tests/pcaps/socks.trace b/tests/pcaps/socks.trace deleted file mode 100644 index 00bf07e..0000000 Binary files a/tests/pcaps/socks.trace and /dev/null differ diff --git a/tests/pcaps/ssh/reverse-ssh.pcap b/tests/pcaps/ssh/reverse-ssh.pcap deleted file mode 100644 index 8ddc4ac..0000000 Binary files a/tests/pcaps/ssh/reverse-ssh.pcap and /dev/null differ diff --git a/tests/pcaps/ssh/ssh-on-port-80.trace b/tests/pcaps/ssh/ssh-on-port-80.trace deleted file mode 100644 index 6c0ae22..0000000 Binary files a/tests/pcaps/ssh/ssh-on-port-80.trace and /dev/null differ diff --git a/tests/pcaps/ssh/ssh.trace b/tests/pcaps/ssh/ssh.trace deleted file mode 100644 index 5498000..0000000 Binary files a/tests/pcaps/ssh/ssh.trace and /dev/null differ diff --git a/tests/pcaps/ssh/ssh1-ssh2-fingerprints.pcap b/tests/pcaps/ssh/ssh1-ssh2-fingerprints.pcap deleted file mode 100644 index 730240e..0000000 Binary files a/tests/pcaps/ssh/ssh1-ssh2-fingerprints.pcap and /dev/null differ diff --git a/tests/pcaps/ssh/ssh_client_sends_first_enc_pkt_with_newkeys.pcap b/tests/pcaps/ssh/ssh_client_sends_first_enc_pkt_with_newkeys.pcap deleted file mode 100644 index 4bbf12d..0000000 Binary files a/tests/pcaps/ssh/ssh_client_sends_first_enc_pkt_with_newkeys.pcap and /dev/null differ diff --git a/tests/pcaps/ssh/ssh_kex_curve25519.pcap b/tests/pcaps/ssh/ssh_kex_curve25519.pcap deleted file mode 100644 index ed31228..0000000 Binary files a/tests/pcaps/ssh/ssh_kex_curve25519.pcap and /dev/null differ diff --git a/tests/pcaps/ssh/ssh_server_sends_first_enc_pkt_with_newkeys.pcap b/tests/pcaps/ssh/ssh_server_sends_first_enc_pkt_with_newkeys.pcap deleted file mode 100644 index 9fbad53..0000000 Binary files a/tests/pcaps/ssh/ssh_server_sends_first_enc_pkt_with_newkeys.pcap and /dev/null differ diff --git a/tests/pcaps/ssh/ssh_version_199.pcap b/tests/pcaps/ssh/ssh_version_199.pcap deleted file mode 100644 index b682bb8..0000000 Binary files a/tests/pcaps/ssh/ssh_version_199.pcap and /dev/null differ diff --git a/tests/pcaps/ssh/sshguess.pcap b/tests/pcaps/ssh/sshguess.pcap deleted file mode 100644 index 7408acc..0000000 Binary files a/tests/pcaps/ssh/sshguess.pcap and /dev/null differ diff --git a/tests/pcaps/ssl-and-ssh-using-sslh.trace b/tests/pcaps/ssl-and-ssh-using-sslh.trace deleted file mode 100644 index 6a608a2..0000000 Binary files a/tests/pcaps/ssl-and-ssh-using-sslh.trace and /dev/null differ diff --git a/tests/pcaps/syslog-missing-pri.trace b/tests/pcaps/syslog-missing-pri.trace deleted file mode 100755 index 625ecdd..0000000 Binary files a/tests/pcaps/syslog-missing-pri.trace and /dev/null differ diff --git a/tests/pcaps/syslog-single-udp.trace b/tests/pcaps/syslog-single-udp.trace deleted file mode 100644 index 9e1505a..0000000 Binary files a/tests/pcaps/syslog-single-udp.trace and /dev/null differ diff --git a/tests/pcaps/tcp/fin_retransmission.pcap b/tests/pcaps/tcp/fin_retransmission.pcap deleted file mode 100644 index 1e17844..0000000 Binary files a/tests/pcaps/tcp/fin_retransmission.pcap and /dev/null differ diff --git a/tests/pcaps/tcp/handshake-reorder.trace b/tests/pcaps/tcp/handshake-reorder.trace deleted file mode 100644 index 0058142..0000000 Binary files a/tests/pcaps/tcp/handshake-reorder.trace and /dev/null differ diff --git a/tests/pcaps/tcp/http-on-irc-port-missing-syn.pcap b/tests/pcaps/tcp/http-on-irc-port-missing-syn.pcap deleted file mode 100644 index c622ad9..0000000 Binary files a/tests/pcaps/tcp/http-on-irc-port-missing-syn.pcap and /dev/null differ diff --git a/tests/pcaps/tcp/miss_end_data.pcap b/tests/pcaps/tcp/miss_end_data.pcap deleted file mode 100644 index ae5aecb..0000000 Binary files a/tests/pcaps/tcp/miss_end_data.pcap and /dev/null differ diff --git a/tests/pcaps/tcp/missing-syn.pcap b/tests/pcaps/tcp/missing-syn.pcap deleted file mode 100644 index 6ad85cd..0000000 Binary files a/tests/pcaps/tcp/missing-syn.pcap and /dev/null differ diff --git a/tests/pcaps/tcp/no-handshake.pcap b/tests/pcaps/tcp/no-handshake.pcap deleted file mode 100644 index 1ca2a32..0000000 Binary files a/tests/pcaps/tcp/no-handshake.pcap and /dev/null differ diff --git a/tests/pcaps/tcp/option-27.pcap b/tests/pcaps/tcp/option-27.pcap deleted file mode 100644 index 783fb47..0000000 Binary files a/tests/pcaps/tcp/option-27.pcap and /dev/null differ diff --git a/tests/pcaps/tcp/option-sack.pcap b/tests/pcaps/tcp/option-sack.pcap deleted file mode 100644 index 22d7118..0000000 Binary files a/tests/pcaps/tcp/option-sack.pcap and /dev/null differ diff --git a/tests/pcaps/tcp/options.pcap b/tests/pcaps/tcp/options.pcap deleted file mode 100644 index d1ebd88..0000000 Binary files a/tests/pcaps/tcp/options.pcap and /dev/null differ diff --git a/tests/pcaps/tcp/payload-syn.trace b/tests/pcaps/tcp/payload-syn.trace deleted file mode 100644 index 4082590..0000000 Binary files a/tests/pcaps/tcp/payload-syn.trace and /dev/null differ diff --git a/tests/pcaps/tcp/payload-synack.trace b/tests/pcaps/tcp/payload-synack.trace deleted file mode 100644 index 2a2e58c..0000000 Binary files a/tests/pcaps/tcp/payload-synack.trace and /dev/null differ diff --git a/tests/pcaps/tcp/qi_internet_SYNACK_curl_jsonip.pcap b/tests/pcaps/tcp/qi_internet_SYNACK_curl_jsonip.pcap deleted file mode 100644 index d906d9c..0000000 Binary files a/tests/pcaps/tcp/qi_internet_SYNACK_curl_jsonip.pcap and /dev/null differ diff --git a/tests/pcaps/tcp/reassembly.pcap b/tests/pcaps/tcp/reassembly.pcap deleted file mode 100644 index f387c3f..0000000 Binary files a/tests/pcaps/tcp/reassembly.pcap and /dev/null differ diff --git a/tests/pcaps/tcp/retransmit-fast009.trace b/tests/pcaps/tcp/retransmit-fast009.trace deleted file mode 100644 index b3dabf9..0000000 Binary files a/tests/pcaps/tcp/retransmit-fast009.trace and /dev/null differ diff --git a/tests/pcaps/tcp/retransmit-timeout.pcap b/tests/pcaps/tcp/retransmit-timeout.pcap deleted file mode 100644 index 2529d4d..0000000 Binary files a/tests/pcaps/tcp/retransmit-timeout.pcap and /dev/null differ diff --git a/tests/pcaps/tcp/rst-inject-rae.trace b/tests/pcaps/tcp/rst-inject-rae.trace deleted file mode 100644 index 7225cc0..0000000 Binary files a/tests/pcaps/tcp/rst-inject-rae.trace and /dev/null differ diff --git a/tests/pcaps/tcp/single-rst.pcap b/tests/pcaps/tcp/single-rst.pcap deleted file mode 100644 index 3b1ddf1..0000000 Binary files a/tests/pcaps/tcp/single-rst.pcap and /dev/null differ diff --git a/tests/pcaps/tcp/ssh-dups.pcap b/tests/pcaps/tcp/ssh-dups.pcap deleted file mode 100644 index cbe8ba8..0000000 Binary files a/tests/pcaps/tcp/ssh-dups.pcap and /dev/null differ diff --git a/tests/pcaps/tcp/syn-synack.pcap b/tests/pcaps/tcp/syn-synack.pcap deleted file mode 100644 index 5bc2599..0000000 Binary files a/tests/pcaps/tcp/syn-synack.pcap and /dev/null differ diff --git a/tests/pcaps/tcp/syn-then-ack-then-rst.pcap b/tests/pcaps/tcp/syn-then-ack-then-rst.pcap deleted file mode 100644 index dcb3854..0000000 Binary files a/tests/pcaps/tcp/syn-then-ack-then-rst.pcap and /dev/null differ diff --git a/tests/pcaps/tcp/syn-then-rst.pcap b/tests/pcaps/tcp/syn-then-rst.pcap deleted file mode 100644 index e22e297..0000000 Binary files a/tests/pcaps/tcp/syn-then-rst.pcap and /dev/null differ diff --git a/tests/pcaps/tcp/syn-then-stuff-then-rst.pcap b/tests/pcaps/tcp/syn-then-stuff-then-rst.pcap deleted file mode 100644 index 4e8d884..0000000 Binary files a/tests/pcaps/tcp/syn-then-stuff-then-rst.pcap and /dev/null differ diff --git a/tests/pcaps/tcp/syn.pcap b/tests/pcaps/tcp/syn.pcap deleted file mode 100644 index a676743..0000000 Binary files a/tests/pcaps/tcp/syn.pcap and /dev/null differ diff --git a/tests/pcaps/tcp/tcp-fast-open.pcap b/tests/pcaps/tcp/tcp-fast-open.pcap deleted file mode 100644 index 2893440..0000000 Binary files a/tests/pcaps/tcp/tcp-fast-open.pcap and /dev/null differ diff --git a/tests/pcaps/tcp/timestamp.pcap b/tests/pcaps/tcp/timestamp.pcap deleted file mode 100644 index 2447f20..0000000 Binary files a/tests/pcaps/tcp/timestamp.pcap and /dev/null differ diff --git a/tests/pcaps/tcp/truncated-header.pcap b/tests/pcaps/tcp/truncated-header.pcap deleted file mode 100644 index b7a6817..0000000 Binary files a/tests/pcaps/tcp/truncated-header.pcap and /dev/null differ diff --git a/tests/pcaps/tls/CVE-2015-3194.pcap b/tests/pcaps/tls/CVE-2015-3194.pcap deleted file mode 100644 index c4a69bc..0000000 Binary files a/tests/pcaps/tls/CVE-2015-3194.pcap and /dev/null differ diff --git a/tests/pcaps/tls/cert-no-cn.pcap b/tests/pcaps/tls/cert-no-cn.pcap deleted file mode 100644 index d208c69..0000000 Binary files a/tests/pcaps/tls/cert-no-cn.pcap and /dev/null differ diff --git a/tests/pcaps/tls/certificate-request-failed.pcap b/tests/pcaps/tls/certificate-request-failed.pcap deleted file mode 100644 index 0191710..0000000 Binary files a/tests/pcaps/tls/certificate-request-failed.pcap and /dev/null differ diff --git a/tests/pcaps/tls/certificate-with-sct.pcap b/tests/pcaps/tls/certificate-with-sct.pcap deleted file mode 100644 index 0b6c1b1..0000000 Binary files a/tests/pcaps/tls/certificate-with-sct.pcap and /dev/null differ diff --git a/tests/pcaps/tls/chrome-34-google.trace b/tests/pcaps/tls/chrome-34-google.trace deleted file mode 100644 index e02d35a..0000000 Binary files a/tests/pcaps/tls/chrome-34-google.trace and /dev/null differ diff --git a/tests/pcaps/tls/chrome-63.0.3211.0-canary-tls_experiment.pcap b/tests/pcaps/tls/chrome-63.0.3211.0-canary-tls_experiment.pcap deleted file mode 100644 index 2b8040b..0000000 Binary files a/tests/pcaps/tls/chrome-63.0.3211.0-canary-tls_experiment.pcap and /dev/null differ diff --git a/tests/pcaps/tls/client-certificate.pcap b/tests/pcaps/tls/client-certificate.pcap deleted file mode 100644 index cef1e8a..0000000 Binary files a/tests/pcaps/tls/client-certificate.pcap and /dev/null differ diff --git a/tests/pcaps/tls/dhe.pcap b/tests/pcaps/tls/dhe.pcap deleted file mode 100644 index d5e034e..0000000 Binary files a/tests/pcaps/tls/dhe.pcap and /dev/null differ diff --git a/tests/pcaps/tls/dtls1_0.pcap b/tests/pcaps/tls/dtls1_0.pcap deleted file mode 100644 index b07e692..0000000 Binary files a/tests/pcaps/tls/dtls1_0.pcap and /dev/null differ diff --git a/tests/pcaps/tls/dtls1_2.pcap b/tests/pcaps/tls/dtls1_2.pcap deleted file mode 100644 index a8ce0f9..0000000 Binary files a/tests/pcaps/tls/dtls1_2.pcap and /dev/null differ diff --git a/tests/pcaps/tls/ecdhe.pcap b/tests/pcaps/tls/ecdhe.pcap deleted file mode 100644 index e37df37..0000000 Binary files a/tests/pcaps/tls/ecdhe.pcap and /dev/null differ diff --git a/tests/pcaps/tls/ecdsa-cert.pcap b/tests/pcaps/tls/ecdsa-cert.pcap deleted file mode 100644 index 8ad7fb7..0000000 Binary files a/tests/pcaps/tls/ecdsa-cert.pcap and /dev/null differ diff --git a/tests/pcaps/tls/google-cert-repeat.pcap b/tests/pcaps/tls/google-cert-repeat.pcap deleted file mode 100644 index 92027db..0000000 Binary files a/tests/pcaps/tls/google-cert-repeat.pcap and /dev/null differ diff --git a/tests/pcaps/tls/google-duplicate.trace b/tests/pcaps/tls/google-duplicate.trace deleted file mode 100644 index e78fb01..0000000 Binary files a/tests/pcaps/tls/google-duplicate.trace and /dev/null differ diff --git a/tests/pcaps/tls/heartbleed-encrypted-short.pcap b/tests/pcaps/tls/heartbleed-encrypted-short.pcap deleted file mode 100644 index 91942d5..0000000 Binary files a/tests/pcaps/tls/heartbleed-encrypted-short.pcap and /dev/null differ diff --git a/tests/pcaps/tls/heartbleed-encrypted-success.pcap b/tests/pcaps/tls/heartbleed-encrypted-success.pcap deleted file mode 100644 index 3658458..0000000 Binary files a/tests/pcaps/tls/heartbleed-encrypted-success.pcap and /dev/null differ diff --git a/tests/pcaps/tls/heartbleed-encrypted.pcap b/tests/pcaps/tls/heartbleed-encrypted.pcap deleted file mode 100644 index dc32d68..0000000 Binary files a/tests/pcaps/tls/heartbleed-encrypted.pcap and /dev/null differ diff --git a/tests/pcaps/tls/heartbleed-success.pcap b/tests/pcaps/tls/heartbleed-success.pcap deleted file mode 100644 index 47a2bac..0000000 Binary files a/tests/pcaps/tls/heartbleed-success.pcap and /dev/null differ diff --git a/tests/pcaps/tls/heartbleed.pcap b/tests/pcaps/tls/heartbleed.pcap deleted file mode 100644 index 46e7935..0000000 Binary files a/tests/pcaps/tls/heartbleed.pcap and /dev/null differ diff --git a/tests/pcaps/tls/hrr.pcap b/tests/pcaps/tls/hrr.pcap deleted file mode 100644 index fa64ab6..0000000 Binary files a/tests/pcaps/tls/hrr.pcap and /dev/null differ diff --git a/tests/pcaps/tls/imap-starttls.pcap b/tests/pcaps/tls/imap-starttls.pcap deleted file mode 100644 index f6bfe54..0000000 Binary files a/tests/pcaps/tls/imap-starttls.pcap and /dev/null differ diff --git a/tests/pcaps/tls/irc-starttls.pcap b/tests/pcaps/tls/irc-starttls.pcap deleted file mode 100644 index 77b2446..0000000 Binary files a/tests/pcaps/tls/irc-starttls.pcap and /dev/null differ diff --git a/tests/pcaps/tls/missing-intermediate.pcap b/tests/pcaps/tls/missing-intermediate.pcap deleted file mode 100644 index 9f44e3e..0000000 Binary files a/tests/pcaps/tls/missing-intermediate.pcap and /dev/null differ diff --git a/tests/pcaps/tls/ocsp-http-get.pcap b/tests/pcaps/tls/ocsp-http-get.pcap deleted file mode 100644 index e264d59..0000000 Binary files a/tests/pcaps/tls/ocsp-http-get.pcap and /dev/null differ diff --git a/tests/pcaps/tls/ocsp-request-only.pcap b/tests/pcaps/tls/ocsp-request-only.pcap deleted file mode 100644 index 1d4e85d..0000000 Binary files a/tests/pcaps/tls/ocsp-request-only.pcap and /dev/null differ diff --git a/tests/pcaps/tls/ocsp-request-response.pcap b/tests/pcaps/tls/ocsp-request-response.pcap deleted file mode 100644 index 77306ea..0000000 Binary files a/tests/pcaps/tls/ocsp-request-response.pcap and /dev/null differ diff --git a/tests/pcaps/tls/ocsp-response-only.pcap b/tests/pcaps/tls/ocsp-response-only.pcap deleted file mode 100644 index 63fbdde..0000000 Binary files a/tests/pcaps/tls/ocsp-response-only.pcap and /dev/null differ diff --git a/tests/pcaps/tls/ocsp-revoked.pcap b/tests/pcaps/tls/ocsp-revoked.pcap deleted file mode 100644 index a2cd450..0000000 Binary files a/tests/pcaps/tls/ocsp-revoked.pcap and /dev/null differ diff --git a/tests/pcaps/tls/ocsp-stapling-digicert.trace b/tests/pcaps/tls/ocsp-stapling-digicert.trace deleted file mode 100644 index 982249c..0000000 Binary files a/tests/pcaps/tls/ocsp-stapling-digicert.trace and /dev/null differ diff --git a/tests/pcaps/tls/ocsp-stapling-twimg.trace b/tests/pcaps/tls/ocsp-stapling-twimg.trace deleted file mode 100644 index f53762f..0000000 Binary files a/tests/pcaps/tls/ocsp-stapling-twimg.trace and /dev/null differ diff --git a/tests/pcaps/tls/ocsp-stapling.trace b/tests/pcaps/tls/ocsp-stapling.trace deleted file mode 100644 index 8b66f72..0000000 Binary files a/tests/pcaps/tls/ocsp-stapling.trace and /dev/null differ diff --git a/tests/pcaps/tls/pop3-starttls.pcap b/tests/pcaps/tls/pop3-starttls.pcap deleted file mode 100644 index cd1b2a8..0000000 Binary files a/tests/pcaps/tls/pop3-starttls.pcap and /dev/null differ diff --git a/tests/pcaps/tls/signed_certificate_timestamp-2.pcap b/tests/pcaps/tls/signed_certificate_timestamp-2.pcap deleted file mode 100644 index 6d19d32..0000000 Binary files a/tests/pcaps/tls/signed_certificate_timestamp-2.pcap and /dev/null differ diff --git a/tests/pcaps/tls/signed_certificate_timestamp.pcap b/tests/pcaps/tls/signed_certificate_timestamp.pcap deleted file mode 100644 index 50efed9..0000000 Binary files a/tests/pcaps/tls/signed_certificate_timestamp.pcap and /dev/null differ diff --git a/tests/pcaps/tls/signed_certificate_timestamp_tls1_0.pcap b/tests/pcaps/tls/signed_certificate_timestamp_tls1_0.pcap deleted file mode 100644 index 4cd9fdc..0000000 Binary files a/tests/pcaps/tls/signed_certificate_timestamp_tls1_0.pcap and /dev/null differ diff --git a/tests/pcaps/tls/smtp-starttls.pcap b/tests/pcaps/tls/smtp-starttls.pcap deleted file mode 100644 index d1d3812..0000000 Binary files a/tests/pcaps/tls/smtp-starttls.pcap and /dev/null differ diff --git a/tests/pcaps/tls/ssl-v2.trace b/tests/pcaps/tls/ssl-v2.trace deleted file mode 100644 index a97ea3f..0000000 Binary files a/tests/pcaps/tls/ssl-v2.trace and /dev/null differ diff --git a/tests/pcaps/tls/ssl.v3.trace b/tests/pcaps/tls/ssl.v3.trace deleted file mode 100644 index 3bcb972..0000000 Binary files a/tests/pcaps/tls/ssl.v3.trace and /dev/null differ diff --git a/tests/pcaps/tls/telesec.pcap b/tests/pcaps/tls/telesec.pcap deleted file mode 100644 index 0f27b68..0000000 Binary files a/tests/pcaps/tls/telesec.pcap and /dev/null differ diff --git a/tests/pcaps/tls/tls-1.2-handshake-failure.trace b/tests/pcaps/tls/tls-1.2-handshake-failure.trace deleted file mode 100644 index aecda8c..0000000 Binary files a/tests/pcaps/tls/tls-1.2-handshake-failure.trace and /dev/null differ diff --git a/tests/pcaps/tls/tls-1.2-stream-keylog.pcap b/tests/pcaps/tls/tls-1.2-stream-keylog.pcap deleted file mode 100644 index bbebc0a..0000000 Binary files a/tests/pcaps/tls/tls-1.2-stream-keylog.pcap and /dev/null differ diff --git a/tests/pcaps/tls/tls-13draft19-early-data.pcap b/tests/pcaps/tls/tls-13draft19-early-data.pcap deleted file mode 100644 index 042ca6a..0000000 Binary files a/tests/pcaps/tls/tls-13draft19-early-data.pcap and /dev/null differ diff --git a/tests/pcaps/tls/tls-conn-with-extensions.trace b/tests/pcaps/tls/tls-conn-with-extensions.trace deleted file mode 100644 index a3b724b..0000000 Binary files a/tests/pcaps/tls/tls-conn-with-extensions.trace and /dev/null differ diff --git a/tests/pcaps/tls/tls-early-alert.trace b/tests/pcaps/tls/tls-early-alert.trace deleted file mode 100644 index b91b506..0000000 Binary files a/tests/pcaps/tls/tls-early-alert.trace and /dev/null differ diff --git a/tests/pcaps/tls/tls-expired-cert.trace b/tests/pcaps/tls/tls-expired-cert.trace deleted file mode 100644 index 2c26b52..0000000 Binary files a/tests/pcaps/tls/tls-expired-cert.trace and /dev/null differ diff --git a/tests/pcaps/tls/tls-fragmented-handshake.pcap.gz b/tests/pcaps/tls/tls-fragmented-handshake.pcap.gz deleted file mode 100644 index 6642502..0000000 Binary files a/tests/pcaps/tls/tls-fragmented-handshake.pcap.gz and /dev/null differ diff --git a/tests/pcaps/tls/tls1.2.trace b/tests/pcaps/tls/tls1.2.trace deleted file mode 100644 index 87d50c2..0000000 Binary files a/tests/pcaps/tls/tls1.2.trace and /dev/null differ diff --git a/tests/pcaps/tls/tls12-decryption.pcap b/tests/pcaps/tls/tls12-decryption.pcap deleted file mode 100644 index 73ffaa1..0000000 Binary files a/tests/pcaps/tls/tls12-decryption.pcap and /dev/null differ diff --git a/tests/pcaps/tls/tls13_psk_succesfull.pcap b/tests/pcaps/tls/tls13_psk_succesfull.pcap deleted file mode 100644 index ccd9dce..0000000 Binary files a/tests/pcaps/tls/tls13_psk_succesfull.pcap and /dev/null differ diff --git a/tests/pcaps/tls/tls13_wolfssl.pcap b/tests/pcaps/tls/tls13_wolfssl.pcap deleted file mode 100644 index d86dd5c..0000000 Binary files a/tests/pcaps/tls/tls13_wolfssl.pcap and /dev/null differ diff --git a/tests/pcaps/tls/tls13draft16-chrome55.0.2879.0-canary-aborted.pcap b/tests/pcaps/tls/tls13draft16-chrome55.0.2879.0-canary-aborted.pcap deleted file mode 100644 index dfe06bf..0000000 Binary files a/tests/pcaps/tls/tls13draft16-chrome55.0.2879.0-canary-aborted.pcap and /dev/null differ diff --git a/tests/pcaps/tls/tls13draft16-chrome55.0.2879.0-canary.pcap b/tests/pcaps/tls/tls13draft16-chrome55.0.2879.0-canary.pcap deleted file mode 100644 index 76b3282..0000000 Binary files a/tests/pcaps/tls/tls13draft16-chrome55.0.2879.0-canary.pcap and /dev/null differ diff --git a/tests/pcaps/tls/tls13draft16-ff52.a01-aborted.pcap b/tests/pcaps/tls/tls13draft16-ff52.a01-aborted.pcap deleted file mode 100644 index 2e62ef6..0000000 Binary files a/tests/pcaps/tls/tls13draft16-ff52.a01-aborted.pcap and /dev/null differ diff --git a/tests/pcaps/tls/tls13draft16-ff52.a01.pcap b/tests/pcaps/tls/tls13draft16-ff52.a01.pcap deleted file mode 100644 index b438907..0000000 Binary files a/tests/pcaps/tls/tls13draft16-ff52.a01.pcap and /dev/null differ diff --git a/tests/pcaps/tls/tls13draft23-chrome67.0.3368.0-canary.pcap b/tests/pcaps/tls/tls13draft23-chrome67.0.3368.0-canary.pcap deleted file mode 100644 index 15c80ef..0000000 Binary files a/tests/pcaps/tls/tls13draft23-chrome67.0.3368.0-canary.pcap and /dev/null differ diff --git a/tests/pcaps/tls/tls1_1.pcap b/tests/pcaps/tls/tls1_1.pcap deleted file mode 100644 index 36ad52c..0000000 Binary files a/tests/pcaps/tls/tls1_1.pcap and /dev/null differ diff --git a/tests/pcaps/tls/webrtc-stun.pcap b/tests/pcaps/tls/webrtc-stun.pcap deleted file mode 100644 index 6eb5f90..0000000 Binary files a/tests/pcaps/tls/webrtc-stun.pcap and /dev/null differ diff --git a/tests/pcaps/tls/x509-generalizedtime.pcap b/tests/pcaps/tls/x509-generalizedtime.pcap deleted file mode 100644 index 6f02603..0000000 Binary files a/tests/pcaps/tls/x509-generalizedtime.pcap and /dev/null differ diff --git a/tests/pcaps/tls/xmpp-dialback-starttls.pcap b/tests/pcaps/tls/xmpp-dialback-starttls.pcap deleted file mode 100644 index ad55c6e..0000000 Binary files a/tests/pcaps/tls/xmpp-dialback-starttls.pcap and /dev/null differ diff --git a/tests/pcaps/tls/xmpp-starttls.pcap b/tests/pcaps/tls/xmpp-starttls.pcap deleted file mode 100644 index b4a7ee6..0000000 Binary files a/tests/pcaps/tls/xmpp-starttls.pcap and /dev/null differ diff --git a/tests/pcaps/trunc/icmp-header-trunc.pcap b/tests/pcaps/trunc/icmp-header-trunc.pcap deleted file mode 100644 index 5765cf2..0000000 Binary files a/tests/pcaps/trunc/icmp-header-trunc.pcap and /dev/null differ diff --git a/tests/pcaps/trunc/icmp-payload-trunc.pcap b/tests/pcaps/trunc/icmp-payload-trunc.pcap deleted file mode 100644 index 13607dd..0000000 Binary files a/tests/pcaps/trunc/icmp-payload-trunc.pcap and /dev/null differ diff --git a/tests/pcaps/trunc/ip4-trunc.pcap b/tests/pcaps/trunc/ip4-trunc.pcap deleted file mode 100644 index 30df0ea..0000000 Binary files a/tests/pcaps/trunc/ip4-trunc.pcap and /dev/null differ diff --git a/tests/pcaps/trunc/ip6-ext-trunc.pcap b/tests/pcaps/trunc/ip6-ext-trunc.pcap deleted file mode 100644 index 1de6590..0000000 Binary files a/tests/pcaps/trunc/ip6-ext-trunc.pcap and /dev/null differ diff --git a/tests/pcaps/trunc/ip6-trunc.pcap b/tests/pcaps/trunc/ip6-trunc.pcap deleted file mode 100644 index 0111cae..0000000 Binary files a/tests/pcaps/trunc/ip6-trunc.pcap and /dev/null differ diff --git a/tests/pcaps/trunc/ipv4-internally-truncated-header.pcap b/tests/pcaps/trunc/ipv4-internally-truncated-header.pcap deleted file mode 100644 index b7ba9f1..0000000 Binary files a/tests/pcaps/trunc/ipv4-internally-truncated-header.pcap and /dev/null differ diff --git a/tests/pcaps/trunc/ipv4-truncated-broken-header.pcap b/tests/pcaps/trunc/ipv4-truncated-broken-header.pcap deleted file mode 100644 index 8dba9bb..0000000 Binary files a/tests/pcaps/trunc/ipv4-truncated-broken-header.pcap and /dev/null differ diff --git a/tests/pcaps/trunc/mpls-6in6-6in6-4in6-trunc.pcap b/tests/pcaps/trunc/mpls-6in6-6in6-4in6-trunc.pcap deleted file mode 100644 index afd07cb..0000000 Binary files a/tests/pcaps/trunc/mpls-6in6-6in6-4in6-trunc.pcap and /dev/null differ diff --git a/tests/pcaps/trunc/mpls-6in6-broken.pcap.gz b/tests/pcaps/trunc/mpls-6in6-broken.pcap.gz deleted file mode 100644 index af717b1..0000000 Binary files a/tests/pcaps/trunc/mpls-6in6-broken.pcap.gz and /dev/null differ diff --git a/tests/pcaps/trunc/trunc-hdr.pcap b/tests/pcaps/trunc/trunc-hdr.pcap deleted file mode 100644 index c7820a3..0000000 Binary files a/tests/pcaps/trunc/trunc-hdr.pcap and /dev/null differ diff --git a/tests/pcaps/tunnels/4in4.pcap b/tests/pcaps/tunnels/4in4.pcap deleted file mode 100644 index b0d89ee..0000000 Binary files a/tests/pcaps/tunnels/4in4.pcap and /dev/null differ diff --git a/tests/pcaps/tunnels/4in6.pcap b/tests/pcaps/tunnels/4in6.pcap deleted file mode 100644 index 5c813b9..0000000 Binary files a/tests/pcaps/tunnels/4in6.pcap and /dev/null differ diff --git a/tests/pcaps/tunnels/6in4.pcap b/tests/pcaps/tunnels/6in4.pcap deleted file mode 100644 index 2d0cd5c..0000000 Binary files a/tests/pcaps/tunnels/6in4.pcap and /dev/null differ diff --git a/tests/pcaps/tunnels/6in6-tunnel-change.pcap b/tests/pcaps/tunnels/6in6-tunnel-change.pcap deleted file mode 100644 index c5838fd..0000000 Binary files a/tests/pcaps/tunnels/6in6-tunnel-change.pcap and /dev/null differ diff --git a/tests/pcaps/tunnels/6in6.pcap b/tests/pcaps/tunnels/6in6.pcap deleted file mode 100644 index ff8aa60..0000000 Binary files a/tests/pcaps/tunnels/6in6.pcap and /dev/null differ diff --git a/tests/pcaps/tunnels/6in6in6.pcap b/tests/pcaps/tunnels/6in6in6.pcap deleted file mode 100644 index 192524a..0000000 Binary files a/tests/pcaps/tunnels/6in6in6.pcap and /dev/null differ diff --git a/tests/pcaps/tunnels/Teredo.pcap b/tests/pcaps/tunnels/Teredo.pcap deleted file mode 100644 index 2eff144..0000000 Binary files a/tests/pcaps/tunnels/Teredo.pcap and /dev/null differ diff --git a/tests/pcaps/tunnels/ayiya3.trace b/tests/pcaps/tunnels/ayiya3.trace deleted file mode 100644 index 8319305..0000000 Binary files a/tests/pcaps/tunnels/ayiya3.trace and /dev/null differ diff --git a/tests/pcaps/tunnels/geneve.README b/tests/pcaps/tunnels/geneve.README deleted file mode 100644 index 2e24706..0000000 --- a/tests/pcaps/tunnels/geneve.README +++ /dev/null @@ -1,2 +0,0 @@ -The trace file `geneve.pcap` was downloaded from the Wireshark bug tracker, -https://gitlab.com/wireshark/wireshark/-/issues/10193. diff --git a/tests/pcaps/tunnels/geneve.pcap b/tests/pcaps/tunnels/geneve.pcap deleted file mode 100644 index d477bc2..0000000 Binary files a/tests/pcaps/tunnels/geneve.pcap and /dev/null differ diff --git a/tests/pcaps/tunnels/gre-aruba.pcap b/tests/pcaps/tunnels/gre-aruba.pcap deleted file mode 100644 index ba150aa..0000000 Binary files a/tests/pcaps/tunnels/gre-aruba.pcap and /dev/null differ diff --git a/tests/pcaps/tunnels/gre-erspan3-dot1q.pcap b/tests/pcaps/tunnels/gre-erspan3-dot1q.pcap deleted file mode 100644 index 21f9449..0000000 Binary files a/tests/pcaps/tunnels/gre-erspan3-dot1q.pcap and /dev/null differ diff --git a/tests/pcaps/tunnels/gre-pptp.pcap b/tests/pcaps/tunnels/gre-pptp.pcap deleted file mode 100644 index 45216c7..0000000 Binary files a/tests/pcaps/tunnels/gre-pptp.pcap and /dev/null differ diff --git a/tests/pcaps/tunnels/gre-sample.pcap b/tests/pcaps/tunnels/gre-sample.pcap deleted file mode 100644 index 31c08b6..0000000 Binary files a/tests/pcaps/tunnels/gre-sample.pcap and /dev/null differ diff --git a/tests/pcaps/tunnels/gre-within-gre.pcap b/tests/pcaps/tunnels/gre-within-gre.pcap deleted file mode 100644 index c0a8d5c..0000000 Binary files a/tests/pcaps/tunnels/gre-within-gre.pcap and /dev/null differ diff --git a/tests/pcaps/tunnels/gtp/gtp10_not_0xff.pcap b/tests/pcaps/tunnels/gtp/gtp10_not_0xff.pcap deleted file mode 100755 index 575edf5..0000000 Binary files a/tests/pcaps/tunnels/gtp/gtp10_not_0xff.pcap and /dev/null differ diff --git a/tests/pcaps/tunnels/gtp/gtp1_gn_normal_incl_fragmentation.pcap b/tests/pcaps/tunnels/gtp/gtp1_gn_normal_incl_fragmentation.pcap deleted file mode 100755 index 7ca3b3b..0000000 Binary files a/tests/pcaps/tunnels/gtp/gtp1_gn_normal_incl_fragmentation.pcap and /dev/null differ diff --git a/tests/pcaps/tunnels/gtp/gtp2_different_udp_port.pcap b/tests/pcaps/tunnels/gtp/gtp2_different_udp_port.pcap deleted file mode 100755 index fda97cd..0000000 Binary files a/tests/pcaps/tunnels/gtp/gtp2_different_udp_port.pcap and /dev/null differ diff --git a/tests/pcaps/tunnels/gtp/gtp3_false_gtp.pcap b/tests/pcaps/tunnels/gtp/gtp3_false_gtp.pcap deleted file mode 100755 index e623fd7..0000000 Binary files a/tests/pcaps/tunnels/gtp/gtp3_false_gtp.pcap and /dev/null differ diff --git a/tests/pcaps/tunnels/gtp/gtp4_udp_2152_inside.pcap b/tests/pcaps/tunnels/gtp/gtp4_udp_2152_inside.pcap deleted file mode 100755 index ca67a37..0000000 Binary files a/tests/pcaps/tunnels/gtp/gtp4_udp_2152_inside.pcap and /dev/null differ diff --git a/tests/pcaps/tunnels/gtp/gtp6_gtp_0x32.pcap b/tests/pcaps/tunnels/gtp/gtp6_gtp_0x32.pcap deleted file mode 100755 index 7dd3905..0000000 Binary files a/tests/pcaps/tunnels/gtp/gtp6_gtp_0x32.pcap and /dev/null differ diff --git a/tests/pcaps/tunnels/gtp/gtp7_ipv6.pcap b/tests/pcaps/tunnels/gtp/gtp7_ipv6.pcap deleted file mode 100755 index 4f358bc..0000000 Binary files a/tests/pcaps/tunnels/gtp/gtp7_ipv6.pcap and /dev/null differ diff --git a/tests/pcaps/tunnels/gtp/gtp8_teredo.pcap b/tests/pcaps/tunnels/gtp/gtp8_teredo.pcap deleted file mode 100755 index fff0b2d..0000000 Binary files a/tests/pcaps/tunnels/gtp/gtp8_teredo.pcap and /dev/null differ diff --git a/tests/pcaps/tunnels/gtp/gtp9_unknown_or_too_short_payload.pcap b/tests/pcaps/tunnels/gtp/gtp9_unknown_or_too_short_payload.pcap deleted file mode 100755 index a39026a..0000000 Binary files a/tests/pcaps/tunnels/gtp/gtp9_unknown_or_too_short_payload.pcap and /dev/null differ diff --git a/tests/pcaps/tunnels/gtp/gtp_control_prime.pcap b/tests/pcaps/tunnels/gtp/gtp_control_prime.pcap deleted file mode 100644 index ebed358..0000000 Binary files a/tests/pcaps/tunnels/gtp/gtp_control_prime.pcap and /dev/null differ diff --git a/tests/pcaps/tunnels/gtp/gtp_create_pdp_ctx.pcap b/tests/pcaps/tunnels/gtp/gtp_create_pdp_ctx.pcap deleted file mode 100644 index 7828315..0000000 Binary files a/tests/pcaps/tunnels/gtp/gtp_create_pdp_ctx.pcap and /dev/null differ diff --git a/tests/pcaps/tunnels/gtp/gtp_ext_header.pcap b/tests/pcaps/tunnels/gtp/gtp_ext_header.pcap deleted file mode 100644 index 453ebf9..0000000 Binary files a/tests/pcaps/tunnels/gtp/gtp_ext_header.pcap and /dev/null differ diff --git a/tests/pcaps/tunnels/gtp/pdp_ctx_messages.trace b/tests/pcaps/tunnels/gtp/pdp_ctx_messages.trace deleted file mode 100644 index 2124ee4..0000000 Binary files a/tests/pcaps/tunnels/gtp/pdp_ctx_messages.trace and /dev/null differ diff --git a/tests/pcaps/tunnels/mpls-6in6-6in6-4in6-invalid-version-4.pcap b/tests/pcaps/tunnels/mpls-6in6-6in6-4in6-invalid-version-4.pcap deleted file mode 100644 index a71c045..0000000 Binary files a/tests/pcaps/tunnels/mpls-6in6-6in6-4in6-invalid-version-4.pcap and /dev/null differ diff --git a/tests/pcaps/tunnels/mpls-6in6-6in6-invalid-version-6.pcap b/tests/pcaps/tunnels/mpls-6in6-6in6-invalid-version-6.pcap deleted file mode 100644 index 5588092..0000000 Binary files a/tests/pcaps/tunnels/mpls-6in6-6in6-invalid-version-6.pcap and /dev/null differ diff --git a/tests/pcaps/tunnels/ping6-in-ipv4.pcap b/tests/pcaps/tunnels/ping6-in-ipv4.pcap deleted file mode 100644 index 5e0995f..0000000 Binary files a/tests/pcaps/tunnels/ping6-in-ipv4.pcap and /dev/null differ diff --git a/tests/pcaps/tunnels/socks.pcap b/tests/pcaps/tunnels/socks.pcap deleted file mode 100644 index d70e2cb..0000000 Binary files a/tests/pcaps/tunnels/socks.pcap and /dev/null differ diff --git a/tests/pcaps/tunnels/teredo-udp-in-udp.pcap b/tests/pcaps/tunnels/teredo-udp-in-udp.pcap deleted file mode 100644 index 3f08887..0000000 Binary files a/tests/pcaps/tunnels/teredo-udp-in-udp.pcap and /dev/null differ diff --git a/tests/pcaps/tunnels/teredo_bubble_with_payload.pcap b/tests/pcaps/tunnels/teredo_bubble_with_payload.pcap deleted file mode 100644 index 5036a52..0000000 Binary files a/tests/pcaps/tunnels/teredo_bubble_with_payload.pcap and /dev/null differ diff --git a/tests/pcaps/tunnels/vxlan-encapsulated-http.pcap b/tests/pcaps/tunnels/vxlan-encapsulated-http.pcap deleted file mode 100644 index 3ad59f4..0000000 Binary files a/tests/pcaps/tunnels/vxlan-encapsulated-http.pcap and /dev/null differ diff --git a/tests/pcaps/tunnels/vxlan-encapsulated-igmp-v2.pcap b/tests/pcaps/tunnels/vxlan-encapsulated-igmp-v2.pcap deleted file mode 100644 index 1e0206a..0000000 Binary files a/tests/pcaps/tunnels/vxlan-encapsulated-igmp-v2.pcap and /dev/null differ diff --git a/tests/pcaps/tunnels/vxlan.pcap b/tests/pcaps/tunnels/vxlan.pcap deleted file mode 100644 index 76c91f7..0000000 Binary files a/tests/pcaps/tunnels/vxlan.pcap and /dev/null differ diff --git a/tests/pcaps/udp-multiple-source-ports.pcap b/tests/pcaps/udp-multiple-source-ports.pcap deleted file mode 100644 index 340fa19..0000000 Binary files a/tests/pcaps/udp-multiple-source-ports.pcap and /dev/null differ diff --git a/tests/pcaps/udp-signature-test.pcap b/tests/pcaps/udp-signature-test.pcap deleted file mode 100644 index 01a880f..0000000 Binary files a/tests/pcaps/udp-signature-test.pcap and /dev/null differ diff --git a/tests/pcaps/var-services-std-ports.trace b/tests/pcaps/var-services-std-ports.trace deleted file mode 100644 index b124fb7..0000000 Binary files a/tests/pcaps/var-services-std-ports.trace and /dev/null differ diff --git a/tests/pcaps/vntag.pcap b/tests/pcaps/vntag.pcap deleted file mode 100644 index 0ac1766..0000000 Binary files a/tests/pcaps/vntag.pcap and /dev/null differ diff --git a/tests/pcaps/web.trace b/tests/pcaps/web.trace deleted file mode 100644 index 1651085..0000000 Binary files a/tests/pcaps/web.trace and /dev/null differ diff --git a/tests/pcaps/wikipedia-filtered-plus-udp.trace b/tests/pcaps/wikipedia-filtered-plus-udp.trace deleted file mode 100644 index a35da06..0000000 Binary files a/tests/pcaps/wikipedia-filtered-plus-udp.trace and /dev/null differ diff --git a/tests/pcaps/wikipedia.trace b/tests/pcaps/wikipedia.trace deleted file mode 100644 index 9e21966..0000000 Binary files a/tests/pcaps/wikipedia.trace and /dev/null differ diff --git a/tests/pcaps/wlanmon.pcap b/tests/pcaps/wlanmon.pcap deleted file mode 100644 index a940ea1..0000000 Binary files a/tests/pcaps/wlanmon.pcap and /dev/null differ diff --git a/tests/pcaps/workshop_2011_browse.trace b/tests/pcaps/workshop_2011_browse.trace deleted file mode 100644 index 74d2f9c..0000000 Binary files a/tests/pcaps/workshop_2011_browse.trace and /dev/null differ diff --git a/tests/pcaps/www-odd-url.trace b/tests/pcaps/www-odd-url.trace deleted file mode 100644 index 2fd86c5..0000000 Binary files a/tests/pcaps/www-odd-url.trace and /dev/null differ