Skip to content

Commit c0db019

Browse files
authored
Merge pull request #1 from satta/DEV-5053-2024-makeover
2025 makeover
2 parents 80e868b + 4cb57a3 commit c0db019

File tree

11 files changed

+148
-40
lines changed

11 files changed

+148
-40
lines changed

.github/workflows/build.yaml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Build
2+
3+
on:
4+
- push
5+
- pull_request
6+
7+
jobs:
8+
build:
9+
name: Build all platforms
10+
runs-on: ubuntu-latest
11+
container:
12+
image: golang:1.23-bullseye
13+
steps:
14+
- name: Check out repository code
15+
uses: actions/checkout@v4
16+
- name: Set up user
17+
run: |
18+
useradd -m -g users builduser
19+
chown -R builduser:users .
20+
- name: Build
21+
run: |
22+
su -c "make all" builduser
23+
- uses: actions/upload-artifact@v4
24+
with:
25+
name: Server binaries
26+
path: mauerspecht-server
27+
- uses: actions/upload-artifact@v4
28+
with:
29+
name: Client binaries
30+
path: mauerspecht-client*

.github/workflows/release.yaml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Build release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
jobs:
9+
release:
10+
name: Create Release ${{ github.ref }}
11+
runs-on: ubuntu-latest
12+
outputs:
13+
upload_url: ${{ steps.create_release.outputs.upload_url }}
14+
steps:
15+
- name: release
16+
uses: actions/create-release@latest
17+
id: create_release
18+
env:
19+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
20+
with:
21+
draft: false
22+
prerelease: false
23+
release_name: ${{ github.ref }}
24+
tag_name: ${{ github.ref }}
25+
26+
build:
27+
name: Build Unix-like Binaries
28+
needs: release
29+
runs-on: ubuntu-latest
30+
container:
31+
image: golang:1.23-bullseye
32+
steps:
33+
- name: Check out repository code
34+
uses: actions/checkout@v2
35+
- name: Set up user
36+
run: |
37+
useradd -m -g users builduser
38+
chown -R builduser:users .
39+
- name: Build
40+
run: |
41+
su -c "make all" builduser
42+
- name: Upload Assets
43+
id: upload_try1
44+
continue-on-error: true
45+
uses: shogo82148/actions-upload-release-asset@v1
46+
with:
47+
asset_path: mauerspecht-*
48+
github_token: ${{ secrets.GITHUB_TOKEN }}
49+
upload_url: ${{ needs.release.outputs.upload_url }}
50+
overwrite: true
51+
- name: Upload Assets (retry)
52+
id: upload_try2
53+
if: steps.upload_try1.outcome == 'failure'
54+
continue-on-error: true
55+
uses: shogo82148/actions-upload-release-asset@v1
56+
with:
57+
asset_path: mauerspecht-*
58+
github_token: ${{ secrets.GITHUB_TOKEN }}
59+
upload_url: ${{ needs.release.outputs.upload_url }}
60+
overwrite: true

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
mauerspecht-client.*
2+
mauerspecht-server

Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
NAMESPACE := github.com/DCSO/mauerspecht
2-
CLIENT_PLATFORMS := x86_64-linux x86_64-windows x86_64-darwin i386-linux i386-windows
2+
CLIENT_PLATFORMS := x86_64-linux x86_64-windows x86_64-darwin arm64-darwin i386-linux i386-windows
33
GOFILES := $(shell find -name "*.go")
44

55
define goarch
66
$(or $(if $(findstring x86_64,$1),amd64),\
7+
$(if $(findstring arm64,$1),arm64),\
78
$(if $(findstring i386,$1),386),\
89
$(error unknown arch $1))
910
endef

README.md

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
# Simple Probing Tool for Corporate Walled Garden Networks
88

