-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrandomstring.py
More file actions
43 lines (36 loc) · 1023 Bytes
/
Copy pathrandomstring.py
File metadata and controls
43 lines (36 loc) · 1023 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import string
import random
def randomstring(string_len):
characters = string.ascii_letters# + string.punctuation + string.digits
password=""
for x in range(random.randint(1,string_len)):
password =password+"".join(random.choice(characters))
return password
def randomstringdigit(string_len):
characters = string.ascii_letters + string.punctuation + string.digits
password = ""
for x in range(random.randint(1,string_len)):
password = password+"".join(random.choice(characters))
return password
class VarString:
def __init__(self):
self._len = 20
self._string = ''
self._type = 'string'
def gen_str(self):
self._string = randomstring(self._len)
def set_len(self,_len):
self._len=_len
def get_str(self):
return self._string
class VarStringDigit:
def __init__(self):
self._len = 20
self._string = ''
self._type = 'stringdigit'
def gen_str(self):
self._string = randomstringdigit(self._len)
def gen_len(self,_len):
self._len =_len
def get_str(self):
return self._string