Add some resources and make it build sort of

This commit is contained in:
Neale Pickett 2018-07-23 10:44:30 -06:00
parent 0da5aa7d09
commit 089627a480
7 changed files with 88 additions and 30 deletions

View File

@ -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()
}

View File

@ -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) {

BIN
res/mattock.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

78
res/mattock.svg Normal file
View File

@ -0,0 +1,78 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
height="451"
width="451"
fill="#000000"
version="1.1"
x="0px"
y="0px"
viewBox="0 0 100 100"
enable-background="new 0 0 100 100"
xml:space="preserve"
id="svg18"
sodipodi:docname="mattock.svg"
inkscape:version="0.92.3 (2405546, 2018-03-11)"
inkscape:export-filename="/home/neale/src/netshovel/mattock.png"
inkscape:export-xdpi="63.858093"
inkscape:export-ydpi="63.858093"><metadata
id="metadata24"><rdf:RDF><cc:Work
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /></cc:Work></rdf:RDF></metadata><defs
id="defs22" /><sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1452"
inkscape:window-height="1023"
id="namedview20"
showgrid="false"
inkscape:zoom="1.4142136"
inkscape:cx="184.37471"
inkscape:cy="251.0513"
inkscape:window-x="0"
inkscape:window-y="27"
inkscape:window-maximized="0"
inkscape:current-layer="svg18"
showguides="false" /><g
id="g8"><path
fill="#000000"
stroke="#000000"
stroke-miterlimit="10"
d="M124.906-3.544"
id="path2" /><path
fill="#000000"
stroke="#000000"
stroke-miterlimit="10"
d="M147.369,15.453"
id="path4" /><path
d="M 66.801,23.023 C 53.805629,37.753899 11.427899,85.009652 7.6112335,91.031689 7.1873792,93.546126 10.771885,95.734163 12.788671,94.927454 18.670827,88.823765 57.824805,40.29268 69.98,25.505 68.95,25.082 67.454,23.899 66.801,23.023 Z"
id="path6"
inkscape:connector-curvature="0"
sodipodi:nodetypes="ccccc" /></g><g
id="g16"><path
fill="#000000"
stroke="#000000"
stroke-miterlimit="10"
d="M26.553,96.965"
id="path10" /><path
fill="#000000"
stroke="#000000"
stroke-miterlimit="10"
d="M13.502-40.626"
id="path12" /><path
d="m 78.217,16.100607 c 0,0 -0.31818,-3.338607 -4.07018,-3.129607 -5.915,-4.5 -15.413441,-9.6549321 -24.877441,-10.6529321 -0.824,-0.152 -5.994379,0.7385389 -6.010379,1.1165389 7.688,1.937 17.017427,3.7446068 28.741932,11.7354952 0,0 -3.700932,3.889505 -5.033932,6.555505 -0.112,0.177 0.02,0.486 0.287,0.844 0.652,0.876 2.149,2.059 3.179,2.482 0.433,0.177 0.786,0.225 0.951,0.049 1.917,-1.375 4.375,-4.917 4.375,-4.917 5.003,6.249 9.596,16.886966 13.31,29.863966 1.431932,-0.678369 8.182752,-4.403539 8.182752,-4.403539 0,0 -4.866752,-17.301427 -19.034752,-29.543427 z"
id="path14"
inkscape:connector-curvature="0"
sodipodi:nodetypes="ccccccccccccc" /></g></svg>

After

Width:  |  Height:  |  Size: 3.2 KiB

BIN
res/session.pcap Normal file

Binary file not shown.

BIN
res/smtp.pcap Normal file

Binary file not shown.

View File

@ -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()
}