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
83c748ef
Commit
83c748ef
authored
8 years ago
by
gpotter2
Committed by
Pierre Lalet
8 years ago
Browse files
Options
Downloads
Patches
Plain Diff
[Windows/Networking] Support no wpcap.dll (#406)
parent
a454ef48
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/pcapdnet.py
+7
-9
7 additions, 9 deletions
scapy/arch/pcapdnet.py
scapy/arch/windows/compatibility.py
+4
-0
4 additions, 0 deletions
scapy/arch/windows/compatibility.py
scapy/arch/windows/disable_sendrecv.py
+51
-0
51 additions, 0 deletions
scapy/arch/windows/disable_sendrecv.py
with
62 additions
and
9 deletions
scapy/arch/pcapdnet.py
+
7
−
9
View file @
83c748ef
...
...
@@ -39,11 +39,11 @@ if conf.use_winpcapy:
pcap_freealldevs
(
devs
)
except
OSError
as
e
:
def
winpcapy_get_if_list
():
return
[]
conf
.
use_winpcapy
=
False
if
conf
.
interactive
:
log_loading
.
error
(
"
Unable to import libpcap library: %s
"
%
e
)
conf
.
use_winpcapy
=
False
else
:
raise
log_loading
.
warning
(
"
wpcap.dll is not installed. You won
'
t be able to send/recieve packets. Visit the scapy
'
s doc to install it
"
)
# From BSD net/bpf.h
#BIOCIMMEDIATE=0x80044270
...
...
@@ -99,7 +99,8 @@ if conf.use_winpcapy:
return
ret
finally
:
pcap_freealldevs
(
devs
)
get_if_list
=
winpcapy_get_if_list
if
conf
.
use_winpcapy
:
get_if_list
=
winpcapy_get_if_list
def
in6_getifaddr
():
err
=
create_string_buffer
(
PCAP_ERRBUF_SIZE
)
devs
=
POINTER
(
pcap_if_t
)()
...
...
@@ -320,10 +321,7 @@ if conf.use_winpcapy:
conf
.
L2socket
=
L2pcapSocket
conf
.
L3socket
=
L3pcapSocket
if
conf
.
use_pcap
:
if
conf
.
use_pcap
:
try
:
import
pcap
except
ImportError
,
e
:
...
...
This diff is collapsed.
Click to expand it.
scapy/arch/windows/compatibility.py
+
4
−
0
View file @
83c748ef
...
...
@@ -248,3 +248,7 @@ L2socket: use the provided L2socket
import
scapy.sendrecv
scapy
.
sendrecv
.
sniff
=
sniff
# If wpcap.dll is not available
if
not
(
conf
.
use_winpcapy
or
conf
.
use_pcap
or
conf
.
use_dnet
):
from
scapy.arch.windows.disable_sendrecv
import
*
This diff is collapsed.
Click to expand it.
scapy/arch/windows/disable_sendrecv.py
0 → 100644
+
51
−
0
View file @
83c748ef
## This file is part of Scapy
## See http://www.secdev.org/projects/scapy for more informations
## Copyright (C) Philippe Biondi <phil@secdev.org>
## This program is published under a GPLv2 license
"""
When wpcap.dll is not available, replace all sendrecv functions that won
'
t work.
"""
from
scapy.error
import
log_runtime
import
scapy.sendrecv
as
sendrecv
import
scapy.config
as
conf
from
scapy.supersocket
import
SuperSocket
def
not_available
(
*
args
,
**
kwargs
):
log_runtime
.
warning
(
"
Function not available
"
)
return
None
class
not_available_socket
(
SuperSocket
):
desc
=
"
wpcap.dll missing
"
def
__init__
(
self
,
type
=
None
,
promisc
=
None
,
filter
=
None
,
iface
=
None
,
nofilter
=
0
):
log_runtime
.
warning
(
"
Function not available
"
)
return
def
send
(
self
,
x
):
return
def
recv
(
self
,
x
=
None
):
return
def
nonblock_recv
(
self
):
return
def
close
(
self
):
return
sendrecv
.
send
=
not_available
sendrecv
.
sendp
=
not_available
sendrecv
.
sendpfast
=
not_available
sendrecv
.
sr
=
not_available
sendrecv
.
sr1
=
not_available
sendrecv
.
srflood
=
not_available
sendrecv
.
srloop
=
not_available
sendrecv
.
srp
=
not_available
sendrecv
.
srp1
=
not_available
sendrecv
.
srpflood
=
not_available
sendrecv
.
srploop
=
not_available
sendrecv
.
sniff
=
not_available
sendrecv
.
sndrcv
=
not_available
sendrecv
.
sndrcvflood
=
not_available
sendrecv
.
tshark
=
not_available
conf
.
L3socket
=
not_available_socket
conf
.
L2socket
=
not_available_socket
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