Skip to content

Commit

Permalink
refactor: artifact generation
Browse files Browse the repository at this point in the history
  • Loading branch information
cugu committed Oct 13, 2024
1 parent 24ac36e commit d762e2a
Show file tree
Hide file tree
Showing 10 changed files with 25 additions and 165 deletions.
50 changes: 12 additions & 38 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,48 +1,22 @@
.benchmarks
.DS_Store
.vscode
*.exe
# config
config/artifacts/

node_modules
/dist
frontend/node_modules
backend/node_modules

# local env files
.env.local
.env.*.local

# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Editor directories and files
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

*.idea
pack/artifacts/
*.syso

*.log
*.forensicstore
*.forensicstore-wal
*.forensicstore-shm
*.forensicstore.zip

artifactcollector
# go
vendor
go1.2.2

# binaries
artifactcollector
artifactcollector.exe
*.syso
build/bin/*
!build/bin/.keep

# store
ac
*.log
collect/*.log
collect/*.zip

coverage.out
# test
coverage.out
.benchmarks
6 changes: 4 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,10 @@ generate:
@echo "Generating..."
go install golang.org/x/tools/cmd/[email protected]
go install github.com/forensicanalysis/go-resources/cmd/[email protected]
go run tools/yaml2go/main.go pack/ac.yaml pack/artifacts/*
resources -package assets -output assets/bin.generated.go pack/bin/*
rm -rf config/artifacts
git clone https://github.com/forensicanalysis/artifacts.git config/artifacts
go run tools/yaml2go/main.go config/ac.yaml config/artifacts/*.yaml
resources -package assets -output assets/bin.generated.go config/bin/*

.PHONY: generate-win
generate-win: generate
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,16 @@ On Linux and macOS, you can run the artifactcollector from the terminal: `./arti
### Build your own artifactcollector

1. Clone the repository: `git clone https://github.com/forensicanalysis/artifactcollector`.
2. Add artifact definition yaml files as needed in `pack/artifacts`. Do not edit the
2. Add artifact definition yaml files as needed in `config/artifacts`. Do not edit the
artifact definitions, as they will be overwritten.
3. Edit `pack/ac.yaml` and add the artifacts you want to collect.
3. Edit `config/ac.yaml` and add the artifacts you want to collect.
4. On windows, you can move the syso into the root folder (e.g. `cp resources\artifactcollector.syso .`)
to enable the icon for the executable and the UAC popup.
5. Run `make build` to generate the artifactcollector binary.

### Embed binaries

Binaries can be added to `pack/bin` and then included into the artifactcollector
Binaries can be added to `config/bin` and then included into the artifactcollector
in the `make build` step. Additionally, a corresponding COMMAND artifact like
the following is required.

Expand Down
5 changes: 0 additions & 5 deletions artifactsgo/artifacts.generated.go

This file was deleted.

2 changes: 1 addition & 1 deletion assets/artifacts.generated.go

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions build/win2k/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ WORKDIR /repo
RUN go install golang.org/x/tools/cmd/[email protected]
RUN go install github.com/forensicanalysis/go-resources/cmd/[email protected]
RUN go install github.com/akavel/[email protected]
RUN go run tools/yaml2go/main.go pack/ac.yaml pack/artifacts/*
RUN resources -package assets -output assets/bin.generated.go pack/bin/*
RUN go run tools/yaml2go/main.go config/ac.yaml config/artifacts/*
RUN resources -package assets -output assets/bin.generated.go config/bin/*
RUN rsrc -arch amd64 -manifest build/win/artifactcollector.exe.manifest -ico build/win/artifactcollector.ico -o build/win/artifactcollector.syso
RUN rsrc -arch 386 -manifest build/win/artifactcollector32.exe.manifest -ico build/win/artifactcollector.ico -o build/win/artifactcollector32.syso
RUN rsrc -arch amd64 -manifest build/win/artifactcollector.exe.user.manifest -ico build/win/artifactcollector.ico -o build/win/artifactcollector.user.syso
Expand Down
4 changes: 2 additions & 2 deletions build/winxp/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ WORKDIR /repo
RUN go install golang.org/x/tools/cmd/[email protected]
RUN go install github.com/forensicanalysis/go-resources/cmd/[email protected]
RUN go install github.com/akavel/[email protected]
RUN go run tools/yaml2go/main.go pack/ac.yaml pack/artifacts/*
RUN resources -package assets -output assets/bin.generated.go pack/bin/*
RUN go run tools/yaml2go/main.go config/ac.yaml config/artifacts/*
RUN resources -package assets -output assets/bin.generated.go config/bin/*
RUN rsrc -arch amd64 -manifest build/win/artifactcollector.exe.manifest -ico build/win/artifactcollector.ico -o build/win/artifactcollector.syso
RUN rsrc -arch 386 -manifest build/win/artifactcollector32.exe.manifest -ico build/win/artifactcollector.ico -o build/win/artifactcollector32.syso
RUN rsrc -arch amd64 -manifest build/win/artifactcollector.exe.user.manifest -ico build/win/artifactcollector.ico -o build/win/artifactcollector.user.syso
Expand Down
File renamed without changes.
8 changes: 1 addition & 7 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,12 @@ package main
import (
"os"

"github.com/forensicanalysis/artifactcollector/artifactsgo"
"github.com/forensicanalysis/artifactcollector/assets"
"github.com/forensicanalysis/artifactcollector/collect"
"github.com/forensicanalysis/artifactcollector/goartifacts"
)

func main() {
var artifacts []goartifacts.ArtifactDefinition
artifacts = append(artifacts, artifactsgo.Artifacts...)
artifacts = append(artifacts, assets.Artifacts...)

if _, err := collect.Collect(assets.Config, artifacts, assets.FS); err != nil {
if _, err := collect.Collect(assets.Config, assets.Artifacts, assets.FS); err != nil {
os.Exit(1)
}
}
105 changes: 0 additions & 105 deletions tools/artifacts2go/main.go

This file was deleted.

0 comments on commit d762e2a

Please sign in to comment.