diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 70106bd..d51357f 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -3,66 +3,70 @@ name: Build and release on: push: tags: - - '*' + - "*" jobs: releases-matrix: name: Release Go Binary runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - run: echo $(go env GOPATH)/bin >> $GITHUB_PATH + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 + with: + go-version: "1.22" + cache: true + - run: echo $(go env GOPATH)/bin >> $GITHUB_PATH - - name: Build collector - run: UPX_COMPRESS=1 make collector - - name: Build Windows binary - run: make windows - - name: Build Linux binary - run: make linux - - name: Build Darwin binary - run: make darwin + - name: Build collector + run: UPX_COMPRESS=1 make collector + - name: Build Windows binary + run: make windows + - name: Build Linux binary + run: make linux + - name: Build Darwin binary + run: make darwin - - name: Upload Windows binary - uses: svenstaro/upload-release-action@v2 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: build/androidqf_windows_amd64.exe - asset_name: androidqf_$tag_windows_amd64.exe - tag: ${{ github.ref }} - overwrite: true + - name: Upload Windows binary + uses: svenstaro/upload-release-action@v2 + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: build/androidqf_windows_amd64.exe + asset_name: androidqf_$tag_windows_amd64.exe + tag: ${{ github.ref }} + overwrite: true - - name: Upload Linux binary - uses: svenstaro/upload-release-action@v2 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: build/androidqf_linux_amd64 - asset_name: androidqf_$tag_linux_amd64 - tag: ${{ github.ref }} - overwrite: true + - name: Upload Linux binary + uses: svenstaro/upload-release-action@v2 + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: build/androidqf_linux_amd64 + asset_name: androidqf_$tag_linux_amd64 + tag: ${{ github.ref }} + overwrite: true - - name: Upload Linux arm64 binary - uses: svenstaro/upload-release-action@v2 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: build/androidqf_linux_arm64 - asset_name: androidqf_$tag_linux_arm64 - tag: ${{ github.ref }} - overwrite: true + - name: Upload Linux arm64 binary + uses: svenstaro/upload-release-action@v2 + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: build/androidqf_linux_arm64 + asset_name: androidqf_$tag_linux_arm64 + tag: ${{ github.ref }} + overwrite: true - - name: Upload Darwin binary - uses: svenstaro/upload-release-action@v2 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: build/androidqf_darwin_amd64 - asset_name: androidqf_$tag_darwin_amd64 - tag: ${{ github.ref }} - overwrite: true + - name: Upload Darwin binary + uses: svenstaro/upload-release-action@v2 + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: build/androidqf_darwin_amd64 + asset_name: androidqf_$tag_darwin_amd64 + tag: ${{ github.ref }} + overwrite: true - - name: Upload Darwin arm64 binary - uses: svenstaro/upload-release-action@v2 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: build/androidqf_darwin_arm64 - asset_name: androidqf_$tag_darwin_arm64 - tag: ${{ github.ref }} - overwrite: true \ No newline at end of file + - name: Upload Darwin arm64 binary + uses: svenstaro/upload-release-action@v2 + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: build/androidqf_darwin_arm64 + asset_name: androidqf_$tag_darwin_arm64 + tag: ${{ github.ref }} + overwrite: true diff --git a/.github/workflows/staticcheck.yaml b/.github/workflows/staticcheck.yaml index adf26fa..e77e332 100644 --- a/.github/workflows/staticcheck.yaml +++ b/.github/workflows/staticcheck.yaml @@ -6,13 +6,18 @@ jobs: name: "Run CI" runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - with: - fetch-depth: 1 - - name: download assets - run: make download - - name: build collector - run: make collector - - uses: dominikh/staticcheck-action@v1.3.0 - with: - version: "2022.1.3" + - uses: actions/checkout@v4 + with: + fetch-depth: 1 + - uses: actions/setup-go@v5 + with: + go-version: "1.23" + cache: true + - name: download assets + run: make download + - name: build collector + run: make collector + - uses: dominikh/staticcheck-action@v1.3.1 + with: + version: "latest" + install-go: false diff --git a/README.md b/README.md index 84b87a2..acbfe10 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ androidqf is intended to provide a simple and portable cross-platform utility to Executable binaries for Linux, Windows and Mac should be available in the [latest release](https://github.com/mvt-project/androidqf/releases/latest). In case you have issues running the binary you might want to build it by yourself. -In order to build androidqf you will need Go 1.15+ installed. You will also need to install `make`. AndroidQF includes a cross-compiled `collector` which runs on the target device to more reliably extract forensically relevant information. Android shell quirkes can make running shell commands to gather information too brittle. +In order to build androidqf you will need Go 1.15+ installed. You will also need to install `make`, `git`, `unzip` and `wget`. AndroidQF includes a cross-compiled `collector` which runs on the target device to more reliably extract forensically relevant information. Android shell quirkes can make running shell commands to gather information too brittle. When ready you can clone the repository and first build the `collector` module with: diff --git a/acquisition/secure.go b/acquisition/secure.go index 8c109b5..10368fb 100644 --- a/acquisition/secure.go +++ b/acquisition/secure.go @@ -6,6 +6,7 @@ package acquisition import ( + "archive/zip" "fmt" "io" "os" @@ -13,11 +14,30 @@ import ( "strings" "filippo.io/age" - "github.com/botherder/go-savetime/files" saveRuntime "github.com/botherder/go-savetime/runtime" "github.com/mvt-project/androidqf/log" ) +func createZipFile(sourceDir, zipPath string) error { + zipFile, err := os.Create(zipPath) + if err != nil { + return fmt.Errorf("failed to create ZIP file: %v", err) + } + defer zipFile.Close() + + zipWriter := zip.NewWriter(zipFile) + defer zipWriter.Close() + + // Use AddFS to add the entire directory + fsys := os.DirFS(sourceDir) + err = zipWriter.AddFS(fsys) + if err != nil { + return fmt.Errorf("failed to add directory to ZIP: %v", err) + } + + return nil +} + func (a *Acquisition) StoreSecurely() error { cwd := saveRuntime.GetExecutableDirectory() @@ -33,7 +53,7 @@ func (a *Acquisition) StoreSecurely() error { log.Info("Compressing the acquisition folder. This might take a while...") - err := files.Zip(a.StoragePath, zipFilePath) + err := createZipFile(a.StoragePath, zipFilePath) if err != nil { return err } diff --git a/go.mod b/go.mod index 7309358..0b9a28c 100644 --- a/go.mod +++ b/go.mod @@ -1,26 +1,21 @@ module github.com/mvt-project/androidqf -go 1.20 +go 1.22 require ( filippo.io/age v1.1.1 github.com/avast/apkverifier v0.0.0-20230614091700-49ed19602069 github.com/botherder/go-savetime v1.4.0 + github.com/google/uuid v1.3.0 github.com/i582/cfmt v1.4.0 github.com/manifoldco/promptui v0.9.0 - github.com/satori/go.uuid v1.2.0 ) require ( github.com/avast/apkparser v0.0.0-20230614091518-10cb8617da43 // indirect github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e // indirect - github.com/fatih/color v1.15.0 // indirect - github.com/google/uuid v1.3.0 // indirect github.com/gookit/color v1.3.2 // indirect github.com/klauspost/compress v1.16.6 // indirect - github.com/mattn/go-colorable v0.1.13 // indirect - github.com/mattn/go-isatty v0.0.17 // indirect golang.org/x/crypto v0.4.0 // indirect golang.org/x/sys v0.6.0 // indirect - gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect ) diff --git a/go.sum b/go.sum index 97c9b64..def3b78 100644 --- a/go.sum +++ b/go.sum @@ -1,21 +1,7 @@ filippo.io/age v1.1.1 h1:pIpO7l151hCnQ4BdyBujnGP2YlUo0uj6sAVNHGBvXHg= filippo.io/age v1.1.1/go.mod h1:l03SrzDUrBkdBx8+IILdnn2KZysqQdbEBUQ4p3sqEQE= -github.com/avast/apkparser v0.0.0-20190516101250-3b8c5efcb6a9/go.mod h1:c0733VBXm1we9M1zCtoOspplSwOYebS3hpDkJyMORRU= -github.com/avast/apkparser v0.0.0-20200102113521-69bcdd9c2403/go.mod h1:eZzHNfZWA1eeKPQE3LVmfRw32lhrH351jDCsma9qxOc= -github.com/avast/apkparser v0.0.0-20200402131724-9fd46d5c4749/go.mod h1:CSBdDZNEsGRYPiDt9QcGrIy8iWQ9YzB1rcuxn44+0jc= -github.com/avast/apkparser v0.0.0-20200924103028-30471fa5618f/go.mod h1:SKNzWGFyNJji/Z+iXjPCpmpFPvenFuhLjrSLCwCM/cM= -github.com/avast/apkparser v0.0.0-20210223100516-186f320f9bfc/go.mod h1:98WPhH/r8MbKpffuuDCAGtPyzSI2IVwXBcWAlXhMVC4= -github.com/avast/apkparser v0.0.0-20221012080151-bfc57d4d0502 h1:Ka3itfe3khrY1wBEgwaBXMCEhWRd9SG6rnAT8eOFXZQ= -github.com/avast/apkparser v0.0.0-20221012080151-bfc57d4d0502/go.mod h1:+p/TgE5RkPjTZkzIeZ1Ut/xlKcxsdJtNOuT33v8DKQU= github.com/avast/apkparser v0.0.0-20230614091518-10cb8617da43 h1:mafDUiR12CJcZrqOc9UzjEI89dACjliiAhv/8g4Does= github.com/avast/apkparser v0.0.0-20230614091518-10cb8617da43/go.mod h1:Q9VJUqVyJjIsFm+2rS5ongUUeHjoTG4b0LanUo7A2yk= -github.com/avast/apkverifier v0.0.0-20190808142831-dbbe53a24744/go.mod h1:mhWRoMg0KhvWt8SX7B2v2E3VfWt5jWfHfD9PtWAN+qM= -github.com/avast/apkverifier v0.0.0-20200217135742-aa28c80b82ae/go.mod h1:SV58cyAAN+SzX8GIBhizatMJNGcDyfQUj/xZUlKRW+I= -github.com/avast/apkverifier v0.0.0-20200416105355-97c5338f32f0/go.mod h1:HskRSJJJbP3poUkDRAyRAdDVSsh5J1mz8cRc2/B4kbc= -github.com/avast/apkverifier v0.0.0-20210219091843-33631264c352/go.mod h1:uhY/I/3Vh3V6ZFgLm/EFX/j5//MdoXpvcULTtzRW3YA= -github.com/avast/apkverifier v0.0.0-20210916093748-2146ff7c4b7f/go.mod h1:APQFx11UQTdbLKlZVJQFddZcJZxoHl6NnJfHN7foLD8= -github.com/avast/apkverifier v0.0.0-20221110131049-7720fc1ebef0 h1:x9HVJYrutJsTbfgN+Fg1mIn9moi8t1oSxvNIY3qhjks= -github.com/avast/apkverifier v0.0.0-20221110131049-7720fc1ebef0/go.mod h1:fnZDjIhf6G9k2Qr2f9IZcXctjGmzOK3y2II9gdG1GP8= github.com/avast/apkverifier v0.0.0-20230614091700-49ed19602069 h1:TR1pg8sts1JnQXuMeIgmzueFK7SzdmkRl4cwJArahtA= github.com/avast/apkverifier v0.0.0-20230614091700-49ed19602069/go.mod h1:20AsdAxqNdbHqHu2oNAOEIxPeK7uUcI3WjOw8BeGuTM= github.com/botherder/go-savetime v1.4.0 h1:udS44zeRg95JXArgqhM5Xl3ZWzWhcXiJ72H89U2btIU= @@ -28,47 +14,23 @@ github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1 h1:q763qf9huN11kDQavWs github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/fatih/color v1.15.0 h1:kOqh6YHBtK8aywxGerMG2Eq3H6Qgoqeo13Bk2Mv/nBs= -github.com/fatih/color v1.15.0/go.mod h1:0h5ZqXfHYED7Bhv2ZJamyIOUej9KtShiJESRwBDUSsw= github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/gookit/color v1.3.2 h1:WO8+16ZZtx+HlOb6cueziUAF8VtALZKRr/jOvuDk0X0= github.com/gookit/color v1.3.2/go.mod h1:R3ogXq2B9rTbXoSHJ1HyUVAZ3poOJHpd9nQmyGZsfvQ= github.com/i582/cfmt v1.4.0 h1:DNugs+dvy3xjJSUk9Oita0udy1YVQh2vDP6cWYhDCIQ= github.com/i582/cfmt v1.4.0/go.mod h1:tpHWAxhE4Y7yy7sliaNe0pnnEs1SZe67KLljyOlEYI8= -github.com/klauspost/compress v1.11.0/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= -github.com/klauspost/compress v1.11.7/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= -github.com/klauspost/compress v1.11.8/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= -github.com/klauspost/compress v1.15.12 h1:YClS/PImqYbn+UILDnqxQCZ3RehC9N318SU3kElDUEM= -github.com/klauspost/compress v1.15.12/go.mod h1:QPwzmACJjUTFsnSHH934V6woptycfrDDJnH7hvFVbGM= github.com/klauspost/compress v1.16.6 h1:91SKEy4K37vkp255cJ8QesJhjyRO0hn9i9G0GoUwLsk= github.com/klauspost/compress v1.16.6/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE= -github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI= -github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/manifoldco/promptui v0.9.0 h1:3V4HzJk1TtXW1MTZMP7mdlwbBpIinw3HztaIlYthEiA= github.com/manifoldco/promptui v0.9.0/go.mod h1:ka04sppxSGFAtxX0qhlYQjISsg9mR4GWtQEhdbn6Pgg= -github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= -github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= -github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= -github.com/mattn/go-isatty v0.0.17 h1:BTarxUcIeDqL27Mc+vyvdWYSL28zpIhv3RoTdsLMPng= -github.com/mattn/go-isatty v0.0.17/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/satori/go.uuid v1.2.0 h1:0uYX9dsZ2yD7q2RtLRtPSdGDWzjeM3TbMJP9utgA0ww= -github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= golang.org/x/crypto v0.4.0 h1:UVQgzMY87xqpKNgb+kDsll2Igd33HszWHFLmpaRMq/8= golang.org/x/crypto v0.4.0/go.mod h1:3quD/ATkf6oY+rnes5c3ExXTbLc8mueNue5/DoinL80= golang.org/x/sys v0.0.0-20181122145206-62eef0e2fa9b/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.3.0 h1:w8ZOecv6NaNa/zC8944JTU3vz4u6Lagfk4RPQxv92NQ= -golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=