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
ab08f456
Commit
ab08f456
authored
8 years ago
by
gpotter2
Browse files
Options
Downloads
Patches
Plain Diff
Fix manufdb detection on windows
parent
8fbcf846
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
scapy/arch/windows/__init__.py
+5
-0
5 additions, 0 deletions
scapy/arch/windows/__init__.py
scapy/data.py
+5
-3
5 additions, 3 deletions
scapy/data.py
test/regression.uts
+11
-0
11 additions, 0 deletions
test/regression.uts
with
21 additions
and
3 deletions
scapy/arch/windows/__init__.py
+
5
−
0
View file @
ab08f456
...
...
@@ -6,11 +6,13 @@
"""
Customizations needed to support Microsoft Windows.
"""
import
os
,
re
,
sys
,
socket
,
time
,
itertools
import
subprocess
as
sp
from
glob
import
glob
import
tempfile
#import scapy.data
from
scapy.config
import
conf
,
ConfClass
from
scapy.error
import
Scapy_Exception
,
log_loading
,
log_runtime
,
warning
from
scapy.utils
import
atol
,
itom
,
inet_aton
,
inet_ntoa
,
PcapReader
...
...
@@ -259,6 +261,9 @@ class WinProgPath(ConfClass):
)
self
.
cscript
=
win_find_exe
(
"
cscript
"
,
installsubdir
=
"
System32
"
,
env
=
"
SystemRoot
"
)
if
self
.
wireshark
!=
"
wireshark
"
:
manu_path
=
load_manuf
(
os
.
path
.
sep
.
join
(
self
.
wireshark
.
split
(
os
.
path
.
sep
)[:
-
1
])
+
os
.
path
.
sep
+
"
manuf
"
)
scapy
.
data
.
MANUFDB
=
conf
.
manufdb
=
MANUFDB
=
manu_path
conf
.
prog
=
WinProgPath
()
if
conf
.
prog
.
powershell
==
"
powershell
"
:
...
...
This diff is collapsed.
Click to expand it.
scapy/data.py
+
5
−
3
View file @
ab08f456
...
...
@@ -147,7 +147,8 @@ class ManufDA(DADict):
if
oui
in
self
:
return
"
:
"
.
join
([
self
[
oui
][
0
]]
+
mac
.
split
(
"
:
"
)[
3
:])
return
mac
def
__repr__
(
self
):
return
"
\n
"
.
join
([
"
<%s %s, %s>
"
%
(
i
[
0
],
i
[
1
][
0
],
i
[
1
][
1
])
for
i
in
self
.
__dict__
.
items
()])
...
...
@@ -165,12 +166,12 @@ def load_manuf(filename):
lng
=
shrt
else
:
lng
=
l
[
i
+
2
:]
manufdb
[
oui
]
=
shrt
,
lng
manufdb
[
oui
]
=
shrt
,
lng
except
Exception
,
e
:
log_loading
.
warning
(
"
Couldn
'
t parse one line from [%s] [%r] (%s)
"
%
(
filename
,
l
,
e
))
except
IOError
:
#log_loading.warning("Couldn't open [%s] file" % filename)
pass
return
""
return
manufdb
...
...
@@ -179,6 +180,7 @@ if WINDOWS:
ETHER_TYPES
=
load_ethertypes
(
"
ethertypes
"
)
IP_PROTOS
=
load_protocols
(
os
.
environ
[
"
SystemRoot
"
]
+
"
\system32\drivers\etc\protocol
"
)
TCP_SERVICES
,
UDP_SERVICES
=
load_services
(
os
.
environ
[
"
SystemRoot
"
]
+
"
\system32\drivers\etc\services
"
)
# Default value, will be updated by arch.windows
MANUFDB
=
load_manuf
(
os
.
environ
[
"
ProgramFiles
"
]
+
"
\\
wireshark
\\
manuf
"
)
else
:
IP_PROTOS
=
load_protocols
(
"
/etc/protocols
"
)
...
...
This diff is collapsed.
Click to expand it.
test/regression.uts
+
11
−
0
View file @
ab08f456
...
...
@@ -650,6 +650,17 @@ send_and_sniff(IP(dst="secdev.org")/ICMP())
send_and_sniff(IP(dst="secdev.org")/ICMP(), flt="icmp")
send_and_sniff(Ether()/IP(dst="secdev.org")/ICMP())
############
############
+ ManuFDB tests
= __repr__
conf.manufdb
= check _resolve_MAC
assert conf.manufdb._resolve_MAC("00:00:63") == "HP"
############
############
...
...
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