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
de67b33e
Commit
de67b33e
authored
11 years ago
by
Dhiru Kholia
Browse files
Options
Downloads
Patches
Plain Diff
add support for MD5 authentication in HSRP dissector
--HG-- branch : HSRP-fixes
parent
eddab2ad
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/hsrp.py
+55
-8
55 additions, 8 deletions
scapy/layers/hsrp.py
with
55 additions
and
8 deletions
scapy/layers/hsrp.py
+
55
−
8
View file @
de67b33e
...
...
@@ -3,6 +3,31 @@
## Copyright (C) Philippe Biondi <phil@secdev.org>
## This program is published under a GPLv2 license
#############################################################################
## ##
## hsrp.py --- HSRP protocol support for Scapy ##
## ##
## Copyright (C) 2010 Mathieu RENARD mathieu.renard(at)gmail.com ##
## ##
## This program is free software; you can redistribute it and/or modify it ##
## under the terms of the GNU General Public License version 2 as ##
## published by the Free Software Foundation; version 2. ##
## ##
## This program is distributed in the hope that it will be useful, but ##
## WITHOUT ANY WARRANTY; without even the implied warranty of ##
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ##
## General Public License for more details. ##
## ##
#############################################################################
## HSRP Version 1
## Ref. RFC 2281
## HSRP Version 2
## Ref. http://www.smartnetworks.jp/2006/02/hsrp_8_hsrp_version_2.html
##
## $Log: hsrp.py,v $
## Revision 0.2 2011/05/01 15:23:34 mrenard
## Cleanup code
"""
HSRP (Hot Standby Router Protocol): proprietary redundancy protocol for Cisco routers.
"""
...
...
@@ -11,22 +36,44 @@ from scapy.fields import *
from
scapy.packet
import
*
from
scapy.layers.inet
import
UDP
class
HSRP
(
Packet
):
name
=
"
HSRP
"
fields_desc
=
[
ByteField
(
"
version
"
,
0
),
ByteEnumField
(
"
opcode
"
,
0
,
{
0
:
"
Hello
"
,
1
:
"
Coup
"
,
2
:
"
Resign
"
,
3
:
"
Advertise
"
}),
ByteEnumField
(
"
state
"
,
16
,
{
0
:
"
Initial
"
,
1
:
"
Learn
"
,
2
:
"
Listen
"
,
4
:
"
Speak
"
,
8
:
"
Standby
"
,
16
:
"
Active
"
}),
ByteEnumField
(
"
opcode
"
,
0
,
{
0
:
"
Hello
"
,
1
:
"
Coup
"
,
2
:
"
Resign
"
,
3
:
"
Advertise
"
}),
ByteEnumField
(
"
state
"
,
16
,
{
0
:
"
Initial
"
,
1
:
"
Learn
"
,
2
:
"
Listen
"
,
4
:
"
Speak
"
,
8
:
"
Standby
"
,
16
:
"
Active
"
}),
ByteField
(
"
hellotime
"
,
3
),
ByteField
(
"
holdtime
"
,
10
),
ByteField
(
"
priority
"
,
120
),
ByteField
(
"
group
"
,
1
),
ByteField
(
"
reserved
"
,
0
),
StrFixedLenField
(
"
auth
"
,
"
cisco
"
,
8
),
IPField
(
"
virtualIP
"
,
"
192.168.1.1
"
)
]
StrFixedLenField
(
"
auth
"
,
"
cisco
"
+
"
\00
"
*
3
,
8
),
IPField
(
"
virtualIP
"
,
"
192.168.1.1
"
)]
def
guess_payload_class
(
self
,
payload
):
if
self
.
underlayer
.
len
>
28
:
return
HSRPmd5
else
:
return
Packet
.
guess_payload_class
(
self
,
payload
)
class
HSRPmd5
(
Packet
):
name
=
"
HSRP MD5 Authentication
"
fields_desc
=
[
ByteEnumField
(
"
type
"
,
4
,
{
4
:
"
MD5 authentication
"
}),
ByteField
(
"
len
"
,
None
),
ByteEnumField
(
"
algo
"
,
0
,
{
1
:
"
MD5
"
}),
ByteField
(
"
padding
"
,
0x00
),
XShortField
(
"
flags
"
,
0x00
),
IPField
(
"
sourceip
"
,
None
),
XIntField
(
"
keyid
"
,
0x00
),
StrFixedLenField
(
"
authdigest
"
,
"
\00
"
*
16
,
16
)]
def
post_build
(
self
,
p
,
pay
):
if
self
.
len
is
None
and
pay
:
l
=
len
(
pay
)
p
=
p
[:
1
]
+
hex
(
l
)[
30
:]
+
p
[
30
:]
return
p
bind_layers
(
UDP
,
HSRP
,
dport
=
1985
,
sport
=
1985
)
bind_layers
(
UDP
,
HSRP
,
dport
=
1985
,
sport
=
1985
)
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