Skip to content

Commit cedec4b

Browse files
committed
New golang based dumpy.
1 parent 3268a47 commit cedec4b

22 files changed

Lines changed: 1889 additions & 81 deletions

.gitignore

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Build artifacts.
2+
dumpy
3+
dumpy.test
4+
*~
5+
/dist/
6+
7+
# Running artifacts.
8+
*.pem
9+
dumpy.yaml*
10+
11+
# IntelliJ files.
12+
*.iml
13+
/.idea

.travis.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
language: go
2+
3+
go:
4+
- 1.2
5+
6+
script: make get-go-deps && go test -f ./...

LICENSE.txt

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// Copyright (c) 2014 Jason Ish. All rights reserved.
2+
//
3+
// Redistribution and use in source and binary forms, with or without
4+
// modification, are permitted provided that the following conditions
5+
// are met:
6+
//
7+
// 1. Redistributions of source code must retain the above copyright
8+
// notice, this list of conditions and the following disclaimer.
9+
//
10+
// 2. Redistributions in binary form must reproduce the above
11+
// copyright notice, this list of conditions and the following
12+
// disclaimer in the documentation and/or other materials provided
13+
// with the distribution.
14+
//
15+
// THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
16+
// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17+
// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18+
// DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
19+
// INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20+
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
21+
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22+
// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
23+
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24+
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
25+
// OF THE POSSIBILITY OF SUCH DAMAGE.

Makefile

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,37 @@
1-
nall:
2-
go build
1+
GODEPS := github.com/GeertJohan/go.rice \
2+
github.com/GeertJohan/go.rice/rice \
3+
code.google.com/p/go.crypto/bcrypt \
4+
github.com/gorilla/mux \
5+
gopkg.in/yaml.v1
6+
7+
all:
8+
go build -o dumpy
9+
10+
dist: VERSION = $(shell ./dumpy version)
11+
dist: GOHOSTARCH = $(shell go env GOHOSTARCH)
12+
dist: GOHOSTOS = $(shell go env GOHOSTOS)
13+
dist: DISTNAME = dumpy-$(VERSION)-$(GOHOSTOS)-$(GOHOSTARCH)
14+
dist: all
15+
rice -v append --exec dumpy
16+
mkdir -p dist/$(DISTNAME)
17+
cp README.md dist/$(DISTNAME)
18+
cp LICENSE.txt dist/$(DISTNAME)
19+
cp dumpy dist/$(DISTNAME)
20+
cd dist && zip -r $(DISTNAME).zip $(DISTNAME)
321

422
clean:
523
rm -f dumpy
24+
rm -rf dist
625
find . -name \*~ -exec rm -f {} \;
726

27+
get-go-deps:
28+
@for dep in $(GODEPS); do \
29+
echo "go get $$dep"; \
30+
go get $$dep; \
31+
done
832

33+
update-go-deps:
34+
@for dep in $(GODEPS); do \
35+
echo "go get -u $$dep"; \
36+
go get -u $$dep; \
37+
done

README.md

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# Dumpy
2+
3+
Dumpy is a simple to install, and simple to use web front end for PCAP
4+
spool file directories such as those produced by daemonlogger or
5+
tcpdump.
6+
7+
## Setup
8+
9+
1. First, setup at least one pcap spool directory. This can be done
10+
using daemonlogger
11+
(http://www.snort.org/snort-downloads/additional-downloads#daemonlogger)
12+
or other tools like it. Example command:
13+
14+
daemonlogger -i eth0 -l /data/capture -s 1000000000 -M 70 -r
15+
16+
2. Download a dumpy binary package
17+
(https://github.com/jasonish/dumpy/releases) or build from source.
18+
Note: Requires libpcap to be installed.
19+
20+
3. Configure:
21+
22+
* Add a spool. The following command will create a spool named
23+
"default" (note: the name default has no special meaning), with
24+
directory /data/capture and a filename prefix of
25+
daemonlogger.pcap - this matches the use of daemonlogger above):
26+
27+
./dumpy config spool add default /data/capture daemonlogger.pcap
28+
29+
* Add a user:
30+
31+
./dumpy config passwd username password
32+
33+
4. Start dumpy:
34+
35+
./dumpy start
36+
37+
5. Then point your browser at http://<hostname>:7000/
38+
39+
## Building
40+
41+
Building dumpy requires a Go(lang) development environment.
42+
Additionally libpcap with development headers is also required.
43+
Assuming thos requirements are satisfied:
44+
45+
1. Install Go dependencies:
46+
47+
make get-go-deps
48+
49+
2. Build:
50+
51+
make
52+
53+
or
54+
55+
go build

command-generate-cert.go

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
// Use of this source code is governed by a BSD-style
33
// license that can be found in the LICENSE file.
44

5-
// +build ignore
6-
75
// Generate a self-signed X.509 certificate for a TLS server. Outputs to
86
// 'cert.pem' and 'key.pem' and will overwrite existing files.
97

8+
// Adapted to be used as a sub-command.
9+
1010
package main
1111

1212
import (
@@ -26,15 +26,17 @@ import (
2626
)
2727

2828
var (
29-
host = flag.String("host", "", "Comma-separated hostnames and IPs to generate a certificate for")
30-
validFrom = flag.String("start-date", "", "Creation date formatted as Jan 1 15:04:05 2011")
31-
validFor = flag.Duration("duration", 365*24*time.Hour, "Duration that certificate is valid for")
32-
isCA = flag.Bool("ca", false, "whether this cert should be its own Certificate Authority")
33-
rsaBits = flag.Int("rsa-bits", 2048, "Size of RSA key to generate")
29+
flagset = flag.NewFlagSet("generate-cert", flag.ExitOnError)
30+
31+
host = flagset.String("host", "", "Comma-separated hostnames and IPs to generate a certificate for")
32+
validFrom = flagset.String("start-date", "", "Creation date formatted as Jan 1 15:04:05 2011")
33+
validFor = flagset.Duration("duration", 365*24*time.Hour, "Duration that certificate is valid for")
34+
isCA = flagset.Bool("ca", false, "whether this cert should be its own Certificate Authority")
35+
rsaBits = flagset.Int("rsa-bits", 2048, "Size of RSA key to generate")
3436
)
3537

36-
func main() {
37-
flag.Parse()
38+
func GenerateCertMain(args []string) {
39+
flagset.Parse(args)
3840

3941
if len(*host) == 0 {
4042
log.Fatalf("Missing required --host parameter")

0 commit comments

Comments
 (0)