コード例 #1
0
ファイル: allPythonContent.py プロジェクト: Mondego/pyreco
    def test_derivation(self):
        hash     = nthash.raw_nthash("clientPass")
        response = binascii.unhexlify("82309ECD8D708B5EA08FAA3981CD83544233114A3D85D6DF")

        state    = MppeStateManager("", "", hash, response)

        assert state.masterKey == binascii.unhexlify("FDECE3717A8C838CB388E527AE3CDD31")

        assert state.serverMasterKey == binascii.unhexlify("8B7CDC149B993A1BA118CB153F56DCCB")

        assert state.serverSessionKey == binascii.unhexlify("405CB2247A7956E6E211007AE27B22D4")

        cipher = RC4(key=state.serverSessionKey)
        assert cipher.update("test message") == binascii.unhexlify("81848317DF68846272FB5ABE")

        cipher = RC4(key=state.serverSessionKey)
        assert cipher.update(binascii.unhexlify("81848317DF68846272FB5ABE")) == "test message"
コード例 #2
0
    def test_parsing(self):
        capture    = open("tests/pptp.cap")
        reader     = ChapPacketReader(capture)
        handshakes = MultiChapStateManager()

        for packet in reader:
            handshakes.addHandshakePacket(packet)

        complete = handshakes.getCompletedHandshakes()

        assert len(complete) == 1

        for server in complete:
            for client in complete[server]:
                c1, c2, c3 = complete[server][client].getCiphertext()
                plaintext  = complete[server][client].getPlaintext()
                username   = complete[server][client].getUserName()

                assert username == "moxie"

                hash = nthash.raw_nthash('bPCFyF2uL1p5Lg5yrKmqmY')

                print "NT Hash: %s" % binascii.hexlify(hash)

                key1 = hash[0:7]
                key1 = des.expand_des_key(key1)

                key2 = hash[7:14]
                key2 = des.expand_des_key(key2)

                key3 = hash[14:16]
                key3 += (chr(0x00) * 5)
                key3 = des.expand_des_key(key3)

                result1 = des.des_encrypt_block(key1, plaintext)
                result2 = des.des_encrypt_block(key2, plaintext)
                result3 = des.des_encrypt_block(key3, plaintext)

                print "DES Encryption 1: %s" % binascii.hexlify(result1)
                print "C1: %s" % binascii.hexlify(c1)
                print "C2: %s" % binascii.hexlify(c2)
                print "C3: %s" % binascii.hexlify(c3)

                assert result1 == c1
                assert result2 == c2
                assert result3 == c3
コード例 #3
0
    def test_derivation(self):
        hash = nthash.raw_nthash("clientPass")
        response = binascii.unhexlify(
            "82309ECD8D708B5EA08FAA3981CD83544233114A3D85D6DF")

        state = MppeStateManager("", "", hash, response)

        assert state.masterKey == binascii.unhexlify(
            "FDECE3717A8C838CB388E527AE3CDD31")

        assert state.serverMasterKey == binascii.unhexlify(
            "8B7CDC149B993A1BA118CB153F56DCCB")

        assert state.serverSessionKey == binascii.unhexlify(
            "405CB2247A7956E6E211007AE27B22D4")

        cipher = RC4(key=state.serverSessionKey)
        assert cipher.update("test message") == binascii.unhexlify(
            "81848317DF68846272FB5ABE")

        cipher = RC4(key=state.serverSessionKey)
        assert cipher.update(
            binascii.unhexlify("81848317DF68846272FB5ABE")) == "test message"
コード例 #4
0
########NEW FILE########
__FILENAME__ = nthash
#!/usr/bin/env python
"""Generates an NT hash from a supplied argument."""

import binascii
import sys

from passlib.hash import nthash

__author__ = "Moxie Marlinspike"
__license__ = "GPLv3"
__copyright__ = "Copyright 2012, Moxie Marlinspike"

print "Hashing: %s" % sys.argv[1]
hash = nthash.raw_nthash(sys.argv[1])
print binascii.hexlify(hash)
########NEW FILE########
__FILENAME__ = Decrypt_Test
from passlib.hash import nthash
import unittest
import binascii
from M2Crypto.RC4 import RC4
from chapcrack.state.MppeStateManager import MppeStateManager


class DecryptTest(unittest.TestCase):
    def test_derivation(self):
        hash = nthash.raw_nthash("clientPass")
        response = binascii.unhexlify(
            "82309ECD8D708B5EA08FAA3981CD83544233114A3D85D6DF")
コード例 #5
0
ファイル: allPythonContent.py プロジェクト: Mondego/pyreco
__FILENAME__ = nthash
#!/usr/bin/env python

"""Generates an NT hash from a supplied argument."""

import binascii
import sys

from passlib.hash import nthash

__author__    = "Moxie Marlinspike"
__license__   = "GPLv3"
__copyright__ = "Copyright 2012, Moxie Marlinspike"

print "Hashing: %s" % sys.argv[1]
hash = nthash.raw_nthash(sys.argv[1])
print binascii.hexlify(hash)
########NEW FILE########
__FILENAME__ = Decrypt_Test
from passlib.hash import nthash
import unittest
import binascii
from M2Crypto.RC4 import RC4
from chapcrack.state.MppeStateManager import MppeStateManager

class DecryptTest(unittest.TestCase):

    def test_derivation(self):
        hash     = nthash.raw_nthash("clientPass")
        response = binascii.unhexlify("82309ECD8D708B5EA08FAA3981CD83544233114A3D85D6DF")
コード例 #6
0
ファイル: webfig.py プロジェクト: takeshixx/webfixy
 def _gen_nt_hash(self, password=None):
     if not password:
         password = self.password
     return nthash.raw_nthash(password)
コード例 #7
0
 def _gen_nt_hash(self, password=None):
     if not password:
         password = self.password
     return nthash.raw_nthash(password)