This repository has been archived by the owner on Feb 7, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
removed compat.py as it wasn't being used by any function. Removed th…
…e dump function from target_info.py as it isn't necessary and required. Added tests to cover target_info.py methods as well as some more lines in compute_response.py
- Loading branch information
BOREAN, Jordan
authored and
BOREAN, Jordan
committed
Aug 7, 2016
1 parent
1f9094f
commit 4bf525b
Showing
4 changed files
with
61 additions
and
11 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import unittest2 as unittest | ||
|
||
from ntlm3.target_info import TargetInfo | ||
from ..utils import HexToByte | ||
|
||
def get_test_target_info(): | ||
target_info = TargetInfo() | ||
target_info[TargetInfo.MSV_AV_NB_DOMAIN_NAME] = HexToByte('44 00 6f 00 6d 00 61 00 69 00 6e 00') | ||
target_info[TargetInfo.MSV_AV_NB_COMPUTER_NAME] = HexToByte('53 00 65 00 72 00 76 00 65 00 72 00') | ||
|
||
return target_info | ||
|
||
class Test_TargetInfo(unittest.TestCase): | ||
def test_del_item(self): | ||
target_info = get_test_target_info() | ||
# Contains the len and id of MSV_AV_NB_COMPUTER_NAME and the EOL as we have remove MSV_AV_NB_DOMAIN_NAME | ||
expected = HexToByte('01 00 0c 00 53 00 65 00 72 00 76 00 65 00 72 00 00 00 00 00') | ||
target_info.__delitem__(TargetInfo.MSV_AV_NB_DOMAIN_NAME) | ||
actual = target_info.get_data() | ||
|
||
assert actual == expected | ||
|
||
def test_add_item(self): | ||
target_info = get_test_target_info() | ||
expected = HexToByte('02 00 0c 00 44 00 6f 00 6d 00 61 00 69 00 6e 00 01 00 0c 00 53 00' | ||
'65 00 72 00 76 00 65 00 72 00 03 00 0c 00 53 00 65 00 72 00 76 00' | ||
'65 00 72 00 00 00 00 00') | ||
target_info[TargetInfo.MSV_AV_DNS_COMPUTER_NAME] = HexToByte('53 00 65 00 72 00 76 00 65 00 72 00') | ||
actual = target_info.get_data() | ||
|
||
assert actual == expected | ||
|
||
def test_get_item(self): | ||
target_info = get_test_target_info() | ||
expected_value = HexToByte('44 00 6f 00 6d 00 61 00 69 00 6e 00') | ||
expected_length = len(expected_value) | ||
(actual_length, actual_value) = target_info[TargetInfo.MSV_AV_NB_DOMAIN_NAME] | ||
|
||
assert actual_length == expected_length | ||
assert actual_value == expected_value |