diff --git a/scapy/volatile.py b/scapy/volatile.py index 17a66e35fe37fa8efbac7afb63190cde6f1017ca..8c8b4533c2d73e059af41a2ff13b032fc5107ed4 100644 --- a/scapy/volatile.py +++ b/scapy/volatile.py @@ -144,9 +144,11 @@ class RandChoice(RandField): return random.choice(self._choice) class RandString(RandField): - def __init__(self, size, chars="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"): - self.chars = chars + def __init__(self, size=None, chars="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"): + if size is None: + size = RandNumExpo(0.01) self.size = size + self.chars = chars def _fix(self): s = "" for i in range(self.size): @@ -154,7 +156,7 @@ class RandString(RandField): return s class RandBin(RandString): - def __init__(self, size): + def __init__(self, size=None): RandString.__init__(self, size, "".join(map(chr,range(256))))