mirror of
https://github.com/bettercap/bettercap
synced 2025-08-20 13:33:21 -07:00
Merge pull request #103 from picatz/fix-mac-changer-configure-bug
Fix Issue #102
This commit is contained in:
commit
d3468683ad
1 changed files with 8 additions and 0 deletions
|
@ -1,6 +1,7 @@
|
|||
package modules
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"net"
|
||||
"runtime"
|
||||
|
@ -64,6 +65,10 @@ func (mc *MacChanger) Author() string {
|
|||
func (mc *MacChanger) Configure() (err error) {
|
||||
var changeTo string
|
||||
|
||||
if mc.originalMac != nil {
|
||||
return errors.New("mac.changer has already been configured, you will need to turn it off to re-configure")
|
||||
}
|
||||
|
||||
if err, mc.iface = mc.StringParam("mac.changer.iface"); err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -119,6 +124,9 @@ func (mc *MacChanger) Stop() error {
|
|||
return err
|
||||
}
|
||||
|
||||
// the the module can now be reconfigured
|
||||
mc.originalMac = nil
|
||||
|
||||
return mc.SetRunning(false, func() {
|
||||
log.Info("Interface mac address restored to %s", core.Bold(mc.originalMac.String()))
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue