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
71365d42
Commit
71365d42
authored
7 years ago
by
Pierre LALET
Browse files
Options
Downloads
Patches
Plain Diff
Pcapy support: fix .fileno() and .close()
parent
3a0bc3a9
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/pcapdnet.py
+14
-10
14 additions, 10 deletions
scapy/arch/pcapdnet.py
with
14 additions
and
10 deletions
scapy/arch/pcapdnet.py
+
14
−
10
View file @
71365d42
...
...
@@ -408,8 +408,8 @@ if conf.use_pcap:
return
(
s
+
0.000001
*
us
),
p
__next__
=
next
def
fileno
(
self
):
warning
(
"
fileno: pcapy API does not permit to get capure file descriptor. Bugs ahead! Press Enter to trigger packet reading
"
)
return
0
raise
RuntimeError
(
"
%s has no fileno. Please report this bug.
"
%
self
.
__class__
.
__name__
)
def
__getattr__
(
self
,
attr
):
return
getattr
(
self
.
pcap
,
attr
)
def
__del__
(
self
):
...
...
@@ -634,10 +634,12 @@ if conf.use_pcap and conf.use_dnet:
return
p
def
close
(
self
):
if
hasattr
(
self
,
"
ins
"
):
del
(
self
.
ins
)
if
hasattr
(
self
,
"
outs
"
):
del
(
self
.
outs
)
if
not
self
.
closed
:
if
hasattr
(
self
,
"
ins
"
):
del
(
self
.
ins
)
if
hasattr
(
self
,
"
outs
"
):
del
(
self
.
outs
)
self
.
closed
=
True
class
L2dnetSocket
(
SuperSocket
):
desc
=
"
read/write packets at layer 2 using libdnet and libpcap
"
...
...
@@ -704,10 +706,12 @@ if conf.use_pcap and conf.use_dnet:
return
p
def
close
(
self
):
if
hasattr
(
self
,
"
ins
"
):
del
(
self
.
ins
)
if
hasattr
(
self
,
"
outs
"
):
del
(
self
.
outs
)
if
not
self
.
closed
:
if
hasattr
(
self
,
"
ins
"
):
del
(
self
.
ins
)
if
hasattr
(
self
,
"
outs
"
):
del
(
self
.
outs
)
self
.
closed
=
True
conf
.
L3socket
=
L3dnetSocket
conf
.
L2socket
=
L2dnetSocket
...
...
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