| 796 | return check_command("getmac.exe") |
| 797 | |
| 798 | def get(self, arg): # type: (str) -> Optional[str] |
| 799 | try: |
| 800 | # /nh: Suppresses table headers |
| 801 | # /v: Verbose |
| 802 | command_output = _popen("getmac.exe", "/NH /V") |
| 803 | except CalledProcessError as ex: |
| 804 | # This shouldn't cause an exception if it's valid command |
| 805 | log.error("getmac.exe failed, marking unusable. Exception: %s", str(ex)) |
| 806 | self.unusable = True |
| 807 | return None |
| 808 | |
| 809 | if self._champ: |
| 810 | return _search(self._champ[0] + arg + self._champ[1], command_output) |
| 811 | |
| 812 | for pair in self._regexes: |
| 813 | result = _search(pair[0] + arg + pair[1], command_output) |
| 814 | if result: |
| 815 | self._champ = pair |
| 816 | return result |
| 817 | |
| 818 | return None |
| 819 | |
| 820 | |
| 821 | class IpconfigExe(Method): |