def show_active_users(): ami_connector = functions.ast_ami_connect(import_creds.AMI_CREDS) users = functions.ast_ami_get_users(ami_connector) num_of_users = len(users) for user in users: print(user) return render_template('monitor/show_active_users.html', users=users, num_of_users=num_of_users)
def show_configured_users(): ami_connector = functions.ast_ami_connect(import_creds.AMI_CREDS) users = functions.ast_ami_get_users(ami_connector) new_users = [] for user in users: if 'p' not in user.username: new_users.append(user) num_of_new_users = len(new_users) for user in new_users: print(user) return render_template('management/show_configured_users.html', users=new_users, num_of_users=num_of_new_users)
# This is needed so as to be run on CLI import sys sys.path.append('/home/whv/whv_ast_ms/') import datetime from modules import functions from scripts import import_creds start = datetime.datetime.now() # print(functions.get_ip_info("155.207.228.165")) # print("\n--->Runtime = {} \n\n\n".format(datetime.datetime.now() - start)) ami_connector = functions.ast_ami_connect(import_creds.AMI_CREDS) ast_users = functions.ast_ami_get_users(ami_connector) for ast_user in ast_users: # print(ast_user) print(ast_user.__dict__) # toaddr = ["*****@*****.**"] # subject = "Test" # body = "test" # functions.send_mail(import_creds.EMAIL_CREDS['username'], import_creds.EMAIL_CREDS['password'], import_creds.EMAIL_CREDS['mail_server'], toaddr, subject, body, [], True, True) print("\n--->Runtime = {} \n\n\n".format(datetime.datetime.now() - start))