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
e1339d4a
Commit
e1339d4a
authored
7 years ago
by
gpotter2
Committed by
Guillaume Valadon
7 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Restore GUID change on VBS
parent
7ad87a41
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
scapy/arch/windows/__init__.py
+9
-7
9 additions, 7 deletions
scapy/arch/windows/__init__.py
with
9 additions
and
7 deletions
scapy/arch/windows/__init__.py
+
9
−
7
View file @
e1339d4a
...
...
@@ -99,22 +99,24 @@ def _vbs_exec_code(code, split_tag="@"):
yield
l
os
.
unlink
(
tmpfile
.
name
)
def
_vbs_get_iface_guid
(
devid
):
def
_vbs_get_
hardware_
iface_guid
(
devid
):
try
:
devid
=
str
(
int
(
devid
)
+
1
)
guid
=
_vbs_exec_code
(
"""
WScript.Echo CreateObject(
"
WScript.Shell
"
).RegRead(
"
HKEY_LOCAL_MACHINE
\\
SOFTWARE
\\
Microsoft
\\
Windows NT
\\
CurrentVersion
\\
NetworkCards
\\
%s
\\
ServiceName
"
)
"""
%
devid
)
.
__iter__
(
).
next
()
guid
=
iter
(
_vbs_exec_code
(
"""
WScript.Echo CreateObject(
"
WScript.Shell
"
).RegRead(
"
HKEY_LOCAL_MACHINE
\\
SOFTWARE
\\
Microsoft
\\
Windows NT
\\
CurrentVersion
\\
NetworkCards
\\
%s
\\
ServiceName
"
)
"""
%
devid
)).
next
()
if
guid
.
startswith
(
'
{
'
)
and
guid
.
endswith
(
'
}
\n
'
):
return
guid
[:
-
1
]
elif
guid
.
startswith
(
'
{
'
)
and
guid
.
endswith
(
'
}
'
):
return
guid
except
StopIteration
:
pass
return
None
# Some names differ between VBS and PS
## None: field will not be returned under VBS
_VBS_WMI_FIELDS
=
{
"
Win32_NetworkAdapter
"
:
{
"
InterfaceIndex
"
:
"
Index
"
,
"
InterfaceDescription
"
:
"
Description
"
,
"
GUID
"
:
"
DeviceID
"
}
}
...
...
@@ -126,7 +128,7 @@ _VBS_WMI_REPLACE = {
_VBS_WMI_OUTPUT
=
{
"
Win32_NetworkAdapter
"
:
{
"
DeviceID
"
:
_vbs_get_iface_guid
,
"
DeviceID
"
:
_vbs_get_
hardware_
iface_guid
,
}
}
...
...
@@ -315,7 +317,7 @@ def get_windows_if_list():
# Name InterfaceDescription ifIndex Status MacAddress LinkSpeed
# ---- -------------------- ------- ------ ---------- ---------
# Ethernet Killer E2200 Gigabit Ethernet Contro... 13 Up D0-50-99-56-DD-F9 1 Gbps
query
=
exec_query
([
'
Get-NetAdapter
'
],
query
=
exec_query
([
'
Get-NetAdapter
-Physical
'
],
[
'
InterfaceDescription
'
,
'
InterfaceIndex
'
,
'
Name
'
,
'
InterfaceGuid
'
,
'
MacAddress
'
])
# It is normal that it is in this order
else
:
...
...
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