Commit 07cb0c69 by Marcin Bury

Adding random_text generator function

parent 1ba4743a
from routersploit.utils import ( from routersploit.utils import (
print_error, print_status, print_success, print_error, print_status, print_success,
print_table, print_info, sanitize_url, print_table, print_info, sanitize_url,
LockedIterator, LockedIterator, random_text,
) )
from routersploit import exploits from routersploit import exploits
......
...@@ -2,7 +2,8 @@ from __future__ import print_function ...@@ -2,7 +2,8 @@ from __future__ import print_function
import threading import threading
from functools import wraps from functools import wraps
import sys import sys
import random
import string
print_lock = threading.Lock() print_lock = threading.Lock()
...@@ -243,3 +244,11 @@ def pprint_dict_in_order(dictionary, order=None): ...@@ -243,3 +244,11 @@ def pprint_dict_in_order(dictionary, order=None):
for rest_keys in keys: for rest_keys in keys:
prettyprint(rest_keys, dictionary[rest_keys]) prettyprint(rest_keys, dictionary[rest_keys])
def random_text(length, alph=string.letters+string.digits):
""" Random text generator. NOT crypto safe.
Generates random text with specified length and alphabet.
"""
return ''.join(random.choice(alph) for _ in range(length))
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment