creole/asm/comm.py

19 lines
410 B
Python

from creole import *
import socket
def connect(ip, port):
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((ip, port))
return s
def execute(creole_instance, socket):
code = creole_instance()
l = len(code)
assert l <= 0xFFFF
socket.sendall(bytes([l & 0xFF, l >> 8]) + code)
def connect_exec(cr, ip="192.168.1.50", port=6626):
s = connect(ip, port)
execute(cr, s)
return s.recv(1024)