Skip to content

Instantly share code, notes, and snippets.

@0x2a94b5
Created July 21, 2020 10:56
Show Gist options
  • Save 0x2a94b5/3f05b99d7ba1a37bd20834274f19d34d to your computer and use it in GitHub Desktop.
Save 0x2a94b5/3f05b99d7ba1a37bd20834274f19d34d to your computer and use it in GitHub Desktop.
Get mac address on windows
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Get mac address on windows
# Package: Pyinstaller -y -F -c getMac.py
#
from subprocess import run, PIPE
try:
cmd = "C:\\Windows\\System32\\getmac.exe"
process = run(cmd, shell=True, check=True, stdout=PIPE, universal_newlines=True)
p = process.stdout.split()[4]
except:
p = "Command Error"
print(p)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment