Skip to content

Commit

Permalink
Readme++
Browse files Browse the repository at this point in the history
  • Loading branch information
Enteee committed Nov 24, 2018
1 parent dac77ec commit 9b17572
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 4 deletions.
45 changes: 43 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ _Aggregates wireshark pdml to flows, with plugins_
| develop | [![Build Status develop]](https://travis-ci.org/Enteee/pdml2flow) | [![Coverage Status develop]](https://coveralls.io/github/Enteee/pdml2flow?branch=develop) |

## Prerequisites

* [python]:
- 3.4
- 3.5
Expand All @@ -18,15 +19,17 @@ _Aggregates wireshark pdml to flows, with plugins_
* [pip](https://pypi.python.org/pypi/pip)

## Installation

```shell
$ sudo pip install pdml2flow
```

## Usage

```shell
$ pdml2flow -h
usage: pdml2flow [-h] [--version] [-f FLOW_DEF_STR] [-t FLOW_BUFFER_TIME]
[-l DATA_MAXLEN] [-s] [-c] [-a] [-m] [-d] [+json [args]]
[-l DATA_MAXLEN] [-s] [-c] [-a] [-d] [+json [args]]
[+xml [args]]

Aggregates wireshark pdml to flows
Expand All @@ -47,7 +50,6 @@ optional arguments:
preserve order of leaves [default: False]
-a Instead of merging the frames will append them to an
array [default: False]
-m Appends flow metadata [default: False]
-d Debug mode [default: False]

Plugins:
Expand All @@ -60,6 +62,7 @@ Plugins:
```
## Example
Sniff from interface and write json:
```shell
$ tshark -i interface -Tpdml | pdml2flow +json
Expand Down Expand Up @@ -90,6 +93,44 @@ $ tshark -i interface -Tpdml | pdml2flow +json | fluentflow rules.js
* [Elasticsearch](https://github.com/Enteee/pdml2flow-elasticsearch)
* see [pdml2flow/plugins/](pdml2flow/plugins/) for a full list of supported plugins
### Interface
```python
# vim: set fenc=utf8 ts=4 sw=4 et :

class Plugin2(object): # pragma: no cover
"""Version 2 plugin interface."""

@staticmethod
def help():
"""Return a help string."""
pass

def __init__(self, *args):
"""Called once during startup."""
pass

def __deinit__(self):
"""Called once during shutdown."""
pass

def flow_new(self, flow, frame):
"""Called every time a new flow is opened."""
pass

def flow_expired(self, flow):
"""Called every time a flow expired, before printing the flow."""
pass

def flow_end(self, flow):
"""Called every time a flow ends, before printing the flow."""
pass

def frame_new(self, frame, flow):
"""Called for every new frame."""
pass
```
### Create a New Plugin
[![asciicast](https://asciinema.org/a/208963.png)](https://asciinema.org/a/208963)
Expand Down
10 changes: 9 additions & 1 deletion pdml2flow/plugin-skeleton/scripts/mkreadme.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
#!/bin/bash
#!/usr/bin/env bash
set -exuo pipefail

TOPLEVEL="$( cd "$(dirname "$0")" ; pwd -P )/../"

# install plugin
sudo pip install --upgrade -e "${TOPLEVEL}"

cat <<EOF > "${TOPLEVEL}/README.md"
# pdml2flow-plugin-skeleton [![PyPI version](https://badge.fury.io/py/pdml2flow-plugin-skeleton.svg)](https://badge.fury.io/py/pdml2flow-plugin-skeleton)
_[pdml2flow] plugin skeleton_
Expand All @@ -11,6 +16,7 @@ _[pdml2flow] plugin skeleton_
| develop | [![Build Status develop]](https://travis-ci.org/Username/pdml2flow-plugin-skeleton) | [![Coverage Status develop]](https://coveralls.io/github/Username/pdml2flow-plugin-skeleton?branch=develop) |
## Prerequisites
$( cat "${TOPLEVEL}/.travis.yml" |
sed -n -e '/# VERSION START/,/# VERSION END/ p' |
sed -e '1d;$d' |
Expand All @@ -21,11 +27,13 @@ $( cat "${TOPLEVEL}/.travis.yml" |
* [pip](https://pypi.python.org/pypi/pip)
## Installation
\`\`\`shell
$ sudo pip install pdml2flow-plugin-skeleton
\`\`\`
## Usage
\`\`\`shell
$(python "${TOPLEVEL}/plugin/plugin.py")
\`\`\`
Expand Down
17 changes: 16 additions & 1 deletion scripts/mkreadme.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#!/bin/bash
#!/usr/bin/env bash
set -exuo pipefail

TOPLEVEL="$( cd "$(dirname "$0")" ; pwd -P )/../"

# install pdml2flow
Expand All @@ -14,6 +16,7 @@ _Aggregates wireshark pdml to flows, with plugins_
| develop | [![Build Status develop]](https://travis-ci.org/Enteee/pdml2flow) | [![Coverage Status develop]](https://coveralls.io/github/Enteee/pdml2flow?branch=develop) |
## Prerequisites
$( cat "${TOPLEVEL}/.travis.yml" |
sed -n -e '/# VERSION START/,/# VERSION END/ p' |
sed -e '1d;$d' |
Expand All @@ -24,17 +27,20 @@ $( cat "${TOPLEVEL}/.travis.yml" |
* [pip](https://pypi.python.org/pypi/pip)
## Installation
\`\`\`shell
$ sudo pip install pdml2flow
\`\`\`
## Usage
\`\`\`shell
$ pdml2flow -h
$(pdml2flow -h)
\`\`\`
## Example
Sniff from interface and write json:
\`\`\`shell
$ tshark -i interface -Tpdml | pdml2flow +json
Expand Down Expand Up @@ -62,6 +68,15 @@ $ tshark -i interface -Tpdml | pdml2flow +json | fluentflow rules.js
## Plugins
* [Elasticsearch](https://github.com/Enteee/pdml2flow-elasticsearch)
* see [pdml2flow/plugins/](pdml2flow/plugins/) for a full list of supported plugins
### Interface
\`\`\`python
$(cat "${TOPLEVEL}/pdml2flow/plugin.py")
\`\`\`
### Create a New Plugin
[![asciicast](https://asciinema.org/a/208963.png)](https://asciinema.org/a/208963)
Expand Down

0 comments on commit 9b17572

Please sign in to comment.