mirror of
https://github.com/bettercap/bettercap
synced 2025-08-20 13:33:21 -07:00
new: implemented wifi.bruteforce for darwin (ref #1075)
This commit is contained in:
parent
b0d56e4f5e
commit
08da91ed5c
7 changed files with 382 additions and 7 deletions
44
modules/wifi/wifi_bruteforce_darwin.go
Normal file
44
modules/wifi/wifi_bruteforce_darwin.go
Normal file
|
@ -0,0 +1,44 @@
|
|||
package wifi
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"os/exec"
|
||||
"time"
|
||||
|
||||
"github.com/bettercap/bettercap/v2/core"
|
||||
"github.com/evilsocket/islazy/async"
|
||||
)
|
||||
|
||||
// networksetup -setairportnetwork interface 'network name' 'password'
|
||||
func wifiBruteforce(mod *WiFiModule, job bruteforceJob) (bool, error) {
|
||||
networksetup, err := exec.LookPath("networksetup")
|
||||
if err != nil {
|
||||
return false, errors.New("could not find networksetup in $PATH")
|
||||
}
|
||||
|
||||
args := []string{
|
||||
"-setairportnetwork",
|
||||
job.iface,
|
||||
job.essid,
|
||||
job.password,
|
||||
}
|
||||
|
||||
type result struct {
|
||||
auth bool
|
||||
err error
|
||||
}
|
||||
|
||||
if res, err := async.WithTimeout(job.timeout, func() interface{} {
|
||||
start := time.Now()
|
||||
if output, err := core.Exec(networksetup, args); err != nil {
|
||||
return result{auth: false, err: err}
|
||||
} else {
|
||||
mod.Debug("%s %v : %v\n%v", networksetup, args, time.Since(start), output)
|
||||
return result{auth: output == "", err: nil}
|
||||
}
|
||||
}); err == nil && res != nil {
|
||||
return res.(result).auth, res.(result).err
|
||||
}
|
||||
|
||||
return false, nil
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue