mirror of
https://github.com/bettercap/bettercap
synced 2025-08-21 05:53:20 -07:00
new: gps.new event now reports GPS data changes as they occur (fixes #878)
This commit is contained in:
parent
831020983c
commit
8c00207e7e
4 changed files with 34 additions and 20 deletions
|
@ -2,12 +2,13 @@ package events_stream
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/bettercap/bettercap/network"
|
||||
"github.com/bettercap/bettercap/session"
|
||||
"io"
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"github.com/bettercap/bettercap/network"
|
||||
"github.com/bettercap/bettercap/session"
|
||||
|
||||
"github.com/bettercap/bettercap/modules/net_sniff"
|
||||
"github.com/bettercap/bettercap/modules/syn_scan"
|
||||
|
||||
|
@ -119,6 +120,8 @@ func (mod *EventsStream) Render(output io.Writer, e session.Event) {
|
|||
mod.viewBLEEvent(output, e)
|
||||
} else if strings.HasPrefix(e.Tag, "hid.") {
|
||||
mod.viewHIDEvent(output, e)
|
||||
} else if strings.HasPrefix(e.Tag, "gps.") {
|
||||
mod.viewGPSEvent(output, e)
|
||||
} else if strings.HasPrefix(e.Tag, "mod.") {
|
||||
mod.viewModuleEvent(output, e)
|
||||
} else if strings.HasPrefix(e.Tag, "net.sniff.") {
|
||||
|
|
24
modules/events_stream/events_view_gps.go
Normal file
24
modules/events_stream/events_view_gps.go
Normal file
|
@ -0,0 +1,24 @@
|
|||
package events_stream
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
"github.com/bettercap/bettercap/session"
|
||||
"github.com/evilsocket/islazy/tui"
|
||||
)
|
||||
|
||||
func (mod *EventsStream) viewGPSEvent(output io.Writer, e session.Event) {
|
||||
if e.Tag == "gps.new" {
|
||||
gps := e.Data.(session.GPS)
|
||||
|
||||
fmt.Fprintf(output, "[%s] [%s] latitude:%f longitude:%f quality:%s satellites:%d altitude:%f\n",
|
||||
e.Time.Format(mod.timeFormat),
|
||||
tui.Green(e.Tag),
|
||||
gps.Latitude,
|
||||
gps.Longitude,
|
||||
gps.FixQuality,
|
||||
gps.NumSatellites,
|
||||
gps.Altitude)
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue