Skip to content
Lorenzo Mangani edited this page Jun 2, 2019 · 8 revisions

node-webshark

webShark for NodeJS

Development Guide & Quick Reference

sharkd

Commands

The following examples extracted from tests illustrate the baseline sharkd JSON API usage

Status

This command should be executed to retrieve the results of any operation.

 {"req": "status"}
Example Output
{"frames": 0, "duration": 0.0}

Load PCAP

{"req": "load", "file": capture_file('dhcp.pcap')}
Example
{"req": "status"},
 {"frames": 4, "duration": 0.070345000,"filename": "dhcp.pcap", "filesize": 1400}

Analyse

 {"req": "analyse"}
Example
 {"frames": 4, "protocols": ["frame", "eth", "ethertype", "ip", "udp",
                                        "dhcp"], "first": 1102274184.317452908, "last": 1102274184.387798071}

Check

 {"req": "check"}
Example
{"req": "check", "filter": "ip", "field": "ip"}
{"err": 0, "filter": "ok", "field": "ok"}

Complete

{"req": "complete"}
Example
{"req": "complete", "field": "frame.le"}
{"req": "complete", "pref": "tcp."}

Frames

{"req": "frames"}

Tap

{"req": "tap"}
Example
{"req": "tap", "tap0": "conv:Ethernet", "tap1": "endpt:TCP"}

Follow

{"req": "follow", "follow": "UDP", "filter": "frame.number==1"}

IOGraph

 {"req": "iograph"}
Example
 {"req": "iograph", "graph0": "max:udp.length", "filter0": "udp.length"}
{"req": "iograph", "graph0": "packets", "graph1": "bytes"},

Intervals

{"req": "intervals"}
Example
{"req": "intervals", "interval": 1},
{"req": "intervals", "filter": "frame.number <= 2"}

Frame

{"req": "frame", "frame": 2}

Frame + Protocol

{"req": "frame", "frame": 2, "proto": True}

Comment

{"req": "setcomment", "frame": 99999, "comment": "meh\nbaz"}

SetConf

{"req": "setconf", "name": "tcp.check_checksum", "value": "TRUE"}

DumpConf

{"req": "dumpconf"}

Download

Secrets
 {"req": "download", "token": "ssl-secrets"}

Bye

 {"req": "bye"}