mirror of
https://github.com/bettercap/bettercap
synced 2025-07-16 10:03:39 -07:00
misc: small fix or general refactoring i did not bother commenting
This commit is contained in:
parent
4e7377d2a0
commit
b57e329632
11 changed files with 28 additions and 28 deletions
|
@ -149,8 +149,8 @@ func (api *RestAPI) Configure() error {
|
|||
return err
|
||||
}
|
||||
} else {
|
||||
log.Info("Loading TLS key from %s", api.keyFile)
|
||||
log.Info("Loading TLS certificate from %s", api.certFile)
|
||||
log.Info("loading TLS key from %s", api.keyFile)
|
||||
log.Info("loading TLS certificate from %s", api.certFile)
|
||||
}
|
||||
|
||||
api.server.Addr = fmt.Sprintf("%s:%d", ip, port)
|
||||
|
|
|
@ -154,7 +154,7 @@ func (p *ArpSpoofer) Start() error {
|
|||
|
||||
func (p *ArpSpoofer) unSpoof() error {
|
||||
nTargets := len(p.addresses) + len(p.macs)
|
||||
log.Info("Restoring ARP cache of %d targets.", nTargets)
|
||||
log.Info("restoring ARP cache of %d targets.", nTargets)
|
||||
p.sendArp(p.Session.Gateway.IP, p.Session.Gateway.HW, false, false)
|
||||
|
||||
if p.internal {
|
||||
|
@ -174,7 +174,7 @@ func (p *ArpSpoofer) unSpoof() error {
|
|||
|
||||
func (p *ArpSpoofer) Stop() error {
|
||||
return p.SetRunning(false, func() {
|
||||
log.Info("Waiting for ARP spoofer to stop ...")
|
||||
log.Info("waiting for ARP spoofer to stop ...")
|
||||
p.unSpoof()
|
||||
p.ban = false
|
||||
p.waitGroup.Wait()
|
||||
|
|
|
@ -11,7 +11,7 @@ import (
|
|||
)
|
||||
|
||||
var (
|
||||
ErrEmptyExpression = errors.New("Expression can not be empty.")
|
||||
ErrEmptyExpression = errors.New("expression can not be empty")
|
||||
)
|
||||
|
||||
type IgnoreFilter string
|
||||
|
@ -51,7 +51,7 @@ func (l *IgnoreList) Add(expr string) (err error) {
|
|||
// first check for duplicates
|
||||
for _, filter := range l.filters {
|
||||
if filter.Matches(expr) {
|
||||
return fmt.Errorf("Filter '%s' already matches the expression '%s'.", filter, expr)
|
||||
return fmt.Errorf("filter '%s' already matches the expression '%s'", filter, expr)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -79,7 +79,7 @@ func (l *IgnoreList) Remove(expr string) (err error) {
|
|||
}
|
||||
|
||||
if len(newList) == len(l.filters) {
|
||||
return fmt.Errorf("Expression '%s' did not match any filter.", expr)
|
||||
return fmt.Errorf("expression '%s' did not match any filter", expr)
|
||||
}
|
||||
|
||||
// swap
|
||||
|
|
|
@ -162,7 +162,7 @@ func (s *EventsStream) Start() error {
|
|||
if !s.ignoreList.Ignored(e) {
|
||||
s.View(e, true)
|
||||
} else {
|
||||
log.Debug("Skipping ignored event %v", e)
|
||||
log.Debug("skipping ignored event %v", e)
|
||||
}
|
||||
|
||||
case <-s.quit:
|
||||
|
@ -197,9 +197,9 @@ func (s *EventsStream) Show(limit int) error {
|
|||
|
||||
func (s *EventsStream) startWaitingFor(tag string, timeout int) error {
|
||||
if timeout == 0 {
|
||||
log.Info("Waiting for event %s ...", core.Green(tag))
|
||||
log.Info("waiting for event %s ...", core.Green(tag))
|
||||
} else {
|
||||
log.Info("Waiting for event %s for %d seconds ...", core.Green(tag), timeout)
|
||||
log.Info("waiting for event %s for %d seconds ...", core.Green(tag), timeout)
|
||||
go func() {
|
||||
time.Sleep(time.Duration(timeout) * time.Second)
|
||||
s.waitFor = ""
|
||||
|
@ -213,7 +213,7 @@ func (s *EventsStream) startWaitingFor(tag string, timeout int) error {
|
|||
if event == nil {
|
||||
return fmt.Errorf("'events.waitFor %s %d' timed out.", tag, timeout)
|
||||
} else {
|
||||
log.Debug("Got event: %v", event)
|
||||
log.Debug("got event: %v", event)
|
||||
}
|
||||
|
||||
return nil
|
||||
|
|
|
@ -37,7 +37,7 @@ func (s *EventsStream) viewWiFiEvent(e session.Event) {
|
|||
}
|
||||
|
||||
if e.Tag == "wifi.ap.new" {
|
||||
fmt.Fprintf(s.output, "[%s] [%s] WiFi access point %s%s detected as %s%s.\n",
|
||||
fmt.Fprintf(s.output, "[%s] [%s] wifi access point %s%s detected as %s%s.\n",
|
||||
e.Time.Format(eventTimeFormat),
|
||||
core.Green(e.Tag),
|
||||
core.Bold(ap.ESSID()),
|
||||
|
@ -45,7 +45,7 @@ func (s *EventsStream) viewWiFiEvent(e session.Event) {
|
|||
core.Green(ap.BSSID()),
|
||||
core.Dim(vend))
|
||||
} else if e.Tag == "wifi.ap.lost" {
|
||||
fmt.Fprintf(s.output, "[%s] [%s] WiFi access point %s (%s) lost.\n",
|
||||
fmt.Fprintf(s.output, "[%s] [%s] wifi access point %s (%s) lost.\n",
|
||||
e.Time.Format(eventTimeFormat),
|
||||
core.Green(e.Tag),
|
||||
core.Red(ap.ESSID()),
|
||||
|
@ -69,7 +69,7 @@ func (s *EventsStream) viewWiFiEvent(e session.Event) {
|
|||
rssi = fmt.Sprintf(" (%d dBm)", probe.RSSI)
|
||||
}
|
||||
|
||||
fmt.Fprintf(s.output, "[%s] [%s] Station %s%s is probing for SSID %s%s\n",
|
||||
fmt.Fprintf(s.output, "[%s] [%s] station %s%s is probing for SSID %s%s\n",
|
||||
e.Time.Format(eventTimeFormat),
|
||||
core.Green(e.Tag),
|
||||
probe.FromAddr.String(),
|
||||
|
@ -79,7 +79,7 @@ func (s *EventsStream) viewWiFiEvent(e session.Event) {
|
|||
}
|
||||
}
|
||||
|
||||
func (s *EventsStream) viewEndpointEvent(e session.Event) {
|
||||
func (s *EventsStream) viewendpointEvent(e session.Event) {
|
||||
t := e.Data.(*network.Endpoint)
|
||||
vend := ""
|
||||
name := ""
|
||||
|
@ -95,7 +95,7 @@ func (s *EventsStream) viewEndpointEvent(e session.Event) {
|
|||
}
|
||||
|
||||
if e.Tag == "endpoint.new" {
|
||||
fmt.Fprintf(s.output, "[%s] [%s] Endpoint %s%s detected as %s%s.\n",
|
||||
fmt.Fprintf(s.output, "[%s] [%s] endpoint %s%s detected as %s%s.\n",
|
||||
e.Time.Format(eventTimeFormat),
|
||||
core.Green(e.Tag),
|
||||
core.Bold(t.IpAddress),
|
||||
|
@ -103,7 +103,7 @@ func (s *EventsStream) viewEndpointEvent(e session.Event) {
|
|||
core.Green(t.HwAddress),
|
||||
core.Dim(vend))
|
||||
} else if e.Tag == "endpoint.lost" {
|
||||
fmt.Fprintf(s.output, "[%s] [%s] Endpoint %s%s lost.\n",
|
||||
fmt.Fprintf(s.output, "[%s] [%s] endpoint %s%s lost.\n",
|
||||
e.Time.Format(eventTimeFormat),
|
||||
core.Green(e.Tag),
|
||||
core.Red(t.IpAddress),
|
||||
|
@ -159,7 +159,7 @@ func (s *EventsStream) viewSnifferEvent(e session.Event) {
|
|||
|
||||
func (s *EventsStream) viewSynScanEvent(e session.Event) {
|
||||
se := e.Data.(SynScanEvent)
|
||||
fmt.Fprintf(s.output, "[%s] [%s] Found open port %d for %s\n",
|
||||
fmt.Fprintf(s.output, "[%s] [%s] found open port %d for %s\n",
|
||||
e.Time.Format(eventTimeFormat),
|
||||
core.Green(e.Tag),
|
||||
se.Port,
|
||||
|
@ -169,7 +169,7 @@ func (s *EventsStream) viewSynScanEvent(e session.Event) {
|
|||
func (s *EventsStream) viewUpdateEvent(e session.Event) {
|
||||
update := e.Data.(*github.RepositoryRelease)
|
||||
|
||||
fmt.Fprintf(s.output, "[%s] [%s] An update to version %s is available at %s\n",
|
||||
fmt.Fprintf(s.output, "[%s] [%s] an update to version %s is available at %s\n",
|
||||
e.Time.Format(eventTimeFormat),
|
||||
core.Bold(core.Yellow(e.Tag)),
|
||||
core.Bold(*update.TagName),
|
||||
|
@ -180,7 +180,7 @@ func (s *EventsStream) View(e session.Event, refresh bool) {
|
|||
if e.Tag == "sys.log" {
|
||||
s.viewLogEvent(e)
|
||||
} else if strings.HasPrefix(e.Tag, "endpoint.") {
|
||||
s.viewEndpointEvent(e)
|
||||
s.viewendpointEvent(e)
|
||||
} else if strings.HasPrefix(e.Tag, "wifi.") {
|
||||
s.viewWiFiEvent(e)
|
||||
} else if strings.HasPrefix(e.Tag, "ble.") {
|
||||
|
|
|
@ -23,7 +23,7 @@ func (s *EventsStream) viewBLEEvent(e session.Event) {
|
|||
vend = fmt.Sprintf(" (%s)", core.Yellow(vend))
|
||||
}
|
||||
|
||||
fmt.Fprintf(s.output, "[%s] [%s] New BLE device%s detected as %s%s %s.\n",
|
||||
fmt.Fprintf(s.output, "[%s] [%s] new BLE device%s detected as %s%s %s.\n",
|
||||
e.Time.Format(eventTimeFormat),
|
||||
core.Green(e.Tag),
|
||||
name,
|
||||
|
|
|
@ -58,7 +58,7 @@ func LoadHttpProxyScriptSource(path, source string, sess *session.Session) (err
|
|||
}
|
||||
|
||||
func LoadHttpProxyScript(path string, sess *session.Session) (err error, s *HttpProxyScript) {
|
||||
log.Info("Loading proxy script %s ...", path)
|
||||
log.Info("loading proxy script %s ...", path)
|
||||
|
||||
raw, err := ioutil.ReadFile(path)
|
||||
if err != nil {
|
||||
|
|
|
@ -145,8 +145,8 @@ func (httpd *HttpServer) Configure() error {
|
|||
return err
|
||||
}
|
||||
} else {
|
||||
log.Info("Loading server TLS key from %s", keyFile)
|
||||
log.Info("Loading server TLS certificate from %s", certFile)
|
||||
log.Info("loading server TLS key from %s", keyFile)
|
||||
log.Info("loading server TLS certificate from %s", certFile)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -132,8 +132,8 @@ func (p *HttpsProxy) Configure() error {
|
|||
return err
|
||||
}
|
||||
} else {
|
||||
log.Info("Loading proxy certification authority TLS key from %s", keyFile)
|
||||
log.Info("Loading proxy certification authority TLS certificate from %s", certFile)
|
||||
log.Info("loading proxy certification authority TLS key from %s", keyFile)
|
||||
log.Info("loading proxy certification authority TLS certificate from %s", certFile)
|
||||
}
|
||||
|
||||
return p.proxy.ConfigureTLS(address, proxyPort, httpPort, scriptPath, certFile, keyFile, jsToInject, stripSSL)
|
||||
|
|
|
@ -146,7 +146,7 @@ func (pp *PacketProxy) Configure() (err error) {
|
|||
return fmt.Errorf("%s does not exist.", pp.pluginPath)
|
||||
}
|
||||
|
||||
log.Info("Loading packet proxy plugin from %s ...", pp.pluginPath)
|
||||
log.Info("loading packet proxy plugin from %s ...", pp.pluginPath)
|
||||
|
||||
var ok bool
|
||||
var sym plugin.Symbol
|
||||
|
|
|
@ -39,7 +39,7 @@ func LoadTcpProxyScriptSource(path, source string, sess *session.Session) (err e
|
|||
}
|
||||
|
||||
func LoadTcpProxyScript(path string, sess *session.Session) (err error, s *TcpProxyScript) {
|
||||
log.Info("Loading TCP proxy script %s ...", path)
|
||||
log.Info("loading TCP proxy script %s ...", path)
|
||||
|
||||
raw, err := ioutil.ReadFile(path)
|
||||
if err != nil {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue