def get_name_and_size(msg, tcp): (hsize, lsize) = struct.unpack("<II", msg[:8]) size = winsizeize(hsize, lsize) fname = msg[8:-1] if tcp.module_data["savefiles"]: tcp.stream_data["fsize"] = size tcp.stream_data["fname"] = sanitize_filename(fname) chop.prnt(tcp.stream_data["fname"]) tcp.stream_data["byteswritten"] = 0 return (fname, size)
def get_name_and_size(msg, tcp): (hsize, lsize) = struct.unpack('<II', msg[:8]) size = winsizeize(hsize, lsize) fname = msg[8:-1] if tcp.module_data['savefiles']: tcp.stream_data['fsize'] = size tcp.stream_data['fname'] = sanitize_filename(fname) chop.prnt(tcp.stream_data['fname']) tcp.stream_data['byteswritten'] = 0 return (fname, size)
def token_file_list(msg, tcp): if len(msg) == 0: chop.prnt("TOKEN: FILE LIST (INVALID HANDLE)") return chop.prnt("TOKEN: FILE LIST") chop.prnt("TYPE\tNAME\tSIZE\tWRITE TIME") while len(msg) >= 1: d = struct.unpack("B", msg[1])[0] if d & 0x10: d = "DIR" else: d = "FILE" msg = msg[1:] null = msg.find("\x00") name = msg[:null] msg = msg[null + 1 :] (hsize, lsize, wtime) = struct.unpack("<IIQ", msg[:16]) size = winsizeize(hsize, lsize) msg = msg[16:] chop.prnt("%s\t%s\t%i\t%i" % (d, name, size, wtime))
def token_file_list(msg, tcp): if len(msg) == 0: chop.prnt("TOKEN: FILE LIST (INVALID HANDLE)") return chop.prnt("TOKEN: FILE LIST") chop.prnt("TYPE\tNAME\tSIZE\tWRITE TIME") while len(msg) >= 1: d = struct.unpack('B', msg[1])[0] if d & 0x10: d = "DIR" else: d = "FILE" msg = msg[1:] null = msg.find('\x00') name = msg[:null] msg = msg[null + 1:] (hsize, lsize, wtime) = struct.unpack('<IIQ', msg[:16]) size = winsizeize(hsize, lsize) msg = msg[16:] chop.prnt("%s\t%s\t%i\t%i" % (d, name, size, wtime))