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
363500b8
Commit
363500b8
authored
9 years ago
by
Guillaume Valadon
Browse files
Options
Downloads
Plain Diff
Merge pull request #72 from p-l-/fix-unneeded-tests
Remove unneeded tests
parents
1fba9a9f
0dc00449
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/packet.py
+18
-22
18 additions, 22 deletions
scapy/packet.py
with
18 additions
and
22 deletions
scapy/packet.py
+
18
−
22
View file @
363500b8
...
@@ -184,12 +184,10 @@ class Packet(BasePacket):
...
@@ -184,12 +184,10 @@ class Packet(BasePacket):
return
self
.
payload
.
getfield_and_val
(
attr
)
return
self
.
payload
.
getfield_and_val
(
attr
)
def
__getattr__
(
self
,
attr
):
def
__getattr__
(
self
,
attr
):
if
isinstance
(
self
,
Packet
):
fld
,
v
=
self
.
getfield_and_val
(
attr
)
fld
,
v
=
self
.
getfield_and_val
(
attr
)
if
fld
is
not
None
:
if
fld
is
not
None
:
return
fld
.
i2h
(
self
,
v
)
return
fld
.
i2h
(
self
,
v
)
return
v
return
v
raise
AttributeError
(
attr
)
def
setfieldval
(
self
,
attr
,
val
):
def
setfieldval
(
self
,
attr
,
val
):
if
self
.
default_fields
.
has_key
(
attr
):
if
self
.
default_fields
.
has_key
(
attr
):
...
@@ -209,13 +207,12 @@ class Packet(BasePacket):
...
@@ -209,13 +207,12 @@ class Packet(BasePacket):
self
.
payload
.
setfieldval
(
attr
,
val
)
self
.
payload
.
setfieldval
(
attr
,
val
)
def
__setattr__
(
self
,
attr
,
val
):
def
__setattr__
(
self
,
attr
,
val
):
if
isinstance
(
self
,
Packet
):
if
attr
in
self
.
__all_slots__
:
if
attr
in
self
.
__all_slots__
:
return
object
.
__setattr__
(
self
,
attr
,
val
)
return
object
.
__setattr__
(
self
,
attr
,
val
)
try
:
try
:
return
self
.
setfieldval
(
attr
,
val
)
return
self
.
setfieldval
(
attr
,
val
)
except
AttributeError
:
except
AttributeError
:
pass
pass
return
object
.
__setattr__
(
self
,
attr
,
val
)
return
object
.
__setattr__
(
self
,
attr
,
val
)
def
delfieldval
(
self
,
attr
):
def
delfieldval
(
self
,
attr
):
...
@@ -232,15 +229,14 @@ class Packet(BasePacket):
...
@@ -232,15 +229,14 @@ class Packet(BasePacket):
self
.
payload
.
delfieldval
(
attr
)
self
.
payload
.
delfieldval
(
attr
)
def
__delattr__
(
self
,
attr
):
def
__delattr__
(
self
,
attr
):
if
isinstance
(
self
,
Packet
):
if
attr
==
"
payload
"
:
if
attr
==
"
payload
"
:
return
self
.
remove_payload
()
return
self
.
remove_payload
()
if
attr
in
self
.
__all_slots__
:
if
attr
in
self
.
__all_slots__
:
return
object
.
__delattr__
(
self
,
attr
)
return
object
.
__delattr__
(
self
,
attr
)
try
:
try
:
return
self
.
delfieldval
(
attr
)
return
self
.
delfieldval
(
attr
)
except
AttributeError
:
except
AttributeError
:
pass
pass
return
object
.
__delattr__
(
self
,
attr
)
return
object
.
__delattr__
(
self
,
attr
)
def
__repr__
(
self
):
def
__repr__
(
self
):
...
...
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