require "msrpc" require "ndr" require "uuid" MSRPCTransport = {} MSRPCService = { new = function(self, o) o = o or {} setmetatable(o, self) self.__index = self return o end --UUID uuid = {}, setUUID = function(self, uuid_str) self.uuid = uuid.UUID:new(uuid_str) end, getUUID = function(self) self.uuid:get() end, --VERSION version = {major = 1, minor = 0}, setVersion = function(self, major, minor) self.version.major = major or 1 self.version.minor = minor or 0 end, getVersion = function(self) return self.version.major, self.version.minor end --NAME name = "", setName = function(self, name) self.name = name or "unnamed service" end, getName = function(self) return self.name end, --HELPSTRING helpstring = "", setHelpstring = function(self, helpstring) self.helpstring = helpstring end, getHelpstring = function(self) return self.helpstring end, --ENDPOINTS endpoints = {}, pushEndpoint = function(self, proto_tower) endpoints[#endpoints+1] = proto_tower end, getEndpoint = function(self, idx) return self.endpoints[idx] end, --TYPES types = { structure_prototypes = {}, enums = {}, typedefs = {} }, --CONSTANTS consts = {}, setConst = function(self, const_id, const_val) self.consts[const_id] = const_val end, getConst = function(self, const_id) return self.consts[const_id] end, --OPERATION NUMBERS opnums = {}, getOpnum = function(self, op_name) return opnums[op_name] end, --OPERATIONS, METHODS, FUNCTIONS, PROCEDURES operations = {}, --TRANSPORT (FINISH!) transport = MSRPCTransport:new(), startOverSMB = function(self, smbstate) self.transport = smbstate end }