diff --git a/netshovel.go b/netshovel.go index 8b136bf..55ab261 100644 --- a/netshovel.go +++ b/netshovel.go @@ -1,24 +1,16 @@ -package main +package netshovel import ( "flag" - "fmt" - "io" "log" - "sort" - "strings" - "sync" - "time" - "github.com/dirtbags/netshovel/gapstring" "github.com/google/gopacket" "github.com/google/gopacket/layers" "github.com/google/gopacket/pcap" "github.com/google/gopacket/tcpassembly" ) - func Shovel(factory tcpassembly.StreamFactory) { - verbose := flag.Bool("verbose", false, "Write lots of information out") + //verbose := flag.Bool("verbose", false, "Write lots of information out") flag.Parse() streamPool := tcpassembly.NewStreamPool(factory) @@ -48,5 +40,5 @@ func Shovel(factory tcpassembly.StreamFactory) { log.Println("npackets", npackets) } assembler.FlushAll() - goRoutines.Wait() + StreamWG.Wait() } diff --git a/packet.go b/packet.go index 6398940..2e0e5a0 100644 --- a/packet.go +++ b/packet.go @@ -1,19 +1,11 @@ -package main +package netshovel import ( - "flag" "fmt" - "io" - "log" "sort" "strings" - "sync" "time" "github.com/dirtbags/netshovel/gapstring" - "github.com/google/gopacket" - "github.com/google/gopacket/layers" - "github.com/google/gopacket/pcap" - "github.com/google/gopacket/tcpassembly" ) type Packet struct { @@ -44,7 +36,7 @@ func (pkt *Packet) Describe() string { out := new(strings.Builder) fmt.Fprintf(out, "%s %s %d: %s\n", - pkt.When.UTC().Format(tim.RFC3339Nano), + pkt.When.UTC().Format(time.RFC3339Nano), pkt.Name(), pkt.Opcode, pkt.Description, @@ -57,10 +49,10 @@ func (pkt *Packet) Describe() string { } func (pkt *Packet) Set(key, value string) { - pkt.Fileds[key] = value + pkt.Fields[key] = value } -func (pkt *Packet) Keys() { +func (pkt *Packet) Keys() []string{ keys := make([]string, len(pkt.Fields)) i := 0 for k := range(pkt.Fields) { diff --git a/res/mattock.png b/res/mattock.png new file mode 100644 index 0000000..838f7ef Binary files /dev/null and b/res/mattock.png differ diff --git a/res/mattock.svg b/res/mattock.svg new file mode 100644 index 0000000..b2c2dd3 --- /dev/null +++ b/res/mattock.svg @@ -0,0 +1,78 @@ + +image/svg+xml \ No newline at end of file diff --git a/res/session.pcap b/res/session.pcap new file mode 100644 index 0000000..4d85ff6 Binary files /dev/null and b/res/session.pcap differ diff --git a/res/smtp.pcap b/res/smtp.pcap new file mode 100644 index 0000000..c3305df Binary files /dev/null and b/res/smtp.pcap differ diff --git a/stream.go b/stream.go index 96363a1..44d9306 100644 --- a/stream.go +++ b/stream.go @@ -1,18 +1,14 @@ -package main +package netshovel import ( - "flag" "fmt" "io" "log" - "sort" "strings" "sync" "time" "github.com/dirtbags/netshovel/gapstring" "github.com/google/gopacket" - "github.com/google/gopacket/layers" - "github.com/google/gopacket/pcap" "github.com/google/gopacket/tcpassembly" ) @@ -120,9 +116,9 @@ func (stream *Stream) Describe(pkt Packet) string { fmt.Fprintf(out, "%v:%v → %v:%v\n", stream.Net.Src().String(), stream.Transport.Src().String(), - stream.Net.Dst().String(), stream.Transport.Dst().String() + stream.Net.Dst().String(), stream.Transport.Dst().String(), ) - out.writeString(pkt.Describe()) + out.WriteString(pkt.Describe()) return out.String() }