Giter Club home page Giter Club logo

pcapify's Introduction

IEEE 802.15.4 packet logs to PCAP files

In this repository resides Pcapify, a simple Python script for converting log files of IEEE 802.15.4 traffic, for instance, collected with Bitsniff, to PCAP files.

Introduction

For ease of use Pcapify supports a couple of user-defined log formats out-of-box and two link layer types for IEEE 802.15.4 packets having either an FCS or not. To get an idea of what user-defined log formats mean, a few examples are listed below.

[2017-04-02 18:01:06,967]c0ffee
[2017-04-02 18:01:06,967] 0xc0 0xff 0xee
1500566466.965 c0 ff ee
1500566466965c0ffee
25 1500566466.965     1000 c0 ff ee

Perhaps one could use, Pcapify as a starting point for developing more complex conversions of log files to PCAP files including AES decryption, decomposition of MAC and NET headers for in-depth analysis of proprietary protocols and so on.

Usage

Pcapify needs in the first place two arguments to get to work. One of these is for declaring where to look for input, the other is meant to provide knowledge about where to store the output.

-id, --input-directory: a directory containing log files
-if, --input-file: a single log file
-od, --output-directory: directory for storing PCAP files
-of, --output-file: just one PCAP file

Pcapify wants to know either FCS has been captured or not. This is just for setting a value for the IEEE 802.15.4 link layer, which is respected by almost every dissector capable of reading PCAP files.

-fc, --frame-check: frame check sequence is present

The last argument is also optional. It can be used to split the output with regard to time. This option prevents creating massive PCAP files taking hours to load and process by splitting the output into chunks, each getting its own file.

-cp, --chunk-period: split PCAP files into chunks of seconds

Examples

Convert log files in a directory to PCAP

Providing the arguments as follows, Pcapify reads all files in the subdirectory ./log and stores the subsequent PCAP files in the subdirectory ./out. Due to the chunking, each PCAP file obtains a maximum timeframe of 86400 seconds, which equals one day. Since frame check is set, the IEEE 802.15.4 link layer in all PCAP files is set to 195 (0xC3) signaling a frame check sequence (FCS) at the end of each packet.

$ python3 pcapify.py -id ./log -od ./out -cp 86400 -fc

Pipe to Wireshark

Pcapify can read content on stdin (e.g. created by Bitsniff) and forward the output to another pipe, which is observed by another process (e.g. Wireshark). Since Bitsniff appends an FCS to all received frames, the frame check should be set.

$ mkfifo wireshark.in
$ wireshark -k -i wireshark.in &
$ java -jar bitsniff.jar -c 26 -p /dev/ttyACM0 | python3 pcapify.py -sf /dev/stdin -tf wireshark.in -fc

pcapify's People

Contributors

m6c7l avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.