mirror of
https://github.com/bettercap/bettercap
synced 2025-07-12 08:07:00 -07:00
misc: small fix or general refactoring i did not bother commenting
This commit is contained in:
parent
d5fb7b6754
commit
3c506b7809
6 changed files with 9 additions and 10 deletions
|
@ -54,10 +54,7 @@ func (c httpPackage) Request(method string, uri string, headers map[string]strin
|
||||||
req.Header.Add(name, value)
|
req.Header.Add(name, value)
|
||||||
}
|
}
|
||||||
|
|
||||||
transport := &http.Transport{}
|
resp, err := http.DefaultClient.Do(req)
|
||||||
client := &http.Client{Transport: transport}
|
|
||||||
|
|
||||||
resp, err := client.Do(req)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return httpResponse{Error: err}
|
return httpResponse{Error: err}
|
||||||
}
|
}
|
||||||
|
|
|
@ -111,7 +111,8 @@ func (mod *Prober) Start() error {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
list, err := iprange.Parse(mod.Session.Interface.CIDR())
|
cidr := mod.Session.Interface.CIDR()
|
||||||
|
list, err := iprange.Parse(cidr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
mod.Fatal("%s", err)
|
mod.Fatal("%s", err)
|
||||||
}
|
}
|
||||||
|
@ -125,6 +126,8 @@ func (mod *Prober) Start() error {
|
||||||
addresses := list.Expand()
|
addresses := list.Expand()
|
||||||
throttle := time.Duration(mod.throttle) * time.Millisecond
|
throttle := time.Duration(mod.throttle) * time.Millisecond
|
||||||
|
|
||||||
|
mod.Info("probing %d addresses on %s", len(addresses), cidr)
|
||||||
|
|
||||||
for mod.Running() {
|
for mod.Running() {
|
||||||
if mod.probes.MDNS {
|
if mod.probes.MDNS {
|
||||||
mod.sendProbeMDNS(fromIP, fromHW)
|
mod.sendProbeMDNS(fromIP, fromHW)
|
||||||
|
|
|
@ -24,7 +24,7 @@ func (mod *WiFiModule) isInterfaceConnected() bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (mod *WiFiModule) hopUnlocked(channel int) (mustStop bool) {
|
func (mod *WiFiModule) hopUnlocked(channel int) (mustStop bool) {
|
||||||
mod.Debug("hopping on channel %d", channel)
|
// mod.Debug("hopping on channel %d", channel)
|
||||||
|
|
||||||
if err := network.SetInterfaceChannel(mod.iface.Name(), channel); err != nil {
|
if err := network.SetInterfaceChannel(mod.iface.Name(), channel); err != nil {
|
||||||
// check if the device has been disconnected
|
// check if the device has been disconnected
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
import os
|
import os
|
||||||
import six
|
import six
|
||||||
import re
|
import re
|
||||||
import sys
|
|
||||||
|
|
||||||
base = os.path.dirname(os.path.realpath(__file__))
|
base = os.path.dirname(os.path.realpath(__file__))
|
||||||
# "https://code.wireshark.org/review/gitweb?p=wireshark.git;a=blob_plain;f=manuf;hb=HEAD"
|
# "https://code.wireshark.org/review/gitweb?p=wireshark.git;a=blob_plain;f=manuf;hb=HEAD"
|
||||||
|
|
|
@ -41,7 +41,7 @@ func SetInterfaceChannel(iface string, channel int) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
if core.HasBinary("iw") {
|
if core.HasBinary("iw") {
|
||||||
Debug("SetInterfaceChannel(%s, %d) iw based", iface, channel)
|
// Debug("SetInterfaceChannel(%s, %d) iw based", iface, channel)
|
||||||
out, err := core.Exec("iw", []string{"dev", iface, "set", "channel", fmt.Sprintf("%d", channel)})
|
out, err := core.Exec("iw", []string{"dev", iface, "set", "channel", fmt.Sprintf("%d", channel)})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("iw: out=%s err=%s", out, err)
|
return fmt.Errorf("iw: out=%s err=%s", out, err)
|
||||||
|
@ -49,7 +49,7 @@ func SetInterfaceChannel(iface string, channel int) error {
|
||||||
return fmt.Errorf("Unexpected output while setting interface %s to channel %d: %s", iface, channel, out)
|
return fmt.Errorf("Unexpected output while setting interface %s to channel %d: %s", iface, channel, out)
|
||||||
}
|
}
|
||||||
} else if core.HasBinary("iwconfig") {
|
} else if core.HasBinary("iwconfig") {
|
||||||
Debug("SetInterfaceChannel(%s, %d) iwconfig based")
|
// Debug("SetInterfaceChannel(%s, %d) iwconfig based")
|
||||||
out, err := core.Exec("iwconfig", []string{iface, "channel", fmt.Sprintf("%d", channel)})
|
out, err := core.Exec("iwconfig", []string{iface, "channel", fmt.Sprintf("%d", channel)})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("iwconfig: out=%s err=%s", out, err)
|
return fmt.Errorf("iwconfig: out=%s err=%s", out, err)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue