import socket import select import struct import re import time class MCRcon: def __init__(self, host, port, password): self.s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) self.s.connect((host, port)) self.send_real(3, password) def close(self): self.s.close() def send(self, command): return self.send_real(2, command) def send_real(self, out_type, out_data): #Send the data buff = struct.pack('