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
aefe6fcb
Commit
aefe6fcb
authored
9 years ago
by
Pierre LALET
Browse files
Options
Downloads
Patches
Plain Diff
Use __slots__ for PacketList (and subclasses)
parent
b30167aa
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
scapy/base_classes.py
+2
-2
2 additions, 2 deletions
scapy/base_classes.py
scapy/layers/inet.py
+1
-0
1 addition, 0 deletions
scapy/layers/inet.py
scapy/layers/inet6.py
+1
-0
1 addition, 0 deletions
scapy/layers/inet6.py
scapy/plist.py
+3
-3
3 additions, 3 deletions
scapy/plist.py
with
7 additions
and
5 deletions
scapy/base_classes.py
+
2
−
2
View file @
aefe6fcb
...
@@ -250,5 +250,5 @@ class BasePacket(Gen):
...
@@ -250,5 +250,5 @@ class BasePacket(Gen):
## Packet list base classe ##
## Packet list base classe ##
#############################
#############################
class
BasePacketList
:
class
BasePacketList
(
object
)
:
pass
__slots__
=
[]
This diff is collapsed.
Click to expand it.
scapy/layers/inet.py
+
1
−
0
View file @
aefe6fcb
...
@@ -937,6 +937,7 @@ PacketList.timeskew_graph = new.instancemethod(_packetlist_timeskew_graph, None,
...
@@ -937,6 +937,7 @@ PacketList.timeskew_graph = new.instancemethod(_packetlist_timeskew_graph, None,
### Create a new packet list
### Create a new packet list
class
TracerouteResult
(
SndRcvList
):
class
TracerouteResult
(
SndRcvList
):
__slots__
=
[
"
graphdef
"
,
"
graphASres
"
,
"
padding
"
,
"
hloc
"
,
"
nloc
"
]
def
__init__
(
self
,
res
=
None
,
name
=
"
Traceroute
"
,
stats
=
None
):
def
__init__
(
self
,
res
=
None
,
name
=
"
Traceroute
"
,
stats
=
None
):
PacketList
.
__init__
(
self
,
res
,
name
,
stats
)
PacketList
.
__init__
(
self
,
res
,
name
,
stats
)
self
.
graphdef
=
None
self
.
graphdef
=
None
...
...
This diff is collapsed.
Click to expand it.
scapy/layers/inet6.py
+
1
−
0
View file @
aefe6fcb
...
@@ -2888,6 +2888,7 @@ class AS_resolver6(AS_resolver_riswhois):
...
@@ -2888,6 +2888,7 @@ class AS_resolver6(AS_resolver_riswhois):
return
ip
,
asn
,
desc
return
ip
,
asn
,
desc
class
TracerouteResult6
(
TracerouteResult
):
class
TracerouteResult6
(
TracerouteResult
):
__slots__
=
[]
def
show
(
self
):
def
show
(
self
):
return
self
.
make_table
(
lambda
(
s
,
r
):
(
s
.
sprintf
(
"
%-42s,IPv6.dst%:{TCP:tcp%TCP.dport%}{UDP:udp%UDP.dport%}{ICMPv6EchoRequest:IER}
"
),
# TODO: ICMPv6 !
return
self
.
make_table
(
lambda
(
s
,
r
):
(
s
.
sprintf
(
"
%-42s,IPv6.dst%:{TCP:tcp%TCP.dport%}{UDP:udp%UDP.dport%}{ICMPv6EchoRequest:IER}
"
),
# TODO: ICMPv6 !
s
.
hlim
,
s
.
hlim
,
...
...
This diff is collapsed.
Click to expand it.
scapy/plist.py
+
3
−
3
View file @
aefe6fcb
...
@@ -26,7 +26,7 @@ if arch.GNUPLOT:
...
@@ -26,7 +26,7 @@ if arch.GNUPLOT:
#############
#############
class
PacketList
(
BasePacketList
):
class
PacketList
(
BasePacketList
):
res
=
[
]
__slots__
=
[
"
stats
"
,
"
res
"
,
"
listname
"
]
def
__init__
(
self
,
res
=
None
,
name
=
"
PacketList
"
,
stats
=
None
):
def
__init__
(
self
,
res
=
None
,
name
=
"
PacketList
"
,
stats
=
None
):
"""
create a packet list from a list of packets
"""
create a packet list from a list of packets
res: the list of packets
res: the list of packets
...
@@ -47,8 +47,7 @@ class PacketList(BasePacketList):
...
@@ -47,8 +47,7 @@ class PacketList(BasePacketList):
def
_elt2show
(
self
,
elt
):
def
_elt2show
(
self
,
elt
):
return
self
.
_elt2sum
(
elt
)
return
self
.
_elt2sum
(
elt
)
def
__repr__
(
self
):
def
__repr__
(
self
):
# stats=dict.fromkeys(self.stats,0) ## needs python >= 2.3 :(
stats
=
dict
((
x
,
0
)
for
x
in
self
.
stats
)
stats
=
dict
(
map
(
lambda
x
:
(
x
,
0
),
self
.
stats
))
other
=
0
other
=
0
for
r
in
self
.
res
:
for
r
in
self
.
res
:
f
=
0
f
=
0
...
@@ -477,6 +476,7 @@ lfilter: truth function to apply to each packet to decide whether it will be dis
...
@@ -477,6 +476,7 @@ lfilter: truth function to apply to each packet to decide whether it will be dis
class
SndRcvList
(
PacketList
):
class
SndRcvList
(
PacketList
):
__slots__
=
[]
def
__init__
(
self
,
res
=
None
,
name
=
"
Results
"
,
stats
=
None
):
def
__init__
(
self
,
res
=
None
,
name
=
"
Results
"
,
stats
=
None
):
PacketList
.
__init__
(
self
,
res
,
name
,
stats
)
PacketList
.
__init__
(
self
,
res
,
name
,
stats
)
def
_elt2pkt
(
self
,
elt
):
def
_elt2pkt
(
self
,
elt
):
...
...
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