mirror of
https://github.com/bettercap/bettercap
synced 2025-07-16 10:03:39 -07:00
fix: do not emit graph if empty
This commit is contained in:
parent
1d306e6cd2
commit
0042b77c36
2 changed files with 33 additions and 22 deletions
|
@ -23,18 +23,23 @@ func (mod *Module) generateDotGraph(bssid string) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if mod.settings.privacy {
|
if size > 0 {
|
||||||
data = privacyFilter.ReplaceAllString(data, "$1:$2:xx:xx:xx:xx")
|
if mod.settings.privacy {
|
||||||
|
data = privacyFilter.ReplaceAllString(data, "$1:$2:xx:xx:xx:xx")
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := ioutil.WriteFile(mod.settings.dot.output, []byte(data), os.ModePerm); err != nil {
|
||||||
|
return err
|
||||||
|
} else {
|
||||||
|
mod.Info("graph saved to %s in %v (%d edges, %d discarded)",
|
||||||
|
mod.settings.dot.output,
|
||||||
|
time.Since(start),
|
||||||
|
size,
|
||||||
|
discarded)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
mod.Info("graph is empty")
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := ioutil.WriteFile(mod.settings.dot.output, []byte(data), os.ModePerm); err != nil {
|
|
||||||
return err
|
|
||||||
} else {
|
|
||||||
mod.Info("graph saved to %s in %v (%d edges, %d discarded)",
|
|
||||||
mod.settings.dot.output,
|
|
||||||
time.Since(start),
|
|
||||||
size,
|
|
||||||
discarded)
|
|
||||||
}
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
|
@ -20,18 +20,24 @@ func (mod *Module) generateJSONGraph(bssid string) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if mod.settings.privacy {
|
if size > 0 {
|
||||||
data = privacyFilter.ReplaceAllString(data, "$1:$2:xx:xx:xx:xx")
|
|
||||||
|
if mod.settings.privacy {
|
||||||
|
data = privacyFilter.ReplaceAllString(data, "$1:$2:xx:xx:xx:xx")
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := ioutil.WriteFile(mod.settings.json.output, []byte(data), os.ModePerm); err != nil {
|
||||||
|
return err
|
||||||
|
} else {
|
||||||
|
mod.Info("graph saved to %s in %v (%d edges, %d discarded)",
|
||||||
|
mod.settings.json.output,
|
||||||
|
time.Since(start),
|
||||||
|
size,
|
||||||
|
discarded)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
mod.Info("graph is empty")
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := ioutil.WriteFile(mod.settings.json.output, []byte(data), os.ModePerm); err != nil {
|
|
||||||
return err
|
|
||||||
} else {
|
|
||||||
mod.Info("graph saved to %s in %v (%d edges, %d discarded)",
|
|
||||||
mod.settings.json.output,
|
|
||||||
time.Since(start),
|
|
||||||
size,
|
|
||||||
discarded)
|
|
||||||
}
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
Loading…
Add table
Add a link
Reference in a new issue