How to use enable_logging method in localstack

Best Python code snippet using localstack_python

obfuscators.py

Source:obfuscators.py Github

copy

Full Screen

1#! /usr/bin/env python23import logging4import sys5import os6from datetime import datetime7import subprocess as sub89import util as u10import exception as e1112import obfuscator_rebuild13import obfuscator_defunct14import obfuscator_renaming15import obfuscator_goto16import obfuscator_string17import obfuscator_indirections18import obfuscator_nop19import obfuscator_debug20import obfuscator_branch21import obfuscator_reordering22import obfuscator_reflection23import obfuscator_fields24import obfuscator_manifest25import obfuscator_resource26import obfuscator_raw27import obfuscator_restring28import obfuscator_asset29import obfuscator_intercept30import obfuscator_lib3132base_dir = os.path.abspath(os.path.dirname(__file__)) + '/'33#obfuscator_resource_dir = base_dir + 'obfuscators/'34obfuscator_resource_dir = base_dir + ''3536obfuscator_log_file = base_dir + 'obfuscators.log'3738debug = False39cleanup = True40enable_logging = True414243def popen(com_str):44 p = sub.Popen(com_str, shell=True, stdout=sub.PIPE, stderr=sub.PIPE)45 out, err = p.communicate()46 if enable_logging:47 u.logger(out)48 u.logger(err)49 if 'Exception' in out or 'Exception' in err:50 if 'method index is too large' in out or 'method index is too large' in err:51 raise e.AndroidLimitException('Unable run :' + com_str)52 elif 'java.lang.ArrayIndexOutOfBoundsException' in out or 'java.lang.ArrayIndexOutOfBoundsException' in err:53 raise e.AndroidRandomException('Unable run :' + com_str)54 else:55 raise e.RunningObfuscatorException('Unable run :' + com_str)565758def clean_temp(sample_tf_dir): # Clear the temporary support directory59 try:60 if enable_logging:61 u.logger('Directory cleaned: ' + sample_tf_dir)62 popen('rm -rf ' + sample_tf_dir + '/app')63 except OSError as ex:64 raise e.OpenToolException(str(ex) + '\nUnable to clean ' + sample_tf_dir)656667def backsmali(sample_tf_dir, sample_file_name): # Backsmali an apk file68 try:69 if enable_logging:70 u.logger('Backsmali: ' + sample_file_name + ' into ' + sample_tf_dir)71 #popen('apktool/apktool d --force --no-debug-info ' + sample_file_name + ' ' + sample_tf_dir + '/app')72 popen('apktool d --force --no-debug-info ' + sample_file_name + ' -o ' + sample_tf_dir + '/app')73 if os.path.isdir(u.base_dir()+'/smali/com'):74 u.main_exec_dir = 'com'75 elif os.path.isdir(u.base_dir()+'/smali/org'):76 u.main_exec_dir = 'org'77 else:78 u.main_exec_dir = ''79 except OSError as ex:80 raise e.OpenToolException(str(ex) + '\nUnable to backsmali ' + sample_file_name + ' into ' + sample_tf_dir)818283def smali(sample_tf_dir, sample_file_name): # Smali an apk file84 try:85 if enable_logging:86 u.logger('Smali: ' + sample_file_name + ' from ' + sample_tf_dir)87 #print('apktool/apktool b --force-all ' + sample_tf_dir + '/app' + ' ' + sample_file_name)88 #popen('apktool/apktool b --force-all ' + sample_tf_dir + '/app' + ' ' + sample_file_name)89 popen('apktool b --force-all ' + sample_tf_dir + '/app' + ' -o ' + sample_file_name)90 except OSError as ex:91 raise e.OpenToolException(str(ex) + '\nUnable to smali ' + sample_file_name + ' from ' + sample_tf_dir)929394def sign_apk(sample_file_name): # Sign an apk file with a SHA1 key95 try:96 if enable_logging:97 u.logger('Sign: ' + sample_file_name)98 popen('jarsigner -sigalg MD5withRSA -digestalg SHA1 -keystore ' + obfuscator_resource_dir + '/resignKey.keystore -storepass resignKey ' + sample_file_name + ' resignKey')99 #popen('/opt/jdk1.8.0_101/bin/jarsigner -sigalg MD5withRSA -digestalg SHA1 -keystore ' + obfuscator_resource_dir + '/resignKey.keystore -storepass resignKey ' + sample_file_name + ' resignKey')100 except OSError as ex:101 raise e.OpenToolException(str(ex) + '\nUnable to sign ' + sample_file_name)102103104def zip_align(sample_file_name): # Align the file105 try:106 if enable_logging:107 u.logger('Zip: ' + sample_file_name)108 popen('cp ' + sample_file_name + ' ' + sample_file_name + '_old.apk')109 popen('zipalign -f 8 ' + sample_file_name + '_old.apk' + ' ' + sample_file_name)110 popen('rm -f ' + sample_file_name + '_old.apk')111 except OSError as ex:112 raise e.OpenToolException(str(ex) + '\nUnable to zipalign ' + sample_file_name)113114115def design_apk(sample_file_name): # Remove a signature from an apk file116 try:117 if enable_logging:118 u.logger('DeSign: ' + sample_file_name)119 popen('zip -d ' + sample_file_name + ' /META-INF/*') # Delete the META-INF folder from the apk root120 except OSError as ex:121 raise e.OpenToolException(str(ex) + '\nUnable to delete META-INF from ' + sample_file_name)122123124def init(sample_tf_dir): # Initialize the obfuscator routine125 reload(sys)126 sys.setdefaultencoding('utf-8')127 u.obfuscator_dir = obfuscator_resource_dir128 u.global_dir = sample_tf_dir + '/app'129 logging.basicConfig(filename=obfuscator_log_file, level=logging.DEBUG)130 if enable_logging:131 u.logger('Obfuscators Initialize: ' + u.obfuscator_dir + ' ' + u.global_dir)132133134def apply_resign(sample_file_name): # Resign an apk file135 try:136 design_apk(sample_file_name)137 sign_apk(sample_file_name)138 except e.OpenToolException as ex:139 raise e.RunningObfuscatorException(str(ex))140141142def apply_zip(sample_file_name): # Zipaling an apk file143 try:144 zip_align(sample_file_name)145 except e.OpenToolException as ex:146 raise e.RunningObfuscatorException(str(ex))147148149def apply_py_obfuscator(sample_file_name, sample_tf_dir, obfuscatorPy):150 '''Apply an obfuscator'''151 try:152 if enable_logging:153 u.logger('Python Obfuscator!')154 #backsmali(sample_tf_dir, sample_file_name)155 obfuscatorPy.obfuscate()156 if debug:157 smali(sample_tf_dir, sample_file_name)158 #sign_apk(sample_file_name)159 #clean_temp(sample_tf_dir)160 except (e.OpenToolException, e.LoadFileException) as ex:161 raise e.RunningObfuscatorException(str(ex) + '\nUnable run python obfuscator')162163164def run_obfuscator_resigned(sample_file_name, sample_tf_dir):165 try:166 if enable_logging:167 u.logger('Obfuscator Resign')168 apply_resign(sample_file_name)169 except e.OpenToolException as ex:170 raise e.RunningObfuscatorException(str(ex) + '\nUnable to apply Resign')171172173def run_obfuscator_zip(sample_file_name, sample_tf_dir):174 try:175 if enable_logging:176 u.logger('Obfuscator Align')177 apply_zip(sample_file_name)178 except e.RunningObfuscatorException as ex:179 raise e.RunningObfuscatorException(str(ex) + '\nUnable to apply Align')180181182def run_obfuscator_rebuild(sample_file_name, sample_tf_dir):183 try:184 if enable_logging:185 u.logger('Obfuscator Rebuild')186 apply_py_obfuscator(sample_file_name, sample_tf_dir, obfuscator_rebuild)187 except e.RunningObfuscatorException as ex:188 raise e.RunningObfuscatorException(str(ex) + '\nUnable to apply Rebuild')189190191def run_obfuscator_defunct(sample_file_name, sample_tf_dir):192 try:193 if enable_logging:194 u.logger('Obfuscator Defunct')195 apply_py_obfuscator(sample_file_name, sample_tf_dir, obfuscator_defunct)196 except e.RunningObfuscatorException as ex:197 raise e.RunningObfuscatorException(str(ex) + '\nUnable to apply Defunct')198199200def run_obfuscator_renaming(sample_file_name, sample_tf_dir):201 try:202 if enable_logging:203 u.logger('Obfuscator Renaming')204 apply_py_obfuscator(sample_file_name, sample_tf_dir, obfuscator_renaming)205 except e.RunningObfuscatorException as ex:206 raise e.RunningObfuscatorException(str(ex) + '\nUnable to apply Renaming')207208209def run_obfuscator_goto(sample_file_name, sample_tf_dir):210 try:211 if enable_logging:212 u.logger('Obfuscator Goto')213 apply_py_obfuscator(sample_file_name, sample_tf_dir, obfuscator_goto)214 except e.RunningObfuscatorException as ex:215 raise e.RunningObfuscatorException(str(ex) + '\nUnable to apply Goto')216217218def run_obfuscator_string(sample_file_name, sample_tf_dir):219 try:220 if enable_logging:221 u.logger('Obfuscator String')222 apply_py_obfuscator(sample_file_name, sample_tf_dir, obfuscator_string)223 except e.RunningObfuscatorException as ex:224 raise e.RunningObfuscatorException(str(ex) + '\nUnable to apply String')225226227def run_obfuscator_indirections(sample_file_name, sample_tf_dir):228 try:229 if enable_logging:230 u.logger('Obfuscator Indirections')231 apply_py_obfuscator(sample_file_name, sample_tf_dir, obfuscator_indirections)232 except e.RunningObfuscatorException as ex:233 raise e.RunningObfuscatorException(str(ex) + '\nUnable to apply Indirections')234235236def run_obfuscator_nop(sample_file_name, sample_tf_dir):237 try:238 if enable_logging:239 u.logger('Obfuscator Nop')240 apply_py_obfuscator(sample_file_name, sample_tf_dir, obfuscator_nop)241 except e.RunningObfuscatorException as ex:242 raise e.RunningObfuscatorException(str(ex) + '\nUnable to apply Nop')243244245def run_obfuscator_debug(sample_file_name, sample_tf_dir):246 try:247 if enable_logging:248 u.logger('Obfuscator Debug')249 apply_py_obfuscator(sample_file_name, sample_tf_dir, obfuscator_debug)250 except e.RunningObfuscatorException as ex:251 raise e.RunningObfuscatorException(str(ex) + '\nUnable to apply Debug')252253254def run_obfuscator_branch(sample_file_name, sample_tf_dir):255 try:256 if enable_logging:257 u.logger('Obfuscator Branch')258 apply_py_obfuscator(sample_file_name, sample_tf_dir, obfuscator_branch)259 except e.RunningObfuscatorException as ex:260 raise e.RunningObfuscatorException(str(ex) + '\nUnable to apply Branch')261262263def run_obfuscator_reordering(sample_file_name, sample_tf_dir):264 try:265 if enable_logging:266 u.logger('Obfuscator Reordering')267 apply_py_obfuscator(sample_file_name, sample_tf_dir, obfuscator_reordering)268 except e.RunningObfuscatorException as ex:269 raise e.RunningObfuscatorException(str(ex) + '\nUnable to apply Reordering')270271272def run_obfuscator_reflection(sample_file_name, sample_tf_dir):273 try:274 if enable_logging:275 u.logger('Obfuscator Reflection')276 apply_py_obfuscator(sample_file_name, sample_tf_dir, obfuscator_reflection)277 except e.RunningObfuscatorException as ex:278 raise e.RunningObfuscatorException(str(ex) + '\nUnable to apply Reflection')279280281def run_obfuscator_fields(sample_file_name, sample_tf_dir):282 try:283 if enable_logging:284 u.logger('Obfuscator Field')285 apply_py_obfuscator(sample_file_name, sample_tf_dir, obfuscator_fields)286 except e.RunningObfuscatorException as ex:287 raise e.RunningObfuscatorException(str(ex) + '\nUnable to apply Fields')288289290def run_obfuscator_manifest(sample_file_name, sample_tf_dir):291 try:292 if enable_logging:293 u.logger('Obfuscator Manifest')294 apply_py_obfuscator(sample_file_name, sample_tf_dir, obfuscator_manifest)295 except e.RunningObfuscatorException as ex:296 raise e.RunningObfuscatorException(str(ex) + '\nUnable to apply Manifest')297298299def run_obfuscator_resource(sample_file_name, sample_tf_dir):300 try:301 if enable_logging:302 u.logger('Obfuscator Resource')303 apply_py_obfuscator(sample_file_name, sample_tf_dir, obfuscator_resource)304 except e.RunningObfuscatorException as ex:305 raise e.RunningObfuscatorException(str(ex) + '\nUnable to apply Resource')306307308def run_obfuscator_raw(sample_file_name, sample_tf_dir):309 try:310 if enable_logging:311 u.logger('Obfuscator Raw')312 apply_py_obfuscator(sample_file_name, sample_tf_dir, obfuscator_raw)313 except e.RunningObfuscatorException as ex:314 raise e.RunningObfuscatorException(str(ex) + '\nUnable to apply Raw')315316317def run_obfuscator_restring(sample_file_name, sample_tf_dir):318 try:319 if enable_logging:320 u.logger('Obfuscator Restring')321 apply_py_obfuscator(sample_file_name, sample_tf_dir, obfuscator_restring)322 except e.RunningObfuscatorException as ex:323 raise e.RunningObfuscatorException(str(ex) + '\nUnable to apply Restring')324325326def run_obfuscator_asset(sample_file_name, sample_tf_dir):327 try:328 if enable_logging:329 u.logger('Obfuscator Asset')330 apply_py_obfuscator(sample_file_name, sample_tf_dir, obfuscator_asset)331 except e.RunningObfuscatorException as ex:332 raise e.RunningObfuscatorException(str(ex) + '\nUnable to apply Asset')333334335def run_obfuscator_intercept(sample_file_name, sample_tf_dir):336 try:337 if enable_logging:338 u.logger('Obfuscator Intercept')339 apply_py_obfuscator(sample_file_name, sample_tf_dir, obfuscator_intercept)340 except e.RunningObfuscatorException as ex:341 raise e.RunningObfuscatorException(str(ex) + '\nUnable to apply Intercept')342343344def run_obfuscator_lib(sample_file_name, sample_tf_dir):345 try:346 if enable_logging:347 u.logger('Obfuscator Lib')348 apply_py_obfuscator(sample_file_name, sample_tf_dir, obfuscator_lib)349 except e.RunningObfuscatorException as ex:350 raise e.RunningObfuscatorException(str(ex) + '\nUnable to apply Lib')351352353#The obfuscator DB Name to Method mapping354obfuscator_mapping = {355 'Resigned': run_obfuscator_resigned,356 'Alignment': run_obfuscator_zip,357 'Rebuild': run_obfuscator_rebuild,358 'Defunct': run_obfuscator_defunct,359 'Renaming': run_obfuscator_renaming,360 'Goto': run_obfuscator_goto,361 'StringEncrypt': run_obfuscator_string,362 'Indirections': run_obfuscator_indirections,363 'Nop': run_obfuscator_nop,364 'Debug': run_obfuscator_debug,365 'ArithmeticBranch': run_obfuscator_branch,366 'Reordering': run_obfuscator_reordering,367 'Reflection': run_obfuscator_reflection,368 'Fields': run_obfuscator_fields,369 'Manifest': run_obfuscator_manifest,370 'Resource': run_obfuscator_resource,371 'Raw': run_obfuscator_raw,372 'Restring': run_obfuscator_restring,373 'Asset': run_obfuscator_asset,374 'Intercept': run_obfuscator_intercept,375 'Lib': run_obfuscator_lib376}377378379def clean_apk(sample_file_name): # Clear the temporary apk380 try:381 if enable_logging:382 u.logger('Apk cleaned: ' + sample_file_name)383 popen('rm -f ' + sample_file_name)384 except OSError as ex:385 raise e.OpenToolException(str(ex) + '\nUnable to clean ' + sample_file_name)386387388def obfuscate_sample(sample_file_name, obfuscator_list, sample_tf_dir):389 '''This function obfucate a sample with the obfuscators in the list using a temporary directory as support'''390 init(sample_tf_dir)391 if enable_logging:392 u.logger('Obfuscate Request: %s - %s - %s' % (sample_file_name, obfuscator_list, sample_tf_dir))393 else:394 u.logger('Obfuscate Request')395 if not debug:396 clean_temp(sample_tf_dir)397 backsmali(sample_tf_dir, sample_file_name)398 start_time = datetime.utcnow()399 if enable_logging:400 u.logger('Obfuscate Start: ' + str(start_time))401 try:402 for obfuscator_item in obfuscator_list:403 obfuscator_method = obfuscator_mapping[obfuscator_item]404 obfuscator_method(sample_file_name, sample_tf_dir)405 except KeyError as ex:406 raise e.RunningObfuscatorException('Invalid obfuscator id ' + str(ex))407 end_time = datetime.utcnow()408 if enable_logging:409 u.logger('Obfuscate Stop: ' + str(end_time))410 u.logger('Obfuscate Time: ' + str(end_time-start_time))411 if cleanup:412 sample_ob_file_name = sample_file_name + 'Ob'413 else:414 sample_ob_file_name = sample_file_name415 smali(sample_tf_dir, sample_ob_file_name)416 sign_apk(sample_ob_file_name)417 if not debug:418 clean_temp(sample_tf_dir)419 if cleanup:420 clean_apk(sample_file_name)421 u.logger('### SUCCESS ### {' + str(end_time-start_time) + '}')422423424def apply_dir(orgApkDir, obfuscator_to_apply, mode=0, retry=0):425 try:426 #obfuscate_sample(adam_base_dir + 'input/' + filename, obfuscator_to_apply, adam_base_dir + 'temp/' + filename[:-4])427 #sys.exit(0)428429 for apk in os.listdir(orgApkDir):430 if not apk.endswith('.apk'):431 continue432 #obfuscate_sample(adam_base_dir + 'input/' + filename, obfuscator_to_apply, adam_base_dir + 'temp/' + filename[:-4])433 obfuscate_sample(orgApkDir+'/'+apk, obfuscator_to_apply, base_dir + 'temp/' + apk[:-4])434 sys.exit(0)435 except e.AndroidLimitException as ex:436 u.logger('### ERROR ### ' + str(ex) + ' ### ERROR ###')437 u.logger('### WARNING ###')438 if mode == 0:439 apply_dir(filename, [o for o in obfuscator_to_apply if o != 'Reflection'], 1)440 elif mode == 1:441 apply_dir(filename, [o for o in obfuscator_to_apply if o != 'Indirections'], 2)442 else:443 sys.exit(1)444 except e.AndroidRandomException as ex:445 u.logger('### ERROR ### ' + str(ex) + ' ### ERROR ###')446 if retry == 0:447 u.logger('### WARNING ###')448 apply_dir(filename, obfuscator_to_apply, mode, retry + 1)449 else:450 u.logger('### FAILURE ###')451 sys.exit(2)452 except Exception as ex:453 u.logger('### ERROR ### ' + str(ex) + ' ### ERROR ###')454 u.logger('### FAILURE ###')455 sys.exit(2)456457458'''459obfuscator_to_apply = ['Resigned',460 'Alignment',461 'Rebuild',462 'Fields',463 'Debug',464 'Indirections',465 'Defunct',466 'StringEncrypt',467 'Renaming',468 'Reordering',469 'Goto',470 'ArithmeticBranch',471 'Nop',472 'Asset',473 'Intercept',474 'Raw',475 'Resource',476 'Lib',477 'Restring',478 'Manifest',479 'Reflection'480 ]481'''482# the following obfuscators have been made working okay483obfuscator_to_apply = ['Lib',484 'Manifest',485 'Goto',486 'Reflection',487 'Reordering',488 'Intercept',489 'Nop',490 'ArithmeticBranch',491 'Renaming',492 'Indirections',493 'Debug',494 'Rebuild',495 'Alignment',496 'Resigned'497 ]498499def main():500 try:501 apply_dir(sys.argv[1], obfuscator_to_apply)502 except Exception, e:503 return 1504 return 0505506if __name__ == '__main__': ...

Full Screen

Full Screen

rubrik-mosaic-datadog-metrics.py

Source:rubrik-mosaic-datadog-metrics.py Github

copy

Full Screen

1import os2from datadog import initialize, api3import rubrik_mosaic4import urllib35import logging6import datetime7import argparse8urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)9parser = argparse.ArgumentParser(description="Upload the following Rubrik Mosaic metrics to Datadog as custom metrics: protected_object_count, size_protected_MB, secondary_storage_consumed_MB, backup_count.")10parser.add_argument("-api","--dd_api_key", help="Datadog api key, if not defined will default to environment variable 'dd_api_key'")11parser.add_argument("-app","--dd_app_key", help="Datadog app key, if not defined will default to environment variable 'dd_app_key'")12parser.add_argument("-i","--rubrik_mosaic_node_ip", help="mosaic node ip address, if not defined will default to environment variable 'rubrik_mosaic_node_ip'")13parser.add_argument("-u","--rubrik_mosaic_username", help="mosaic username, if not defined will default to environment variable 'rubrik_mosaic_username'")14parser.add_argument("-p","--rubrik_mosaic_password", help="mosaic password, if not defined will default to environment variable 'rubrik_mosaic_password'")15parser.add_argument("-l","--logging_enabled", help="enable or disable debug logging", type=bool)16args = parser.parse_args()17##User Defined Variables##18#api/app keys used to connect to datadog api19#can also be specified via env vars dd_api_key and dd_app_key20dd_api_key = args.dd_api_key21dd_app_key = args.dd_app_key22#ip, username, and password used to connect to mosaic api23#can also be specified via env vars rubrik_mosaic_node_ip, rubrik_mosaic_username, and rubrik_mosaic_password24rubrik_mosaic_node_ip = args.rubrik_mosaic_node_ip25rubrik_mosaic_username = args.rubrik_mosaic_username26rubrik_mosaic_password = args.rubrik_mosaic_password27#debug logging28if args.logging_enabled:29 logging_enabled=args.logging_enabled30else:31 logging_enabled=False32if logging_enabled:33 #debug logging34 console_output_handler = logging.StreamHandler()35 logging.getLogger().setLevel(logging.DEBUG)36 formatter = logging.Formatter("[%(asctime)s] [%(levelname)s] -- %(message)s")37 console_output_handler.setFormatter(formatter)38 logger = logging.getLogger(__name__)39 logger.propagate = False40 logger.addHandler(console_output_handler)41 def log(log_message):42 logger.debug(log_message)43def connect_datadog(api_key=None, app_key=None):44 #If the api_key and app_key has not been provided check for the env variable45 if api_key is None:46 api_key = os.environ.get('dd_api_key')47 if api_key is None:48 raise ValueError("The Datadog api key has not been provided.")49 if app_key is None:50 app_key = os.environ.get('dd_app_key')51 if app_key is None:52 raise ValueError("The Datadog app key has not been provided.")53 #connect to datadog api54 options = {55 'api_key': api_key,56 'app_key': app_key57 }58 initialize(**options)59#connect to datadog60connect_datadog(dd_api_key, dd_app_key)61#connect to mosaic cluster62rubrik = rubrik_mosaic.Connect(node_ip=rubrik_mosaic_node_ip, username=rubrik_mosaic_username,password=rubrik_mosaic_password, enable_logging=logging_enabled)63def post_metrics(rubrik, enable_logging=False):64 #dict to iterate metrics 65 metrics = {}66 #get number of objects protected via mosaic67 if enable_logging:68 log('post_metrics - getting protected_object_count')69 metrics['protected_object_count'] = rubrik.get_protected_object_count()70 if enable_logging:71 log('post_metrics - protected_object_count: {}'.format(metrics['protected_object_count']))72 #get size under protection73 if enable_logging:74 log('post_metrics - getting size_protected')75 metrics['size_protected_MB'] = rubrik.get_size_under_protection()76 if enable_logging:77 log('post_metrics - size_protected_MB: {}'.format(metrics['size_protected_MB']))78 #get secondary storage consumed79 if enable_logging:80 log('post_metrics - getting secondary_storage_consumed')81 metrics['secondary_storage_consumed_MB'] = rubrik.get_secondary_storage_consumed()82 if enable_logging:83 log('post_metrics - secondary_storage_consumed_MB: {}'.format(metrics['secondary_storage_consumed_MB']))84 #get total number of backups85 if enable_logging:86 log('post_metrics - getting backup_count')87 metrics['backup_count'] = rubrik.get_backup_count()88 if enable_logging:89 log('post_metrics - backup_count: {}'.format(metrics['backup_count']))90 for metric, value in metrics.items():91 if enable_logging:92 log('post_metrics - posting {} to datadog api for mosaic cluster {}'.format(metric, rubrik.node_ip))93 response = api.Metric.send(metric="mosaic.{}.{}".format(rubrik.node_ip, metric), points=value)94 if enable_logging:95 log('post metrics - {}'.format(response))...

Full Screen

Full Screen

backtester.py

Source:backtester.py Github

copy

Full Screen

1import Strategies.strategies as t_strategy2import Backtesting.TBTLib.tbt_engine as t_engine3# Interface4# Debugging5data = ""6enable_logging = False7plot = True8debugging = False9strategy = t_strategy.PNLTrailNew()10def start():11 strategy.enable_logging = enable_logging12 engine = t_engine.BacktestEngine(strategy)13 engine.debugging = debugging14 engine.enable_logging = enable_logging15 engine.plot = plot16 engine.start()...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run localstack automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful