diff options
author | Guillaume Valadon <guillaume@valadon.net> | 2018-01-18 14:40:35 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-01-18 14:40:35 +0100 |
commit | 2facfe57d22d79c43aed2b51e7b3401b520defa1 (patch) | |
tree | 1cc951a27525bb6a094d3ba17e805ebbc7bf01dc | |
parent | 3f195b172bcbb8c4c4105acde8e16af1d67cdaa5 (diff) | |
parent | b947efe3c08897d6a292f1fb5770373b573e162c (diff) | |
download | scapy-2facfe57d22d79c43aed2b51e7b3401b520defa1.tar.gz |
Merge pull request #1068 from gpotter2/mockwin-test
Tiny fix in mock_windows.uts test
-rw-r--r-- | test/mock_windows.uts | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/test/mock_windows.uts b/test/mock_windows.uts index b016294b..81abb6b7 100644 --- a/test/mock_windows.uts +++ b/test/mock_windows.uts @@ -206,21 +206,23 @@ import mock from scapy.config import conf ps_ip = get_ip_from_name(conf.iface.name) -ps_ip ps_if_list = get_windows_if_list() -ps_if_list ps_read_routes = read_routes() -ps_read_routes # Turn on VBS mode conf.prog.powershell = None = Test get_ip_from_name with VBS +ps_ip + assert get_ip_from_name(conf.iface.name) == ps_ip = Test get_windows_if_list with VBS +ps_if_list def is_in_if_list(i, list): + if not i["mac"]: + return True for j in list: if j["guid"] == i["guid"] and j["name"] == i["name"]: return True @@ -229,20 +231,23 @@ def is_in_if_list(i, list): vbs_if_list = get_windows_if_list() vbs_if_list _correct = True -for i in ps_if_list: - if not is_in_if_list(i, vbs_if_list): +for i in vbs_if_list: + if not is_in_if_list(i, ps_if_list): _correct = False break assert _correct = Test read_routes with VBS +ps_read_routes def is_in_route_list(i, list): + # Ignore all empty IP or macs + if i[4] == '': + return True + if i[3].mac == '' or i[3].guid == '' or i[3].ip == '': + return True for j in list: - #Ignore all empty IP - if j[4] == '' or i[4] == '': - return True if j[2] == i[2] and j[4] == i[4] and j[3].guid == i[3].guid: return True return False @@ -250,8 +255,8 @@ def is_in_route_list(i, list): vbs_read_routes = read_routes() vbs_if_list _correct = True -for i in ps_read_routes: - if not is_in_route_list(i, vbs_read_routes): +for i in vbs_read_routes: + if not is_in_route_list(i, ps_read_routes): _correct = False break |