import argparse import datetime as dt import os import pickle import random import sys import numpy as np import yaml from datetime import datetime from multiprocessing import Process, Value from collections import defaultdict from utils import log # variables logger = log.setLogger('gen_invoke_data') no_of_data_points = None heavy_traffic = None time_patterns = None scenario_pool = {} process_pool = [] current_data_points = Value('i', 0) script_start_time = None abs_path = os.path.abspath(os.path.dirname(__file__)) def loadConfig(): """
import sys import time import numpy as np import requests import urllib3 import yaml from collections import defaultdict from datetime import datetime from multiprocessing import Process, Value from utils import util_methods, log urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning) # variables logger = log.setLogger('invoke_API') max_connection_refuse_count = None host_protocol = None host_ip = None host_port = None heavy_traffic = None post_data = [] delete_data = [] time_patterns = None script_start_time = None scenario_pool = {} connection_refuse_count = Value('i', 0) process_pool = []
# http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. import os import yaml import csv from utils import request_methods, log # variables logger = log.setLogger('generate_tokens') abs_path = "" gateway_protocol = "" gateway_host = "" nio_pt_transport_port = "" token_endpoint = "" user_app = [] app_key_secret = {} tenant_name = "super" def loadConfig(): """ This function will load and set the configuration data :return: None """
# http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. import os import yaml import base64 from utils import request_methods, log # variables logger = log.setLogger('multi_tenant_setup') abs_path = "" tenant_list = [] app_list = {} app_api_subs = {} app_tenant = {} def loadConfig(): """ This function will load and set the configuration data :return: None """ global abs_path, app_list, app_api_subs # load application details
# Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. import os import yaml import math import random from scipy.stats import truncnorm from utils import log # variables logger = log.setLogger('gen_scenario_yaml') abs_path = None no_of_users = 0 frequency_limits = None app_list = {} time_patterns = {} app_api_subs = {} api_resources = {} def getNormal(mean, sd, lower, upper): """ This function will return a normal distribution bound to a given limit :param mean: mean of the distribution :param sd: standard deviation :param lower: lower bound of the range
# software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. import os import yaml import base64 import glob import json import copy from utils import request_methods, log # variables logger = log.setLogger('multi_tenant_create_scenario') abs_path = "" apim_version = "" token_registration_endpoint = "" token_endpoint = "" publisher_api_endpoint = "" store_application_endpoint = "" store_subs_endpoint = "" user_signup_endpoint = "" gateway_protocol = "" gateway_host = "" gateway_servelet_port_https = "" gateway_servelet_port_http = "" nio_pt_transport_port = ""
# software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. import os import yaml import base64 import glob import json import copy from utils import request_methods, log # variables logger = log.setLogger('create_api_scenario') abs_path = "" apim_version = "" token_registration_endpoint = "" token_endpoint = "" publisher_api_endpoint = "" store_application_endpoint = "" store_subs_endpoint = "" user_signup_endpoint = "" gateway_protocol = "" gateway_host = "" gateway_servelet_port_https = "" gateway_servelet_port_http = "" nio_pt_transport_port = ""
import ipaddress import os import pickle import random import string import sys import pandas as pd import yaml from datetime import datetime from utils import log from faker import Factory from scipy.stats import norm # variables logger = log.setLogger('gen_invoke_scenario') tenant_name = '' ip_dataset_name = None apis = None invoke_scenario = None user_country = {} user_ip = {} user_cookie = {} users_apps = {} scenario_pool = {} scenario_distribution = [] existing_no_of_user_combinations = 0 # to validate the user count total_no_of_user_combinations = 0 used_ips = [] ip_dataset = None
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. import rstr from faker import Faker import argparse import os import yaml from datetime import datetime import sys from utils import log # global variables logger = log.setLogger('gen_user_details') faker = Faker() scenario_name = None no_of_users = 0 abs_path = os.path.abspath(os.path.dirname(__file__)) # load and set configurations try: with open(abs_path + '/../../../../config/traffic-tool.yaml', 'r') as file: traffic_config = yaml.load(file, Loader=yaml.FullLoader) no_of_users = int(traffic_config['tool_config']['no_of_users']) if no_of_users <= 0: logger.error('User creation Failed!. Invalid user count: {}'.format( str(no_of_users))) sys.exit()
import random import string import sys from datetime import datetime, timedelta from multiprocessing import Process, Lock, Value import numpy as np import yaml from constants import * from utilities import util_methods from utilities.entity_classes import Config from utils import log abs_path = os.path.abspath(os.path.dirname(__file__)) logger = log.setLogger("Stolen_TOKEN") current_data_points = Value('i', 0) used_ips = [] # Constants STOLEN_TOKEN = 'stolen_token' # noinspection PyProtectedMember def generate_unique_ip(): """ Returns a unique ip address :return: an unique ip """ global used_ips
# # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. import os import yaml import base64 import csv from utils import request_methods, log # variables logger = log.setLogger('cleanup_scenario') abs_path = "" token_registration_endpoint = "" token_endpoint = "" publisher_api_endpoint = "" store_application_endpoint = "" delete_user_soap_endpoint = "" gateway_protocol = "" gateway_host = "" gateway_servelet_port_https = "" nio_pt_transport_port = "" admin_username = "" admin_password = "" admin_b64 = ""
# http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. import os import yaml import csv from utils import request_methods, log # variables logger = log.setLogger('multi_tenant_generate_tokens') abs_path = "" gateway_protocol = "" gateway_host = "" nio_pt_transport_port = "" token_endpoint = "" user_app = [] app_key_secret = {} app_tenant = {} def loadConfig(): """ This function will load and set the configuration data :return: None """
# # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. import os import yaml import base64 import csv from utils import request_methods, log # variables logger = log.setLogger('multi_tenant_cleanup_scenario') abs_path = "" token_registration_endpoint = "" token_endpoint = "" publisher_api_endpoint = "" store_application_endpoint = "" delete_user_soap_endpoint = "" gateway_protocol = "" gateway_host = "" gateway_servelet_port_https = "" nio_pt_transport_port = "" user_tenant = {} tenant_config_details = None