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
02d76dd3
Commit
02d76dd3
authored
15 years ago
by
Phil
Browse files
Options
Downloads
Plain Diff
Merge with scapy-win2 branch
parents
81dfaee3
0e54b950
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
scapy/asn1/asn1.py
+3
-0
3 additions, 0 deletions
scapy/asn1/asn1.py
scapy/asn1/ber.py
+7
-1
7 additions, 1 deletion
scapy/asn1/ber.py
with
10 additions
and
1 deletion
scapy/asn1/asn1.py
+
3
−
0
View file @
02d76dd3
...
@@ -20,6 +20,9 @@ class RandASN1Object(RandField):
...
@@ -20,6 +20,9 @@ class RandASN1Object(RandField):
o
=
random
.
choice
(
self
.
objlist
)
o
=
random
.
choice
(
self
.
objlist
)
if
issubclass
(
o
,
ASN1_INTEGER
):
if
issubclass
(
o
,
ASN1_INTEGER
):
return
o
(
int
(
random
.
gauss
(
0
,
1000
)))
return
o
(
int
(
random
.
gauss
(
0
,
1000
)))
elif
issubclass
(
o
,
ASN1_IPADDRESS
):
z
=
RandIP
().
_fix
()
return
o
(
z
)
elif
issubclass
(
o
,
ASN1_STRING
):
elif
issubclass
(
o
,
ASN1_STRING
):
z
=
int
(
random
.
expovariate
(
0.05
)
+
1
)
z
=
int
(
random
.
expovariate
(
0.05
)
+
1
)
return
o
(
""
.
join
([
random
.
choice
(
self
.
chars
)
for
i
in
range
(
z
)]))
return
o
(
""
.
join
([
random
.
choice
(
self
.
chars
)
for
i
in
range
(
z
)]))
...
...
This diff is collapsed.
Click to expand it.
scapy/asn1/ber.py
+
7
−
1
View file @
02d76dd3
...
@@ -233,7 +233,7 @@ class BERcodec_NULL(BERcodec_INTEGER):
...
@@ -233,7 +233,7 @@ class BERcodec_NULL(BERcodec_INTEGER):
if
i
==
0
:
if
i
==
0
:
return
chr
(
cls
.
tag
)
+
"
\0
"
return
chr
(
cls
.
tag
)
+
"
\0
"
else
:
else
:
return
super
(
cls
,
cls
)
.
enc
(
i
)
return
BERcodec_INTEGER
.
enc
(
i
)
class
BERcodec_SEP
(
BERcodec_NULL
):
class
BERcodec_SEP
(
BERcodec_NULL
):
tag
=
ASN1_Class_UNIVERSAL
.
SEP
tag
=
ASN1_Class_UNIVERSAL
.
SEP
...
@@ -260,6 +260,12 @@ class BERcodec_T61_STRING (BERcodec_STRING):
...
@@ -260,6 +260,12 @@ class BERcodec_T61_STRING (BERcodec_STRING):
class
BERcodec_IA5_STRING
(
BERcodec_STRING
):
class
BERcodec_IA5_STRING
(
BERcodec_STRING
):
tag
=
ASN1_Class_UNIVERSAL
.
IA5_STRING
tag
=
ASN1_Class_UNIVERSAL
.
IA5_STRING
class
BERcodec_NUMERIC_STRING
(
BERcodec_STRING
):
tag
=
ASN1_Class_UNIVERSAL
.
NUMERIC_STRING
class
BERcodec_VIDEOTEX_STRING
(
BERcodec_STRING
):
tag
=
ASN1_Class_UNIVERSAL
.
VIDEOTEX_STRING
class
BERcodec_IPADDRESS
(
BERcodec_STRING
):
class
BERcodec_IPADDRESS
(
BERcodec_STRING
):
tag
=
ASN1_Class_UNIVERSAL
.
IPADDRESS
tag
=
ASN1_Class_UNIVERSAL
.
IPADDRESS
...
...
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