Esempio n. 1
0
    def test_hNetrServerReqChallenge_hNetrServerAuthenticate(self):
        dce, rpctransport = self.connect()
        resp = nrpc.hNetrServerReqChallenge(dce, NULL,
                                            self.serverName + '\x00',
                                            '12345678')
        resp.dump()
        serverChallenge = resp['ServerChallenge']

        if self.hashes == '':
            ntHash = None
        else:
            ntHash = unhexlify(self.hashes.split(':')[1])

        sessionKey = nrpc.ComputeSessionKeyStrongKey(self.password, '12345678',
                                                     serverChallenge, ntHash)

        ppp = nrpc.ComputeNetlogonCredential('12345678', sessionKey)

        resp.dump()
        try:
            resp = nrpc.hNetrServerAuthenticate(
                dce, NULL, self.username + '\x00',
                nrpc.NETLOGON_SECURE_CHANNEL_TYPE.WorkstationSecureChannel,
                self.serverName + '\x00', ppp)
            resp.dump()
        except Exception, e:
            if str(e).find('STATUS_DOWNGRADE_DETECTED') < 0:
                raise
Esempio n. 2
0
    def test_hNetrServerReqChallenge_hNetrServerAuthenticate(self):
        dce, rpctransport = self.connect()
        resp = nrpc.hNetrServerReqChallenge(dce, NULL, self.serverName + "\x00", "12345678")
        resp.dump()
        serverChallenge = resp["ServerChallenge"]

        if self.hashes == "":
            ntHash = None
        else:
            ntHash = unhexlify(self.hashes.split(":")[1])

        sessionKey = nrpc.ComputeSessionKeyStrongKey(self.password, "12345678", serverChallenge, ntHash)

        ppp = nrpc.ComputeNetlogonCredential("12345678", sessionKey)

        resp.dump()
        try:
            resp = nrpc.hNetrServerAuthenticate(
                dce,
                NULL,
                self.username + "\x00",
                nrpc.NETLOGON_SECURE_CHANNEL_TYPE.WorkstationSecureChannel,
                self.serverName + "\x00",
                ppp,
            )
            resp.dump()
        except Exception, e:
            if str(e).find("STATUS_DOWNGRADE_DETECTED") < 0:
                raise
Esempio n. 3
0
    def test_hNetrServerReqChallenge_hNetrServerAuthenticate(self):
        dce, rpctransport = self.connect()
        resp = nrpc.hNetrServerReqChallenge(dce, self.serverName,
                                            self.machine_user, b'12345678')
        resp.dump()
        serverChallenge = resp['ServerChallenge']

        bnthash = self.machine_user_bnthash or None
        sessionKey = nrpc.ComputeSessionKeyStrongKey(self.password,
                                                     b'12345678',
                                                     serverChallenge, bnthash)

        ppp = nrpc.ComputeNetlogonCredential(b'12345678', sessionKey)

        resp.dump()
        try:
            nrpc.hNetrServerAuthenticate(
                dce, self.serverName, self.machine_user,
                nrpc.NETLOGON_SECURE_CHANNEL_TYPE.WorkstationSecureChannel,
                self.serverName, ppp)
        except DCERPCException as e:
            if str(e).find('STATUS_DOWNGRADE_DETECTED') < 0:
                raise
Esempio n. 4
0
    def test_hNetrServerReqChallenge_hNetrServerAuthenticate(self):
        dce, rpctransport = self.connect()
        resp = nrpc.hNetrServerReqChallenge(dce, NULL,  self.serverName + '\x00','12345678' )
        #resp.dump()
        serverChallenge = resp['ServerChallenge']

        if self.hashes == '':
            ntHash = None
        else:
            ntHash = self.hashes.split(':')[1].decode('hex')

        sessionKey = nrpc.ComputeSessionKeyStrongKey(self.password, '12345678', serverChallenge, ntHash)

        ppp = nrpc.ComputeNetlogonCredential('12345678', sessionKey)

        #resp.dump()
        try:
            resp = nrpc.hNetrServerAuthenticate(dce, NULL,self.username + '\x00', nrpc.NETLOGON_SECURE_CHANNEL_TYPE.WorkstationSecureChannel ,self.serverName + '\x00', ppp)
            #resp.dump()
        except Exception, e:
            if str(e).find('STATUS_DOWNGRADE_DETECTED') < 0:
                raise