2016-12-15 07:28:00 +00:00
|
|
|
import random
|
|
|
|
import string
|
|
|
|
import re
|
2017-05-08 03:16:18 +00:00
|
|
|
import inspect
|
2016-12-15 07:28:00 +00:00
|
|
|
|
|
|
|
def gen_random_string(length=10):
|
|
|
|
return ''.join(random.sample(string.ascii_letters, int(length)))
|
|
|
|
|
|
|
|
def validate_ntlm(data):
|
|
|
|
allowed = re.compile("^[0-9a-f]{32}", re.IGNORECASE)
|
|
|
|
if allowed.match(data):
|
|
|
|
return True
|
|
|
|
else:
|
|
|
|
return False
|
2017-05-08 03:16:18 +00:00
|
|
|
|
|
|
|
def called_from_cmd_args():
|
|
|
|
for stack in inspect.stack():
|
|
|
|
if stack[3] == 'print_host_info':
|
|
|
|
return True
|
|
|
|
if stack[3] == 'plaintext_login' or stack[3] == 'hash_login':
|
|
|
|
return True
|
|
|
|
if stack[3] == 'call_cmd_args':
|
|
|
|
return True
|
|
|
|
return False
|