99
The Problem: Network sensors such as
10-
[Suricata](https://suricata-ids.org/) or [Bro/Zeek](https://zeek.org/)
10+
[Suricata](https://suricata-ids.org/) or [Zeek](https://zeek.org/)
1111
have been successfully deployed in a large network, but the rate of
1212
alarms or other useful information is suspiciously low -- not even the
1313
usual background noise can be seen. Can we be sure that our sensors
@@ -76,15 +76,10 @@ Server:
7676

7777
## Building
7878

79-
If a Go toolchain with [modules](...) support is available (version
80-
1.11 or later), simply running `make all` from the Git checkout is
79+
For recent Go versions, simply running `make all` from the Git checkout is
8180
sufficient.
8281

83-
For earlier Go versions, run `go get github.com/DCSO/mauerspecht`
84-
change to the directory within the `GOPATH` where the project was
85-
downloaded, and run `make all`
86-
87-
In both cases, the following binaries will be generated:
82+
The following binaries will be generated:
8883
- `mauerspecht-server`: The server component, a Linux/x86-64 binary
8984
- `mauerspecht-client-$ARCH`: The clients, for various architectures
9085

@@ -95,15 +90,17 @@ In both cases, the following binaries will be generated:
9590
- The server stores session keys submitted by clients in memory and does
9691
not expire them yet. This is a denial-of-service vector.
9792
- Bundled client configuration for easy single-binary deployment (see
98-
also: [spyre](https://github.com/DCSO/spyre))
93+
also: [spyre](https://github.com/spyre-project/spyre))
94+
95+
## Contact
9996

100-
## Author
97+
Sascha Steinbiss <<[email protected]>>
10198

102-
Hilko Bengen <<[email protected]>>
99+
Original Author: Hilko Bengen
103100

104101
## Copyright
105102

106-
Copyright 2019 Deutsche Cyber-Sicherheitsorganisation GmbH
103+
Copyright 2019, 2024 Deutsche Cyber-Sicherheitsorganisation GmbH
107104

108105
This program is free software: you can redistribute it and/or modify
109106
it under the terms of the GNU General Public License as published by

client/client.go

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import (
99
"encoding/json"
1010
"fmt"
1111
"io"
12-
"io/ioutil"
1312
"log"
1413
"net/http"
1514
"net/url"
@@ -38,7 +37,7 @@ func (c *Client) do(req *http.Request) (*http.Response, error) {
3837
return nil, err
3938
}
4039
if res.StatusCode != 200 {
41-
return nil, fmt.Errorf("Expected status code 200, got %d", res.StatusCode)
40+
return nil, fmt.Errorf("expected status code 200, got %d", res.StatusCode)
4241
}
4342
return res, nil
4443
}
@@ -89,18 +88,18 @@ func New(baseurl string, proxyurl string) (*Client, error) {
8988
if err != nil {
9089
return nil, err
9190
}
92-
buf, err := ioutil.ReadAll(r.Body)
91+
buf, _ := io.ReadAll(r.Body)
9392
r.Body.Close()
9493
if len(buf) != 32 {
95-
return nil, fmt.Errorf("Expected 32 byte key lengths from server, got %d", len(buf))
94+
return nil, fmt.Errorf("expected 32 byte key lengths from server, got %d", len(buf))
9695
}
9796
copy(c.ServerPubKey[:], buf)
9897
c.logf("Fetching configuration from %s", baseurl)
9998
u.Path = "/v1/config"
10099
if r, err = c.do(&http.Request{Method: "GET", URL: u}); err != nil {
101100
return nil, err
102101
}
103-
buf, err = ioutil.ReadAll(r.Body)
102+
buf, err = io.ReadAll(r.Body)
104103
r.Body.Close()
105104
if err != nil {
106105
return nil, err
@@ -191,7 +190,7 @@ func (c *Client) download() {
191190
}
192191
}
193192
if xfer&xferBody != 0 {
194-
buf, _ := ioutil.ReadAll(res.Body)
193+
buf, _ := io.ReadAll(res.Body)
195194
if string(buf) == c.Config.MagicStrings[id] {
196195
c.logf("download %s (%d): found string in body", xfer, id)
197196
} else {
@@ -227,7 +226,7 @@ func (c *Client) upload() {
227226
c.logf("upload %s (%d): %v", xfer, id, err)
228227
continue
229228
}
230-
buf, err := ioutil.ReadAll(res.Body)
229+
buf, err := io.ReadAll(res.Body)
231230
res.Body.Close()
232231
if err != nil {
233232
c.logf("upload %s (%d): %v", xfer, id, err)
@@ -291,12 +290,10 @@ func (c *Client) report() {
291290
if err != nil {
292291
c.logf("Failed to send log message: %v", err)
293292
}
294-
return
295293
}
296294

297295
func (c *Client) Run() {
298296
c.download()
299297
c.upload()
300298
c.report()
301-
return
302299
}

cmd/server/server.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import (
66

77
"encoding/json"
88
"flag"
9-
"io/ioutil"
109
"log"
1110
"os"
1211
"os/signal"
@@ -16,7 +15,7 @@ func main() {
1615
var cfgfile string
1716
flag.StringVar(&cfgfile, "config", "mauerspecht.json", "Config file")
1817
flag.Parse()
19-
buf, err := ioutil.ReadFile(cfgfile)
18+
buf, err := os.ReadFile(cfgfile)
2019
if err != nil {
2120
log.Fatalf("open config file %s: %v", cfgfile, err)
2221
}
@@ -28,7 +27,7 @@ func main() {
2827
if err != nil {
2928
log.Fatalf("Error while initializing server: %v", err)
3029
}
31-
stop := make(chan os.Signal)
30+
stop := make(chan os.Signal, 1)
3231
signal.Notify(stop, os.Interrupt)
3332
<-stop
3433
s.Close()

go.mod

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
module github.com/DCSO/mauerspecht
22

3+
go 1.21.6
4+
5+
require (
6+
github.com/mattn/go-ieproxy v0.0.12
7+
golang.org/x/crypto v0.31.0
8+
)
9+
310
require (
4-
github.com/mattn/go-ieproxy v0.0.0-20190610004146-91bb50d98149
5-
golang.org/x/crypto v0.0.0-20190621222207-cc06ce4a13d4
11+
golang.org/x/net v0.33.0 // indirect
12+
golang.org/x/sys v0.28.0 // indirect
13+
golang.org/x/text v0.21.0 // indirect
614
)

go.sum

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
github.com/mattn/go-ieproxy v0.0.0-20190610004146-91bb50d98149 h1:HfxbT6/JcvIljmERptWhwa8XzP7H3T+Z2N26gTsaDaA=
2+
github.com/mattn/go-ieproxy v0.0.0-20190610004146-91bb50d98149/go.mod h1:31jz6HNzdxOmlERGGEc4v/dMssOfmp2p5bT/okiKFFc=
3+
github.com/mattn/go-ieproxy v0.0.12 h1:OZkUFJC3ESNZPQ+6LzC3VJIFSnreeFLQyqvBWtvfL2M=
4+
github.com/mattn/go-ieproxy v0.0.12/go.mod h1:Vn+N61199DAnVeTgaF8eoB9PvLO8P3OBnG95ENh7B7c=
5+
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
6+
golang.org/x/crypto v0.0.0-20190621222207-cc06ce4a13d4 h1:ydJNl0ENAG67pFbB+9tfhiL2pYqLhfoaZFw/cjLhY4A=
7+
golang.org/x/crypto v0.0.0-20190621222207-cc06ce4a13d4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
8+
golang.org/x/crypto v0.31.0 h1:ihbySMvVjLAeSH1IbfcRTkD/iNscyz8rGzjF/E5hV6U=
9+
golang.org/x/crypto v0.31.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk=
10+
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3 h1:0GoQqolDA55aaLxZyTzK/Y2ePZzZTUrRacwib7cNsYQ=
11+
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
12+
golang.org/x/net v0.33.0 h1:74SYHlV8BIgHIFC/LrYkOGIwL19eTYXQ5wc6TBuO36I=
13+
golang.org/x/net v0.33.0/go.mod h1:HXLR5J+9DxmrqMwG9qjGCxZ+zKXxBru04zlTvWlWuN4=
14+
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
15+
golang.org/x/sys v0.0.0-20190412213103-97732733099d h1:+R4KGOnez64A81RvjARKc4UT5/tI9ujCIVX+P5KiHuI=
16+
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
17+
golang.org/x/sys v0.28.0 h1:Fksou7UEQUWlKvIdsqzJmUmCX3cZuD2+P3XyyzwMhlA=
18+
golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
19+
golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
20+
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
21+
golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo=
22+
golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ=

integration/integration_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ func TestIntegration(t *testing.T) {
2727
if s == nil {
2828
t.Fatal("could not start server")
2929
}
30-
c, err = client.New(fmt.Sprintf("http://%s:%d/", config.Hostname, config.HTTPPorts[0]))
30+
c, err = client.New(fmt.Sprintf("http://%s:%d/", config.Hostname, config.HTTPPorts[0]), "")
3131
if err != nil {
3232
t.Fatalf("could not create client: %v", err)
3333
}

0 commit comments

Comments
 (0)