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
d95249d0
Commit
d95249d0
authored
8 years ago
by
Jan Sebechlebsky
Browse files
Options
Downloads
Patches
Plain Diff
Add support for RFC 2637 (PPTP) GRE
parent
67ee2f3b
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/layers/l2.py
+38
-0
38 additions, 0 deletions
scapy/layers/l2.py
with
38 additions
and
0 deletions
scapy/layers/l2.py
+
38
−
0
View file @
d95249d0
...
...
@@ -968,6 +968,13 @@ class GRE(Packet):
ConditionalField
(
XIntField
(
"
key
"
,
None
),
lambda
pkt
:
pkt
.
key_present
==
1
),
ConditionalField
(
XIntField
(
"
seqence_number
"
,
None
),
lambda
pkt
:
pkt
.
seqnum_present
==
1
),
]
@classmethod
def
dispatch_hook
(
cls
,
_pkt
=
None
,
*
args
,
**
kargs
):
if
_pkt
and
struct
.
unpack
(
"
!H
"
,
_pkt
[
2
:
4
])[
0
]
==
0x880b
:
return
GRE_PPTP
return
cls
def
post_build
(
self
,
p
,
pay
):
p
+=
pay
if
self
.
chksum_present
and
self
.
chksum
is
None
:
...
...
@@ -976,6 +983,37 @@ class GRE(Packet):
return
p
class
GRE_PPTP
(
GRE
):
"""
Enhanced GRE header used with PPTP
RFC 2637
"""
name
=
"
GRE PPTP
"
fields_desc
=
[
BitField
(
"
chksum_present
"
,
0
,
1
),
BitField
(
"
routing_present
"
,
0
,
1
),
BitField
(
"
key_present
"
,
1
,
1
),
BitField
(
"
seqnum_present
"
,
0
,
1
),
BitField
(
"
strict_route_source
"
,
0
,
1
),
BitField
(
"
recursion_control
"
,
0
,
3
),
BitField
(
"
acknum_present
"
,
0
,
1
),
BitField
(
"
flags
"
,
0
,
4
),
BitField
(
"
version
"
,
1
,
3
),
XShortEnumField
(
"
proto
"
,
0x880b
,
ETHER_TYPES
),
ShortField
(
"
payload_len
"
,
None
),
ShortField
(
"
call_id
"
,
None
),
ConditionalField
(
XIntField
(
"
seqence_number
"
,
None
),
lambda
pkt
:
pkt
.
seqnum_present
==
1
),
ConditionalField
(
XIntField
(
"
ack_number
"
,
None
),
lambda
pkt
:
pkt
.
acknum_present
==
1
)]
def
post_build
(
self
,
p
,
pay
):
p
+=
pay
if
self
.
payload_len
is
None
:
pay_len
=
len
(
pay
)
p
=
p
[:
4
]
+
chr
((
pay_len
>>
8
)
&
0xff
)
+
chr
(
pay_len
&
0xff
)
+
p
[
6
:]
return
p
### *BSD loopback layer
class
LoIntEnumField
(
EnumField
):
...
...
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