Skip to content

Commit cf70ab0

Browse files
committed
refactor: update import paths to use kafka-http-scanner
1 parent dd607d3 commit cf70ab0

36 files changed

+530
-220
lines changed

.github/workflows/build.yml

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+
branches: [master, dev]
6+
pull_request:
7+
branches: [master, dev]
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v3
14+
15+
- name: Set up Go
16+
uses: actions/setup-go@v4
17+
with:
18+
go-version: "1.22"
19+
20+
- name: Get dependencies
21+
run: go mod download
22+
23+
- name: Build
24+
run: go build -v ./...
25+
26+
- name: Upload artifact
27+
uses: actions/upload-artifact@v3
28+
with:
29+
name: http-scanner
30+
path: ./http-scanner

.github/workflows/go.yml

Lines changed: 0 additions & 25 deletions
This file was deleted.

.github/workflows/release.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
8+
jobs:
9+
goreleaser:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@v3
14+
with:
15+
fetch-depth: 0
16+
17+
- name: Set up Go
18+
uses: actions/setup-go@v4
19+
with:
20+
go-version: "1.22"
21+
22+
- name: Run GoReleaser
23+
uses: goreleaser/goreleaser-action@v4
24+
with:
25+
distribution: goreleaser
26+
version: latest
27+
args: release --clean
28+
env:
29+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/test.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Test
2+
3+
on:
4+
push:
5+
branches: [master, dev]
6+
pull_request:
7+
branches: [master, dev]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v3
14+
15+
- name: Set up Go
16+
uses: actions/setup-go@v4
17+
with:
18+
go-version: "1.22"
19+
20+
- name: Get dependencies
21+
run: go mod download
22+
23+
- name: Run unit tests
24+
run: go test -v ./tests/unit/...
25+
26+
- name: Run integration tests
27+
run: go test -v ./tests/integration/...
28+
29+
- name: Generate test coverage
30+
run: go test -coverprofile=coverage.out ./...
31+
32+
- name: Upload coverage reports to Codecov
33+
uses: codecov/codecov-action@v3
34+
with:
35+
file: ./coverage.out

.goreleaser.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
before:
2+
hooks:
3+
- go mod tidy
4+
5+
builds:
6+
- env:
7+
- CGO_ENABLED=0
8+
goos:
9+
- linux
10+
- windows
11+
- darwin
12+
goarch:
13+
- amd64
14+
- arm64
15+
main: ./main.go
16+
17+
archives:
18+
- format_overrides:
19+
- goos: windows
20+
format: zip
21+
name_template: >-
22+
{{ .ProjectName }}_
23+
{{- title .Os }}_
24+
{{- if eq .Arch "amd64" }}x86_64
25+
{{- else if eq .Arch "386" }}i386
26+
{{- else }}{{ .Arch }}{{ end }}
27+
28+
checksum:
29+
name_template: "checksums.txt"
30+
31+
snapshot:
32+
name_template: "{{ incpatch .Version }}-next"
33+
34+
changelog:
35+
sort: asc
36+
filters:
37+
exclude:
38+
- "^docs:"
39+
- "^test:"
40+
- "^ci:"

Dockerfile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
FROM golang:1.22-alpine AS builder
2+
WORKDIR /app
3+
COPY . .
4+
RUN go mod download
5+
RUN go build -o http-scanner .
6+
7+
FROM alpine:latest
8+
RUN apk --no-cache add ca-certificates
9+
WORKDIR /root/
10+
COPY --from=builder /app/http-scanner .
11+
COPY --from=builder /app/configs ./configs
12+
ENTRYPOINT ["./http-scanner"]

Makefile

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
.PHONY: all build test test-unit test-integration lint clean
2+
3+
BINARY_NAME=http-scanner
4+
GOFLAGS=-ldflags="-s -w"
5+
6+
all: test build
7+
8+
build:
9+
go build ${GOFLAGS} -o ${BINARY_NAME} ./main.go
10+
11+
test: test-unit test-integration
12+
13+
test-unit:
14+
go test -v ./tests/unit/...
15+
16+
test-integration:
17+
go test -v ./tests/integration/...
18+
19+
lint:
20+
golangci-lint run ./...
21+
22+
clean:
23+
rm -f ${BINARY_NAME}
24+
go clean -cache
25+
26+
27+
ci-test: test-unit test-integration
28+
29+
30+
dev:
31+
air -c .air.toml
32+
33+
cover:
34+
go test -coverprofile=coverage ./...
35+
go tool cover -html=coverage

cmd/scan.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ import (
66
"strings"
77
"time"
88

9-
"github.com/aymaneallaoui/go-http-scanner/internal/core"
10-
_ "github.com/aymaneallaoui/go-http-scanner/internal/modules"
11-
"github.com/aymaneallaoui/go-http-scanner/internal/output"
12-
"github.com/aymaneallaoui/go-http-scanner/pkg/utils"
9+
"github.com/aymaneallaoui/kafka-http-scanner/internal/core"
10+
_ "github.com/aymaneallaoui/kafka-http-scanner/internal/modules"
11+
"github.com/aymaneallaoui/kafka-http-scanner/internal/output"
12+
"github.com/aymaneallaoui/kafka-http-scanner/pkg/utils"
1313
"github.com/spf13/cobra"
1414
)
1515

go.mod

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,21 @@
1-
module github.com/aymaneallaoui/go-http-scanner
1+
module github.com/aymaneallaoui/kafka-http-scanner
22

33
go 1.22.4
44

