Add a reorderpcap tool

This commit is contained in:
2026-10-05 20:35:47 +02:00
parent c11c893845
commit e70549337e
5 changed files with 46 additions and 28 deletions
+4 -1
View File
@@ -23,6 +23,7 @@ type Tool struct {
var tools = []Tool{
{Name: "Hex → pcap", Path: "/hex2pcap", Description: "Build a pcap file from hex-encoded layer 2, layer 3 and payload bytes, optionally fixing IP lengths and checksums."},
{Name: "Split pcap", Path: "/split", Description: "Split a pcap file into several files by packet count or file size, downloaded as a zip."},
{Name: "Reorder pcap", Path: "/reorder", Description: "Sort the packets of a pcap file by timestamp, like reordercap."},
}
// Config holds server settings.
@@ -43,7 +44,7 @@ func New(cfg Config) (*Server, error) {
// Each page is parsed together with the shared layout so pages can define
// their own "title" and "content" blocks.
for _, page := range []string{"index.html", "hex2pcap.html", "split.html"} {
for _, page := range []string{"index.html", "hex2pcap.html", "split.html", "reorder.html"} {
t, err := template.New(page).ParseFS(assets, "templates/layout.html", "templates/"+page)
if err != nil {
return nil, err
@@ -61,6 +62,8 @@ func New(cfg Config) (*Server, error) {
s.mux.HandleFunc("POST /hex2pcap", s.handleHex2Pcap)
s.mux.HandleFunc("GET /split", s.handleSplitForm)
s.mux.HandleFunc("POST /split", s.handleSplit)
s.mux.HandleFunc("GET /reorder", s.handleReorderForm)
s.mux.HandleFunc("POST /reorder", s.handleReorder)
return s, nil
}