Exemple #1
0
 def __init__(self, username = '', password = '', challenge = '', lmhash = '', nthash = '', flags = 0):
     Structure.__init__(self)
     self['session_key']=''
     self['user_name']=username.encode('utf-16le')
     self['domain_name']='' #"CLON".encode('utf-16le')
     self['host_name']='' #"BETS".encode('utf-16le')
     self['flags'] = (   #authResp['flags']
             # we think (beto & gera) that his flags force a memory conten leakage when a windows 2000 answers using uninitializaed verifiers
        NTLMSSP_KEY_128     |
        NTLMSSP_KEY_EXCHANGE|
        # NTLMSSP_LM_KEY      |
        NTLMSSP_NTLM_KEY    |
        NTLMSSP_UNICODE     |
        # NTLMSSP_ALWAYS_SIGN |
        NTLMSSP_SIGN        |
        NTLMSSP_SEAL        |
        # NTLMSSP_TARGET      |
        0)
     # Here we do the stuff
     if username and ( lmhash != '' or nthash != ''):            
         self['lanman'] = get_ntlmv1_response(lmhash, challenge)
         self['ntlm'] = get_ntlmv1_response(nthash, challenge)
     elif (username and password):
         lmhash = compute_lmhash(password)
         nthash = compute_nthash(password)
         self['lanman']=get_ntlmv1_response(lmhash, challenge)
         self['ntlm']=get_ntlmv1_response(nthash, challenge)    # This is not used for LM_KEY nor NTLM_KEY
     else:
         self['lanman'] = ''
         self['ntlm'] = ''
         if not self['host_name']:
             self['host_name'] = 'NULL'.encode('utf-16le')      # for NULL session there must be a hostname
Exemple #2
0
    def __init__(self, data=None, alignment = 0):
        Structure.__init__(self, data, alignment)
        if data:
            self.__array = ndrutils.NDRArray(data = self['Buffer'], itemClass = SHARE_INFO_1)
            self['Buffer'] = self.__array

        return 
Exemple #3
0
 def __init__(self, data=None, alignment=0):
     Structure.__init__(self, data, alignment)
     if data:
         self.__array = ndrutils.NDRArray(data=self['Buffer'],
                                          itemClass=SESSION_INFO_502)
         self['Buffer'] = self.__array
     return
Exemple #4
0
 def __init__(self, data=None, alignment=0):
     Structure.__init__(self, data, alignment)
     if data is None:
         self['cname'] = ''
         self['username'] = ''
         self['cltype_name'] = ''
         self['transport'] = ''
     return
Exemple #5
0
 def __init__(self, data = None, alignment = 0):
     Structure.__init__(self, data, alignment)
     if data is None:
         self['cname'] = ''
         self['username'] = ''
         self['cltype_name'] = ''
         self['transport'] = ''
     return 
Exemple #6
0
 def __init__(self, data = None, alignment = 0):
     self.__ctx_items = []
     Structure.__init__(self,data,alignment)
     if data is None:
         self['Pad'] = ''
         self['ctx_items'] = ''
         self['sec_trailer'] = ''
         self['auth_data'] = ''
Exemple #7
0
 def __init__(self, data=None, alignment=0):
     self.__ctx_items = []
     Structure.__init__(self, data, alignment)
     if data is None:
         self['Pad'] = ''
         self['ctx_items'] = ''
         self['sec_trailer'] = ''
         self['auth_data'] = ''
Exemple #8
0
 def __init__(self, data = None, alignment = 0):
     Structure.__init__(self, data, alignment)
     if data is None:
         self['max_tfrag'] = 4280
         self['max_rfrag'] = 4280
         self['assoc_group'] = 0
         self['ctx_num'] = 1
         self['ctx_items'] = ''
     self.__ctx_items = []
Exemple #9
0
 def __init__(self, data=None, alignment=0):
     Structure.__init__(self, data, alignment)
     if data is None:
         self['max_tfrag'] = 4280
         self['max_rfrag'] = 4280
         self['assoc_group'] = 0
         self['ctx_num'] = 1
         self['ctx_items'] = ''
     self.__ctx_items = []
Exemple #10
0
 def __init__(self, data = None, alignment = 0):
     Structure.__init__(self,data, alignment)
     if data is None:
         self['ver_major'] = 5
         self['ver_minor'] = 0
         self['flags'] = MSRPC_FIRSTFRAG | MSRPC_LASTFRAG 
         self['type'] = MSRPC_REQUEST
         self.__frag_len_set = 0
         self['auth_len'] = 0
         self['pduData'] = ''
         self['auth_data'] = ''
         self['sec_trailer'] = ''
         self['pad'] = ''
Exemple #11
0
 def __init__(self, data=None, alignment=0):
     Structure.__init__(self, data, alignment)
     if data is None:
         self['ver_major'] = 5
         self['ver_minor'] = 0
         self['flags'] = MSRPC_FIRSTFRAG | MSRPC_LASTFRAG
         self['type'] = MSRPC_REQUEST
         self.__frag_len_set = 0
         self['auth_len'] = 0
         self['pduData'] = ''
         self['auth_data'] = ''
         self['sec_trailer'] = ''
         self['pad'] = ''
Exemple #12
0
 def __init__(self):
     Structure.__init__(self)
     self['flags'] = (
         NTLMSSP_KEY_128 | NTLMSSP_KEY_EXCHANGE |
         # NTLMSSP_LM_KEY      |
         NTLMSSP_NTLM_KEY | NTLMSSP_UNICODE |
         # NTLMSSP_ALWAYS_SIGN |
         NTLMSSP_SIGN | NTLMSSP_SEAL |
         # NTLMSSP_TARGET      |
         0)
     self['host_name'] = ''
     self['domain_name'] = ''
     self['os_version'] = ''
Exemple #13
0
    def __init__(self, version, revision, pageSize=8192, data=None):
        if (version < 0x620) or (version == 0x620 and revision < 0x0b):
            # For sure the old format
            self.structure = self.structure_2003_SP0 + self.common
        elif version == 0x620 and revision < 0x11:
            # Exchange 2003 SP1 and Windows Vista and later
            self.structure = self.structure_0x620_0x0b + self.common
        else:
            # Windows 7 and later
            self.structure = self.structure_win7 + self.common
            if pageSize > 8192:
                self.structure += self.extended_win7

        Structure.__init__(self, data)
Exemple #14
0
    def __init__(self, version, revision, pageSize=8192, data=None):
        if (version < 0x620) or (version == 0x620 and revision < 0x0b):
            # For sure the old format
            self.structure = self.structure_2003_SP0 + self.common
        elif version == 0x620 and revision < 0x11:
            # Exchange 2003 SP1 and Windows Vista and later
            self.structure = self.structure_0x620_0x0b + self.common
        else:
            # Windows 7 and later
            self.structure = self.structure_win7 + self.common
            if pageSize > 8192:
                self.structure += self.extended_win7

        Structure.__init__(self,data)
Exemple #15
0
 def __init__(self):
     Structure.__init__(self)
     self['flags']= (
            NTLMSSP_KEY_128     |
            NTLMSSP_KEY_EXCHANGE|
            # NTLMSSP_LM_KEY      |
            NTLMSSP_NTLM_KEY    |
            NTLMSSP_UNICODE     |
            # NTLMSSP_ALWAYS_SIGN |
            NTLMSSP_SIGN        |
            NTLMSSP_SEAL        |
            # NTLMSSP_TARGET      |
            0)
     self['host_name']=''
     self['domain_name']=''
     self['os_version']=''
Exemple #16
0
 def __init__(self,
              username='',
              password='',
              challenge='',
              lmhash='',
              nthash='',
              flags=0):
     Structure.__init__(self)
     self['session_key'] = ''
     self['user_name'] = username.encode('utf-16le')
     self['domain_name'] = ''  #"CLON".encode('utf-16le')
     self['host_name'] = ''  #"BETS".encode('utf-16le')
     self['flags'] = (  #authResp['flags']
         # we think (beto & gera) that his flags force a memory conten leakage when a windows 2000 answers using uninitializaed verifiers
         NTLMSSP_KEY_128 | NTLMSSP_KEY_EXCHANGE |
         # NTLMSSP_LM_KEY      |
         NTLMSSP_NTLM_KEY | NTLMSSP_UNICODE |
         # NTLMSSP_ALWAYS_SIGN |
         NTLMSSP_SIGN | NTLMSSP_SEAL |
         # NTLMSSP_TARGET      |
         0)
     # Here we do the stuff
     if username and (lmhash != '' or nthash != ''):
         self['lanman'] = get_ntlmv1_response(lmhash, challenge)
         self['ntlm'] = get_ntlmv1_response(nthash, challenge)
     elif (username and password):
         lmhash = compute_lmhash(password)
         nthash = compute_nthash(password)
         self['lanman'] = get_ntlmv1_response(lmhash, challenge)
         self['ntlm'] = get_ntlmv1_response(
             nthash, challenge)  # This is not used for LM_KEY nor NTLM_KEY
     else:
         self['lanman'] = ''
         self['ntlm'] = ''
         if not self['host_name']:
             self['host_name'] = 'NULL'.encode(
                 'utf-16le')  # for NULL session there must be a hostname
Exemple #17
0
    def __init__(self, data):
        # Depending on the type of data we'll end up building a different struct
        dataType = unpack('<H', data[4:][:2])[0]
        self.structure = self.fixed

        if dataType == CATALOG_TYPE_TABLE:
            self.structure += self.other + self.table_stuff
        elif dataType == CATALOG_TYPE_COLUMN:
            self.structure += self.column_stuff
        elif dataType == CATALOG_TYPE_INDEX:
            self.structure += self.other + self.index_stuff
        elif dataType == CATALOG_TYPE_LONG_VALUE:
            self.structure += self.other + self.lv_stuff
        elif dataType == CATALOG_TYPE_CALLBACK:
            LOG.error('CallBack types not supported!')
            raise
        else:
            LOG.error('Unknown catalog type 0x%x' % dataType)
            self.structure = ()
            Structure.__init__(self, data)

        self.structure += self.common

        Structure.__init__(self, data)
Exemple #18
0
    def __init__(self,data):
        # Depending on the type of data we'll end up building a different struct
        dataType = unpack('<H', data[4:][:2])[0]
        self.structure = self.fixed

        if dataType == CATALOG_TYPE_TABLE:
            self.structure += self.other + self.table_stuff
        elif dataType == CATALOG_TYPE_COLUMN:
            self.structure += self.column_stuff
        elif dataType == CATALOG_TYPE_INDEX:
            self.structure += self.other + self.index_stuff
        elif dataType == CATALOG_TYPE_LONG_VALUE:
            self.structure += self.other + self.lv_stuff
        elif dataType == CATALOG_TYPE_CALLBACK:
            LOG.error('CallBack types not supported!')
            raise
        else:
            LOG.error('Unknown catalog type 0x%x' % dataType)
            self.structure = ()
            Structure.__init__(self,data)

        self.structure += self.common

        Structure.__init__(self,data)
Exemple #19
0
 def __init__(self, data=None, alignment=0):
     Structure.__init__(self, data, alignment)
     if data is None:
         self['SupportedVersions'] = ''
Exemple #20
0
 def __init__(self, data = None):
     Structure.__init__(self,data)
     if data is None:
         self['TreeID'] = 0
Exemple #21
0
 def __init__(self, flags=0, **kargs):
     if flags & NTLMSSP_NTLM2_KEY:
         self.structure = self.extendedMessageSignature
     else:
         self.structure = self.MessageSignature
     return Structure.__init__(self, **kargs)
Exemple #22
0
 def __init__(self, data=None, alignment=0):
     Structure.__init__(self, data, alignment)
     if data is None:
         self['netname'] = ''
         self['remark'] = ''
     return
Exemple #23
0
 def __init__(self, data = None):
     Structure.__init__(self,data)
     if data is None:
         self['AlignPad'] = ''
Exemple #24
0
 def __init__(self, data = None, alignment = 0):
     Structure.__init__(self,data,alignment)
     if data is None:
         self['SupportedVersions'] = ''
Exemple #25
0
 def __init__(self, flags, data=None):
     if flags & TAG_COMMON > 0:
         # Include the common header
         self.structure = self.common + self.structure
     Structure.__init__(self, data)
Exemple #26
0
 def __init__(self, flags = 0, **kargs):
     if flags & NTLMSSP_NTLM2_KEY:
         self.structure = self.extendedMessageSignature
     else:
         self.structure = self.MessageSignature
     return Structure.__init__(self, **kargs)
Exemple #27
0
 def __init__(self, flags, data=None):
     if flags & TAG_COMMON > 0:
         # Include the common header
         self.structure = self.common + self.structure
     Structure.__init__(self,data)
Exemple #28
0
 def __init__(self, data = None, alignment = 0):
     Structure.__init__(self, data, alignment)
     if data is None:
         self['netname'] = ''
         self['remark'] = ''
     return