def __init__(self, data=None, ShareArray=[]): Struct.__init__(self, data) self.shares = [] if data is not None: pos = self.calcsize() for i in xrange(self['MaxCount']): refptr = unpack('<L', data[pos:pos + 4])[0] pos += 4 stype = unpack('<L', data[pos:pos + 4])[0] pos += 4 self.shares.append({'type': stype}) refptr2 = unpack('<L', data[pos:pos + 4])[0] pos += 4 for i in xrange(self['MaxCount']): s = DCERPCString(data=data[pos:]) self.shares[i]['name'] = s.get_string().decode( 'UTF-16LE').encode('ascii')[:-1] pos += len(s.pack()) s2 = DCERPCString(data=data[pos:]) self.shares[i]['comment'] = s2.get_string().decode( 'UTF-16LE').encode('ascii')[:-1] pos += len(s2.pack()) else: self.shares = ShareArray self['MaxCount'] = len(self.shares)
def __init__(self, data=None, ShareArray=[]): Struct.__init__(self, data) self.shares = [] if data is not None: pos = 0 refptr = unpack('<L', data[pos:pos + 4])[0] pos += 4 refptr = unpack('<L', data[pos:pos + 4])[0] pos += 4 self['Type'] = unpack('<L', data[pos:pos + 4])[0] pos += 4 refptr = unpack('<L', data[pos:pos + 4])[0] pos += 4 self['Permission'] = unpack('<L', data[pos:pos + 4])[0] pos += 4 self['MaxUses'] = unpack('<L', data[pos:pos + 4])[0] pos += 4 self['CurrentUses'] = unpack('<L', data[pos:pos + 4])[0] pos += 4 refptr = unpack('<L', data[pos:pos + 4])[0] pos += 4 refptr = unpack('<L', data[pos:pos + 4])[0] pos += 4 s = DCERPCString(data=data[pos:]) self['NetName'] = s.get_string().decode('UTF-16LE').encode( 'ascii')[:-1] pos += len(s.pack()) s = DCERPCString(data=data[pos:]) self['Comment'] = s.get_string().decode('UTF-16LE').encode( 'ascii')[:-1] pos += len(s.pack()) s = DCERPCString(data=data[pos:]) self['Path'] = s.get_string().decode('UTF-16LE').encode( 'ascii')[:-1] pos += len(s.pack()) s = DCERPCString(data=data[pos:]) self['Passwd'] = s.get_string().decode('UTF-16LE').encode( 'ascii')[:-1] pos += len(s.pack()) else: pass ## TODO
def __init__(self, data=None, service_handle='', args=[], is_unicode=True): Struct.__init__(self, data) if not data: self['ServiceHandle'] = service_handle self['argc'] = len(args) self['argv'] = [ DCERPCString(string=arg.encode('ASCII'), is_unicode=False) for arg in args ] else: pos = 28 self['argc'] = len(args) self['argv'] = [] for i in xrange(self['argc']): arg = DCERPCString(data=data[pos:]) self['argv'].append(arg) pos += len(arg.pack())
def __init__(self, data=None, UsernameArray=[]): Struct.__init__(self, data) self.usernames = [] if data is not None: Struct.__init__(self, data) pos = self.calcsize() for i in xrange(self['MaxCount']): refptr = unpack('<L', data[pos:pos+4])[0] pos += 4 for i in xrange(self['MaxCount']): s = DCERPCString(data=data[pos:]) self.usernames.append(s.get_string().decode('UTF-16LE').encode('ascii')[:-1]) pos += len(s.pack()) self['UsernameArray'] = ''.join(UsernameArray) else: self.usernames = UsernameArray self['MaxCount'] = len(self.usernames) self['UsernameArray'] = ''.join(UsernameArray)