Ejemplo n.º 1
0
    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)
Ejemplo n.º 2
0
    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
Ejemplo n.º 3
0
    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)