@@ -27,7 +27,6 @@ import (
27
27
log "github.com/sirupsen/logrus"
28
28
29
29
"github.com/gin-gonic/gin"
30
- vip "github.com/spf13/viper"
31
30
"gorm.io/gorm"
32
31
)
33
32
@@ -42,6 +41,7 @@ func StartCliExtraction(apkPath string, db *gorm.DB, is_db_req bool) {
42
41
log .Info (json_data )
43
42
}
44
43
}
44
+
45
45
packageModel := ExtractPackageData (apkPath )
46
46
metadata := StartMetaDataCollection (apkPath )
47
47
@@ -54,7 +54,6 @@ func StartCliExtraction(apkPath string, db *gorm.DB, is_db_req bool) {
54
54
}
55
55
56
56
scanner_data := StartSecScan (utils .GetInputDir () + fileName )
57
- scanner_data = utils .SanitizeSecrets (scanner_data )
58
57
secret_data , secret_error := json .Marshal (scanner_data )
59
58
60
59
if secret_error != nil {
@@ -78,16 +77,11 @@ func StartCliExtraction(apkPath string, db *gorm.DB, is_db_req bool) {
78
77
util .CreateBackUpDir (fs )
79
78
}
80
79
81
- util .WriteToFile (fs , vip .GetString ("backup_path" )+ fileName + "_" + secret .APKVersion + ".json" , string (json_data ))
82
- util .WriteToFile (fs , vip .GetString ("backup_path" )+ fileName + "_" + "Secrets_" + secret .APKVersion + ".json" , string (secret_data ))
83
-
84
- util .WriteToFile (fs , "results" + "/" + fileName + "_" + secret .APKVersion + ".json" , string (json_data ))
85
- util .WriteToFile (fs , "results" + "/" + fileName + "_" + "Secrets_" + secret .APKVersion + ".json" , string (secret_data ))
86
-
87
- log .Info ("APK Data saved to: " + vip .GetString ("backup_path" ) + "/" + fileName + "_" + secret .APKVersion + ".json" )
80
+ utils .CreateReport (fs , secret , json_data , secret_data , fileName )
88
81
}
89
82
90
83
func StartJiraProcess (jiramodel models.JiraModel , db * gorm.DB , c * gin.Context ) {
84
+
91
85
apk_path := util .DownloadFileUsingSlack (jiramodel , c )
92
86
if apk_path == "" {
93
87
return
@@ -114,6 +108,7 @@ func StartJiraProcess(jiramodel models.JiraModel, db *gorm.DB, c *gin.Context) {
114
108
if secret_error != nil {
115
109
log .Error (secret_error )
116
110
}
111
+
117
112
secret := util .CreateSecretModel (apk_path , packageModel , metadata , scanner_data , secret_data )
118
113
database .InsertSecrets (secret , db )
119
114
@@ -158,17 +153,12 @@ func StartExtractProcess(apkPath string, db *gorm.DB, c *gin.Context, isSlack bo
158
153
log .Error (json_error )
159
154
}
160
155
161
- //Check if backup folder exists
162
156
//Check if backup folder exists
163
157
if ! util .CheckBackUpDirExists (fs ) {
164
158
util .CreateBackUpDir (fs )
165
159
}
166
160
167
- util .WriteToFile (fs , vip .GetString ("backup_path" )+ apkPath + "_" + secret .APKVersion + ".json" , string (json_data ))
168
- util .WriteToFile (fs , vip .GetString ("backup_path" )+ apkPath + "_" + "Secrets_" + secret .APKVersion + ".json" , string (secret_data ))
169
-
170
- util .WriteToFile (fs , "results" + "/" + apkPath + "_" + secret .APKVersion + ".json" , string (json_data ))
171
- util .WriteToFile (fs , "results" + "/" + apkPath + "_" + "Secrets_" + secret .APKVersion + ".json" , string (secret_data ))
161
+ utils .CreateReport (fs , secret , json_data , secret_data , apkPath )
172
162
173
163
if ! isSlack {
174
164
c .JSON (http .StatusOK , gin.H {
0 commit comments