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
15ae22b2
Commit
15ae22b2
authored
9 years ago
by
Pierre LALET
Browse files
Options
Downloads
Patches
Plain Diff
Linux: L2Socket can set promiscuous mode (fixes #17)
parent
99669ea2
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/linux.py
+6
-1
6 additions, 1 deletion
scapy/arch/linux.py
with
6 additions
and
1 deletion
scapy/arch/linux.py
+
6
−
1
View file @
15ae22b2
...
@@ -408,7 +408,7 @@ class L3PacketSocket(SuperSocket):
...
@@ -408,7 +408,7 @@ class L3PacketSocket(SuperSocket):
class
L2Socket
(
SuperSocket
):
class
L2Socket
(
SuperSocket
):
desc
=
"
read/write packets at layer 2 using Linux PF_PACKET sockets
"
desc
=
"
read/write packets at layer 2 using Linux PF_PACKET sockets
"
def
__init__
(
self
,
iface
=
None
,
type
=
ETH_P_ALL
,
filter
=
None
,
nofilter
=
0
):
def
__init__
(
self
,
iface
=
None
,
type
=
ETH_P_ALL
,
promisc
=
None
,
filter
=
None
,
nofilter
=
0
):
if
iface
is
None
:
if
iface
is
None
:
iface
=
conf
.
iface
iface
=
conf
.
iface
self
.
ins
=
socket
.
socket
(
socket
.
AF_PACKET
,
socket
.
SOCK_RAW
,
socket
.
htons
(
type
))
self
.
ins
=
socket
.
socket
(
socket
.
AF_PACKET
,
socket
.
SOCK_RAW
,
socket
.
htons
(
type
))
...
@@ -421,6 +421,11 @@ class L2Socket(SuperSocket):
...
@@ -421,6 +421,11 @@ class L2Socket(SuperSocket):
filter
=
"
not (%s)
"
%
conf
.
except_filter
filter
=
"
not (%s)
"
%
conf
.
except_filter
if
filter
is
not
None
:
if
filter
is
not
None
:
attach_filter
(
self
.
ins
,
filter
)
attach_filter
(
self
.
ins
,
filter
)
if
promisc
is
None
:
promisc
=
conf
.
sniff_promisc
self
.
promisc
=
promisc
if
self
.
promisc
:
set_promisc
(
self
.
ins
,
iface
)
self
.
ins
.
bind
((
iface
,
type
))
self
.
ins
.
bind
((
iface
,
type
))
_flush_fd
(
self
.
ins
)
_flush_fd
(
self
.
ins
)
self
.
ins
.
setsockopt
(
socket
.
SOL_SOCKET
,
socket
.
SO_RCVBUF
,
2
**
30
)
self
.
ins
.
setsockopt
(
socket
.
SOL_SOCKET
,
socket
.
SO_RCVBUF
,
2
**
30
)
...
...
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