diff --git a/apk/analysis.go b/apk/analysis.go index 8b95764..d2f41bd 100644 --- a/apk/analysis.go +++ b/apk/analysis.go @@ -17,13 +17,14 @@ limitations under the License. import ( "encoding/json" "fmt" - database "morf/db" - "morf/models" - "morf/utils" - util "morf/utils" "net/http" "path/filepath" + database "github.com/amrudesh1/morf/db" + "github.com/amrudesh1/morf/models" + "github.com/amrudesh1/morf/utils" + util "github.com/amrudesh1/morf/utils" + log "github.com/sirupsen/logrus" "github.com/gin-gonic/gin" diff --git a/apk/metadata.go b/apk/metadata.go index 9a23ff6..f695d00 100644 --- a/apk/metadata.go +++ b/apk/metadata.go @@ -17,13 +17,14 @@ limitations under the License. import ( "encoding/json" "io" - "morf/models" - "morf/utils" "os" "os/exec" "path/filepath" "strings" + "github.com/amrudesh1/morf/models" + "github.com/amrudesh1/morf/utils" + log "github.com/sirupsen/logrus" alf "github.com/spf13/afero" ) @@ -50,9 +51,9 @@ func StartMetaDataCollection(apkPath string) models.MetaDataModel { // Move APK to input directory apkPath = utils.CopyApktoInputDir(fs, apkPath) - - log.Info("Starting metadata collection for " + apkPath) - + + log.Info("Starting metadata collection for " + apkPath) + metadata_success, metadata_error := exec.Command("java", "-cp", "tools/apkanalyzer.jar", "sk.styk.martin.bakalarka.execute.Main", "-analyze", "--in", utils.GetInputDir(), "--out", utils.GetOutputDir()).Output() if metadata_error != nil { @@ -62,7 +63,7 @@ func StartMetaDataCollection(apkPath string) models.MetaDataModel { } if metadata_success != nil { - log.Debug("Metadata collection successful") + log.Debug("Metadata collection successful") file_path, file_name := filepath.Split(apkPath) log.Debug(file_path) diff --git a/apk/packageparse.go b/apk/packageparse.go index 0c3dd8a..f360e13 100644 --- a/apk/packageparse.go +++ b/apk/packageparse.go @@ -16,11 +16,13 @@ limitations under the License. import ( "fmt" - "morf/models" - util "morf/utils" "regexp" "strings" + "github.com/amrudesh1/morf/models" + + util "github.com/amrudesh1/morf/utils" + "github.com/lib/pq" ) diff --git a/apk/resultparser.go b/apk/resultparser.go index 5a4d378..057af5e 100644 --- a/apk/resultparser.go +++ b/apk/resultparser.go @@ -1,8 +1,8 @@ package apk import ( - "morf/models" - "morf/utils" + "github.com/amrudesh1/morf/models" + "github.com/amrudesh1/morf/utils" log "github.com/sirupsen/logrus" "github.com/spf13/afero" diff --git a/apk/scanner.go b/apk/scanner.go index 832661c..5bd7894 100644 --- a/apk/scanner.go +++ b/apk/scanner.go @@ -19,14 +19,15 @@ package apk import ( "fmt" - "morf/models" - "morf/utils" "os" "os/exec" "strconv" "strings" "sync" + "github.com/amrudesh1/morf/models" + "github.com/amrudesh1/morf/utils" + log "github.com/sirupsen/logrus" "gopkg.in/yaml.v2" ) @@ -109,6 +110,7 @@ func StartScan(apkPath string) []models.SecretModel { for _, pattern := range secretPatterns.Patterns { pat := pattern.Pattern.Regex + log.Info("Searching for pattern: " + pat) result, err := exec.Command("rg", "-n", "-e", pat, "--multiline", utils.GetFilesDir()).Output() if err != nil { continue diff --git a/cmd/cli.go b/cmd/cli.go index e8229cb..c1549ec 100644 --- a/cmd/cli.go +++ b/cmd/cli.go @@ -16,8 +16,9 @@ limitations under the License. import ( "fmt" - "morf/apk" - "morf/db" + + "github.com/amrudesh1/morf/apk" + "github.com/amrudesh1/morf/db" log "github.com/sirupsen/logrus" cob "github.com/spf13/cobra" diff --git a/cmd/server.go b/cmd/server.go index 0ab327f..d9e2e16 100644 --- a/cmd/server.go +++ b/cmd/server.go @@ -15,11 +15,12 @@ limitations under the License. */package cmd import ( - "morf/db" - route "morf/router" "net/http" "time" + "github.com/amrudesh1/morf/db" + route "github.com/amrudesh1/morf/router" + gin "github.com/gin-gonic/gin" cob "github.com/spf13/cobra" vip "github.com/spf13/viper" diff --git a/db/db.go b/db/db.go index 5446827..ebf3208 100644 --- a/db/db.go +++ b/db/db.go @@ -16,9 +16,10 @@ limitations under the License. import ( "fmt" - "morf/models" "os" + "github.com/amrudesh1/morf/models" + "gorm.io/driver/mysql" "gorm.io/gorm" ) diff --git a/go.mod b/go.mod index 0262a94..69a75d2 100644 --- a/go.mod +++ b/go.mod @@ -1,15 +1,11 @@ -module morf +module github.com/amrudesh1/morf go 1.19 -require ( - github.com/gin-gonic/gin v1.9.0 - google.golang.org/appengine v1.6.7 -) +require github.com/gin-gonic/gin v1.9.0 require ( github.com/go-sql-driver/mysql v1.7.0 // indirect - github.com/golang/protobuf v1.5.2 // indirect github.com/gorilla/websocket v1.4.2 // indirect github.com/jinzhu/inflection v1.0.0 // indirect github.com/jinzhu/now v1.1.5 // indirect diff --git a/go.sum b/go.sum index e38df0c..43a636d 100644 --- a/go.sum +++ b/go.sum @@ -111,8 +111,6 @@ github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QD github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= -github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= -github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= @@ -467,7 +465,6 @@ google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7 google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= -google.golang.org/appengine v1.6.7 h1:FZR1q0exgwxzPzp/aF+VccGrSfxfPpkBqjIIEq3ru6c= google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= @@ -532,7 +529,6 @@ google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpAD google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= -google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.28.1 h1:d0NfwRgPtno5B1Wa6L2DAG+KivqkdutMf1UhdNx175w= google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/main.go b/main.go index df51bb0..01bb2d2 100644 --- a/main.go +++ b/main.go @@ -17,7 +17,7 @@ Copyright © 2023 NAME HERE */ package main -import "morf/cmd" +import "github.com/amrudesh1/morf/cmd" func main() { cmd.Execute() diff --git a/router/routers.go b/router/routers.go index 52742a7..615d719 100644 --- a/router/routers.go +++ b/router/routers.go @@ -18,12 +18,13 @@ package router import ( "fmt" - "morf/apk" - "morf/db" - "morf/models" - "morf/utils" "net/http" + "github.com/amrudesh1/morf/apk" + "github.com/amrudesh1/morf/db" + "github.com/amrudesh1/morf/models" + "github.com/amrudesh1/morf/utils" + "github.com/gin-gonic/gin" "github.com/gin-gonic/gin/binding" ) diff --git a/utils/utils.go b/utils/utils.go index 3adaa4b..8c85931 100644 --- a/utils/utils.go +++ b/utils/utils.go @@ -21,8 +21,6 @@ import ( "encoding/json" "fmt" "io" - "morf/db" - "morf/models" "net/http" "os" "os/exec" @@ -30,6 +28,9 @@ import ( "strings" "syscall" + "github.com/amrudesh1/morf/db" + "github.com/amrudesh1/morf/models" + log "github.com/sirupsen/logrus" alf "github.com/spf13/afero" vip "github.com/spf13/viper"