{"action":"created","issue":{"url":"https://api.github.com/repos/bettercap/bettercap/issues/102","repository_url":"https://api.github.com/repos/bettercap/bettercap","labels_url":"https://api.github.com/repos/bettercap/bettercap/issues/102/labels{/name}","comments_url":"https://api.github.com/repos/bettercap/bettercap/issues/102/comments","events_url":"https://api.github.com/repos/bettercap/bettercap/issues/102/events","html_url":"https://github.com/bettercap/bettercap/issues/102","id":300888241,"number":102,"title":"mac.changer error: not restoring original mac address when called more than once","user":{"login":"picatz","id":14850816,"avatar_url":"https://avatars0.githubusercontent.com/u/14850816?v=4","gravatar_id":"","url":"https://api.github.com/users/picatz","html_url":"https://github.com/picatz","followers_url":"https://api.github.com/users/picatz/followers","following_url":"https://api.github.com/users/picatz/following{/other_user}","gists_url":"https://api.github.com/users/picatz/gists{/gist_id}","starred_url":"https://api.github.com/users/picatz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/picatz/subscriptions","organizations_url":"https://api.github.com/users/picatz/orgs","repos_url":"https://api.github.com/users/picatz/repos","events_url":"https://api.github.com/users/picatz/events{/privacy}","received_events_url":"https://api.github.com/users/picatz/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-02-28T04:33:42Z","updated_at":"2018-02-28T04:55:22Z","closed_at":null,"author_association":"MEMBER","body":"### Prerequisites\r\n\r\n* [x] I read the [README](https://github.com/bettercap/bettercap/blob/master/README.md).\r\n* [x] I am running the [latest stable version](https://github.com/bettercap/bettercap/releases).\r\n* [x] I already searched [other issues](https://github.com/bettercap/bettercap/issues?q=is%3Aopen+is%3Aissue+label%3Abug) to see if this problem was already reported.\r\n* [x] I understand I don't necessarily have to paste this `Prerequisites` section in the issue.\r\n\r\n### Description\r\n`mac.changer` will fail to reset back to the old mac address if accidentally called twice ( maybe more? ).\r\n\r\n### Environment\r\n* macOS\r\n\r\n```\r\nsudo bettercap\r\nbettercap v2.0.0 (type 'help' for a list of commands)\r\n\r\n10.0.0.0/24 > 10.0.0.37  » mac.changer on\r\n10.0.0.0/24 > 10.0.0.37  » [23:21:49] [sys.log] [inf] Interface mac address set to d1:59:38:f4:a1:f5\r\n10.0.0.0/24 > 10.0.0.37  » mac.changer off\r\n[23:21:52] [sys.log] [inf] Interface mac address restored to 98:7b:f3:1e:a0:5e\r\n10.0.0.0/24 > 10.0.0.37  » mac.changer off\r\n[23:21:55] [sys.log] [err] Module is not running.\r\n10.0.0.0/24 > 10.0.0.37  » mac.changer on\r\n[23:22:00] [sys.log] [inf] Interface mac address set to e6:e0:76:22:2f:b6\r\n10.0.0.0/24 > 10.0.0.37  » mac.changer on\r\n[23:22:03] [sys.log] [err] Module is already running.\r\n10.0.0.0/24 > 10.0.0.37  » mac.changer off\r\n[23:22:05] [sys.log] [inf] Interface mac address restored to e6:e0:76:22:2f:b6\r\n10.0.0.0/24 > 10.0.0.37  » mac.changer off\r\n[23:22:10] [sys.log] [err] Module is not runni\r\n```\r\n\r\n### Steps to Reproduce\r\nI turn on the `mac.changer` module for the first time:\r\n1. `mac.changer on`\r\nI accidentally call it again:\r\n2. `mac.changer on` *again*\r\nI then decide I'm done with that.\r\n3. `mac.changer off`\r\nBut now I see that the mac address hasn't been restored properly.\r\n\r\n**Expected behavior:** I would expect the second `mac.changer on` to error out and not cause the subsequent `mac.changer off` to fail to reset the mac address properly.\r\n\r\n**Actual behavior:** The mac address changed in the first `on` was _probably_ written to a variable or something, even in the event of the error. So when the module was turned off, the mac address wasn't able to restore properly."},"comment":{"url":"https://api.github.com/repos/bettercap/bettercap/issues/comments/369121518","html_url":"https://github.com/bettercap/bettercap/issues/102#issuecomment-369121518","issue_url":"https://api.github.com/repos/bettercap/bettercap/issues/102","id":369121518,"user":{"login":"picatz","id":14850816,"avatar_url":"https://avatars0.githubusercontent.com/u/14850816?v=4","gravatar_id":"","url":"https://api.github.com/users/picatz","html_url":"https://github.com/picatz","followers_url":"https://api.github.com/users/picatz/followers","following_url":"https://api.github.com/users/picatz/following{/other_user}","gists_url":"https://api.github.com/users/picatz/gists{/gist_id}","starred_url":"https://api.github.com/users/picatz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/picatz/subscriptions","organizations_url":"https://api.github.com/users/picatz/orgs","repos_url":"https://api.github.com/users/picatz/repos","events_url":"https://api.github.com/users/picatz/events{/privacy}","received_events_url":"https://api.github.com/users/picatz/received_events","type":"User","site_admin":false},"created_at":"2018-02-28T04:55:22Z","updated_at":"2018-02-28T04:55:22Z","author_association":"MEMBER","body":"I'm working on a fix to this now / I'm sure @evilsocket or @Matrix86 could easily beat me to it. 🙏 "}}
{"actor":{"display_login":"picatz"}}