<commit_before># Dot11 [![Build Status](https://travis-ci.org/mtth/dot11.svg?branch=master)](https://travis-ci.org/mtth/dot11)

*A powerful yet simple API for Wi-Fi monitoring.*

`dot11` leverages Node.js' [streams](http://nodejs.org/api/stream.html) to
provide an intuitive and efficient interface for packet capture and injection.
It is inspired by other packet capturing libraries (e.g.
[lib_pcap](https://github.com/mranney/node_pcap)).

```javascript
var dot11 = require('dot11');

var capture = new dot11.capture.Live('en0', {promisc: true, monitor: true});
var extractor = new dot11.transform.Extractor();
var decoder = new dot11.transform.Decoder({stringify: true, ignoreErrors: true});

capture                     // Stream of Wi-Fi packets inside Radiotap headers.
  .pipe(extractor)          // Stream of extracted 802.11 frames.
  .pipe(decoder)            // Stream of decoded and stringified 802.11 frames.
  .pipe(process.stdout);    // Output result to console.
```


## Installation

```bash
$ npm install dot11
```

`dot11` depends on [libpcap](http://www.tcpdump.org/) (available by default on
OS X). In order to be able to capture packets, you might also need to run live
captures as root.


## Quickstart

### Capture

In the example below, we create a readable
[`Live`](https://github.com/mtth/dot11/blob/master/doc/api.md#class-dot11capturelive)
stream from default network interface and store 5 seconds' worth of packets to
`log.pcap` by writing to a
[`Save`](https://github.com/mtth/dot11/blob/master/doc/api.md#class-dot11capturesave)
stream. We also print each packet's length and the total number of packets
processed.

```javascript
var dot11 = require('dot11');

var liveStream = new dot11.capture.Live(); // Readable stream of packets.
var saveStream = new dot11.capture.Save('log.pcap'); // Writable stream.

liveStream
  .close(5000)<commit_msg>Update doc.<commit_after># Dot11 [![Build Status](https://travis-ci.org/mtth/dot11.svg?branch=master)](https://travis-ci.org/mtth/dot11)

*A powerful yet simple API for Wi-Fi monitoring.*

`dot11` leverages Node.js' [streams](http://nodejs.org/api/stream.html) to
provide an intuitive and efficient interface for packet capture and injection.
It is inspired by other packet capturing libraries (e.g.
[lib_pcap](https://github.com/mranney/node_pcap)).

```javascript
var dot11 = require('dot11');

var capture = new dot11.capture.Live('en0', {promisc: true, monitor: true});
var extractor = new dot11.transform.Extractor();
var decoder = new dot11.transform.Decoder({stringify: true, ignoreErrors: true});

capture                     // Stream of Wi-Fi packets inside Radiotap headers.
  .pipe(extractor)          // Stream of extracted 802.11 frames.
  .pipe(decoder)            // Stream of decoded and stringified 802.11 frames.
  .pipe(process.stdout);    // Output result to console.
```


## Installation

```bash
$ npm install dot11
```

`dot11` depends on [libpcap](http://www.tcpdump.org/) (available by default on
OS X). In order to be able to capture packets, you might also need to run live
captures as root.


## Quickstart

### Capture

In the example below, we create a readable
[`Live`](https://github.com/mtth/dot11/blob/master/doc/api.md#class-dot11capturelive)
stream from the default network interface and store 5 seconds' worth of packets to
a file by writing to a
[`Save`](https://github.com/mtth/dot11/blob/master/doc/api.md#class-dot11capturesave)
stream. We also print each packet's length and the total number of packets
processed at the very end.

```javascript
var dot11 = require('dot11');

var liveStream = new dot11.capture.Live(); // Readable stream of packets.
var saveStream = new dot11.capture.Save('log.pcap'); // Writable stream.

liveStream
  .close(5000)
{'fraction_non_alphanumeric': 0.1288441145281018, 'fraction_numerical': 0.02863202545068929, 'mean_word_length': 4.044117647058823, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 10, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '392722', 'n_tokens_mistral': 1249, 'n_tokens_neox': 1143, 'n_words': 376}