Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
scapy
Manage
Activity
Members
Plan
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
CodeLinaro
public-release-test-restored
platform
external
scapy
Commits
b947efe3
Commit
b947efe3
authored
7 years ago
by
gpotter2
Browse files
Options
Downloads
Patches
Plain Diff
Tiny fix in mock_windows.uts test
parent
6a783f4a
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
test/mock_windows.uts
+15
-10
15 additions, 10 deletions
test/mock_windows.uts
with
15 additions
and
10 deletions
test/mock_windows.uts
+
15
−
10
View file @
b947efe3
...
@@ -206,21 +206,23 @@ import mock
...
@@ -206,21 +206,23 @@ import mock
from scapy.config import conf
from scapy.config import conf
ps_ip = get_ip_from_name(conf.iface.name)
ps_ip = get_ip_from_name(conf.iface.name)
ps_ip
ps_if_list = get_windows_if_list()
ps_if_list = get_windows_if_list()
ps_if_list
ps_read_routes = read_routes()
ps_read_routes = read_routes()
ps_read_routes
# Turn on VBS mode
# Turn on VBS mode
conf.prog.powershell = None
conf.prog.powershell = None
= Test get_ip_from_name with VBS
= Test get_ip_from_name with VBS
ps_ip
assert get_ip_from_name(conf.iface.name) == ps_ip
assert get_ip_from_name(conf.iface.name) == ps_ip
= Test get_windows_if_list with VBS
= Test get_windows_if_list with VBS
ps_if_list
def is_in_if_list(i, list):
def is_in_if_list(i, list):
if not i["mac"]:
return True
for j in list:
for j in list:
if j["guid"] == i["guid"] and j["name"] == i["name"]:
if j["guid"] == i["guid"] and j["name"] == i["name"]:
return True
return True
...
@@ -229,20 +231,23 @@ def is_in_if_list(i, list):
...
@@ -229,20 +231,23 @@ def is_in_if_list(i, list):
vbs_if_list = get_windows_if_list()
vbs_if_list = get_windows_if_list()
vbs_if_list
vbs_if_list
_correct = True
_correct = True
for i in
p
s_if_list:
for i in
vb
s_if_list:
if not is_in_if_list(i,
vb
s_if_list):
if not is_in_if_list(i,
p
s_if_list):
_correct = False
_correct = False
break
break
assert _correct
assert _correct
= Test read_routes with VBS
= Test read_routes with VBS
ps_read_routes
def is_in_route_list(i, list):
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:
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:
if j[2] == i[2] and j[4] == i[4] and j[3].guid == i[3].guid:
return True
return True
return False
return False
...
@@ -250,8 +255,8 @@ def is_in_route_list(i, list):
...
@@ -250,8 +255,8 @@ def is_in_route_list(i, list):
vbs_read_routes = read_routes()
vbs_read_routes = read_routes()
vbs_if_list
vbs_if_list
_correct = True
_correct = True
for i in
p
s_read_routes:
for i in
vb
s_read_routes:
if not is_in_route_list(i,
vb
s_read_routes):
if not is_in_route_list(i,
p
s_read_routes):
_correct = False
_correct = False
break
break
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment