mirror of
https://github.com/maride/pancap.git
synced 2024-11-22 08:54:24 +00:00
Add more meaningful output to ARP module
This commit is contained in:
parent
b228d1ddbb
commit
1ee36fc944
@ -65,7 +65,20 @@ func printTrafficStats() {
|
|||||||
|
|
||||||
// Iterate over all participants
|
// Iterate over all participants
|
||||||
for _, p := range arpStatsList {
|
for _, p := range arpStatsList {
|
||||||
tmparr = append(tmparr, fmt.Sprintf("%s asked for %d addresses and answered %d requests", p.macaddr, p.asked, p.answered))
|
// produce a meaningful output
|
||||||
|
if p.asked > 0 {
|
||||||
|
// device asked at least for one IP
|
||||||
|
if p.answered > 0 {
|
||||||
|
// and also answered requests
|
||||||
|
tmparr = append(tmparr, fmt.Sprintf("%s asked for %d addresses and answered %d requests", p.macaddr, p.asked, p.answered))
|
||||||
|
} else {
|
||||||
|
// only asked, never answered
|
||||||
|
tmparr = append(tmparr, fmt.Sprintf("%s asked for %d addresses", p.macaddr, p.asked))
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Answered, but never asked for any addresses
|
||||||
|
tmparr = append(tmparr, fmt.Sprintf("%s answered %d requests", p.macaddr, p.answered))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// And print it as a tree
|
// And print it as a tree
|
||||||
|
Loading…
Reference in New Issue
Block a user