Пример #1
0
    def step(self):
        log.info("NTLM: Generating Negotiate message")
        msg1 = self.context.step()
        log.debug("NTLM: Negotiate message: %s" % _bytes_to_hex(msg1))
        msg2 = yield msg1

        log.info("NTLM: Parsing Challenge message and generating Authentication message")
        log.debug("NTLM: Challenge message: %s" % _bytes_to_hex(msg2))
        msg3 = self.context.step(input_token=msg2)

        yield msg3
Пример #2
0
    def step(self):
        log.info("NTLM: Generating Negotiate message")
        msg1 = self.context.create_negotiate_message(self.domain)
        msg1 = base64.b64decode(msg1)
        log.debug("NTLM: Negotiate message: %s" % _bytes_to_hex(msg1))
        yield msg1

        log.info("NTLM: Parsing Challenge message")
        msg2 = base64.b64encode(self.in_token)
        log.debug("NTLM: Challenge message: %s" % _bytes_to_hex(self.in_token))
        self.context.parse_challenge_message(msg2)

        log.info("NTLM: Generating Authenticate message")
        msg3 = self.context.create_authenticate_message(
            user_name=self.username,
            password=self.password,
            domain_name=self.domain)
        yield base64.b64decode(msg3)
Пример #3
0
def test_bytes_to_hex_pretty_nonewline():
    bytes_str = b"\x00\x01abc123new"
    expected = "00 01 61 62 63 31 32 33 6E 65 77"
    actual = _bytes_to_hex(bytes_str, pretty=True, hex_per_line=0)
    assert actual == expected
Пример #4
0
def test_bytes_to_hex_not_pretty():
    bytes_str = b"\x00\x01abc123new"
    expected = "00016162633132336e6577"
    actual = _bytes_to_hex(bytes_str, pretty=False)
    assert actual == expected
Пример #5
0
def test_bytes_to_hex_pretty_newline_override():
    bytes_str = b"\x00\x01abc123new"
    expected = "00 01 61 62\n63 31 32 33\n6E 65 77"
    actual = _bytes_to_hex(bytes_str, pretty=True, hex_per_line=4)
    assert actual == expected