Skip to content

Instantly share code, notes, and snippets.

@zhreshold
Last active May 30, 2019 14:39
Show Gist options
  • Select an option

  • Save zhreshold/f4defab409cc0e6f6a0e75237f73ca99 to your computer and use it in GitHub Desktop.

Select an option

Save zhreshold/f4defab409cc0e6f6a0e75237f73ca99 to your computer and use it in GitHub Desktop.
Check OS/Python/Cpu Info and Network connections
import platform, subprocess, sys
print('----------Python Info----------')
print('Version :', platform.python_version())
print('Compiler :', platform.python_compiler())
print('Build :', platform.python_build())
print('Arch :', platform.architecture())
print('----------System Info----------')
print('Platform :', platform.platform())
print('system :', platform.system())
print('node :', platform.node())
print('release :', platform.release())
print('version :', platform.version())
print('machine :', platform.machine())
print('processor :', platform.processor())
print('----------Hardware Info----------')
if sys.platform.startswith('darwin'):
pipe = subprocess.Popen(('sysctl', '-a'), stdout=subprocess.PIPE)
output = pipe.communicate()[0]
for line in output.split('\n'):
if 'brand_string' in line or 'features' in line:
print(line.strip())
elif sys.platform.startswith('linux'):
subprocess.call(['lscpu'])
elif sys.platform.startswith('win32'):
subprocess.call(['wmic', 'cpu', 'get', 'name'])
@az-pz
Copy link

az-pz commented May 30, 2019

Hey,
What's the license of this gist?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment