This guide covers the minimal concepts and common workflows for Paclo.
For installation and CLI entry examples, start from README.md.
paclo.core is the user-facing API.packets returns lazy packet maps from a file (:path) or device (:device).bpf converts a small Clojure DSL to BPF strings.write-pcap! writes byte records back to a PCAP file.paclo.decode-ext) annotate decoded packets.(require '[paclo.core :as core])
(->> (core/packets {:path "test/resources/dns-sample.pcap"
:decode? true})
(map #(select-keys % [:caplen :decoded :decode-error]))
(take 2)
doall)
(require '[paclo.core :as core])
(->> (core/packets {:device "en0"
:filter (core/bpf [:and [:udp] [:port 53]])
:timeout-ms 50})
(take 10)
doall)
(require '[paclo.core :as core])
(core/write-pcap! [(byte-array (repeat 60 (byte 0)))
{:bytes (byte-array (repeat 60 (byte -1)))
:sec 1700000000
:usec 123456}]
"out.pcap")
(core/bpf [:and [:ipv6] [:udp] [:dst-port-range 8000 9000]])
;; => "(ip6) and (udp) and (dst portrange 8000-9000)"
(core/bpf [:and [:net "10.0.0.0/8"] [:not [:port 22]]])
;; => "(net 10.0.0.0/8) and (not (port 22))"
(require '[paclo.core :as core]
'[paclo.proto.dns-ext :as dns-ext])
(dns-ext/register!)
(->> (core/packets {:path "test/resources/dns-sample.pcap"
:decode? true})
(take 1)
doall)
See docs/extensions.md for hook contract and TLS/DNS extension notes.
Paclo ships practical CLI examples under dev/examples.
Use README.md as the command index, and use this guide for API behavior.
:decode? true does not throw on parse failure.:decode-error in each packet map.:filter type) throw ex-info.:xform transducers in packets for early map/filter and lower allocation.transduce or bounded realization over full materialization../cljdoc-api-contract.md./extensions.md./ROADMAP.mdCan you improve this documentation?Edit on GitHub
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |