def cmd_names(self, client, arg_string): args = arg_string.split() reqid = int(args[0]) ip = int(args[1]) mask = int(args[2]) result_string_parts = [] results = IpName.fetch(ip, mask) for result in results: result_string_parts.extend([cs_escape(result.name), format_date(result.date), result.count]) result_string_parts = map(str, result_string_parts) result_string = '" "'.join(result_string_parts) client.send("names {} \"{}\"\n".format(reqid, result_string))
def cmd_recname(self, client, arg_string): args = arg_string.rsplit(' ', 1) name = args[0] ip = int(args[1]) IpName.record(name, ip)