mirror of
https://github.com/bettercap/bettercap
synced 2025-08-20 21:43:18 -07:00
Merge pull request #373 from Edznux/refactoring
Refactoring and fix tests
This commit is contained in:
commit
24037bce47
9 changed files with 35181 additions and 35268 deletions
|
@ -28,7 +28,7 @@ func (s *EventsStream) shouldDumpHttpRequest(req HTTPRequest) bool {
|
|||
return true
|
||||
}
|
||||
// search for interesting headers and cookies
|
||||
for name, _ := range req.Headers {
|
||||
for name := range req.Headers {
|
||||
headerName := strings.ToLower(name)
|
||||
if strings.Contains(headerName, "auth") || strings.Contains(headerName, "token") {
|
||||
return true
|
||||
|
@ -48,7 +48,7 @@ func (s *EventsStream) shouldDumpHttpResponse(res HTTPResponse) bool {
|
|||
return true
|
||||
}
|
||||
// search for interesting headers
|
||||
for name, _ := range res.Headers {
|
||||
for name := range res.Headers {
|
||||
headerName := strings.ToLower(name)
|
||||
if strings.Contains(headerName, "auth") || strings.Contains(headerName, "token") || strings.Contains(headerName, "cookie") {
|
||||
return true
|
||||
|
|
|
@ -119,14 +119,14 @@ func (d *Discovery) Show(by string, expr string) (err error) {
|
|||
} else {
|
||||
targets = d.Session.Lan.List()
|
||||
}
|
||||
|
||||
if by == "seen" {
|
||||
switch by {
|
||||
case "seen":
|
||||
sort.Sort(BySeenSorter(targets))
|
||||
} else if by == "sent" {
|
||||
case "sent":
|
||||
sort.Sort(BySentSorter(targets))
|
||||
} else if by == "rcvd" {
|
||||
case "rcvd":
|
||||
sort.Sort(ByRcvdSorter(targets))
|
||||
} else {
|
||||
default:
|
||||
sort.Sort(ByAddressSorter(targets))
|
||||
}
|
||||
|
||||
|
|
|
@ -123,14 +123,14 @@ func (w *WiFiModule) Show(by string) error {
|
|||
} else {
|
||||
stations = w.Session.WiFi.Stations()
|
||||
}
|
||||
|
||||
if by == "seen" {
|
||||
switch by {
|
||||
case "seen":
|
||||
sort.Sort(ByWiFiSeenSorter(stations))
|
||||
} else if by == "essid" {
|
||||
case "essid":
|
||||
sort.Sort(ByEssidSorter(stations))
|
||||
} else if by == "channel" {
|
||||
case "channel":
|
||||
sort.Sort(ByChannelSorter(stations))
|
||||
} else {
|
||||
default:
|
||||
sort.Sort(ByRSSISorter(stations))
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue