Skip to content

Commit f0caa4a

Browse files
committed
Release v0.12
1 parent c249528 commit f0caa4a

File tree

4 files changed

+22
-2
lines changed

4 files changed

+22
-2
lines changed

cmd/config.go

+1
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ func runConfig(cmd *cobra.Command, _ []string) error {
7777
reloadSignature(path.Join(options.RootFolder, "base-signatures"), mics)
7878
break
7979
case "clear":
80+
utils.GoodF("Cleaning your DB")
8081
database.CleanScans()
8182
database.CleanSigns()
8283
database.CleanRecords()

core/config.go

+6
Original file line numberDiff line numberDiff line change
@@ -103,5 +103,11 @@ func InitConfig(options *libs.Options) {
103103
if options.PassiveSummary == "" {
104104
options.PassiveSummary = path.Join(options.PassiveOutput, "jaeles-passive-summary.txt")
105105
}
106+
107+
dbSize := utils.GetFileSize(options.Server.DBPath)
108+
if dbSize > 5.0 {
109+
utils.WarningF("Your Database size look very big: %vGB", fmt.Sprintf("%.2f", dbSize))
110+
utils.WarningF("Consider clean your db with this command: 'jaeles config -a clear' or just remove your '~/.jaeles/'")
111+
}
106112
utils.InforF("Summary output: %v", options.SummaryOutput)
107113
}

utils/helper.go

+13
Original file line numberDiff line numberDiff line change
@@ -328,3 +328,16 @@ func StripName(raw string) string {
328328
func MoveFolder(src string, dest string) {
329329
os.Rename(NormalizePath(src), NormalizePath(dest))
330330
}
331+
332+
// GetFileSize get file size of a file in GB
333+
func GetFileSize(src string) float64 {
334+
var sizeGB float64
335+
fi, err := os.Stat(NormalizePath(src))
336+
if err != nil {
337+
return sizeGB
338+
}
339+
// get the size
340+
size := fi.Size()
341+
sizeGB = float64(size) / (1024 * 1024 * 1024)
342+
return sizeGB
343+
}

utils/log.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ func PrintLine() {
7676
// GoodF print good message
7777
func GoodF(format string, args ...interface{}) {
7878
good := color.HiGreenString("[+]")
79-
fmt.Printf("%s %s\n", good, fmt.Sprintf(format, args...))
79+
fmt.Fprintf(os.Stderr, "%s %s\n", good, fmt.Sprintf(format, args...))
8080
}
8181

8282
// BannerF print info message
@@ -104,7 +104,7 @@ func ErrorF(format string, args ...interface{}) {
104104
// WarningF print good message
105105
func WarningF(format string, args ...interface{}) {
106106
good := color.YellowString("[!]")
107-
fmt.Printf("%s %s\n", good, fmt.Sprintf(format, args...))
107+
fmt.Fprintf(os.Stderr, "%s %s\n", good, fmt.Sprintf(format, args...))
108108
}
109109

110110
// DebugF print debug message

0 commit comments

Comments
 (0)