mirror of
https://github.com/bettercap/bettercap.git
synced 2025-03-12 04:36:03 -07:00
fix: do not show gateway warning if the interface is not connected to any network
This commit is contained in:
parent
ae223d7110
commit
3c798794eb
@ -10,8 +10,9 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
PromptVariable = "$"
|
||||
DefaultPrompt = "{by}{fw}{cidr} {fb}> {env.iface.ipv4} {reset} {bold}» {reset}"
|
||||
PromptVariable = "$"
|
||||
DefaultPrompt = "{by}{fw}{cidr} {fb}> {env.iface.ipv4} {reset} {bold}» {reset}"
|
||||
DefaultPromptMonitor = "{by}{fb} {env.iface.name} {reset} {bold}» {reset}"
|
||||
)
|
||||
|
||||
var (
|
||||
|
@ -227,7 +227,11 @@ func (s *Session) Start() error {
|
||||
}
|
||||
|
||||
if s.Gateway, err = network.FindGateway(s.Interface); err != nil {
|
||||
s.Events.Log(log.WARNING, "%s", err.Error())
|
||||
level := log.WARNING
|
||||
if s.Interface.IsMonitor() {
|
||||
level = log.DEBUG
|
||||
}
|
||||
s.Events.Log(level, "%s", err.Error())
|
||||
}
|
||||
|
||||
if s.Gateway == nil || s.Gateway.IpAddress == s.Interface.IpAddress {
|
||||
|
@ -131,7 +131,11 @@ func (s *Session) setupEnv() {
|
||||
s.Env.Set("gateway.mac", s.Gateway.HwAddress)
|
||||
|
||||
if found, v := s.Env.Get(PromptVariable); !found || v == "" {
|
||||
s.Env.Set(PromptVariable, DefaultPrompt)
|
||||
if s.Interface.IsMonitor() {
|
||||
s.Env.Set(PromptVariable, DefaultPromptMonitor)
|
||||
} else {
|
||||
s.Env.Set(PromptVariable, DefaultPrompt)
|
||||
}
|
||||
}
|
||||
|
||||
dbg := "false"
|
||||
|
Loading…
x
Reference in New Issue
Block a user