Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

examples: Move in RIOT/applications #18602

Merged
merged 153 commits into from
Sep 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
153 commits
Select commit Hold shift + click to select a range
0345f28
sixlowapp: initial import of a 6LoWPAN example app
OlegHahm Nov 6, 2014
b921f57
sixlowapp: fixed typo and complemented usage text
OlegHahm Nov 6, 2014
1744c66
sixlowapp: updated README
OlegHahm Nov 6, 2014
7bc5111
sniffer: initial import
OlegHahm Nov 27, 2014
7daa0c0
add microcoap example application
Lotterleben Feb 5, 2015
db292ba
Merge pull request https://github.com/RIOT-OS/applications/pull/2 fro…
miri64 Mar 4, 2015
de18e75
sixlowapp: fix small typo
Lotterleben Mar 21, 2015
4e4305c
Merge pull request https://github.com/RIOT-OS/applications/pull/3 fro…
miri64 Mar 27, 2015
afc9758
sixlowapp: adapted to new shell handler prototype
OlegHahm Apr 9, 2015
03d2494
Merge pull request https://github.com/RIOT-OS/applications/pull/5 fro…
Lotterleben Apr 9, 2015
47a6057
ng_sniffer: added ng version of sniffer application
haukepetersen Apr 21, 2015
bf11b0f
Merge pull request https://github.com/RIOT-OS/applications/pull/6 fro…
haukepetersen Jun 2, 2015
e0ef049
sixlowapp: rename thread related constants
booo Jun 4, 2015
568c26c
Merge pull request https://github.com/RIOT-OS/applications/pull/8 fro…
miri64 Jun 4, 2015
c42da5e
git: added .gitignore, copied from RIOT
haukepetersen Jun 2, 2015
2dec123
Merge pull request https://github.com/RIOT-OS/applications/pull/7 fro…
OlegHahm Jun 23, 2015
3e1346d
add application for openwsn
thomaseichinger Dec 19, 2014
ccc4e3f
Merge pull request https://github.com/RIOT-OS/applications/pull/1 fro…
OlegHahm Jul 16, 2015
e454242
openwsn: fix prototype for putchar
OlegHahm Jul 17, 2015
ad75cdd
Merge pull request https://github.com/RIOT-OS/applications/pull/9 fro…
haukepetersen Jul 20, 2015
367f329
ng_sniffer: added ng_netif_default
OlegHahm Aug 3, 2015
76362f9
Merge pull request https://github.com/RIOT-OS/applications/pull/10 fr…
miri64 Aug 3, 2015
18965d5
ng_sniffer: use uart0 only for none newlib boards
OlegHahm Aug 4, 2015
66e3cb9
Merge pull request https://github.com/RIOT-OS/applications/pull/11 fr…
haukepetersen Aug 5, 2015
bde91e0
sniffer: remove old application
miri64 Aug 9, 2015
10cad08
Merge pull request https://github.com/RIOT-OS/applications/pull/12 fr…
OlegHahm Aug 9, 2015
017cbf1
remove apps belonging to the old network stack
OlegHahm Aug 23, 2015
131b20f
Merge pull request https://github.com/RIOT-OS/applications/pull/13 fr…
miri64 Aug 23, 2015
b425340
sniffer: re-add sniffer
OlegHahm Sep 9, 2015
094f8a8
Merge pull request https://github.com/RIOT-OS/applications/pull/14 fr…
miri64 Sep 9, 2015
4ecbc71
sniffer: update application to current RIOT master
OlegHahm Sep 15, 2015
a9355a4
Merge pull request https://github.com/RIOT-OS/applications/pull/15 fr…
miri64 Sep 15, 2015
f654c1e
sniffer: switch to xtimer
OlegHahm Sep 16, 2015
cec9a54
Merge pull request https://github.com/RIOT-OS/applications/pull/16 fr…
Sep 16, 2015
2424c6e
sniffer: s/CREATE_STACKTEST/THREAD_CREATE_STACKTEST/
haukepetersen Jan 6, 2016
9ff9997
Merge pull request https://github.com/RIOT-OS/applications/pull/18 fr…
haukepetersen Jan 6, 2016
d737d8e
microcoap: rm stale example in favor of RIOT/examples/microcoap_server
Lotterleben Jan 26, 2016
34ec440
openwsn: make: use correct name of iotlab-m3
cgundogan Apr 6, 2016
6ec13f8
Merge pull request https://github.com/RIOT-OS/applications/pull/24 fr…
OlegHahm Apr 6, 2016
b4f5cb6
openwsn: remove vtimer, use xtimer
cgundogan Apr 6, 2016
0e9af39
Merge pull request https://github.com/RIOT-OS/applications/pull/25 fr…
OlegHahm Apr 6, 2016
9651f8f
sniffer: update to RIOT master module name
OlegHahm Apr 8, 2016
571ca99
Merge pull request https://github.com/RIOT-OS/applications/pull/26 fr…
haukepetersen Apr 8, 2016
b96c0f6
Merge pull request https://github.com/RIOT-OS/applications/pull/21 fr…
miri64 Apr 22, 2016
0ef7e8e
sniffer: Update to follow gnrc_netreg_entry_t API change
Nov 10, 2016
ae7c8f5
Merge pull request https://github.com/RIOT-OS/applications/pull/28 fr…
miri64 Nov 10, 2016
8c8de7c
sniffer: Update xtimer_now64 usage after xtimer API change
Jun 3, 2017
a455a00
sniffer: Avoid relying on printf support for 64 bit numbers
Jun 3, 2017
857aed3
Merge pull request https://github.com/RIOT-OS/applications/pull/29 fr…
miri64 Jun 3, 2017
03a5318
spectrum-scanner: Application for radio ED scanning
Jun 3, 2017
93d864f
Merge pull request https://github.com/RIOT-OS/applications/pull/30 fr…
smlng Oct 23, 2017
4f14d2a
sniffer: add script, moved from RIOT main repo
smlng Nov 23, 2017
126a1c7
Merge pull request https://github.com/RIOT-OS/applications/pull/31 fr…
OlegHahm Nov 24, 2017
f9b3889
sniffer: remove gnrc_netif header; read LQI
miri64 Jun 18, 2018
47aa717
sniffer: add message queue for dumper thread
miri64 Jun 18, 2018
1376b75
Merge pull request https://github.com/RIOT-OS/applications/pull/34 fr…
smlng Jun 19, 2018
3628f0d
sniffer: script: ignore non-ASCII characters on input
miri64 Jun 19, 2018
f0427fb
Merge pull request https://github.com/RIOT-OS/applications/pull/33 fr…
cgundogan Jun 19, 2018
517f000
openwsn: remove deprecated application
PeterKietzmann Jun 22, 2018
b600dcf
sniffer: use argparse to parse script arguments
miri64 Jun 19, 2018
271eaef
Merge pull request https://github.com/RIOT-OS/applications/pull/37 fr…
miri64 Jul 13, 2018
1f77040
sniffer: make baudrate optional
miri64 Jun 19, 2018
d671b22
Merge pull request https://github.com/RIOT-OS/applications/pull/39 fr…
miri64 Jul 13, 2018
e4f7369
sniffer: get connection type from string format
miri64 Jun 19, 2018
d0ec177
Merge pull request https://github.com/RIOT-OS/applications/pull/35 fr…
miri64 Jul 14, 2018
73dca04
Merge pull request https://github.com/RIOT-OS/applications/pull/40 fr…
miri64 Jul 14, 2018
9204feb
sniffer: use fmt instead of printf
miri64 Jun 19, 2018
3ef810f
sniffer: adapt parsing script
miri64 Jun 19, 2018
5c19cf3
sniffer: reduce rawdump thread stack size
miri64 Jun 19, 2018
853f294
Merge pull request https://github.com/RIOT-OS/applications/pull/41 fr…
miri64 Sep 28, 2018
c32bd15
sniffer: fix default baudrate in script
smlng Oct 2, 2018
76a98e3
Merge pull request https://github.com/RIOT-OS/applications/pull/45 fr…
miri64 Oct 2, 2018
ee613bd
sniffer: Update script path in README of sniffer application
miri64 Sep 26, 2018
1216b9b
sniffer.py: document default parameter values in help
miri64 Sep 26, 2018
9f50194
sniffer/tools: Update README to reflect use of argparse
miri64 Sep 26, 2018
24ea80f
Merge pull request https://github.com/RIOT-OS/applications/pull/43 fr…
miri64 Oct 2, 2018
ca9dea3
Merge pull request https://github.com/RIOT-OS/applications/pull/36 fr…
miri64 Oct 2, 2018
f8fbc9a
sniffer: uncrustify
smlng Oct 2, 2018
a62839b
spectrum-scanner: uncrustify
smlng Oct 2, 2018
bb49847
Merge pull request https://github.com/RIOT-OS/applications/pull/46 fr…
miri64 Oct 2, 2018
b0eae4b
spektrum-scanner: adapt to new gnrc_netif calls
smlng Oct 4, 2018
6838b92
spektrum-scanner: set default board to samr21-xpro
smlng Oct 4, 2018
612b733
Merge pull request https://github.com/RIOT-OS/applications/pull/47 fr…
Oct 8, 2018
b1cfc48
spektrum-scanner: fix plot_rssi.py script
smlng Oct 4, 2018
d90adcb
Merge pull request https://github.com/RIOT-OS/applications/pull/49 fr…
smlng Oct 8, 2018
8869afd
coap-chat: a simple chat application using gCoAP
smlng Aug 28, 2018
8278c7d
Merge pull request https://github.com/RIOT-OS/applications/pull/44 fr…
kb2ma Oct 13, 2018
025e103
spectrum-scanner: Plotting rewrite
Oct 16, 2018
ead0b1a
spectrum-scanner: Shrink plot Z limits
Oct 18, 2018
4ab673c
sniffer: Check for missing netif header in dump_pkt
Oct 26, 2018
fd81987
Merge pull request https://github.com/RIOT-OS/applications/pull/54 fr…
miri64 Oct 27, 2018
2138b01
add RIOT as a submodule
smlng Oct 2, 2018
71ab847
adapt RIOTBASE to use submodule path
smlng Oct 2, 2018
bd1e557
Merge pull request https://github.com/RIOT-OS/applications/pull/50 fr…
kaspar030 Jan 3, 2019
0d63000
initial travis.yml
smlng Oct 2, 2018
1dcc7f8
Merge pull request https://github.com/RIOT-OS/applications/pull/48 fr…
miri64 Jan 8, 2019
b203452
Revert submodule change of #48
miri64 Jan 8, 2019
96b8fa0
Merge pull request https://github.com/RIOT-OS/applications/pull/57 fr…
smlng Jan 8, 2019
7a771c2
add missing LICENSE
smlng Jan 9, 2019
3131dac
Merge pull request https://github.com/RIOT-OS/applications/pull/59 fr…
miri64 Jan 9, 2019
53e91a1
Update RIOT submodule to 2019.01
miri64 Feb 15, 2019
9e8e41b
Merge pull request https://github.com/RIOT-OS/applications/pull/60 fr…
miri64 Feb 18, 2019
1ee703a
RIOT: update submodule to 2019.04
miri64 Apr 30, 2019
96a894b
Provide README
miri64 Jan 8, 2019
3b73f9a
Merge pull request https://github.com/RIOT-OS/applications/pull/63 fr…
Apr 30, 2019
4be4e20
sniffer: remove obsolete reference to RIOTBASE
kb2ma Dec 24, 2019
b926d47
Merge pull request https://github.com/RIOT-OS/applications/pull/58 fr…
smlng Feb 18, 2019
d78501d
spectrum-scanner: fix flake8 issues
smlng Nov 28, 2019
3d2c230
Merge pull request https://github.com/RIOT-OS/applications/pull/53 fr…
smlng Nov 28, 2019
1b99397
sniffer: add output example
kb2ma Dec 24, 2019
6ca3a17
travis: notify maintainers via mail about builds
miri64 Apr 12, 2019
a780454
Merge pull request https://github.com/RIOT-OS/applications/pull/65 fr…
miri64 Nov 29, 2019
f31eb2f
sniffer: formatting and syntax updates
kb2ma Dec 24, 2019
190e592
RIOT: update submodule to 2019.10
kb2ma Dec 24, 2019
23b7164
Merge pull request https://github.com/RIOT-OS/applications/pull/62 fr…
smlng Nov 29, 2019
5955c6f
RIOT: bump version to 2020.01
fjmolinas Feb 5, 2020
bb9aa60
sniffer: fix references to board network interface
kb2ma Dec 24, 2019
8dd36cf
coap-chat: update for gcoap change in 2019.10 release
kb2ma Dec 24, 2019
b166ba3
Merge pull request https://github.com/RIOT-OS/applications/pull/67 fr…
miri64 Dec 26, 2019
5a0a37a
RIOT-OS Submodule : Update to 2022.07 release
akshaim Sep 6, 2022
33024b4
RIOT: update for 2020.07
miri64 Jul 27, 2020
e0e2e40
README: fix submodule initialization
fjmolinas Feb 5, 2020
818eb2d
sniffer: fix reference to sniffer tool README
kb2ma Dec 24, 2019
04ff351
Merge pull request https://github.com/RIOT-OS/applications/pull/68 fr…
miri64 Dec 26, 2019
8f8db4f
coap-chat: Update to 2022.07 release
chrysn Sep 16, 2022
5b050d8
coap-chat: adapt for 2020.07 release
miri64 Jul 27, 2020
b0307a4
coap-chat/coap.c: apply api changes
fjmolinas Feb 5, 2020
ad5c7c9
Merge pull request https://github.com/RIOT-OS/applications/pull/69 fr…
miri64 Jan 13, 2020
bc38fd4
spectrum-scanner: Update to 2022.07 release
chrysn Sep 16, 2022
0fb6a17
spectrum-scanner: adapt for 2020.07 release
miri64 Jul 27, 2020
5b40f96
Merge pull request https://github.com/RIOT-OS/applications/pull/71 fr…
aabadie Feb 5, 2020
25a5151
sniffer: Update to 2022.07 release
chrysn Sep 16, 2022
9d17a74
coap-chat: adapt to new gcoap API
leandrolanzieri Feb 4, 2021
9db3138
Merge pull request https://github.com/RIOT-OS/applications/pull/72 fr…
miri64 Jul 28, 2020
dda61ca
dependencies: Replace deprecated module
chrysn Sep 19, 2022
b4f4173
travis: Remove flak8
akshaim Mar 22, 2021
c71f74e
Merge pull request https://github.com/RIOT-OS/applications/pull/74 fr…
miri64 Feb 5, 2021
ef9b3a0
sniffer: Migrate to ztimer
chrysn Sep 19, 2022
43903b1
Merge pull request https://github.com/RIOT-OS/applications/pull/76 fr…
miri64 Mar 22, 2021
1c187bb
sniffer: correct handling of byte strings
miri64 Sep 19, 2022
eb0ec39
Remove "coap-chat" application
chrysn Sep 19, 2022
7c5f2e3
Merge pull request https://github.com/RIOT-OS/applications/pull/78 fr…
miri64 Sep 19, 2022
adf8ed1
sniffer.py: enforce use of python3
miri64 Sep 20, 2022
4217c68
Merge pull request https://github.com/RIOT-OS/applications/pull/80 fr…
chrysn Sep 19, 2022
646b37b
sniffer / spectrum-scanner: reformat using black
miri64 Sep 20, 2022
a6a642a
Merge pull request https://github.com/RIOT-OS/applications/pull/81 fr…
miri64 Sep 20, 2022
a54501f
Merge pull request https://github.com/RIOT-OS/applications/pull/82 fr…
chrysn Sep 20, 2022
39dab4e
Remove files from RIOT-applications that make no sense in RIOT examples
chrysn Sep 20, 2022
17a042a
Move RIOT-applications into examples
chrysn Sep 20, 2022
ff3d3b5
makefiles: Adjust paths of RIOT-applications to run from examples
chrysn Sep 20, 2022
f738c9b
Move in RIOT/applications
chrysn Sep 20, 2022
13f94cb
examples: sniffer / spectrum_analyzer: amend Makefile.ci
miri64 Sep 20, 2022
59d184f
examples/spectrum-scanner: Fix building on PIC32 and RISC-V
chrysn Sep 20, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions examples/sniffer/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Set the name of your application:
APPLICATION = sniffer

# If no BOARD is found in the environment, use this default:
BOARD ?= native

# This has to be the absolute path to the RIOT base directory:
RIOTBASE ?= $(CURDIR)/../..

# Define modules that are used
USEMODULE += fmt
USEMODULE += gnrc
USEMODULE += netdev_default
USEMODULE += auto_init_gnrc_netif
USEMODULE += shell
USEMODULE += shell_commands
USEMODULE += ps
USEMODULE += ztimer64_usec

# Change this to 0 show compiler invocation lines by default:
QUIET ?= 1

include $(RIOTBASE)/Makefile.include
25 changes: 25 additions & 0 deletions examples/sniffer/Makefile.ci
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
BOARD_INSUFFICIENT_MEMORY := \
arduino-duemilanove \
arduino-leonardo \
arduino-mega2560 \
arduino-nano \
arduino-uno \
atmega328p-xplained-mini \
atmega328p \
bluepill-stm32f030c8 \
i-nucleo-lrwan1 \
nucleo-f030r8 \
nucleo-f031k6 \
nucleo-f042k6 \
nucleo-l011k4 \
nucleo-l031k6 \
nucleo-l053r8 \
samd10-xmini \
slstk3400a \
stk3200 \
stm32f030f4-demo \
stm32f0discovery \
stm32g0316-disco \
stm32l0538-disco \
waspmote-pro \
#
22 changes: 22 additions & 0 deletions examples/sniffer/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
About
=====

This application is built to run together with the script `./tools/sniffer.py`
as a sniffer for (wireless) data traffic. This application works with any board
with any network device that supports the gnrc network stack (or precisely the
gnrc parts up to the link-layer). Further the network device (and its driver)
needs to support promiscuous and raw mode for usable output. Finally the board
needs to include auto-initialization code for the targeted network device.


Usage
=====

Compile and flash this application to the board of your choice. You can check
if everything on the RIOT side works by connecting to the board via UART and by
checking with `ifconfig` if a network device is available. Also note the
interface number for the following commands. Then you can check with
`ifconfig <iface> promisc` if promiscuous mode is supported and with
`ifconfig <iface> raw` if raw mode is supported by the driver/network device.

For further information on setting up the host part, see `./tools/README.md`.
137 changes: 137 additions & 0 deletions examples/sniffer/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
/*
* Copyright (C) 2015-18 Freie Universität Berlin
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
* directory for more details.
*/

/**
* @defgroup app_sniffer
* @brief Sniffer application based on the new network stack
* @{
*
* @file
* @brief Sniffer application for RIOT
*
* @author Hauke Petersen <hauke.petersen@fu-berlin.de>
* @author Martine Lenders <m.lenders@fu-berlin.de>
*
* @}
*/

#include <stdio.h>

#include "fmt.h"
#include "thread.h"
#include "shell.h"
#include "net/gnrc.h"
#include "ztimer64.h"

/**
* @brief Buffer size used by the shell
*/
#define SHELL_BUFSIZE (64U)

/**
* @brief Priority of the RAW dump thread
*/
#define RAWDUMP_PRIO (THREAD_PRIORITY_MAIN - 1)

/**
* @brief Message queue size of the RAW dump thread
*/
#define RAWDUMP_MSG_Q_SIZE (32U)

/**
* @brief Stack for the raw dump thread
*/
static char rawdmp_stack[THREAD_STACKSIZE_SMALL];

/**
* @brief Make a raw dump of the given packet contents
*/
void dump_pkt(gnrc_pktsnip_t *pkt)
{
gnrc_pktsnip_t *snip = pkt;
uint8_t lqi = 0;
if (pkt->next) {
if (pkt->next->type == GNRC_NETTYPE_NETIF) {
gnrc_netif_hdr_t *netif_hdr = pkt->next->data;
lqi = netif_hdr->lqi;
pkt = gnrc_pktbuf_remove_snip(pkt, pkt->next);
}
}
uint64_t now_us = ztimer64_now(ZTIMER64_USEC);

print_str("rftest-rx --- len ");
print_u32_hex((uint32_t)gnrc_pkt_len(pkt));
print_str(" lqi ");
print_byte_hex(lqi);
print_str(" rx_time ");
print_u64_hex(now_us);
print_str("\n");
while (snip) {
for (size_t i = 0; i < snip->size; i++) {
print_byte_hex(((uint8_t *)(snip->data))[i]);
print_str(" ");
}
snip = snip->next;
}
print_str("\n\n");

gnrc_pktbuf_release(pkt);
}

/**
* @brief Event loop of the RAW dump thread
*
* @param[in] arg unused parameter
*/
void *rawdump(void *arg)
{
msg_t msg_q[RAWDUMP_MSG_Q_SIZE];

(void)arg;
msg_init_queue(msg_q, RAWDUMP_MSG_Q_SIZE);
while (1) {
msg_t msg;

msg_receive(&msg);
switch (msg.type) {
case GNRC_NETAPI_MSG_TYPE_RCV:
dump_pkt((gnrc_pktsnip_t *)msg.content.ptr);
break;
default:
/* do nothing */
break;
}
}

/* never reached */
return NULL;
}

/**
* @brief Maybe you are a golfer?!
*/
int main(void)
{
gnrc_netreg_entry_t dump;

puts("RIOT sniffer application");

/* start and register rawdump thread */
puts("Run the rawdump thread and register it");
dump.target.pid = thread_create(rawdmp_stack, sizeof(rawdmp_stack), RAWDUMP_PRIO,
THREAD_CREATE_STACKTEST, rawdump, NULL, "rawdump");
dump.demux_ctx = GNRC_NETREG_DEMUX_CTX_ALL;
gnrc_netreg_register(GNRC_NETTYPE_UNDEF, &dump);

/* start the shell */
puts("All ok, starting the shell now");
char line_buf[SHELL_DEFAULT_BUFSIZE];
shell_run(NULL, line_buf, SHELL_DEFAULT_BUFSIZE);

return 0;
}
114 changes: 114 additions & 0 deletions examples/sniffer/tools/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
# RIOT Sniffer Application


## About

This sniffer script can be used to monitor and capture network traffic using
a RIOT based node. It is primarily designed for sniffing wireless data traffic,
but can also well be used for wired network traffic, as long as used network
devices support promiscuous mode and output of raw data.

The python script `sniffer.py` requires a RIOT node running the sniffer app, its
source code is located in this repository (see main folder). This node outputs
received network traffic via a serial port or a network socket in the common
Wireshark/libpcap (pcap) format. This output is then parsed by the `sniffer.py`
script included in this folder run on a host computer.

The `sniffer.py` script is a modified version of [malvira's script](https://github.com/malvira/libmc1322x/blob/master/tools/rftestrx2pcap.py)
for the Redbee Ecotag (https://github.com/malvira/libmc1322x/wiki/wireshark).

## Dependencies

The `sniffer.py` script is written in Python and needs [pyserial](https://pypi.python.org/pypi/pyserial).

Installing the dependencies:


#### Debuntu
apt-get install python-serial

#### PIP
pip install pyserial


## Usage

General usage:

1. Flash an applicable RIOT node with the sniffer application (insert path to
RIOT source and board name), as follows:
```
$ git clone https://github.com/RIOT-OS/applications/
$ cd applications/sniffer
$ BOARD=<name> make clean all flash
```

2. Run the `sniffer.py` script (change to subfolder `tools/`) as follows :
For serial port:
```
$ ./sniffer.py [-b baudrate] <tty> <channel> [outfile]
```
For network socket:
```
$ ./sniffer.py <host>:<port> <channel> [outfile]
```

You should see output like below:
```
ifconfig 3 set chan 26
ifconfig 3 raw
ifconfig 3 promisc
RX: 0
```

For detailed information on the parameters use the scripts on-line help:

```
./sniffer.py -h
```

### Examples

The following examples are made when using the sniffer application together with
an `iotlab-m3` node that is connected to `/dev/ttyUSB1`(or COM1) (`serial` connection type)
and runs per default with a baudrate of 500000. For the `socket` connection type port 20000
is used.

#### Linux (serial)

Dump packets to a file:
```
$ ./sniffer.py -b 500000 /dev/ttyUSB1 17 foo.pcap
```

This .pcap can then be opened in Wireshark.

Alternatively for live captures, you can pipe directly into Wireshark with:
```
$ ./sniffer.py -b 500000 /dev/ttyUSB1 17 | wireshark -k -i -
```

#### Windows (serial)

For windows you can use the optional third argument to output to a
.pcap:

```
$ ./sniffer.py -b 500000 COM1 17 foo.pcap
```

#### IoT-Lab Testbed (socket)

Start an experiment either via the website provided by the IoT-Lab testbed or
by using the RIOT specific iotlab Makefile with 3 neighboring `iotlab-m3` nodes,
where one of them runs the sniffer application and the others run the `gnrc_networking` application.

Now you can bind the sniffer node to localhost:
ssh -L 20000:_node-id_:20000 _user_@_site_.iot-lab.info

Then you can dump or observe the traffic generated by the other nodes running the `gnrc_networking`
application via one of the following commands:
```
$ ./sniffer.py localhost:20000 26 foo.pcap
$ ./sniffer.py localhost:20000 26 | wireshark -k -i -
```
Loading