5-
require github.com/sirupsen/logrus v1.9.3
6-
75
require (
8-
github.com/inconshreveable/mousetrap v1.1.0 // indirect
9-
github.com/spf13/pflag v1.0.6 // indirect
6+
github.com/spf13/cobra v1.9.1
7+
github.com/stretchr/testify v1.7.0
108
)
119

1210
require (
13-
github.com/spf13/cobra v1.9.1
11+
github.com/davecgh/go-spew v1.1.1 // indirect
12+
github.com/pmezard/go-difflib v1.0.0 // indirect
1413
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8 // indirect
14+
)
15+
16+
require (
17+
github.com/inconshreveable/mousetrap v1.1.0 // indirect
18+
github.com/sirupsen/logrus v1.9.3
19+
github.com/spf13/pflag v1.0.6 // indirect
1520
gopkg.in/yaml.v3 v3.0.1
1621
)

internal/core/scanner.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ import (
88
"sync"
99
"time"
1010

11-
customhttp "github.com/aymaneallaoui/go-http-scanner/internal/http"
12-
"github.com/aymaneallaoui/go-http-scanner/internal/model"
13-
"github.com/aymaneallaoui/go-http-scanner/internal/modules"
11+
customhttp "github.com/aymaneallaoui/kafka-http-scanner/internal/http"
12+
"github.com/aymaneallaoui/kafka-http-scanner/internal/model"
13+
"github.com/aymaneallaoui/kafka-http-scanner/internal/modules"
1414
"github.com/sirupsen/logrus"
1515
)
1616

internal/http/client.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010
"strings"
1111
"time"
1212

13-
"github.com/aymaneallaoui/go-http-scanner/internal/model"
13+
"github.com/aymaneallaoui/kafka-http-scanner/internal/model"
1414
)
1515

1616
const (

internal/modules/clickjacking.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package modules
33
import (
44
"strings"
55

6-
"github.com/aymaneallaoui/go-http-scanner/internal/model"
6+
"github.com/aymaneallaoui/kafka-http-scanner/internal/model"
77
)
88

99
type ClickjackingModule struct{}

internal/modules/content_security.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
"fmt"
55
"strings"
66

7-
"github.com/aymaneallaoui/go-http-scanner/internal/model"
7+
"github.com/aymaneallaoui/kafka-http-scanner/internal/model"
88
)
99

1010
type ContentSecurityModule struct{}

internal/modules/cookie_security.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
"strings"
77
"time"
88

9-
"github.com/aymaneallaoui/go-http-scanner/internal/model"
9+
"github.com/aymaneallaoui/kafka-http-scanner/internal/model"
1010
)
1111

1212
type CookieSecurityModule struct{}

internal/modules/cors_misconfiguration.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
"fmt"
55
"strings"
66

7-
"github.com/aymaneallaoui/go-http-scanner/internal/model"
7+
"github.com/aymaneallaoui/kafka-http-scanner/internal/model"
88
)
99

1010
type CORSMisconfigurationModule struct{}

internal/modules/directory_traversal.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77
"regexp"
88
"strings"
99

10-
"github.com/aymaneallaoui/go-http-scanner/internal/model"
10+
"github.com/aymaneallaoui/kafka-http-scanner/internal/model"
1111
)
1212

1313
type DirectoryTraversalModule struct{}

internal/modules/header_security.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package modules
33
import (
44
"fmt"
55

6-
"github.com/aymaneallaoui/go-http-scanner/internal/model"
6+
"github.com/aymaneallaoui/kafka-http-scanner/internal/model"
77
)
88

99
type HeaderSecurityModule struct{}

internal/modules/http_smuggling.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package modules
33
import (
44
"strings"
55

6-
"github.com/aymaneallaoui/go-http-scanner/internal/model"
6+
"github.com/aymaneallaoui/kafka-http-scanner/internal/model"
77
)
88

99
type HTTPSmugglingModule struct{}

internal/modules/module.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
"io"
55
"net/http"
66

7-
"github.com/aymaneallaoui/go-http-scanner/internal/model"
7+
"github.com/aymaneallaoui/kafka-http-scanner/internal/model"
88
"github.com/sirupsen/logrus"
99
)
1010

internal/modules/registry.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,10 @@ func GetModules() []ScanModule {
3535

3636
return result
3737
}
38+
39+
func ResetModuleRegistry() {
40+
modulesMu.Lock()
41+
defer modulesMu.Unlock()
42+
43+
modules = make(map[string]ScanModule)
44+
}

internal/modules/server_info_leakage.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77
"strings"
88
"time"
99

10-
"github.com/aymaneallaoui/go-http-scanner/internal/model"
10+
"github.com/aymaneallaoui/kafka-http-scanner/internal/model"
1111
)
1212

1313
type ServerInfoLeakageModule struct{}

internal/modules/sql_injection.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88
"strings"
99
"time"
1010

11-
"github.com/aymaneallaoui/go-http-scanner/internal/model"
11+
"github.com/aymaneallaoui/kafka-http-scanner/internal/model"
1212
)
1313

1414
type SQLInjectionModule struct{}

internal/modules/ssltls_security.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55
"net"
66
"time"
77

8-
"github.com/aymaneallaoui/go-http-scanner/internal/model"
8+
"github.com/aymaneallaoui/kafka-http-scanner/internal/model"
99
)
1010

1111
type SSLTLSSecurityModule struct{}

internal/modules/xss_vulnerability.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
"net/url"
77
"strings"
88

9-
"github.com/aymaneallaoui/go-http-scanner/internal/model"
9+
"github.com/aymaneallaoui/kafka-http-scanner/internal/model"
1010
)
1111

1212
type XSSVulnerabilityModule struct{}

0 commit comments

Comments
 (0)