Skip to content

Commit

Permalink
Release v0.12
Browse files Browse the repository at this point in the history
  • Loading branch information
j3ssie committed Aug 2, 2020
1 parent c249528 commit f0caa4a
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 2 deletions.
1 change: 1 addition & 0 deletions cmd/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ func runConfig(cmd *cobra.Command, _ []string) error {
reloadSignature(path.Join(options.RootFolder, "base-signatures"), mics)
break
case "clear":
utils.GoodF("Cleaning your DB")
database.CleanScans()
database.CleanSigns()
database.CleanRecords()
Expand Down
6 changes: 6 additions & 0 deletions core/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,5 +103,11 @@ func InitConfig(options *libs.Options) {
if options.PassiveSummary == "" {
options.PassiveSummary = path.Join(options.PassiveOutput, "jaeles-passive-summary.txt")
}

dbSize := utils.GetFileSize(options.Server.DBPath)
if dbSize > 5.0 {
utils.WarningF("Your Database size look very big: %vGB", fmt.Sprintf("%.2f", dbSize))
utils.WarningF("Consider clean your db with this command: 'jaeles config -a clear' or just remove your '~/.jaeles/'")
}
utils.InforF("Summary output: %v", options.SummaryOutput)
}
13 changes: 13 additions & 0 deletions utils/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -328,3 +328,16 @@ func StripName(raw string) string {
func MoveFolder(src string, dest string) {
os.Rename(NormalizePath(src), NormalizePath(dest))
}

// GetFileSize get file size of a file in GB
func GetFileSize(src string) float64 {
var sizeGB float64
fi, err := os.Stat(NormalizePath(src))
if err != nil {
return sizeGB
}
// get the size
size := fi.Size()
sizeGB = float64(size) / (1024 * 1024 * 1024)
return sizeGB
}
4 changes: 2 additions & 2 deletions utils/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ func PrintLine() {
// GoodF print good message
func GoodF(format string, args ...interface{}) {
good := color.HiGreenString("[+]")
fmt.Printf("%s %s\n", good, fmt.Sprintf(format, args...))
fmt.Fprintf(os.Stderr, "%s %s\n", good, fmt.Sprintf(format, args...))
}

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

// DebugF print debug message
Expand Down

0 comments on commit f0caa4a

Please sign in to comment.