Skip to content
Snippets Groups Projects
Commit 000caba4 authored by Phil's avatar Phil
Browse files

Fixed RandASN1Object() in case of IP address object

parent 0be3f632
No related branches found
No related tags found
No related merge requests found
...@@ -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)]))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment