daily pastebin goal
1%
SHARE
TWEET

Untitled

a guest May 16th, 2018 103 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import platform
  2. import ctypes, os
  3. import subprocess
  4. import socket
  5. from getpass import getuser as getUser
  6.  
  7. def isAdmin():
  8.     try:
  9.         return os.getuid() == 0
  10.     except AttributeError:
  11.         return ctypes.windll.shell32.IsUserAnAdmin() != 0
  12.  
  13. def getIp():
  14.     ifconfig = subprocess.Popen(['ifconfig'], stdout=subprocess.PIPE).stdout
  15.     filtered = [x.strip() for x in ifconfig if 'inet ' in x and '127.0.0.1' not in x]
  16.     return filtered[0]
  17.  
  18. def isAlreadyRunning():
  19.     ps = subprocess.Popen(['ps', 'aux'], stdout=subprocess.PIPE).stdout
  20.     filtered = [x for x in ps if 'virus' in x]
  21.     return bool(filtered)
  22.  
  23. info = {}
  24. info['system'] = '%s %s' % (platform.system(), platform.release())
  25. info['username'] = getUser()
  26. info['architecture'] = str(platform.architecture()[0])
  27. info['admin'] = isAdmin()
  28. info['ip'] = getIp()
  29. info['alreadyRunning'] = isAlreadyRunning()
  30. info['ip-for-facebook'] = socket.gethostbyname('facebook.com')
  31.  
  32.  
  33. for k,v in info.iteritems():
  34.     print "%s: %s" % (k,v)
RAW Paste Data
Top